{"record":{"id":"d5b20fb1f51f1c95","repo":"BerriAI/litellm","slug":"mcp-upstream-registration-endpoint-returned-no-usa","errorCode":null,"errorMessage":"MCP upstream registration endpoint returned no usable client_id","messagePattern":"MCP upstream registration endpoint returned no usable client_id","errorType":"http","errorClass":"HTTPException","httpStatus":502,"severity":"error","filePath":"litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py","lineNumber":1516,"sourceCode":"        cached_after_wait: Final = _EPHEMERAL_DCR_CLIENT_CACHE.get_cache(cache_key)\n        if isinstance(cached_after_wait, EphemeralDcrClient):\n            return cached_after_wait\n        register_data: Final[dict[str, object]] = {\n            \"client_name\": mcp_server.server_name or mcp_server.server_id,\n            \"redirect_uris\": [f\"{request_base_url}/callback\"],\n            \"grant_types\": [\"authorization_code\", \"refresh_token\"],\n            \"response_types\": [\"code\"],\n            \"token_endpoint_auth_method\": \"none\",\n        }\n        response: Final = await _post_dcr_registration(\n            registration_url=mcp_server.registration_url,\n            register_data=register_data,\n            server_id=mcp_server.server_id,\n        )\n        try:\n            registration: Final = _DcrClientRegistration.model_validate_json(response.text)\n        except ValidationError as exc:\n            raise HTTPException(\n                status_code=502,\n                detail=\"MCP upstream registration endpoint returned no usable client_id\",\n            ) from exc\n        if not registration.client_id:\n            raise HTTPException(\n                status_code=502,\n                detail=\"MCP upstream registration endpoint returned no usable client_id\",\n            )\n        minted: Final = EphemeralDcrClient(\n            client_id=registration.client_id,\n            client_secret=registration.client_secret,\n            token_endpoint_auth_method=normalize_token_endpoint_auth_method(registration.token_endpoint_auth_method),\n        )\n        _EPHEMERAL_DCR_CLIENT_CACHE.set_cache(cache_key, minted)\n        return minted\n\n\nasync def resolve_ephemeral_dcr_client(","sourceCodeStart":1498,"sourceCodeEnd":1534,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py#L1498-L1534","documentation":"Raised after a successful-looking dynamic client registration (DCR) POST to the MCP upstream when the parsed registration response contains no usable client_id — some servers return 2xx with an error body or an unexpected shape. The registration result is unusable for subsequent authorization_code/refresh_token flows, so the ephemeral-client setup is aborted rather than cached.","triggerScenarios":"Thrown at litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py:1516 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the upstream registration response; it must return a client_id.","Verify the registration request payload meets the upstream requirements."],"exampleFix":"Log the registration response body to inspect what was returned.","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"}