loading…
Search for a command to run...
loading…
Exposes CEDARScript Editor through Model Context Protocol, enabling AI agents to perform semantic-aware code transformations with security features like path va
Exposes CEDARScript Editor through Model Context Protocol, enabling AI agents to perform semantic-aware code transformations with security features like path validation and dry-run mode.
AI-Assisted Code Transformations via Model Context Protocol
CEDARScript MCP Server exposes the powerful CEDARScript Editor through the Model Context Protocol (MCP), enabling AI agents like Claude to perform intelligent, semantic-aware code transformations.
pip install cedarscript-mcp-server
Open Claude Desktop configuration (usually ~/.config/Claude/claude_desktop_config.json)
Add CEDARScript MCP server:
{
"mcpServers": {
"cedarscript": {
"command": "python",
"args": [
"-m",
"cedarscript_mcp.server",
"--root",
"/path/to/your/project"
]
}
}
}
Restart Claude Desktop
Ask Claude to use CEDARScript:
UPDATE myfile.py SET imports.append('import os')"UPDATE calculator.py SET function:calculate REPLACE 'x + 1' WITH 'x + 2'"# Start server (STDIO mode)
python -m cedarscript_mcp.server --root /path/to/project
# With custom options
python -m cedarscript_mcp.server \
--root /path/to/project \
--read-only \
--log-level DEBUG \
--max-file-size 10485760
CEDARScript MCP Server is a thin adapter layer that:
┌─────────────────────────────────┐
│ Claude Desktop / VS Code │
│ (MCP Client) │
└────────────┬────────────────────┘
│ JSON-RPC over STDIO
┌────────────▼────────────────────┐
│ CEDARScript MCP Server │
│ • Security (path validation) │
│ • Tools (parse, apply, list) │
│ • Adapters (protocol mapping) │
└────────────┬────────────────────┘
│
┌────────────▼────────────────────┐
│ CEDARScript Editor (core) │
│ • AST parsing │
│ • Tree-sitter analysis │
│ • File transformations │
└─────────────────────────────────┘
parse_cedarscriptParse and validate CEDARScript commands without execution.
Parameters:
content (string): CEDARScript commandsReturns: Parsed AST commands
Example:
{
"content": "UPDATE myfile.py SET imports.append('import os')"
}
apply_cedarscriptApply CEDARScript transformations to code files.
Parameters:
commands (string): CEDARScript commandsroot (string): Project root directory pathdry_run (boolean, default: true): Preview changes without writingReturns: Results, diffs (if dry_run), affected files
Example:
{
"commands": "UPDATE calculator.py SET function:add REPLACE 'x + y' WITH 'x + y + 1'",
"root": "/path/to/project",
"dry_run": true
}
list_capabilitiesList server capabilities and supported features.
Returns: Server version, features, security settings
CEDARSCRIPT_ROOT: Default project root (default: current directory)CEDARSCRIPT_LOG_LEVEL: Logging level (DEBUG, INFO, WARNING, ERROR)CEDARSCRIPT_LOG_FORMAT: Log format (text, json)CEDARSCRIPT_READ_ONLY: Force read-only mode (true/false)CEDARSCRIPT_MAX_FILE_SIZE: Max file size in bytes (default: 10485760)python -m cedarscript_mcp.server \
--root /path/to/project \ # Project root directory
--read-only \ # Enable read-only mode
--log-level DEBUG \ # Logging level
--max-file-size 10485760 # Max file size (bytes)
../../../etc/passwd) are blockedFiles matching these patterns are automatically rejected:
.git/**, node_modules/**, __pycache__/**.env, *.env, .env.*credentials.json, *.key, *.pemWhen enabled, all write operations are rejected (parsing/analysis only).
Configurable maximum file size (default: 10MB) to prevent resource exhaustion.
# Clone repository
git clone https://github.com/CEDARScript/cedarscript-mcp-server.git
cd cedarscript-mcp-server
# Install development dependencies
make install
# Run tests
make test
# Run with coverage
make test-cov
# Format and lint
make check
make help # Show all available targets
make install # Install with dev dependencies
make test # Run full test suite
make test-fast # Run tests (skip integration)
make check # Format, lint, security checks
make run # Launch server (demo mode)
make build # Build distribution packages
See planning/MAKEFILE_DESIGN.md for complete target documentation.
# Run all tests
make test
# With coverage report
make test-cov
# Watch mode (auto-rerun on changes)
make test-watch
# Test against multiple cedarscript-editor versions
make test-matrix
See examples/claude_desktop.json for drop-in configuration.
See examples/vscode_mcp.json for VS Code setup.
from cedarscript_mcp import PathValidator, apply_cedarscript_tool
# Create validator
validator = PathValidator(Path("/path/to/project"))
# Apply transformation (dry-run)
result = apply_cedarscript_tool(
commands="UPDATE myfile.py SET imports.append('import os')",
root="/path/to/project",
dry_run=True,
validator=validator
)
print(result)
Issue: ModuleNotFoundError: No module named 'mcp'
Solution: Install MCP SDK: pip install mcp>=1.0.0
Issue: SecurityError: Path escape attempt
Solution: Ensure file paths are within the specified root directory.
Issue: SecurityError: Write operation rejected
Solution: Remove --read-only flag or set CEDARSCRIPT_READ_ONLY=false.
Contributions welcome! Please:
make check test before committingApache License 2.0 - see LICENSE for details.
Made with ❤️ by the CEDARScript Team
Run in your terminal:
claude mcp add cedarscript-mcp-server -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.