Enables creation and management of GitHub issues, allowing automated workflows like migrating issues from other systems or creating issues based on processed data.
Enables retrieval of Google Drive documents, allowing workflows that extract and process content from Drive.
Provides access to Jira issues through search and retrieval operations, enabling workflows like issue migration and data extraction from Jira projects.
Allows updating Salesforce records with processed data, enabling integration workflows that store information in Salesforce objects.
MCP Server Code Execution Mode
An MCP server that executes Python code in isolated rootless containers with optional MCP server proxying.
Overview
This bridge implements the "Code Execution with MCP" patternβa revolutionary approach to using Model Context Protocol tools. Instead of exposing all MCP tools directly to Claude (consuming massive context), the bridge:
Auto-discovers configured MCP servers
Proxies tools into sandboxed code execution
Eliminates context overhead (95%+ reduction)
Enables complex workflows through Python code
Key Features
π Security First
Rootless containers - No privileged helpers required
Network isolation - No network access
Read-only filesystem - Immutable root
Dropped capabilities - No system access
Unprivileged user - Runs as UID 65534
Resource limits - Memory, PIDs, CPU, time
Auto-cleanup - Temporary IPC directories
β‘ Performance
Persistent clients - MCP servers stay warm
Context efficiency - 95%+ reduction vs traditional MCP
Async execution - Proper resource management
Single tool - Only
run_pythonin Claude's context
π§ Developer Experience
Multiple access patterns:
mcp_servers["server"] # Dynamic lookup mcp_server_name # Attribute access from mcp.servers.server import * # Module importTop-level await - Modern Python patterns
Type-safe - Proper signatures and docs
TOON responses - Tool outputs are emitted as TOON code blocks for token-efficient prompting
TOON Response Format
We encode every MCP bridge response using Token-Oriented Object Notation (TOON).
TOON collapses repetitive JSON keys and emits newline-aware arrays, trimming token counts 30-60% for uniform tables so LLM bills stay lower.
Clients that expect plain JSON can still recover the structured payload: the TOON code block includes the same fields (status, stdout, stderr, etc.) and we fall back to JSON automatically if the encoder is unavailable.
Quick Start
1. Prerequisites (macOS or Linux)
Install a rootless container runtime (Podman or Docker).
macOS:
brew install podmanorbrew install --cask dockerUbuntu/Debian:
sudo apt-get install -y podmanorcurl -fsSL https://get.docker.com | sh
Install uv to manage this project:
curl -LsSf https://astral.sh/uv/install.sh | shPull a Python base image once your runtime is ready:
podman pull python:3.12-slim # or docker pull python:3.12-slim
2. Install Dependencies
Use uv to sync the project environment:
3. Launch Bridge
4. Register with Claude Code
File: ~/.config/mcp/servers/mcp-server-code-execution-mode.json
Restart Claude Code
5. Execute Code
Architecture
Process:
Client calls
run_python(code, servers, timeout)Bridge loads requested MCP servers
Prepares a sandbox invocation: collects MCP tool metadata, writes an entrypoint into a shared
/ipcvolume, and exportsMCP_AVAILABLE_SERVERSGenerated entrypoint rewires stdio into JSON-framed messages and proxies MCP calls over the container's stdin/stdout pipe
Runs container with security constraints
Host stream handler processes JSON frames, forwards MCP traffic, enforces timeouts, and cleans up
Configuration
Environment Variables
Variable | Default | Description |
| auto | Container runtime (podman/docker) |
| python:3.12-slim | Container image |
| 30s | Default timeout |
| 120s | Max timeout |
| 512m | Memory limit |
| 128 | Process limit |
| - | CPU limit |
| 65534:65534 | Run as UID:GID |
| 300s | Shutdown delay |
|
| Host directory for IPC sockets and temp state |
Server Discovery
Scanned Locations:
~/.claude.json~/Library/Application Support/Claude Code/claude_code_config.json~/Library/Application Support/Claude/claude_code_config.json(early Claude Code builds)~/Library/Application Support/Claude/claude_desktop_config.json(Claude Desktop fallback)~/.config/mcp/servers/*.json./claude_code_config.json./claude_desktop_config.json(project-local fallback)./mcp-servers/*.json
Example Server (~/.config/mcp/servers/filesystem.json):
Docker MCP Gateway Integration
When you rely on docker mcp gateway run to expose third-party MCP servers, the bridge simply executes the gateway binary. The gateway is responsible for pulling tool images and wiring stdio transports, so make sure the host environment is ready:
Run
docker loginfor every registry referenced in the gateway catalog (e.g. Docker Hubmcp/*images,ghcr.io/github/github-mcp-server). Without cached credentials the pull step fails before any tools come online.Provide required secrets for those serversβ
github-officialneedsgithub.personal_access_token, others may expect API keys or auth tokens. Usedocker mcp secret set <name>(or whichever mechanism your gateway is configured with) so the container sees the values at start-up.Mirror any volume mounts or environment variables that the catalog expects (filesystem paths, storage volumes, etc.). Missing mounts or credentials commonly surface as
failed to connect: calling "initialize": EOFduring the stdio handshake.If
list_toolsonly returns the internal management helpers (mcp-add,code-mode, β¦), the gateway never finished initializing the external serversβcheck the gateway logs for missing secrets or registry access errors.
State Directory & Volume Sharing
Runtime artifacts (including the generated
/ipc/entrypoint.pyand related handshake metadata) live under./.mcp-bridge/by default. SetMCP_BRIDGE_STATE_DIRto relocate them.When the selected runtime is Podman, the bridge automatically issues
podman machine set --rootful --now --volume <state_dir>:<state_dir>so the VM can mount the directory.Docker Desktop does not expose a CLI for file sharing; ensure the chosen state directory is marked as shared in Docker Desktop β Settings β Resources β File Sharing before running the bridge.
To verify a share manually, run
docker run --rm -v $PWD/.mcp-bridge:/ipc alpine ls /ipc(or the Podman equivalent) and confirm the files are visible.
Usage Examples
File Processing
Data Pipeline
Multi-System Workflow
Inspect Available Servers
Example output seen by the LLM when running the snippet above with the stub server:
Security
Container Constraints
Constraint | Setting | Purpose |
Network |
| No external access |
Filesystem |
| Immutable base |
Capabilities |
| No system access |
Privileges |
| No escalation |
User |
| Unprivileged |
Memory |
| Resource cap |
PIDs |
| Process cap |
Workspace | tmpfs, noexec | Safe temp storage |
Capabilities Matrix
Action | Allowed | Details |
Import stdlib | β | Python standard library |
Access MCP tools | β | Via proxies |
Memory ops | β | Process data |
Write to disk | β | Only /tmp, /workspace |
Network | β | Completely blocked |
Host access | β | No system calls |
Privilege escalation | β | Prevented by sandbox |
Container escape | β | Rootless + isolation |
Documentation
README.md - This file, quick start
GUIDE.md - Comprehensive user guide
ARCHITECTURE.md - Technical deep dive
HISTORY.md - Evolution and lessons
STATUS.md - Current state and roadmap
Resources
External
Status
β Implemented
Rootless container sandbox
Single
run_pythontoolMCP server proxying
Persistent clients
Comprehensive docs
π In Progress
Automated testing
Observability (logging, metrics)
Policy controls
Runtime diagnostics
π Roadmap
Connection pooling
Web UI
Multi-language support
Workflow orchestration
License
GPLv3 License
Support
For issues or questions, see the documentation or file an issue.
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Executes Python code in isolated rootless containers while proxying MCP server tools, reducing context overhead by 95%+ and enabling complex multi-tool workflows through sandboxed code execution.