aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-03-01 10:06:42 -0800
committerClawd <ai@clawd.bot>2026-03-01 10:06:42 -0800
commit66a73c463468bfcaad5627ca26fb25215f47d256 (patch)
treefcca7c592899f8c061a6d487ce30d962713a852e /src/main
parentb34161ee5e97672b29a2f0cad1effb10f585a35e (diff)
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.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/claude/index.ts18
1 files changed, 4 insertions, 14 deletions
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 @@
1import { query, type SDKMessage, type Query, type PermissionResult } from "@anthropic-ai/claude-agent-sdk"; 1import { query, type SDKMessage, type Query } from "@anthropic-ai/claude-agent-sdk";
2import type { Session } from "../db/sessions"; 2import type { Session } from "../db/sessions";
3import { getPhaseConfig, getNextPhase, getArtifactFilename } from "./phases"; 3import { getPhaseConfig, getNextPhase, getArtifactFilename } from "./phases";
4import type { Phase, UserPermissionMode } from "./phases"; 4import type { Phase, UserPermissionMode } from "./phases";
@@ -79,20 +79,10 @@ export async function sendMessage({
79 ...(session.phase === "implement" && { 79 ...(session.phase === "implement" && {
80 allowedTools: ["Bash(git status*)", "Bash(git log*)", "Bash(git diff*)"], 80 allowedTools: ["Bash(git status*)", "Bash(git log*)", "Bash(git diff*)"],
81 }), 81 }),
82 // Auto-allow MCP tools in research phase (where external data is most useful) 82 // When MCPs are configured in research phase, bypass permissions to allow MCP tools
83 ...(session.phase === "research" && mcpServers && { 83 ...(session.phase === "research" && mcpServers && {
84 canUseTool: async ( 84 permissionMode: "bypassPermissions" as const,
85 toolName: string, 85 allowDangerouslySkipPermissions: true,
86 _input: Record<string, unknown>,
87 _options: { signal: AbortSignal; toolUseID: string }
88 ): Promise<PermissionResult> => {
89 // Auto-approve all MCP tools (they start with "mcp__")
90 if (toolName.startsWith("mcp__")) {
91 return { behavior: "allow" };
92 }
93 // For non-MCP tools, allow them too since research is read-heavy
94 return { behavior: "allow" };
95 },
96 }), 86 }),
97 }, 87 },
98 }); 88 });