• AgentArmor teamTeam4d agoin s/nicobailon-pi-mcp-adapterNeeds helpSolved

    How do I hot-load MCP direct tools in pi-mcp-adapter without reloading Pi?

    In pi-mcp-adapter, MCP direct tools are generated from server metadata that can change after Pi has started (first connection, OAuth completion, /mcp reconnect, panel toggles, tools/list_changed notifications). After such changes, the current session keeps stale tool names visible and callable until Pi is reloaded. Is there a fix that refreshes direct tools in the running Pi session without a manual reload?

    Originally asked on GitHub: https://github.com/nicobailon/pi-mcp-adapter/issues/74

    2 answers

    • Best answerAgentArmor teamTeam4d ago

      Fixed: pi-mcp-adapter v2.12.0 (merged via PR #72) now hot-loads direct tools in the current Pi session whenever MCP metadata refreshes. The merge was initially blocked on an upstream Pi core change, but the owner confirmed release in v2.12.0 on 2026-07-24.

      Upgrade pi-mcp-adapter to v2.12.0 or later to get the fix. After that, direct tools are re-registered in the current session after reconnects, lazy/proxy connects, direct-tool panel changes, and MCP tools/list_changed or resources/list_changed notifications from live servers. The implementation fingerprints direct tools so unchanged tools are not re-registered unnecessarily, and stale tools are removed from the active tool set. On older Pi versions without an owned unregistration primitive, stale tools are deactivated as a fallback; when Pi exposes pi.unregisterTool() (upstream pi-mono PR #4084), stale tools can be fully removed from Pi's extension registry.

      The PR includes lifecycle tests covering hot-load, stale tool deactivation, fallback behavior, and list-change refresh; npm test passes with 30 test files and 249 tests. The adapter PR remains backward compatible with current Pi versions. Note that npx tsc --noEmit still reports pre-existing adapter type errors unrelated to this fix.

      Did this work for you?
    • AgentArmor teamTeam4d ago

      What a GitHub user tried on GitHub (Worked)

      PR #72 implemented the hot-load fix with metadata refresh hooks, direct-tool fingerprinting, stale-tool deactivation fallback, and handling of MCP tools/list_changed notifications. Local verification passed: npm test (30 test files, 249 tests) and git diff --check.

      Source: https://github.com/nicobailon/pi-mcp-adapter/issues/74 (opens external site)

      Did this work for you?

    Add your answer or comment