| @@ -68,6 +68,13 @@ type SourceGroup = { · 67 unmodified lines |
| 68 | const configuredControlPlaneBaseUrl = | 68 | const configuredControlPlaneBaseUrl = |
| 69 | process.env.NEXT_PUBLIC_CONTROL_PLANE_BASE_URL?.trim() ?? ""; | 69 | process.env.NEXT_PUBLIC_CONTROL_PLANE_BASE_URL?.trim() ?? ""; |
| 70 | | 70 | |
| | 71 | const isLocalHost = (hostname: string): boolean => |
| | 72 | hostname === "localhost" |
| | 73 | || hostname === "127.0.0.1" |
| | 74 | || hostname === "0.0.0.0" |
| | 75 | || hostname === "::1" |
| | 76 | || hostname === "[::1]"; |
| | 77 | |
| 71 | // --------------------------------------------------------------------------- | 78 | // --------------------------------------------------------------------------- |
| 72 | // Search helpers (ported from old executor explorer-derived.ts) | 79 | // Search helpers (ported from old executor explorer-derived.ts) |
| 73 | // --------------------------------------------------------------------------- | 80 | // --------------------------------------------------------------------------- |
| @@ -410,7 +417,11 @@ export function ToolsView(props: { · 336 unmodified lines |
| 410 | return `http://127.0.0.1:8788/v1/mcp?workspaceId=${encodeURIComponent(workspaceId)}`; | 417 | return `http://127.0.0.1:8788/v1/mcp?workspaceId=${encodeURIComponent(workspaceId)}`; |
| 411 | } | 418 | } |
| 412 | | 419 | |
| 413 | const url = new URL("/v1/mcp", "http://127.0.0.1:8788"); | 420 | const baseOrigin = isLocalHost(window.location.hostname) |
| | 421 | ? "http://127.0.0.1:8788" |
| | 422 | : window.location.origin; |
| | 423 | |
| | 424 | const url = new URL("/v1/mcp", baseOrigin); |
| 414 | url.searchParams.set("workspaceId", workspaceId); | 425 | url.searchParams.set("workspaceId", workspaceId); |
| 415 | return url.toString(); | 426 | return url.toString(); |
| 416 | }, [props.mcpBaseUrl, workspaceId]); | 427 | }, [props.mcpBaseUrl, workspaceId]); |