From fd85c30eb180de4d631ffe3dc7994d4d9a4bb7ed Mon Sep 17 00:00:00 2001 From: null-runner Date: Thu, 4 Dec 2025 23:32:58 +0100 Subject: [PATCH] fix: enable tool activation for Claude clients in mcp-add MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 #278 (tool-name-prefix dispatch fix) --- pkg/gateway/mcpadd.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/gateway/mcpadd.go b/pkg/gateway/mcpadd.go index 2d76e2388..767d86e8b 100644 --- a/pkg/gateway/mcpadd.go +++ b/pkg/gateway/mcpadd.go @@ -209,9 +209,9 @@ func addServerHandler(g *Gateway, clientConfig *clientConfig) mcp.ToolHandler { } clientNameLower := strings.ToLower(clientName) - // Only activate tools if activate is true AND client name doesn't contain "claude" - // (Claude clients auto-refresh their tool list, so they don't need explicit activation) - shouldActivate := params.Activate && !strings.Contains(clientNameLower, "claude") + // Activate tools if requested - all clients need explicit activation + // (Removed incorrect assumption that Claude auto-refreshes tool list) + shouldActivate := params.Activate // Claude clients also need explicit activation if shouldActivate { // Now update g.mcpServer with the new capabilities