Enables secure execution of Python code in a sandboxed WebAssembly environment with automatic dependency management, capturing output and return values
Code is executed using Pyodide in Deno and is therefore isolated from the rest of the operating system.
Features
- Secure Execution: Run Python code in a sandboxed WebAssembly environment
- Package Management: Automatically detects and installs required dependencies
- Complete Results: Captures standard output, standard error, and return values
- Asynchronous Support: Runs async code properly
- Error Handling: Provides detailed error reports for debugging
Usage
To use this server, you must have both Python and Deno installed.
The server can be run with deno
installed using uvx
:
where:
stdio
runs the server with the Stdio MCP transport — suitable for running the process as a subprocess locallystreamable-http
runs 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 SSEwarmup
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.
Usage in codes
Then you can use mcp-run-python
with Pydantic AI:
Logging
MCP Run Python supports emitting stdout and stderr from the python execution as MCP logging messages.
For logs to be emitted you must set the logging level when connecting to the server. By default, the log level is set to the highest level, emergency
.
Currently, it's not possible to demonstrate this due to a bug in the Python MCP Client, see modelcontextprotocol/python-sdk#201.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables secure execution of Python code in a sandboxed WebAssembly environment using Pyodide and Deno. Automatically handles package management and captures complete execution results including stdout, stderr, and return values.
Related MCP Servers
- -securityAlicense-qualityAn interactive Python code execution environment that allows users and LLMs to safely execute Python code and install packages in isolated Docker containers.Last updated -24Apache 2.0
- -securityAlicense-qualityAn interactive Python code execution tool that allows users and LLMs to safely execute Python code and install packages in isolated Docker containers.Last updated -24Apache 2.0
- -securityFlicense-qualityA secure Node.js execution environment that allows coding agents and LLMs to run JavaScript dynamically, install NPM packages, and retrieve results while adhering to the Model Control Protocol.Last updated -884
- AsecurityAlicenseAqualityA Python code execution sandbox based on IPython and Docker. Stateful code execution, file transfer between host and container, configurable network access.Last updated -434Apache 2.0