mcp-run-python
OfficialMCP Запустить Python
Модель сервера Context Protocol для запуска кода Python в «песочнице».
Код выполняется с использованием Pyodide в Deno и поэтому изолирован от остальной части операционной системы.
Полную документацию смотрите по адресу https://ai.pydantic.dev/mcp/run-python/ .
Сервер можно запустить с установленным deno с помощью:
deno run \
-N -R=node_modules -W=node_modules --node-modules-dir=auto \
jsr:@pydantic/mcp-run-python [stdio|sse|warmup]где:
-N -R=node_modules -W=node_modules(псевдоним--allow-net --allow-read=node_modules --allow-write=node_modules) разрешает сетевой доступ и доступ на чтение и запись к./node_modules. Они необходимы для того, чтобы pyodide мог загружать и кэшировать стандартную библиотеку и пакеты Python--node-modules-dir=autoсообщает deno использовать локальный каталогnode_modulesstdioзапускает сервер с транспортом Stdio MCP — подходит для локального запуска процесса как подпроцессаsseзапускает сервер с транспортом SSE MCP — запуск сервера как HTTP-сервера для локального или удаленного подключенияwarmupзапустит минимальный скрипт Python для загрузки и кэширования стандартной библиотеки Python. Это также полезно для проверки корректности работы сервера.
Вот пример использования @pydantic/mcp-run-python с PydanticAI:
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', mcp_servers=[server])
async def main():
async with agent.run_mcp_servers():
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 deployed
Maintenance
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for Studex tools, notifications, and profile integrations
Model Context Protocol server for todo.vu task management and time tracking.
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA 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.11-
- AlicenseNot gradedqualityNot gradedmaintenanceA streamlined foundation for building Model Context Protocol servers in Python, designed to make AI-assisted development of MCP tools easier and more efficient.12MIT
- FlicenseNot gradedqualityDmaintenanceA Python-based implementation of the Model Context Protocol that enables communication between a model context management server and client through a request-response architecture.-
- AlicenseAqualityFmaintenanceA Model Context Protocol server that allows LLMs to interact with Python environments, execute code, and manage files within a specified working directory.102,046 PyPI104MIT