mcp-code-exec-python
by heroku
Overview
Provides a Model Context Protocol (MCP) server for executing arbitrary Python code with optional package installations, supporting HTTP, SSE, and STDIO transports.
Installation
uvicorn src.streamable_http_server:app --reloadEnvironment Variables
- API_KEY
- STDIO_MODE_ONLY
- REMOTE_SERVER_TRANSPORT_MODULE
- USE_TEMP_DIR
Security Notes
CRITICAL: The server is designed to execute arbitrary Python code and install arbitrary packages provided by a client, without robust sandboxing. The `code_exec_python` tool explicitly states it has access to networking, the filesystem, and the standard library. This functionality inherently allows for Remote Code Execution (RCE) if a malicious client can access the server. The `USE_TEMP_DIR` option only isolates package installations within a temporary virtual environment, not the underlying execution environment from the host system. Deployment in a highly restricted, isolated environment (e.g., a container with minimal privileges) is essential but not enforced by the codebase itself. No hardcoded secrets were found.
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.
ipybox
A Python code execution sandbox for AI agents to programmatically interact with MCP tools and execute code actions in a stateful, sandboxed environment.
lex
Provides a UK legal research API for AI agents, offering capabilities to search legislation, caselaw, amendments, and explanatory notes using semantic and keyword search, and includes a Micro-Copilot (MCP) server for integration with AI assistants.
mcp-units
Converts cooking measurements (volume, weight, temperature) between common units, designed for integration with MCP-compatible tools and VSCode extensions.