From 044d628a47f063bcbbd9adba7860542156a0c66e Mon Sep 17 00:00:00 2001 From: Clawd Date: Sun, 1 Mar 2026 10:15:14 -0800 Subject: feat(mcp): add tool discovery and per-tool permissions - Add MCP protocol client for tool discovery (initialize + tools/list) - Show discovered tools in settings UI with enable/disable checkboxes - Build explicit allowedTools list from enabled MCP tools - Remove bypassPermissions hack - now uses proper tool allowlisting - Format: mcp__servername__toolname for SDK allowedTools --- src/main/ipc/handlers.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/ipc/handlers.ts') diff --git a/src/main/ipc/handlers.ts b/src/main/ipc/handlers.ts index e0863f3..4894e1d 100644 --- a/src/main/ipc/handlers.ts +++ b/src/main/ipc/handlers.ts @@ -4,6 +4,7 @@ import * as sessions from "../db/sessions"; import * as claude from "../claude"; import * as settingsDb from "../db/settings"; import { createSessionBranch, ensureGitIgnore, ensureGitRepo, getCurrentBranch } from "../git"; +import { discoverMcpTools } from "../mcp"; import type { UserPermissionMode } from "../claude/phases"; import { getDefaultSystemPromptTemplate } from "../claude/phases"; @@ -199,4 +200,15 @@ export function registerIpcHandlers(mainWindow: BrowserWindow): void { }); return result.canceled ? null : result.filePaths[0]; }); + + // MCP + ipcMain.handle("mcp:discoverTools", async (_, config: { + type: "stdio" | "sse" | "http"; + command?: string; + args?: string[]; + env?: Record; + url?: string; + }) => { + return discoverMcpTools(config); + }); } -- cgit v1.2.3