The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
MCP Server 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…
Install
git clone https://github.com/elusznik/mcp-server-code-execution-modeInstall command taken from the project's README or registry entry. Always review code before running it.
README excerpt
Read full README on GitHub →MCP Code Execution Server: Zero-Context Discovery for 100+ MCP Tools
Stop paying 30,000 tokens per query. This bridge implements Anthropic's discovery pattern with rootless security—reducing MCP context from 30K to 200 tokens while proxying any stdio server.
Overview
This bridge implements the "Code Execution with MCP" pattern, a convergence of ideas from industry leaders:
- Apple's CodeAct: "Your LLM Agent Acts Better when Generating Code."
- Anthropic's Code execution with MCP: "Building more efficient agents."
- Cloudflare's Code Mode: "LLMs are better at writing code to call MCP, than at calling MCP directly."
- Docker's Dynamic MCPs: "Stop Hardcoding Your Agents’ World."
- Terminal Bench's Terminus: "A realistic terminal environment for evaluating LLM agents."
Instead of exposing hundreds of individual tools to the LLM (which consumes massive context and confuses the model), this bridge exposes one tool: run_python. The LLM writes Python code to discover, call, and compose other tools.
Why This vs. JS "Code Mode"?
While there are JavaScript-based alternatives (like universal-tool-calling-protocol/code-mode), this project is built for Data Science and Security:
| Feature | This Project (Python) | JS Code Mode (Node.js) |
|---|---|---|
| Native Language | Python (The language of AI/ML) | TypeScript/JavaScript |
| Data Science | Native (pandas, numpy, scikit-learn) |
Impossible / Hacky |
| Isolation | Hard (Podman/Docker Containers) | Soft (Node.js VM) |
| Security | Enterprise (Rootless, No Net, Read-Only) | Process-level |
| Philosophy | Infrastructure (Standalone Bridge) | Library (Embeddable) |
Choose this if: You want your agent to analyze data, generate charts, use scientific libraries, or if you require strict container-based isolation for running untrusted code.
What This Solves (That Others Don't)
The Pain: MCP Token Bankruptcy
Connect Claude to 11 MCP servers with ~100 tools = 30,000 tokens of tool schemas loaded into every prompt. That's $0.09 per query before you ask a single question. Scale to 50 servers and your context window breaks.
Why Existing "Solutions" Fail
- Docker MCP Gateway: Manages containers beautifully, but still streams all tool schemas into Claude's context. No token optimization.
- Cloudflare Code Mode: V8 isolates are fast, but you can't proxy your existing MCP servers (Serena, Wolfram, custom tools). Platform lock-in.
- Academic Papers: Describe Anthropic's discovery pattern, but provide no hardened implementation.
- Proofs of Concept: Skip security (no rootless), skip persistence (cold starts), skip proxying edge cases.
The Fix: Discovery-First Architecture
- Constant 200-token overhead regardless of server count
- Proxy any stdio MCP server into rootless containers
- Fuzzy search across servers without preloading schemas
- Production-hardened with capability dropping and security isolation
Architecture: How It Differs
Similar plugs
Reverse engineer anything with agents, from app behavior down to native binaries.
Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype…
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io
Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.