Skip to content

mcp-hmr: Send notifications/tools/list_changed after hot-swap #79

@richardpowellus

Description

@richardpowellus

When mcp-hmr hot-swaps the inner app (unmount old proxy → mount new proxy on base_app), it does not send a notifications/tools/list_changed notification per the MCP spec.

The client caches its tool list from the initial tools/list call and never re-queries it, so newly added or removed tools are invisible until a full server restart — which defeats the purpose of hot reload.

Expected

After each hot-swap, mcp-hmr should send notifications/tools/list_changed so the client refreshes its tool cache.

Reproduction

  1. Start a server via mcp-hmr src.server:mcp -t stdio
  2. Add a new @mcp.tool() function in a new or existing module
  3. Save the file — mcp-hmr detects the change and hot-swaps
  4. Call the new tool → Tool does not exist (client still has stale cache)
  5. Restart the server → tool now appears

Workaround

We use a wrapper script that monkey-patches ServerSession.__init__ to capture the active session reference, then monitors base_app._mounted_servers for changes and calls session.send_tool_list_changed() after each swap.

Environment

  • mcp-hmr 0.0.3.3
  • fastmcp 2.14.6
  • MCP client: GitHub Copilot CLI (stdio transport)

Metadata

Metadata

Assignees

No one assigned

    Labels

    mcp-hmrRelated to the `mcp-hmr` package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions