Code Execution Mode
An MCP server that executes Python code in isolated rootless containers with optional MCP server proxying. Implementation of Anthropic's and Cloudflare's ideas for reducing MCP tool definitions context bloat.
What is Code Execution Mode?
Code Execution Mode is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp server that executes python code in isolated rootless containers with optional mcp server proxying. implementation of anthropic's and cloudflare's ideas for reducing mcp tool definitions context b...
An MCP server that executes Python code in isolated rootless containers with optional MCP server proxying. Implementation of Anthropic's and Cloudflare's ideas for reducing MCP tool definitions context bloat.
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- An MCP server that executes Python code in isolated rootless
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx code-execution-modeConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Code Execution Mode
Code Execution Mode is an MCP server that runs Python inside isolated rootless containers (Podman or Docker), giving AI assistants a safe sandbox for arbitrary code execution. It addresses context window bloat by exposing just one tool — `run_python` — that dynamically proxies any number of downstream MCP servers discovered at runtime, so agents can orchestrate complex multi-tool workflows without loading every tool definition upfront. Built by elusznik as an implementation of Anthropic's and Cloudflare's context-reduction ideas, it is especially useful for agentic pipelines that need secure, reproducible Python execution.
Prerequisites
- Python 3.11 or higher (3.13+ recommended)
- Podman or Docker installed and running on macOS or Linux
- uv package manager (install via: curl -LsSf https://astral.sh/uv/install.sh | sh)
- An MCP client such as Claude Desktop or Claude Code
- Docker Desktop users must add ~/MCPs/ to File Sharing under Settings → Resources
Install uv package manager
The server is run via uvx, which ships with uv. Install uv if you do not already have it on your system.
curl -LsSf https://astral.sh/uv/install.sh | shPull the sandbox container image
Pull the Python slim image that the server uses as its execution sandbox so the first run does not block on a large download.
podman pull python:3.13-slim
# or with Docker:
docker pull python:3.13-slimRun the server to verify it works
Start the server directly from the Git repository using uvx to confirm your environment is correctly configured before adding it to your MCP client.
uvx --from git+https://github.com/elusznik/mcp-server-code-execution-mode mcp-server-code-execution-mode runAdd the server to your MCP client configuration
Register the server in claude_desktop_config.json with the appropriate container runtime. The MCP_BRIDGE_STATE_DIR directory is used for IPC socket communication between the host and sandbox.
Tune sandbox resource limits
Optionally configure memory, process limits, and timeout via environment variables: MCP_BRIDGE_MEMORY (default 512m), MCP_BRIDGE_PIDS (default 128), MCP_BRIDGE_TIMEOUT (default 30s), and MCP_BRIDGE_MAX_TIMEOUT (default 120s).
Code Execution Mode Examples
Client configuration
Register Code Execution Mode in claude_desktop_config.json. This example uses Docker as the container runtime with a 60-second execution timeout.
{
"mcpServers": {
"code-execution-mode": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/elusznik/mcp-server-code-execution-mode",
"mcp-server-code-execution-mode",
"run"
],
"env": {
"MCP_BRIDGE_RUNTIME": "docker",
"MCP_BRIDGE_TIMEOUT": "60s",
"MCP_BRIDGE_MEMORY": "1g"
}
}
}
}Prompts to try
These prompts exercise Python execution in the isolated container and multi-server proxying capabilities.
- "Run Python code in the secure sandbox to calculate the first 20 Fibonacci numbers"
- "Execute a script inside the container to fetch JSON from a public API and parse the results"
- "List available MCP servers inside the sandbox, then use one to read a file from my filesystem"
- "Run a Python data pipeline in the isolated environment: load a dataset, filter rows, and return summary statistics"Troubleshooting Code Execution Mode
Docker Desktop reports a volume sharing error on startup
Open Docker Desktop → Settings → Resources → File Sharing and add ~/MCPs/ (or the path in MCP_BRIDGE_STATE_DIR) to the allowed list, then restart Docker Desktop.
uvx command not found after installation
After running the uv installer, restart your shell or run `source ~/.bashrc` (or ~/.zshrc) so the PATH update takes effect. Verify with `which uvx`.
Code execution times out on data-heavy scripts
Set MCP_BRIDGE_TIMEOUT to a higher value such as '90s' and ensure MCP_BRIDGE_MAX_TIMEOUT is at least as large. Also consider increasing MCP_BRIDGE_MEMORY if the script is memory-intensive.
Frequently Asked Questions about Code Execution Mode
What is Code Execution Mode?
Code Execution Mode is a Model Context Protocol (MCP) server that mcp server that executes python code in isolated rootless containers with optional mcp server proxying. implementation of anthropic's and cloudflare's ideas for reducing mcp tool definitions context bloat. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Code Execution Mode?
Follow the installation instructions on the Code Execution Mode GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Code Execution Mode?
Code Execution Mode works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Code Execution Mode free to use?
Yes, Code Execution Mode is open source and available under the GPL-3.0 license. You can use it freely in both personal and commercial projects.
Code Execution Mode Alternatives — Similar Developer Tools Servers
Looking for alternatives to Code Execution Mode? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Code Execution Mode in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Code Execution Mode?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.