Back to MCP directory
publicPublicdnsLocal runtime

python-run-mcp

Python实现的MCP协议服务,提供标准化API执行Python代码

article

README

🚀 MCP 服务器

MCP 服务器是一个用 Python 实现的服务,它遵循 Model Context Protocol (MCP),借助标准化的 API 端点来执行 Python 代码,为相关开发工作提供便利。

🚀 快速开始

MCP 服务器的使用十分便捷,只需简单的几个步骤,就能让你开始体验它的功能。

📦 安装指南

使用以下命令安装所需依赖:

pip install -r requirements.txt

💻 使用示例

基础用法

  1. 启动服务器:
python src/server.py
  1. 发送请求到 /run_python 端点:
curl -X POST http://localhost:8000/run_python \
    -H "Content-Type: application/json" \
    -d '{"code": "print(\'Hello, World!\')"'

📚 详细文档

开发注意事项

  • 遵循模块化结构,以提高代码的可维护性和可扩展性。
  • 在提交更改前运行测试,确保代码的稳定性。
  • 根据需要更新文档,保证文档的时效性和准确性。

📄 许可证

本项目采用 MIT 许可证。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client