No project description provided
Project description
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.
To use this server, you must have both Python and Deno installed
The server can be run with deno installed using uvx:
uvx mcp-run-python [stdio|streamable-http|warmup]
where:
stdioruns 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 SSEwarmupwill 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 mcp-run-python with Pydantic AI:
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStdio
from mcp_run_python import deno_args
import logfire
logfire.configure()
logfire.instrument_mcp()
logfire.instrument_pydantic_ai()
server = MCPServerStdio('deno', args=deno_args('stdio'))
agent = Agent('claude-3-5-haiku-latest', toolsets=[server])
async def main():
async with agent:
result = await agent.run('How many days between 2000-01-01 and 2025-03-18?')
print(result.output)
#> There are 9,208 days between January 1, 2000, and March 18, 2025.w
if __name__ == '__main__':
import asyncio
asyncio.run(main())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_run_python-0.0.1.tar.gz.
File metadata
- Download URL: mcp_run_python-0.0.1.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e496a936771b3099bf560e9ba16a0bce4151147bbb2dae72522cdc99d93caa2
|
|
| MD5 |
81c63b23054110b314ab8c2417b07c44
|
|
| BLAKE2b-256 |
cc4517c6951db5287b000315ce49ed8777df432e504c623560909a4f2b26abef
|
File details
Details for the file mcp_run_python-0.0.1-py3-none-any.whl.
File metadata
- Download URL: mcp_run_python-0.0.1-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7516150bd2a7c9485bf3733b2143918f4197eb66e189c31f0a5793d64ba6d411
|
|
| MD5 |
bae804193769a099b47f2bbf78f36686
|
|
| BLAKE2b-256 |
08aa84a8a9c6b1ae71ccaed69a8c230f48ae1c5b4ad20f2f7c443f554832897b
|