MCP Code Execution
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 MCP Code Execution?
MCP Code Execution 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 mcp-server-code-execution-modeConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MCP Code Execution
MCP Server Code Execution Mode runs Python code inside isolated rootless containers (Podman or Docker) so AI assistants can execute arbitrary scripts without exposing the host system. It implements Anthropic's and Cloudflare's ideas for reducing MCP tool-definition context bloat by exposing a single `run_python` tool that proxies any number of downstream MCP servers discovered at runtime. This makes it ideal for agentic workflows where an AI needs to orchestrate many tools without blowing up the context window with hundreds of tool definitions.
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 distributed as a Python package and run via uvx. Install uv first if you do not already have it.
curl -LsSf https://astral.sh/uv/install.sh | shPull the sandbox container image
The server spins up a fresh Python container for each execution. Pull the base image ahead of time to avoid delays on first run.
podman pull python:3.13-slim
# or with Docker:
docker pull python:3.13-slimTest the server manually
Run the server directly with uvx to verify it starts correctly before wiring it into 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
Edit your claude_desktop_config.json (or equivalent) to register the server. Set MCP_BRIDGE_RUNTIME to match your container engine.
Configure optional environment variables
Tune the sandbox with environment variables. Key options include MCP_BRIDGE_IMAGE (default: python:3.14-slim), MCP_BRIDGE_TIMEOUT (default: 30s), MCP_BRIDGE_MEMORY (default: 512m), and MCP_BRIDGE_STATE_DIR (default: ~/MCPs) which holds IPC sockets for server discovery.
Verify sandbox execution
Ask your MCP client to run a simple Python snippet through the server to confirm the container starts and code executes successfully.
MCP Code Execution Examples
Client configuration
Add this block to your claude_desktop_config.json to register the server with Podman as the container runtime.
{
"mcpServers": {
"mcp-server-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": "podman",
"MCP_BRIDGE_TIMEOUT": "60s",
"MCP_BRIDGE_MEMORY": "512m"
}
}
}
}Prompts to try
These prompts demonstrate running Python code in an isolated container and using multi-server orchestration through the single run_python tool.
- "Run this Python script in an isolated container and return the output: import platform; print(platform.python_version())"
- "Use the sandbox to list directory contents via the filesystem MCP server, then summarize what you find"
- "Execute a Python data analysis script that reads a CSV, computes summary statistics, and returns the results"
- "Discover which MCP servers are available in the sandbox and tell me their capabilities"Troubleshooting MCP Code Execution
Container fails to start with a volume mount error
On Docker Desktop, go to Settings → Resources → File Sharing and add the ~/MCPs/ directory (or the path set in MCP_BRIDGE_STATE_DIR). On Podman, the server auto-configures this via podman machine set.
Server not found after running uvx command
Ensure uv is on your PATH by running `which uvx`. If missing, re-run the uv installer and restart your terminal. Also confirm you have Python 3.11+ with `python3 --version`.
Execution times out on longer scripts
Increase the timeout by setting MCP_BRIDGE_TIMEOUT (e.g., '120s') and MCP_BRIDGE_MAX_TIMEOUT in the env block of your MCP config. The maximum cap is controlled by MCP_BRIDGE_MAX_TIMEOUT.
Frequently Asked Questions about MCP Code Execution
What is MCP Code Execution?
MCP Code Execution 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 MCP Code Execution?
Follow the installation instructions on the MCP Code Execution GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MCP Code Execution?
MCP Code Execution works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MCP Code Execution free to use?
Yes, MCP Code Execution is open source and available under the GPL 3.0 license. You can use it freely in both personal and commercial projects.
MCP Code Execution Alternatives — Similar Developer Tools Servers
Looking for alternatives to MCP Code Execution? 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 MCP Code Execution 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 MCP Code Execution?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.