MCP.so
登录

MCP Python Sdk Inmemory Server Tests

@junkmd

基本信息

分类

开发工具

许可证

MIT license

传输方式

stdio

作者

junkmd

关于 MCP Python Sdk Inmemory Server Tests

暂无概览

MCP Python Sdk Inmemory Server Tests 配置

使用下面的配置,将此服务器添加到你的 MCP 客户端。

{
  "mcpServers": {
    "mcp-python-sdk-inmemory-server-tests": {
      "command": "uv",
      "args": [
        "sync",
        "--frozen"
      ]
    }
  }
}

MCP Python Sdk Inmemory Server Tests 工具

工具列表暂未提供

当前收录暂时没有可展示的工具列表,不代表服务没有工具。请查阅项目文档了解支持的能力。

工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。

概览

What is mcp-python-sdk-inmemory-server-tests?

It is an example repository with code and tests for developing robust MCP tools. It demonstrates how unit tests on individual functions can miss asynchronous pitfalls like asyncio.run in tools, and showcases a more reliable testing approach using in-memory client sessions.

How to use mcp-python-sdk-inmemory-server-tests?

Set up the environment with Node.js via Volta and uv, then run npm install and uv sync --frozen. Execute tests with uv run pytest tests/.. Debug mcpserver.py using the MCP Inspector with uv run mcp dev mcpserver.py. Format code with uv run ruff format . and uv run ruff check --select I --fix ..

Key features of mcp-python-sdk-inmemory-server-tests

  • Example code for robust MCP tool development
  • Reveals async pitfalls like asyncio.run in tools
  • Showcases in-memory client session testing approach
  • Setup with Node.js and uv package manager
  • Debugging support via MCP Inspector
  • Code formatting with Ruff

Use cases of mcp-python-sdk-inmemory-server-tests

  • Learning how to properly test MCP tools
  • Identifying and fixing async errors in tool implementations
  • Developing reliable, isolated test suites for MCP servers

常见问题

1

What problem does this project address?

It shows that unit tests on individual functions can miss asynchronous pitfalls like `asyncio.run` in MCP tools, and provides a better testing strategy using in-memory client sessions.

2

How do I run the tests?

After setup, execute `uv run pytest tests/.` in the repository root.

3

What is the MCP Inspector and how is it used?

The MCP Inspector is a debugging tool for MCP servers. Run `uv run mcp dev mcpserver.py` to start it and test `mcpserver.py`.

4

What dependencies are required?

Node.js (installed via Volta), npm, and uv (installed via shell script). After that, run `npm install` and `uv sync --frozen`.

评论

开发工具 分类下的更多 MCP 服务器