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