MCP Run Python
Published on: 2025-04-21 07:09:30
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 https://ai.pydantic.dev/mcp/run-python/ for complete documentation.
The server can be run with deno installed using:
deno run \ -N -R=node_modules -W=node_modules --node-modules-dir=auto \ jsr:@pydantic/mcp-run-python [stdio | sse | warmup]
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
(alias of ) allows network access and read+write access to . These are required so pyodide can download and cache the Python standard library and packages --node-modules-dir=auto tells deno to use a local node_modules directory
tells deno to use a local directory stdio runs the serv
... Read full article.