From 66a73c463468bfcaad5627ca26fb25215f47d256 Mon Sep 17 00:00:00 2001 From: Clawd Date: Sun, 1 Mar 2026 10:06:42 -0800 Subject: fix(mcp): bypass permissions in research phase when MCPs configured canUseTool callback caused ZodError. Simpler approach: override to bypassPermissions mode when MCPs are present in research phase. --- src/main/claude/index.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/main/claude/index.ts b/src/main/claude/index.ts index ebbf8a9..ca54164 100644 --- a/src/main/claude/index.ts +++ b/src/main/claude/index.ts @@ -1,4 +1,4 @@ -import { query, type SDKMessage, type Query, type PermissionResult } from "@anthropic-ai/claude-agent-sdk"; +import { query, type SDKMessage, type Query } from "@anthropic-ai/claude-agent-sdk"; import type { Session } from "../db/sessions"; import { getPhaseConfig, getNextPhase, getArtifactFilename } from "./phases"; import type { Phase, UserPermissionMode } from "./phases"; @@ -79,20 +79,10 @@ export async function sendMessage({ ...(session.phase === "implement" && { allowedTools: ["Bash(git status*)", "Bash(git log*)", "Bash(git diff*)"], }), - // Auto-allow MCP tools in research phase (where external data is most useful) + // When MCPs are configured in research phase, bypass permissions to allow MCP tools ...(session.phase === "research" && mcpServers && { - canUseTool: async ( - toolName: string, - _input: Record, - _options: { signal: AbortSignal; toolUseID: string } - ): Promise => { - // Auto-approve all MCP tools (they start with "mcp__") - if (toolName.startsWith("mcp__")) { - return { behavior: "allow" }; - } - // For non-MCP tools, allow them too since research is read-heavy - return { behavior: "allow" }; - }, + permissionMode: "bypassPermissions" as const, + allowDangerouslySkipPermissions: true, }), }, }); -- cgit v1.2.3