Python MCP server example using FastMCP with Deephaven worker tools

Python MCP server example using FastMCP with Deephaven worker tools

test-dh-mcp•bychipkent

A demonstration MCP server built with FastMCP that registers example and Deephaven-related tools and can run over SSE or stdio transports.

License: Not specified•Runtime: Awaiting documentation review•Category: databases storage

WHAT IT DOES

  • •Registers MCP tools using the @mcp_server.tool() decorator, including example tools like echo and gnome counting.
  • •Provides tools to list configured Deephaven workers and the default worker.
  • •Exposes tools to list tables and retrieve table schemas from a specified or default Deephaven worker.
  • •Supports running the server over SSE or stdio transports.

BEST FOR

  • •Prototyping custom MCP tools and testing them via clients and MCP Inspector.
  • •Exploring Deephaven table metadata through MCP by configuring workers in a JSON config file.
  • •Connecting a local MCP server to Claude Desktop using stdio transport.

ABOUT TEST-DH-MCP

Python MCP server example using FastMCP with Deephaven worker tools is cataloged as an MCP server attributed to chipkent. A demonstration MCP server built with FastMCP that registers example and Deephaven-related tools and can run over SSE or stdio transports. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Python MCP server example using FastMCP with Deephaven worker tools are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How are Deephaven workers configured for the tools?

Worker configuration is handled entirely via a JSON file whose path is set through the required DH_MCP_CONFIG_FILE environment variable, with no default path.

Does the example client work with any transport?

No, the Python client requires the MCP server to be running in SSE mode and will not work in stdio mode.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 003a5434cd81 · 采集于 2026-11-13 13:31:28 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

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).
  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
    
  4. Upgrade dependencies:
    uv sync --upgrade
    

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 to add your MCP server. Deephaven worker configuration is now handled entirely via a JSON config file, and the path must be specified using the required DH_MCP_CONFIG_FILE environment variable. There is no default path—this environment variable must always be set.

    Example Claude Desktop config (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"],
          "env": {
            "DH_MCP_CONFIG_FILE": "/Users/chip/dev/test-dh-mcp/deephaven_workers.json"
          }
        }
      }
    }
    

    Or with uv:

    {
      "mcpServers": {
        "test-dh-mcp": {
          "command": "uv",
          "args": [
            "--directory",
            "/Users/chip/dev/test-dh-mcp/src",
            "run",
            "mcp_server.py",
            "--transport",
            "stdio"
          ],
          "env": {
            "DH_MCP_CONFIG_FILE": "/Users/chip/dev/test-dh-mcp/deephaven_workers.json"
          }
        }
      }
    }
    

    Note: Always set DH_MCP_CONFIG_FILE in the env section if your config is not named deephaven_workers.json in the project root, or if you want to be explicit about the config location.

       "args": [
         "--directory",
         "/Users/chip/dev/test-dh-mcp/src",
         "run", 
         "mcp_server.py", 
         "--transport", 
         "stdio"
       ],
       "env": {
         "DH_MCP_SERVER_NAME": "test-dh-mcp",
         "DH_MCP_HOST": "localhost",
         "DH_MCP_PORT": "10000",
         "DH_MCP_AUTH_TYPE": "Anonymous"
       }
     }
    

    } }

Note: All DH_MCP_* environment variables listed in the Deephaven Session Configuration section can be set here. These control the Deephaven session for every tool call.

  1. Restart Claude Desktop.
  2. Debugging logs can be found in ~/Library/Logs/Claude/

Deephaven Worker Configuration

All Deephaven worker configuration is now handled via a JSON file. The path to this file must be specified using the DH_MCP_CONFIG_FILE environment variable. There is no default path—this variable is required.

The config file should look like this:

{
  "workers": {
    "worker1": {
      "host": "localhost",
      "port": 10000,
      "auth_type": "Anonymous",
      "auth_token": "",
      "never_timeout": true
    },
    "worker2": {
      "host": "otherhost",
      "port": 10001,
      "auth_type": "Bearer",
      "auth_token": "YOUR_TOKEN"
    }
  },
  "default_worker": "worker1"
}
  • The workers object maps worker names to their connection settings.
  • The default_worker is optional and used if a worker name is not specified in a tool call. If set, it must match one of the keys in the workers dictionary.

Important: The DH_MCP_CONFIG_FILE environment variable must always be set to the path of your worker config file. There is no default config path.

Supported fields for each worker:

FieldTypeDescription
hoststrDeephaven server hostname or IP (optional)
portintDeephaven server port (optional)
auth_typestrAuthentication type (e.g., Anonymous, Bearer) (optional)
auth_tokenstrAuthentication token (optional)
never_timeoutboolWhether the session should never timeout (optional, default: True)
session_typestrSession type, e.g., python (optional, default: 'python')
use_tlsboolWhether to use TLS/SSL (optional, default: False)
tls_root_certsstr or nullPath to TLS root certificates (optional)
client_cert_chainstr or nullPath to client certificate chain (optional)
client_private_keystr or nullPath to client private key (optional)

Note: You may define workers with only a subset of these fields, depending on your use case and authentication method. No fields are strictly required; defaults will be used where possible.

Tool Usage

  • echo_tool(message: str) -> str: Echoes back the input message, prefixed with 'Echo:'.
  • gnome_count_colorado() -> int: Returns the current number of gnomes in Colorado (demo tool).
  • deephaven_worker_names() -> list[str]: Returns all configured Deephaven worker names from the config file.
  • deephaven_default_worker() -> str: Returns the name of the default worker as set in config (or None if not set).
  • deephaven_list_tables(worker_name: str = None) -> list: Lists table names for the specified worker. If worker_name is not provided, uses the default_worker from config.
  • deephaven_table_schemas(worker_name: str = None) -> list: Returns schemas for all tables in the specified worker. If worker_name is not provided, uses the default_worker from config.

See the example config file above for how to set up multiple workers.

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@latest
    
  2. Run the MCP Inspector:

⚠️ WARNING: When using the MCP Inspector, all string values must be entered with quotes (e.g., "worker1"). If you do not use quotes, the Inspector may send null or invalid values to the server. The value can be validated by clicking on the Format JSON button.

- ** SSE mode: **

    - Using `venv`:

    ```bash
    cd /Users/chip/dev/test-dh-mcp/src
    npx @modelcontextprotocol/inspector@latest \
    /Users/chip/dev/test-dh-mcp/venv/bin/python3 mcp_server.py --transport sse
    ```

    - Using `uv`:

    ```bash
    cd /Users/chip/dev/test-dh-mcp/src
    npx @modelcontextprotocol/inspector@latest \
    uv run mcp_server.py --transport sse
    ```

- ** Stdio mode: **

    - Using `venv`:

    ```
    cd /Users/chip/dev/test-dh-mcp/src
    npx @modelcontextprotocol/inspector@latest \
    /Users/chip/dev/test-dh-mcp/venv/bin/python3 mcp_server.py --transport stdio
    ```

    - Using `uv`:

    ```bash
    cd /Users/chip/dev/test-dh-mcp/src
    npx @modelcontextprotocol/inspector@latest \
    uv run mcp_server.py --transport stdio
    ```

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Python MCP server example using FastMCP with Deephaven worker tools from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/test-dh-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related databases storage MCP Servers

Alternative and complementary servers in the same category

View all in databases storage →
AIStor MCP server
mcp-server-aistor•minio

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

Repository stats unavailable
Databases & Storage
InfluxDB v2 MCP Server
influxdb-mcp-server•idoru

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.

Repository stats unavailable
Databases & Storage