diff options
| author | Clawd <ai@clawd.bot> | 2026-03-01 10:15:14 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-03-01 10:15:14 -0800 |
| commit | 044d628a47f063bcbbd9adba7860542156a0c66e (patch) | |
| tree | 9796fa37fc048a9613710e13bdb6b0ea29caa6b1 /src/main/ipc/handlers.ts | |
| parent | 66a73c463468bfcaad5627ca26fb25215f47d256 (diff) | |
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
Diffstat (limited to 'src/main/ipc/handlers.ts')
| -rw-r--r-- | src/main/ipc/handlers.ts | 12 |
1 files changed, 12 insertions, 0 deletions
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"; | |||
| 4 | import * as claude from "../claude"; | 4 | import * as claude from "../claude"; |
| 5 | import * as settingsDb from "../db/settings"; | 5 | import * as settingsDb from "../db/settings"; |
| 6 | import { createSessionBranch, ensureGitIgnore, ensureGitRepo, getCurrentBranch } from "../git"; | 6 | import { createSessionBranch, ensureGitIgnore, ensureGitRepo, getCurrentBranch } from "../git"; |
| 7 | import { discoverMcpTools } from "../mcp"; | ||
| 7 | import type { UserPermissionMode } from "../claude/phases"; | 8 | import type { UserPermissionMode } from "../claude/phases"; |
| 8 | import { getDefaultSystemPromptTemplate } from "../claude/phases"; | 9 | import { getDefaultSystemPromptTemplate } from "../claude/phases"; |
| 9 | 10 | ||
| @@ -199,4 +200,15 @@ export function registerIpcHandlers(mainWindow: BrowserWindow): void { | |||
| 199 | }); | 200 | }); |
| 200 | return result.canceled ? null : result.filePaths[0]; | 201 | return result.canceled ? null : result.filePaths[0]; |
| 201 | }); | 202 | }); |
| 203 | |||
| 204 | // MCP | ||
| 205 | ipcMain.handle("mcp:discoverTools", async (_, config: { | ||
| 206 | type: "stdio" | "sse" | "http"; | ||
| 207 | command?: string; | ||
| 208 | args?: string[]; | ||
| 209 | env?: Record<string, string>; | ||
| 210 | url?: string; | ||
| 211 | }) => { | ||
| 212 | return discoverMcpTools(config); | ||
| 213 | }); | ||
| 202 | } | 214 | } |
