MCP cover image
See in Github
2025-04-14

Explore creating a Deephaven Core MCP server

0

Github Watches

0

Github Forks

0

Github Stars

test-dh-mcp

This project demonstrates how to define and run an MCP (Multi-Channel Protocol) server using the FastMCP implementation. It includes examples for tool registration, server/client usage, and integration with Claude Desktop and MCP Inspector.

Project Structure

  • src/mcp_server.py — Main entrypoint to run the MCP server (configurable for SSE or stdio transport).
  • src/dhmcp/__init__.py — All tools are registered here using the @mcp_server.tool() decorator.
  • src/mcp_client.py — Example async client for testing tools.
  • requirements.txt — Python dependencies (including mcp[cli] and autogen-ext).

Using uv for Dependency Management

uv is a modern, ultra-fast Python package manager and runner. It can be used as a drop-in replacement for pip and venv, providing faster installs and improved dependency management.

Key Concepts

  • pyproject.toml: The modern, recommended way to specify your project's dependencies and metadata. uv uses this as the source of truth.
  • requirements.txt: Supported for compatibility with traditional Python tools and workflows. Optional if you use pyproject.toml.
  • uv.lock: Lockfile for reproducible installs (auto-managed by uv).

Modern Workflow (Recommended)

  1. Add dependencies directly to your project:
    uv pip install <package>
    # Example:
    uv pip install autogen-ext mcp[cli]
    
    This updates pyproject.toml and uv.lock.
  2. Sync environment:
    uv pip install  # Installs all dependencies from pyproject.toml
    
  3. Run scripts:
    uv run src/mcp_server.py
    uv run src/mcp_client.py
    

Compatibility Workflow (requirements.txt)

  • If you have an existing requirements.txt, you can use:
    uv pip install -r requirements.txt
    # or
    uv add --requirements requirements.txt
    
  • This will sync dependencies and update your lockfile. You can keep both files in sync for maximum compatibility.

Notes

  • requirements.txt is optional with uv. For new projects, you can rely entirely on pyproject.toml and uv.lock.
  • For legacy projects or sharing with users of pip, keep requirements.txt up to date.
  • uv works with or without a virtual environment. Use uv venv .venv to create one if desired.
  • If you have multiple environments, use --active to target the currently activated one.

Quick Start: Server

1. Install dependencies

It is recommended to use a virtual environment:

  • Using venv:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
  • Using uv:
uv pip install -r requirements.txt

2. Run the MCP Server

From the project root, run (choose the transport that fits your use case):

  • SSE transport (default, for browser/web clients):

    python src/mcp_server.py
    # or, explicitly:
    python src/mcp_server.py --transport sse
    # or, using uv:
    uv run src/mcp_server.py
    

    The server will listen on http://localhost:8000/sse

  • Stdio transport (recommended for Claude Desktop/Inspector):

    python src/mcp_server.py --transport stdio
    # or, using uv:
    uv run src/mcp_server.py --transport stdio
    

    The server will communicate via stdio (no HTTP port needed).

You should see log output indicating the server is running with the selected transport.

Quick Start: Client

Note: The Python client (mcp_client.py) requires the MCP server to be running in SSE mode (the default). It will not work if the server is running in stdio mode.

1. Install dependencies

It is recommended to use a virtual environment:

  • Using venv:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
  • Using uv:
uv pip install -r requirements.txt

2. Run the MCP Client

From the project root, run:

  • Using venv:
cd src
python -m mcp_client
  • Using uv:
cd src
uv run mcp_client.py

You should see log output indicating the client is running and listing available tools.

Claude Desktop

You can connect Claude Desktop to your local stdio MCP server to use custom tools.

  1. Edit ~/Library/Application\ Support/Claude/claude_desktop_config.json:

    • Using venv:
    {
        "mcpServers": {
            "test-dh-mcp": {
                "command": "/Users/chip/dev/test-dh-mcp/.venv/bin/python3",
                "args": ["/Users/chip/dev/test-dh-mcp/src/mcp_server.py", "--transport", "stdio"]
            }
        }
    }
    
    • Using uv:
    {
        "mcpServers": {
            "test-dh-mcp": {
                "command": "uv",
                "args": [
                    "--directory",
                    "/Users/chip/dev/test-dh-mcp/src",
                    "run", 
                    "mcp_server.py", 
                    "--transport", 
                    "stdio"
                ]
            }
        }
    }
    
  2. Restart Claude Desktop.

  3. Debugging logs can be found in ~/Library/Logs/Claude/

Registering Tools

Define new tools in dhmcp/__init__.py using the @mcp_server.tool() decorator. Example:

@mcp_server.tool()
def echo_tool(message: str) -> str:
    """
    Echo tool that returns the input message prefixed with 'Echo:'.
    """
    return f"Echo: {message}"

Troubleshooting

  • Ensure you are running commands from the correct directory (src for direct script execution).
  • If you change tool definitions, restart the server.
  • For connection issues, check that the server is running and listening on the expected address/port (for SSE), or correctly attached via stdio (for Claude/Inspector).

Is the server running?

  • SSE mode:
    curl http://localhost:8000/sse
    
  • Stdio mode:
    • Check your Claude/Inspector logs for successful connection and tool listing.

MCP Inspector

The MCP Inspector is a tool that allows you to inspect the state of an MCP server.

  1. Install the MCP Inspector:

    npm install -g @modelcontextprotocol/inspector
    
  2. Run the MCP Inspector:

    • ** SSE mode: **

      • Using venv:
      cd /Users/chip/dev/test-dh-mcp/src
      npx @modelcontextprotocol/inspector \
      /Users/chip/dev/test-dh-mcp/venv/bin/python3 mcp_server.py --transport sse
      
      • Using uv:
      cd /Users/chip/dev/test-dh-mcp/src
      npx @modelcontextprotocol/inspector \
      uv run mcp_server.py --transport sse
      
    • ** Stdio mode: **

      • Using venv:
      cd /Users/chip/dev/test-dh-mcp/src
      npx @modelcontextprotocol/inspector \
      /Users/chip/dev/test-dh-mcp/venv/bin/python3 mcp_server.py --transport stdio
      
      • Using uv:
      cd /Users/chip/dev/test-dh-mcp/src
      npx @modelcontextprotocol/inspector \
      uv run mcp_server.py --transport stdio
      

相关推荐

  • Aurity Ltd
  • Create and Publish Business Websites in seconds. AI will gather all the details about your website and generate link to your website.

  • John Rafferty
  • Text your favorite pet, after answering 10 questions about their everyday lives!

  • Ian O'Connell
  • Provide players' names or enter Quickstart to start the game!

  • Convincible Ltd
  • You're in a stone cell – can you get out? A classic choose-your-adventure interactive fiction game, based on a meticulously-crafted playbook. With a medieval fantasy setting, infinite choices and outcomes, and dice!

  • analogchat.com
  • Efficient Spotify assistant for personalized music data.

  • Matthieu Savioux
  • Evaluates language quality of texts, responds with a numerical score between 50-150.

  • Liaozhaohe
  • - Talk with your own cat-girl maid as in visual novels!

  • WangRongsheng
  • 🧑‍🚀 全世界最好的LLM资料总结(Agent框架、辅助编程、数据处理、模型训练、模型推理、o1 模型、MCP、小语言模型、视觉语言模型) | Summary of the world's best LLM resources.

  • av
  • Effortlessly run LLM backends, APIs, frontends, and services with one command.

  • 1Panel-dev
  • 🔥 1Panel provides an intuitive web interface and MCP Server to manage websites, files, containers, databases, and LLMs on a Linux server.

  • langgenius
  • Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.

  • alibaba
  • an easy-to-use dynamic service discovery, configuration and service management platform for building AI cloud native applications.

  • rulego
  • ⛓️RuleGo is a lightweight, high-performance, embedded, next-generation component orchestration rule engine framework for Go.

  • Byaidu
  • PDF scientific paper translation with preserved formats - 基于 AI 完整保留排版的 PDF 文档全文双语翻译,支持 Google/DeepL/Ollama/OpenAI 等服务,提供 CLI/GUI/MCP/Docker/Zotero

  • lasso-security
  • A plugin-based gateway that orchestrates other MCPs and allows developers to build upon it enterprise-grade agents.

  • hkr04
  • Lightweight C++ MCP (Model Context Protocol) SDK

    Reviews

    2.8 (5)
    Avatar
    user_ea88unDA
    2025-04-24

    As a dedicated user of test-dh-mcp, I am thoroughly impressed with its seamless integration and user-friendly interface. Created by the talented chipkent, this application has significantly streamlined my workflow. Although there are no specific product details available in the description, I highly recommend giving it a try based on my positive experience.

    Avatar
    user_N2wYM7Wx
    2025-04-24

    As a loyal user of the test-dh-mcp application, I am highly impressed with its performance and user-friendly interface. Developed by chipkent, this tool stands out for its reliability and efficiency. It significantly enhances my workflow, and I would highly recommend it to anyone looking for a robust MCP application.

    Avatar
    user_8hHk4GtB
    2025-04-24

    As a loyal user of test-dh-mcp, I must commend chipkent for creating such a fantastic application. It is incredibly user-friendly and efficient, meeting all my needs seamlessly. This product stands out in its category and has made my workflow much more streamlined. Highly recommend it!

    Avatar
    user_bSzJMv0G
    2025-04-24

    As an avid user of test-dh-mcp, I have been thoroughly impressed by its performance and reliability. Developed by the talented chipkent, this application has significantly streamlined my workflow. Highly recommended for anyone seeking efficiency and precision.

    Avatar
    user_oj24SenY
    2025-04-24

    I've been using test-dh-mcp by chipkent for a while now, and it's truly a game-changer. The seamless integration and intuitive design make it stand out. Highly recommended for anyone looking to improve their workflow!