Skip to content

[Bug] MCP tool list not refreshed on notifications/tools/list_changed event #13646

Description

@temujin9

Bug Description
Claude Code does not refresh its tool list when receiving the MCP notifications/tools/list_changed notification from servers.

Investigation of the minified cli.js source confirms that while Claude Code defines the Zod schema for this notification and includes it in the server-to-client notification types, no handler is registered via setNotificationHandler for notifications/tools/list_changed. When the notification arrives, the _onnotification method finds no matching handler and no fallbackNotificationHandler, so it returns early without action. The listTools method exists but is only called once during initial connection setup.

This prevents dynamic tool loading scenarios where an MCP server adds or removes tools during a session. Tools added via runtime operations like mcp-add from the docker mcp-gateway are registered server-side and the notification is sent correctly, but Claude Code never re-fetches the tool list to discover them.

Suggested solution: Register a notification handler for notifications/tools/list_changed that calls listTools on the affected server connection and updates the internal tool cache. This would enable hot-loading of MCP tools without requiring a full restart of Claude Code.

Environment Info

  • Platform: linux
  • Terminal: konsole
  • Version: 2.0.65
  • Feedback ID: 54d8c9f6-c4f2-4d41-a5c9-6c89d5e19dc0

Errors

[{"error":"Error: Plugin hook \"cat | curl -sf -X POST -H \"X-Wrapper-PID: $MAITRED_WRAPPER_PID\" -d @- http://localhost:9100/hook\" failed with exit code 7\n    at Object.callback (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1860:13)\n    at async K35 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2993:1190)\n    at async file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2986:912\n    at async vZA (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1878:5591)\n    at async Ri (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2986:3960)\n    at async rt1 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2986:9274)\n    at async tz (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1860:2665)\n    at async Vl (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1878:14901)\n    at async YZ0.<anonymous> (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:4669:6953)\n    at async YZ0.parseAsync (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:4373:4156)","timestamp":"2025-12-11T05:25:02.417Z"},{"error":"Error: Tool mcp__mcp-gateway__mcp-find not found\n    at XC2 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2703:6635)\n    at d2 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:21820)\n    at t2 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:38061)\n    at J_ (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:49007)\n    at bM (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:85342)\n    at ti (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:84348)\n    at ri (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:84174)\n    at fh (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:80666)\n    at E0 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:8794)\n    at Immediate.Xj1 [as _onImmediate] (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:596:5108)","timestamp":"2025-12-11T05:25:02.500Z"},{"error":"Error: Tool mcp__mcp-gateway__mcp-add not found\n    at XC2 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2703:6635)\n    at d2 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:21820)\n    at t2 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:38061)\n    at J_ (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:49007)\n    at bM (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:85342)\n    at ti (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:84348)\n    at ri (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:84174)\n    at fh (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:80666)\n    at E0 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:8794)\n    at Immediate.Xj1 [as _onImmediate] (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:596:5108)","timestamp":"2025-12-11T05:25:02.502Z"},{"error":"Error: Tool mcp__mcp-gateway__mcp-add not found\n    at XC2 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2703:6635)\n    at d2 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:21820)\n    at t2 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:38061)\n    at J_ (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:49007)\n    at bM (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:85342)\n    at ti (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:84348)\n    at ri (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:84174)\n    at fh (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:80666)\n    at E0 (file:///home/temujin9/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:603:8794)\n    at Immedi

Note: Error logs were truncated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:mcpbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions