Advanced MCP Code Execution Server
Provides tools for creating and activating isolated Python environments with package installation, and for executing Python code and commands in persistent sessions.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Advanced MCP Code Execution Server
The most comprehensive code execution environment for AI assistants, providing advanced workspace management, file operations, and development environments far beyond any built-in tools.
Related MCP server: Coding Tools MCP
π Why Choose This Server?
Superior to Any Native Code 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
Perfect Synergy with Our Bash Server
β‘ 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
Perfect For
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
Key Advantages
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
β‘ Quick Setup
For Experts (30 seconds)
git clone https://github.com/stat-guy/code-execution.git
cd code-execution
npm installConfigure in Claude Desktop (~/.config/claude_desktop_config.json):
{
"mcpServers": {
"code-execution": {
"command": "node",
"args": ["path/to/code-execution/index.js"]
}
}
}For Claude Code Users (10 seconds)
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.jsReplace /ABSOLUTE/PATH/TO/ with your actual folder path!
Recommended: Dual Server Setup (Best Performance)
# 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.jsFor Beginners (Step-by-step)
1. Prerequisites
Node.js 16+: Download from nodejs.org
Git: Download from git-scm.com
2. Download & Install
# Clone the repository
git clone https://github.com/stat-guy/code-execution.git
cd code-execution
# Install dependencies
npm install3. Test Installation
# Test the server starts correctly
npm testYou should see: π All tests passed! Server is ready for production use.
4. Configure Claude Desktop
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"]
}
}
}β οΈ Important: Use the absolute path to index.js
5. Restart Claude Desktop
Completely quit and restart Claude Desktop to load the new server.
π§ Server Configuration
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
π Usage Examples
Basic File Operations
// 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!')"
})Workspace Management
// 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"
})Development Environments
// 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"
})Command Execution
// 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"
})π Available Tools
Tool | Description | Key Features |
| Enhanced command execution | Session persistence, background jobs, advanced timeout |
| Advanced file operations | Syntax validation, backups, diff generation, 20+ languages |
| Project workspace management | Isolation, templates, file transfers, project organization |
| Development environments | Python/Node/Go, package management, environment switching |
π― Why Use Both Servers Together?
Specialized Optimization
Bash Server: Optimized for system commands, process management, shell operations
Code Execution Server: Optimized for file operations, workspace management, development environments
Performance Benefits
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
Complete Development Environment
// 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)π Troubleshooting
Common Issues
Server not starting:
# Check Node.js version
node --version # Should be 16+
# Verify dependencies
npm list @modelcontextprotocol/sdkClaude 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)
Getting Help
Issues: GitHub Issues
Documentation: See
CLAUDE.mdfor AI-specific instructionsExamples: Check
docs/examples/for real-world usage patterns
π Performance & Reliability
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
π Security Features
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
π― Real-World Examples
Data Science Pipeline
// 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"})Web Development
// 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})π License
MIT License - see LICENSE file for details.
π€ Contributing
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.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent cloud workspaces for AI agents: run commands, edit files, use git and a browser.
Give every project one workspace for its files, its team, and its AI agents.
Coding agents build full-stack apps in persistent workspaces and share them by link.
A persistent workspace where your AI builds and runs automations, with an encrypted key vault.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to securely execute Python and JavaScript code in sandboxed environments, with file management and package installation.7MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to develop within a local project workspace by reading and modifying files, running commands and tests, checking Git state, and persisting progress as history sessions that can be restored in later conversations.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to turn local projects into persistent workspaces, providing file editing, command execution, Git integration, and cross-session history management.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to safely read, search, understand, and edit local project code and files, with Git inspection, code indexing, and controlled command execution within permissioned workspaces.6MIT