MCP Code Execution Server
An MCP bridge: a single run_python tool runs code in a container and calls your MCP servers
- 340 ★ on the repository
- Last commit
- GPL-3.0
Broad access
Why this level
- The agent executes arbitrary Python, even if inside a container with no network and no root
- Through the code proxies every MCP server from your configurations is reachable, including those that write data and use keys
Install
- Works in
Manual install
{
"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"}
}
}
}Pull the image with podman pull python:3.13-slim or docker pull python:3.13-slim first. You can set docker instead of podman.
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- The agent executes arbitrary Python, even if inside a container with no network and no root
- Through the code proxies every MCP server from your configurations is reachable, including those that write data and use keys
This is third-party code. Review the repository files before installing.
What it does
MCP Code Execution Server tackles bloated context for agents with dozens of MCP servers. It shows the model one tool, run_python, and three discovery helpers: `discovered_servers()`, `query_tool_docs()` and `search_tool_docs()`. The system prompt stays around 200 tokens regardless of how many servers are connected, and the model loads the schemas it needs on demand. Code runs in a rootless Podman or Docker container. The network is off, the root file system is read-only and all Linux capabilities are dropped. Memory is capped at 512 MB and processes at 128. Writing is allowed in /tmp and /workspace. The container starts once and stays active, so variables, imports and functions from one call are available in the next. Inside the sandbox there are proxies to your MCP servers: `mcp_filesystem.read_file(...)`, `mcp_serena.search(...)` and others. The server finds them in the configurations of Claude Code, Claude Desktop, Cursor, OpenCode, Windsurf and VS Code, and you pass the list of servers to load in the servers parameter.
Who it is for. For developers and analysts who connected many MCP servers to Claude Code or Cursor and want to save context while getting isolated Python execution.
Good fit when
- Dozens of MCP servers are connected to the agent and tool schemas eat the context
- The agent has to analyze data in pandas or numpy inside an isolated environment
- You need to combine calls to several MCP servers in one Python script
- State must persist between calls: variables, imports and functions
Not a fit when
- There is no Podman or Docker on the machine: the server always uses a container runtime
- Your code needs network access: the sandbox has it switched off completely
- You need to proxy remote HTTP MCP servers: the proxies are described for stdio servers
- You need a license softer than GPL-3.0 to embed it in your product
Example request
Through run_python find all TODOs in the project with the filesystem tool, group them by file with pandas and print a tableMCP
- Transport
- stdio
- Authentication
- not required
Environment variables
MCP_BRIDGE_RUNTIME- Container runtime: podman or docker, chosen automatically by default
MCP_BRIDGE_IMAGE- Container image, python:3.14-slim by default
MCP_BRIDGE_TIMEOUT- Default call timeout, 30 seconds
MCP_BRIDGE_MEMORY- Container memory limit, 512m by default
MCP_BRIDGE_STATE_DIR- Host folder for sockets and temporary state, ~/MCPs by default
Limitations
You need Python 3.11 or newer, Podman or Docker and the python:3.13-slim image, which has to be pulled in advance. The server starts through uvx straight from the GitHub repository. The default call timeout is 30 seconds with a 120-second maximum, and the container shuts down after five minutes of idleness.
Target servers are discovered in client configurations automatically, and the bridge's own entry in those configurations is skipped to avoid a recursive launch. The license is GPL-3.0.
How to disable. Remove the mcp-server-code-execution-mode entry from the MCP client configuration and restart the client. The container exits after idling, and you can clear the `~/MCPs` state folder by hand.
FAQ
How do I install MCP Code Execution Server in Claude Code?
Install uv and Podman or Docker and add a server to the MCP configuration with the uvx command and the arguments `--from git+https://github.com/elusznik/mcp-server-code-execution-mode mcp-server-code-execution-mode run`. Pull the container's Python image in advance.
How do I connect other MCP servers through the bridge?
The bridge finds them itself in `~/MCPs`, `~/.config/mcp/servers`, `./mcp-servers` and in client configurations. When calling run_python list the names you need in the servers parameter, otherwise a call to a chosen server returns an error that it is unavailable.
What happens to the network inside the sandbox?
It is fully disabled by the `--network none` flag. External services are reachable only through the MCP proxies the bridge creates for the chosen servers.
How does it differ from Cloudflare Code Mode?
The bridge is written in Python, isolates code in a container and proxies existing stdio servers. Cloudflare Code Mode is JS and runs in a V8 isolate or a Node.js VM.
Which output mode should I choose?
The MCP_BRIDGE_OUTPUT_MODE variable accepts compact (default) and toon.
Discussion
No questions or reviews yet.
Related
MCP serversA Python framework and CLI for MCP: write servers as plain functions, test tools and install servers into Claude Code, Cursor and other clients
A zero-dependency Python CLI: one catalog of MCP servers and skills for every agent, with only a compact index in context
A CLI for any MCP server: list and call tools, resources and prompts, run mock and proxy modes, guard access and manage agent configs
A universal MCP CLI client from Apify: persistent sessions, OAuth, JSON output for scripts and shell access to any MCP server for agents
A CLI that turns any MCP server, OpenAPI spec or GraphQL endpoint into commands at runtime, with no codegen
An Open WebUI proxy that exposes any MCP server as an HTTP API with an OpenAPI schema
Comparison with similar tools
Entries that share the main search query, and how they differ.
| Entry | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| MCP Code Execution Server (this entry) | no | not required | 340 | |
| Code Mode | no | 1,622 | lets an agent call MCP and UTCP tools through code, with no container isolation | |
| AIO Sandbox | no | key is optional | 6,247 | a ready multi-purpose sandbox for agents |
README in short
The core idea is «code instead of tool calls», and the author cites material on it from Anthropic, Cloudflare, Docker and Apple. Container constraints, environment variables and server discovery locations are laid out in tables.