{"record":{"id":"f7725892435dc978","repo":"microsoft/autogen","slug":"mcp-health-check-failed","errorCode":null,"errorMessage":"MCP health check failed","messagePattern":"MCP health check failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-studio/frontend/src/components/views/mcp/api.ts","lineNumber":246,"sourceCode":"    });\n\n    const data = await response.json();\n    if (!response.ok) {\n      throw new Error(data.message || \"Failed to call MCP tool\");\n    }\n\n    return data;\n  }\n\n  async healthCheck(): Promise<{ status: boolean; message: string }> {\n    const response = await fetch(`${this.getBaseUrl()}/mcp/health`, {\n      method: \"GET\",\n      headers: this.getHeaders(),\n    });\n\n    const data = await response.json();\n    if (!response.ok) {\n      throw new Error(data.message || \"MCP health check failed\");\n    }\n\n    return data;\n  }\n\n  // Test MCP server connection\n  async testMcpConnection(\n    workbench: Component<McpWorkbenchConfig>\n  ): Promise<boolean> {\n    try {\n      // Use the health check or list tools to test connection\n      if (workbench.config.server_params) {\n        const result = await this.listTools(workbench.config.server_params);\n        return result.status;\n      }\n      return false;\n    } catch (error) {\n      return false;","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-studio/frontend/src/components/views/mcp/api.ts#L228-L264","documentation":"Thrown by McpAPI.healthCheck when GET /mcp/health returns a non-2xx status. This endpoint is the liveness probe for the backend's MCP integration; failure means either the route is not up/authed or the backend's MCP manager failed its self-check. The thrown message is data.message or the generic fallback.","triggerScenarios":"GET {base}/mcp/health returning 401/403/404/500: backend route not mounted (version mismatch), auth token missing/expired, API proxy not forwarding /mcp/health, or backend MCP manager raising during its internal check.","commonSituations":"Frontend served separately from backend so /mcp/health hits the dev server instead of the API, backend version that predates the MCP routes, stale auth_token in localStorage after switching auth backends.","solutions":["curl the backend directly: GET http://<backend>/mcp/health with the Bearer token — isolate proxy vs backend","Verify getServerUrl() resolves to the correct base (should include /api prefix when proxied)","Re-login to refresh the auth_token if status is 401","Confirm the backend version includes the MCP router (check its route table at startup logs)","If proxied through a dev server, ensure /mcp/* is in the proxy config, not just /agents or /sessions"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// cheap preflight: backend reachable at all?\nawait fetch(`${getServerUrl()}/mcp/health`, { method: \"HEAD\" }).catch(() => {\n  throw new Error(\"Backend MCP route unreachable — check server URL / proxy\");\n});","typeGuard":null,"tryCatchPattern":"try {\n  return await mcpAPI.healthCheck();\n} catch (e) {\n  return { status: false, message: e instanceof Error ? e.message : \"MCP health check failed\" };\n}","preventionTips":["Run healthCheck on app start and gate MCP UI behind its result","Alert on repeated health failures rather than per-call toasts","Keep /mcp/* in sync between dev proxy config and backend routes"],"tags":["mcp","health-check","http","fetch","autogen-studio"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}