MCPcopy Create free account
hub / github.com/modelcontextprotocol/inspector / checkProxyHealth

Function checkProxyHealth

client/src/lib/hooks/useConnection.ts:363–381  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 (

Callers 1

connectFunction · 0.85

Calls 2

getMCPProxyAddressFunction · 0.90
getMCPProxyAuthTokenFunction · 0.90

Tested by

no test coverage detected