{"record":{"id":"c62edb75f256ecea","repo":"BerriAI/litellm","slug":"mcp-server-server-id-not-found-c62edb","errorCode":null,"errorMessage":"MCP Server {server_id} not found","messagePattern":"MCP Server (.+?) not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/management_endpoints/mcp_management_endpoints.py","lineNumber":2293,"sourceCode":"    ) -> LiteLLM_MCPServerTable:\n        \"\"\"Resolve the MCP server a caller may manage their own per-user state for.\n\n        Looks the server up in the DB, then the in-memory registry, so a\n        config-defined server (which never gets a DB row) resolves too. Admins\n        may reach any server and get a 404 for an unknown id. A non-admin may\n        only reach a server in their allowed set and otherwise gets 403 (never\n        404, so server ids can't be enumerated), using the same allowed-server\n        resolution the MCP gateway enforces on tool calls.\n        \"\"\"\n        server = await get_mcp_server(prisma_client, server_id)\n        if server is None:\n            registry_server: Final = global_mcp_server_manager.get_mcp_server_by_id(server_id)\n            if registry_server is not None:\n                server = global_mcp_server_manager._build_mcp_server_table(registry_server)\n\n        if _user_has_admin_view(user_api_key_dict):\n            if server is None:\n                raise HTTPException(\n                    status_code=status.HTTP_404_NOT_FOUND,\n                    detail={\"error\": f\"MCP Server {server_id} not found\"},\n                )\n            return server\n\n        allowed_server_ids: Final[set[str]] = set()\n        for auth_context in await build_effective_auth_contexts(user_api_key_dict):\n            allowed_server_ids.update(await global_mcp_server_manager.get_allowed_mcp_servers(auth_context))\n        if server is None or server.server_id not in allowed_server_ids:\n            raise HTTPException(\n                status_code=status.HTTP_403_FORBIDDEN,\n                detail={\n                    \"error\": (\n                        f\"User does not have permission to access mcp server with id {server_id}. \"\n                        \"You can only manage mcp servers that you have access to.\"\n                    )\n                },\n            )","sourceCodeStart":2275,"sourceCodeEnd":2311,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/mcp_management_endpoints.py#L2275-L2311","documentation":"Lookup guard in the per-user MCP state resolver: the server_id was not found in the DB and the in-memory registry, so no server with that id exists at all. Admins get this 404 for unknown ids; config-defined servers resolve via the registry before this fires.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:2293 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the server_id in the request path.","List servers via GET /mcp/servers to find the correct id."],"exampleFix":null,"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-14T05:17:10.506Z"}