()
| 361 | }; |
| 362 | |
| 363 | const checkProxyHealth = async () => { |
| 364 | try { |
| 365 | const proxyHealthUrl = new URL(`${getMCPProxyAddress(config)}/health`); |
| 366 | const { token: proxyAuthToken, header: proxyAuthTokenHeader } = |
| 367 | getMCPProxyAuthToken(config); |
| 368 | const headers: HeadersInit = {}; |
| 369 | if (proxyAuthToken) { |
| 370 | headers[proxyAuthTokenHeader] = `Bearer ${proxyAuthToken}`; |
| 371 | } |
| 372 | const proxyHealthResponse = await fetch(proxyHealthUrl, { headers }); |
| 373 | const proxyHealth = await proxyHealthResponse.json(); |
| 374 | if (proxyHealth?.status !== "ok") { |
| 375 | throw new Error("MCP Proxy Server is not healthy"); |
| 376 | } |
| 377 | } catch (e) { |
| 378 | console.error("Couldn't connect to MCP Proxy Server", e); |
| 379 | throw e; |
| 380 | } |
| 381 | }; |
| 382 | |
| 383 | const isProxyAuthError = (error: unknown): boolean => { |
| 384 | return ( |
no test coverage detected