Mari6814/code-mode-mcp
A mcp written in python that allows agents to go 'code mode' and just execute code to call APIs inside of isolated environments instead of installing hundreds of other MCPs that bloat the context window.
Platform-specific configuration:
{
"mcpServers": {
"code-mode-mcp": {
"command": "npx",
"args": [
"-y",
"code-mode-mcp"
]
}
}
}Add the config above to .claude/settings.json under the mcpServers key.
An MCP server that lets agents go "code mode" and execute code in isolated Docker containers. The idea is that agents are apparently bad at using mcp tools when they have too many options. Which is why we write a simplified MCP that only has very few, but powerful tools. The MCP is intended to allow the agent to just read documentation, and write code that runs or calls APIs directly instead of having to put thousands of tokens explaining each mcp tool and its parameters with each message.
Agents pick from a set of approved images (e.g. python, node, ubuntu) and run code without touching the host. The images are either a single dockerfile (oneshot) or a compose setup (persistent).
send_lines call spins up a fresh container, pipes the code to the interpreter via stdin, and returns the output.docker compose. Code is written to a temp script inside the container and executed with sh. State persists across calls until the session is stopped.Here's an example of how a conversation with an agent using the MCP tools might look:
> User: Hey agent, please get me the latest pull requests. > > Agent: Sure! I'll use the GitHub CLI tool in a Python environment to fetch the latest pull requests. First, I'll start a session with the Python image. > ``json > { > "tool": "start_session", > "args": { > "image": "python" > } > } > { > "session_id": "abc123" > } > ` > > Agent: Great, I have a session running with ID abc123. Now I'll send the code to fetch the latest pull requests using the GitHub CLI. > > ``json > { > "tool": "send_lines", > "args": { > "session_id": "abc123", > "lines": [ > "import os", > "os.system('gh pr list --limit 5')" > ] > } > } > { > "stdout": "Pull request 1: Fix bug in authentication etc...", > "stderr": "", > "return_cod
Loading reviews...