mcp-run-python
OfficialProvides the ability to execute Python code in a sandboxed environment using pyodide, allowing safe Python code execution isolated from the operating system.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-run-pythoncalculate the factorial of 10"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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|streamable_http|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--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:
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStdio
import logfire
logfire.configure()
logfire.instrument_mcp()
logfire.instrument_pydantic_ai()
server = MCPServerStdio('deno',
args=[
'run',
'-N',
'-R=node_modules',
'-W=node_modules',
'--node-modules-dir=auto',
'jsr:@pydantic/mcp-run-python',
'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())This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceA 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 updated11
- -license-quality-maintenanceA streamlined foundation for building Model Context Protocol servers in Python, designed to make AI-assisted development of MCP tools easier and more efficient.Last updated12
- Flicense-qualityDmaintenanceA 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
- FlicenseAqualityCmaintenanceA Model Context Protocol server that allows LLMs to interact with Python environments, execute code, and manage files within a specified working directory.Last updated10101
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
Connect AI agents to Replynodes over the Model Context Protocol.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pydantic/pydantic-ai'
If you have feedback or need assistance with the MCP directory API, please join our Discord server