{"record":{"id":"4526d3c46407bd63","repo":"BerriAI/litellm","slug":"mcp-server-not-found","errorCode":null,"errorMessage":"MCP server not found","messagePattern":"MCP server not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py","lineNumber":1686,"sourceCode":"            client_id=client_id,\n            redirect_uri=redirect_uri,\n            state=state,\n            code_challenge=code_challenge,\n            code_challenge_method=code_challenge_method,\n            response_type=response_type,\n            session_user_id=_session_cookie_user_id(request),\n            resource=resource,\n        )\n\n    lookup_name: Final[str | None] = mcp_server_name or client_id\n    client_ip: Final = IPAddressUtils.get_mcp_client_ip(request)\n    mcp_server = (\n        global_mcp_server_manager.get_mcp_server_by_name(lookup_name, client_ip=client_ip) if lookup_name else None\n    )\n    if mcp_server is None and mcp_server_name is None:\n        mcp_server = _resolve_oauth2_server_for_root_endpoints(client_ip=client_ip)\n    if mcp_server is None:\n        raise HTTPException(status_code=404, detail=\"MCP server not found\")\n    _raise_if_not_oauth2(mcp_server)\n    # Use server's stored client_id when caller doesn't supply one.\n    # Raise a clear error instead of passing an empty string — an empty\n    # client_id would silently produce a broken authorization URL.\n    resolved_client_id: Final[str] = mcp_server.client_id or client_id or \"\"\n    if not resolved_client_id:\n        raise HTTPException(\n            status_code=400,\n            detail={\n                \"error\": \"client_id is required but was not supplied and is not \"\n                \"stored on the MCP server record. Provide client_id as a query \"\n                \"parameter or configure it on the server.\"\n            },\n        )\n    return await authorize_with_server(\n        request=request,\n        mcp_server=mcp_server,\n        client_id=resolved_client_id,","sourceCodeStart":1668,"sourceCodeEnd":1704,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py#L1668-L1704","documentation":"The authorize endpoint could not resolve mcp_server_name (or client_id used as lookup name) to a server visible to the caller's IP, and root-endpoint single-server fallback also found nothing. 404 keeps server existence un泄露 for unauthorized callers.","triggerScenarios":"Thrown at litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py:1686 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the server_id/name exists in the proxy's MCP server registry."],"exampleFix":"List configured MCP servers and use an existing name.","handlingStrategy":"validation","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-14T00:17:10.932Z"}