{"record":{"id":"87e9748825078917","repo":"BerriAI/litellm","slug":"mcp-upstream-token-endpoint-returned-no-response","errorCode":null,"errorMessage":"MCP upstream token endpoint returned no response","messagePattern":"MCP upstream token endpoint returned no response","errorType":"http","errorClass":"HTTPException","httpStatus":502,"severity":"error","filePath":"litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py","lineNumber":1033,"sourceCode":"            log_context=mcp_server.server_id,\n        )\n        upstream_rejected_bridge_refresh: Final = (\n            is_bridge\n            and grant_type == \"refresh_token\"\n            and isinstance(fault, CallerRejected)\n            and fault.code == \"invalid_grant\"\n        )\n        if upstream_rejected_bridge_refresh:\n            verbose_logger.info(\n                \"bridge refresh: the upstream rejected the sealed refresh token for server=%s with \"\n                \"invalid_grant (revoked or expired at the IdP); returning invalid_grant so the client \"\n                \"re-runs authorization_code rather than an opaque upstream error\",\n                mcp_server.server_id,\n            )\n            return _bridge_mint_error_response(\"invalid_refresh\")\n        return render_token_fault(fault)\n    if response is None:\n        raise HTTPException(\n            status_code=502,\n            detail=\"MCP upstream token endpoint returned no response\",\n        )\n    token_response = response.json()\n\n    # Validate token response against server-configured rules before any storage.\n    # This rejects tokens from wrong Slack workspaces, Atlassian orgs, etc.\n    if mcp_server.token_validation and isinstance(mcp_server.token_validation, dict):\n        _validate_token_response(\n            token_response=token_response,\n            validation_rules=mcp_server.token_validation,\n            server_id=mcp_server.server_id,\n        )\n\n    # Store server-side when the server is configured for per-user OAuth and\n    # the calling client has provided a valid LiteLLM identity.\n    # Errors are non-fatal: the token is still returned to the client.\n    if mcp_server.needs_user_oauth_token:","sourceCodeStart":1015,"sourceCodeEnd":1051,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py#L1015-L1051","documentation":"The POST to the upstream OAuth token endpoint completed without an HTTP response object (connection-level failure or an httpx client returning None). The gateway converts this absent-response case into a 502 instead of crashing on a None dereference downstream.","triggerScenarios":"Thrown at litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py:1033 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check network connectivity to the upstream token endpoint.","Verify the token URL is correct and the upstream server is up."],"exampleFix":"curl the token endpoint directly to confirm reachability.","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}