mcp-python-sdk-inmemory-server-tests

by junkmd

177 downloads
Not rated
GitHub

Description

# mcp-python-sdk-inmemory-server-tests This repository provides example 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. A more reliable testing approach using…

About

# mcp-python-sdk-inmemory-server-tests This repository provides example 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. A more reliable testing approach using in-memory client sessions is showcased. ##…

Details

Author
junkmd
Downloads
177
Categories
Developer Tools

- 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

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name mcp-python-sdk-inmemory-server-tests
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

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 ..

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

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

McpServers

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

mcp-python-sdk-inmemory-server-tests

This repository provides example 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.
A more reliable testing approach using in-memory client sessions is showcased.

Commands

Setup:
curl https://get.volta.sh | bash
volta install node
npm install
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync --frozen

Run tests:

uv run pytest tests/.

Test and debug mcpserver.py with the MCP Inspector:

uv run mcp dev mcpserver.py

Format codebases:

uv run ruff format .
uv run ruff check --select I --fix .

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.