| 1359 | // --------------------------------------------------------------------------- |
| 1360 | |
| 1361 | const mcpUrlForActiveLocalServer = (input: { |
| 1362 | readonly connection: ExecutorServerConnection; |
| 1363 | readonly elicitationMode: "browser" | "model"; |
| 1364 | readonly artifacts: boolean; |
| 1365 | readonly searchTools: boolean; |
| 1366 | }): URL => { |
| 1367 | const url = new URL("/mcp", input.connection.origin); |
| 1368 | if (input.elicitationMode === "browser") { |
| 1369 | url.searchParams.set("elicitation_mode", "browser"); |
| 1370 | } |
| 1371 | // Artifacts are on by default; only the opt-out is spelled out, so the |
| 1372 | // default endpoint stays clean. |
| 1373 | if (!input.artifacts) { |
| 1374 | url.searchParams.set("artifacts", "false"); |
| 1375 | } |
| 1376 | // Per-integration search tools are off by default; only the opt-in is |
| 1377 | // spelled out. |
| 1378 | if (input.searchTools) { |
| 1379 | url.searchParams.set("search_tools", "true"); |
| 1380 | } |
| 1381 | return url; |
| 1382 | }; |
| 1383 | |
| 1384 | /** |
| 1385 | * Bridge a stdio MCP client to a local server's HTTP `/mcp` endpoint. `executor |