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)

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)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@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
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.

1 participant