| 1338 | // --------------------------------------------------------------------------- |
| 1339 | |
| 1340 | const mcpUrlForActiveLocalServer = (input: { |
| 1341 | readonly connection: ExecutorServerConnection; |
| 1342 | readonly elicitationMode: "browser" | "model"; |
| 1343 | readonly artifacts: boolean; |
| 1344 | }): URL => { |
| 1345 | const url = new URL("/mcp", input.connection.origin); |
| 1346 | if (input.elicitationMode === "browser") { |
| 1347 | url.searchParams.set("elicitation_mode", "browser"); |
| 1348 | } |
| 1349 | // Artifacts are on by default; only the opt-out is spelled out, so the |
| 1350 | // default endpoint stays clean. |
| 1351 | if (!input.artifacts) { |
| 1352 | url.searchParams.set("artifacts", "false"); |
| 1353 | } |
| 1354 | return url; |
| 1355 | }; |
| 1356 | |
| 1357 | /** |
| 1358 | * Bridge a stdio MCP client to a local server's HTTP `/mcp` endpoint. `executor |