mcp-code-mode
by Jame0077
Overview
An AI agent that generates and executes Python code, orchestrating external Model Context Protocol (MCP) tools to solve user tasks.
Installation
python -m mcp_code_mode.executor_serverEnvironment Variables
- OPENAI_API_KEY
- GEMINI_API_KEY
- MCP_SERVERS_CONFIG
- MCP_EXECUTOR
Security Notes
CRITICAL RISK: By default, the server uses `LocalPythonExecutor` (as specified in `executor_server.py` via `_EXECUTOR_BACKEND = 'local'`). This executor runs user-provided or LLM-generated Python code using `exec()` within the same Python process as the server itself. This grants the executed code full access to the host system's filesystem, network, and environment variables (including any API keys present in the server's environment). While `policies.py` attempts to filter dangerous imports like 'subprocess' or 'open()', these are string-based checks and can often be bypassed by a determined attacker or a clever LLM. The `SandboxedPythonExecutor` offers much stronger isolation (Deno+Pyodide, network/filesystem restrictions) but is explicitly *not* the default due to stated limitations with HTTP requests (which are necessary for the tool bridge). Running this server in its default configuration with untrusted input (e.g., from a public API or a public Hugging Face Space) poses a severe code execution vulnerability, allowing arbitrary code execution on the host machine.
Similar Servers
mcp-server-code-execution-mode
This server enables LLM agents to execute Python code in a highly secure, isolated container environment, facilitating complex multi-tool orchestration and data analysis with minimal LLM context token usage.
mcp-run-python
MCP server to securely run untrusted Python code in a sandboxed WebAssembly environment, typically as a tool for AI agents.
Polymcp
A comprehensive TypeScript framework for building and orchestrating Model Context Protocol (MCP) servers and AI agents, enabling LLMs to intelligently discover, select, and execute external tools.
AgentUp
A developer-first framework for building, deploying, and managing secure, scalable, and configurable AI agents, supporting various agent types (reactive, iterative) and the Model-Context Protocol (MCP) for seamless interactions.