MCP 运行 Python
模型上下文协议服务器在沙箱中运行 Python 代码。
该代码使用Deno中的Pyodide执行,因此与操作系统的其余部分隔离。
请参阅
可以使用以下命令安装deno
来运行服务器:
在哪里:
-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_modules
目录stdio
使用Stdio MCP 传输运行服务器 - 适合在本地将进程作为子进程运行sse
使用SSE MCP 传输运行服务器 — 将服务器作为 HTTP 服务器运行,以便进行本地或远程连接warmup
将运行一个精简的 Python 脚本来下载并缓存 Python 标准库。这对于检查服务器是否正常运行也很有用。
以下是使用@pydantic/mcp-run-python
与 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.
模型上下文协议服务器在沙箱中运行 Python 代码。
Related MCP Servers
- -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 -8
- -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.
- -securityAlicense-qualityA streamlined foundation for building Model Context Protocol servers in Python, designed to make AI-assisted development of MCP tools easier and more efficient.Last updated -13MIT 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 -