mcp-python-sdk内存服务器测试
此存储库提供了开发健壮的MCP工具的示例代码和测试。\ 它演示了单个函数的单元测试如何错过异步陷阱,例如 asyncio.run 在工具中。\ 展示了一种使用内存中客户端会话的更可靠的测试方法。
命令
设置:
curl https://get.volta.sh | bash
volta install node
npm install
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync --frozen运行测试:
uv run pytest tests/.测试和调试 mcpserver.py 随着 MCP检查员:
uv run mcp dev mcpserver.py格式化代码库:
uv run ruff format .
uv run ruff check --select I --fix .