The most comprehensive code execution environment for AI assistants, providing advanced workspace management, file operations, and development environments far beyond any built-in tools.
- β Complete workspace isolation: Multiple independent development environments
- β Advanced file operations: Syntax validation, automatic backups, diff generation
- β Multi-language environments: Python, Node.js, Go with package management
- β Session persistence: Maintain state across complex development workflows
- β Professional tooling: Everything needed for real development projects
β‘ OPTIMAL PERFORMANCE: Load both bash + code-execution servers together!
- Bash Server: Handles system commands, process management, background jobs
- Code Execution Server: Manages workspaces, file operations, development environments
- Combined Power: Complete development ecosystem with specialized optimization for each domain
- Claude Code: Complete development environment with advanced capabilities
- Cursor Agent CLI: Professional-grade code execution with workspace management
- Custom AI assistants: Full MCP protocol support with enterprise features
- 4 unified tools providing complete development environment
- Zero workspace contamination between different projects
- Advanced syntax validation for 20+ programming languages
- Multi-environment support with automatic dependency management
- Production-ready reliability with comprehensive error handling
git clone https://github.com/stat-guy/code-execution.git
cd code-execution
npm install
Configure in Claude Desktop (~/.config/claude_desktop_config.json):
{
"mcpServers": {
"code-execution": {
"command": "node",
"args": ["path/to/code-execution/index.js"]
}
}
}
git clone https://github.com/stat-guy/code-execution.git
cd code-execution && npm install
claude mcp add code-execution node /ABSOLUTE/PATH/TO/code-execution/index.js
Replace /ABSOLUTE/PATH/TO/
with your actual folder path!
# Install both servers for optimal performance
git clone https://github.com/stat-guy/bash.git
git clone https://github.com/stat-guy/code-execution.git
# Setup bash server
cd bash && npm install && pip3 install mcp pydantic
claude mcp add bash node /ABSOLUTE/PATH/TO/bash/mcp-bash-wrapper.js
# Setup code execution server
cd ../code-execution && npm install
claude mcp add code-execution node /ABSOLUTE/PATH/TO/code-execution/index.js
- Node.js 16+: Download from nodejs.org
- Git: Download from git-scm.com
# Clone the repository
git clone https://github.com/stat-guy/code-execution.git
cd code-execution
# Install dependencies
npm install
# Test the server starts correctly
npm test
You should see: π All tests passed! Server is ready for production use.
macOS: Edit ~/.config/claude_desktop_config.json
Windows: Edit %APPDATA%\claude_desktop_config.json
{
"mcpServers": {
"code-execution": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/code-execution/index.js"]
}
}
}
index.js
Completely quit and restart Claude Desktop to load the new server.
The server automatically manages sessions with these defaults:
- Session timeout: 1 hour of inactivity
- Cleanup interval: Every 5 minutes
- File size limit: 10MB per file
- Workspace isolation: Complete separation between sessions
// Create and edit files with syntax validation
file_editor({
operation: "create",
path: "app.py",
file_text: "print('Hello, World!')",
session_id: "python-project"
})
// Advanced string replacement with diff
file_editor({
operation: "str_replace",
path: "app.py",
old_str: "print('Hello, World!')",
new_str: "print('Hello, Code Execution!')"
})
// Create isolated project workspace
workspace_manager({
operation: "create_project",
project_name: "web_app",
template: "nodejs",
session_id: "web-dev"
})
// Upload files to workspace
workspace_manager({
operation: "upload_file",
file_path: "data/dataset.csv",
content: "name,age,city\nJohn,30,NYC",
session_id: "data-analysis"
})
// Create Python environment with packages
environment_controller({
operation: "create_env",
env_name: "ml_project",
env_type: "python",
packages: ["pandas", "numpy", "scikit-learn"],
session_id: "ml-session"
})
// Activate environment for development
environment_controller({
operation: "activate_env",
env_name: "ml_project",
session_id: "ml-session"
})
// Execute commands in isolated sessions
bash_execution({
command: "python train_model.py",
session_id: "ml-session",
timeout: 300000
})
// Background processes
bash_execution({
command: "npm run dev",
background: true,
session_id: "web-dev"
})
Tool | Description | Key Features |
---|---|---|
bash_execution |
Enhanced command execution | Session persistence, background jobs, advanced timeout |
file_editor |
Advanced file operations | Syntax validation, backups, diff generation, 20+ languages |
workspace_manager |
Project workspace management | Isolation, templates, file transfers, project organization |
environment_controller |
Development environments | Python/Node/Go, package management, environment switching |
- Bash Server: Optimized for system commands, process management, shell operations
- Code Execution Server: Optimized for file operations, workspace management, development environments
- Reduced overhead: Each server handles what it does best
- Better resource management: Specialized memory and process handling
- Faster response times: Optimized tool routing and caching
- Enhanced reliability: Isolated failure domains
// Typical workflow using both servers:
// 1. Bash server: System setup
bash.execute_command("git clone https://github.com/user/project.git")
// 2. Code execution: Project workspace
code_execution.workspace_manager({operation: "create_project", template: "python"})
// 3. Code execution: Environment setup
code_execution.environment_controller({operation: "create_env", packages: ["fastapi"]})
// 4. Code execution: File operations
code_execution.file_editor({operation: "create", path: "main.py", content: "..."})
// 5. Bash server: Testing and deployment
bash.execute_command("pytest tests/", background: true)
Server not starting:
# Check Node.js version
node --version # Should be 16+
# Verify dependencies
npm list @modelcontextprotocol/sdk
Claude not finding server:
- Verify absolute paths in configuration
- Restart Claude Desktop completely
- Check Claude Desktop logs for error messages
Permission errors:
# Ensure read permissions
chmod +r index.js
# Check workspace permissions
ls -la ~/.code-execution/
Memory issues with large files:
- Files over 10MB are streamed automatically
- Use file chunking for very large datasets
- Monitor session cleanup (automatic every 5 minutes)
- Issues: GitHub Issues
- Documentation: See
CLAUDE.md
for AI-specific instructions - Examples: Check
docs/examples/
for real-world usage patterns
- File operations: 0.05-0.2s for typical files
- Environment creation: 2-10s depending on packages
- Session isolation: 100% guaranteed separation
- Error handling: Comprehensive validation and recovery
- Memory management: Automatic cleanup and optimization
- Workspace isolation: Complete separation between sessions
- Path validation: Prevents directory traversal attacks
- Input sanitization: Comprehensive validation of all inputs
- Resource limits: Configurable timeouts and size limits
- Audit logging: Complete operation history tracking
// Complete data analysis workflow
workspace_manager({operation: "create_project", template: "python"})
environment_controller({operation: "create_env", packages: ["pandas", "matplotlib"]})
workspace_manager({operation: "upload_file", file_path: "data.csv", content: "..."})
file_editor({operation: "create", path: "analyze.py", file_text: "import pandas as pd..."})
bash_execution({command: "python analyze.py"})
// Full-stack development setup
workspace_manager({operation: "create_project", template: "nodejs"})
environment_controller({operation: "create_env", packages: ["express", "react"]})
file_editor({operation: "create", path: "server.js", file_text: "const express = require..."})
bash_execution({command: "npm run dev", background: true})
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Ready to supercharge your development workflow?
β Star this repo and experience the most advanced code execution environment for AI assistants!
π‘ Pro Tip: Install both bash and code-execution servers for the ultimate development experience.