Provides the ability to execute Python code in a sandboxed environment using pyodide, allowing safe Python code execution isolated from the operating system.
MCP Run Python
Model Context Protocol server to run Python code in a sandbox.
The code is executed using Pyodide in Deno and is therefore isolated from the rest of the operating system.
See
The server can be run with deno installed using:
where:
-N -R=node_modules -W=node_modules(alias of--allow-net --allow-read=node_modules --allow-write=node_modules) allows network access and read+write access to./node_modules. These are required so pyodide can download and cache the Python standard library and packages--node-modules-dir=autotells deno to use a localnode_modulesdirectorystdioruns the server with the Stdio MCP transport — suitable for running the process as a subprocess locallystreamable_httpruns the server with the Streamable HTTP MCP transport - suitable for running the server as an HTTP server to connect locally or remotely. This supports stateful requests, but does not require the client to hold a stateful connection like SSEsseruns the server with the SSE MCP transport — suitable for running the server as an HTTP server to connect locally or remotely. Note that the SSE transport has been deprecated in newer MCP protocol versions and is there to maintain backwards compatibility.warmupwill run a minimal Python script to download and cache the Python standard library. This is also useful to check the server is running correctly.
Here's an example of using @pydantic/mcp-run-python with Pydantic AI: