MCP 单仓库启动脚本/模板
这个仓库为编排(或协调)提供了基础 模型上下文协议 (MCP) 服务器进程来自一个单独的 Python 包。它提供了一个高级的接口/功能 MCPExecutor 该系统能够管理多个服务器子进程,发送JSON-RPC请求,并将错误信息反馈给调用者。
项目布局
pyproject.toml # Project metadata and pytest configuration
src/mcp_mono/ # Library source code
└── testing/fake_server.py # Lightweight server used by the test-suite
tests/ # Unit tests (planning snapshot + runtime behaviour)用法
from mcp_mono import MCPExecutor, ServerConfig
config = ServerConfig(
name="demo",
command=["python", "-m", "mcp_mono.testing.fake_server"],
env={"MCP_FAKE_SERVER_NAME": "demo"},
)
with MCPExecutor([config]) as executor:
result = executor.request("demo", "echo", {"message": "hello"})
print(result)测试
安装可选的测试依赖项,并通过以下方式运行测试套件:
pip install -e .[test]
pytest