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 https://ai.pydantic.dev/mcp/run-python/ for complete documentation.
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=auto
tells deno to use a localnode_modules
directorystdio
runs the server with the Stdio MCP transport — suitable for running the process as a subprocess locallysse
runs the server with the SSE MCP transport — running the server as an HTTP server to connect locally or remotelywarmup
will 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 PydanticAI:
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Model Context Protocol server to run Python code in a sandbox.
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server that allows execution of Python code within Daytona workspaces, providing a secure and isolated environment for executing and managing Python scripts.Last updated -18PythonApache 2.0
- -securityFlicense-qualityA Model Context Protocol server that allows management and execution of Blender Python scripts, enabling users to create, edit and run scripts in a headless Blender environment through natural language interfaces.Last updated -4Python
- -securityAlicense-qualityA Model Context Protocol server that enables seamless execution of commands, Python code, web content fetching, and reusable task management with secure credentials handling.Last updated -2PythonMIT License
- -securityFlicense-qualityA Python-based implementation of the Model Context Protocol that enables communication between a model context management server and client through a request-response architecture.Last updated -Python