Skip to content

Conversation

@null-runner
Copy link
Contributor

@null-runner null-runner commented Dec 4, 2025

Summary

The mcp-add command was incorrectly skipping tool activation for clients with "claude" in their name, based on the assumption that these clients auto-refresh their tool list. This assumption is incorrect.

Problem

When mcp-add is called with activate=true from affected clients:

  1. Tools are added to g.toolRegistrations (accessible via mcp-exec)
  2. But updateServerCapabilities() is never called due to a client name check
  3. Therefore g.mcpServer.AddTool() is never executed
  4. Direct MCP tool calls fail with "unknown tool" error

Reproduction:

mcp-add chromedev (activate=true)     → success (26 tools registered)
mcp-exec chromedev:list_pages         → works ✓
direct call to chromedev:list_pages   → "unknown tool" error ✗

Root Cause

In pkg/gateway/mcpadd.go line 234:

shouldActivate := params.Activate && \!strings.Contains(clientNameLower, "claude")

This check prevents tool activation for any client with "claude" in its name.

Fix

Remove the client name exclusion:

shouldActivate := params.Activate // All clients need explicit activation

Testing

Tested with Claude Code:

  • Before fix: direct tool calls fail after mcp-add
  • After fix: direct tool calls work correctly

Related

Related to #278 (tool-name-prefix dispatch fix)

@null-runner null-runner requested a review from a team as a code owner December 4, 2025 22:33
@null-runner null-runner changed the title fix: enable tool activation for Claude clients in mcp-add fix: emove explicit exclusion of 'claude' clients from tool activation logic. Dec 4, 2025
@null-runner null-runner changed the title fix: emove explicit exclusion of 'claude' clients from tool activation logic. fix: remove explicit exclusion of 'claude' clients from tool activation logic. Dec 5, 2025
@null-runner null-runner force-pushed the fix/claude-client-tool-activation branch from 47e9ca3 to 5463d5d Compare January 7, 2026 11:55
@null-runner
Copy link
Contributor Author

Hi @slimslenderslacks,

Following up on this PR after a month. This fix addresses a critical issue where Claude clients cannot use tools added via mcp-add with activate=true due to the hardcoded client name exclusion.

Current behavior:

  • mcp-add chromedev --activate → tools registered in toolRegistrations but NOT in mcpServer
  • mcp-exec chromedev:list_pages → ✅ works (uses toolRegistrations)
  • Native MCP call to chromedev:list_pages → ❌ "unknown tool" error

This PR:

  • Removes the incorrect "Claude auto-refresh" assumption
  • Allows updateServerCapabilities() to call AddTool() for all clients
  • Just rebased on latest main (no conflicts)

The fix is tested and working on my end. Could we get a review or feedback on whether this aligns with the current roadmap?

Thanks for maintaining this project!

The mcp-add command was incorrectly skipping tool activation for Claude
clients based on the assumption that "Claude clients auto-refresh their
tool list". This assumption is incorrect.

When mcp-add is called with activate=true, tools were added to
g.toolRegistrations (accessible via mcp-exec) but NOT to g.mcpServer
(required for native MCP tool calls). This caused:

- mcp-add chromedev → success (26 tools registered)
- mcp-exec chromedev:list_pages → works (uses toolRegistrations)
- native call to chromedev:list_pages → "unknown tool" error

The fix removes the Claude client exclusion, allowing updateServerCapabilities()
to call g.mcpServer.AddTool() for all clients.

Related to docker#278 (tool-name-prefix dispatch fix)
@null-runner null-runner force-pushed the fix/claude-client-tool-activation branch from 5463d5d to fd85c30 Compare January 7, 2026 12:05
@slimslenderslacks
Copy link
Collaborator

@null-runner apologies for taking so long. We were planning on adding this change to #313 as well so I think it looks good. But the last time I checked, claude code still wasn't processing the tool list changed notifications. When you test this now, are you seeing notificiations being processed?

@slimslenderslacks
Copy link
Collaborator

@null-runner it looks like there's a conflict here but we did actually merge your change as part of fixing another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants