{"record":{"id":"9f239f1918af31d6","repo":"BerriAI/litellm","slug":"server-not-found","errorCode":"server_not_found","errorMessage":"MCP server '{server_id}' was not found","messagePattern":"MCP server '(.+?)' was not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/_experimental/mcp_server/rest_endpoints.py","lineNumber":480,"sourceCode":"            if (\n                _server is not None\n                and _rest_client_ip is not None\n                and not global_mcp_server_manager._is_server_accessible_from_ip(_server, _rest_client_ip)\n            ):\n                raise HTTPException(\n                    status_code=403,\n                    detail={\n                        \"error\": \"ip_filtering\",\n                        \"message\": (\n                            f\"MCP server '{server_id}' is not accessible from your IP address \"\n                            f\"({_rest_client_ip}). This server is restricted to internal \"\n                            \"networks only. To make it externally accessible, set \"\n                            \"'available_on_public_internet: true' in the server configuration.\"\n                        ),\n                    },\n                )\n            if _server is None:\n                raise HTTPException(\n                    status_code=404,\n                    detail={\n                        \"error\": \"server_not_found\",\n                        \"message\": f\"MCP server '{server_id}' was not found\",\n                    },\n                )\n            raise HTTPException(\n                status_code=403,\n                detail={\n                    \"error\": \"access_denied\",\n                    \"message\": f\"The key is not allowed to access server {server_id}\",\n                },\n            )\n\n        # Build allowed_mcp_servers list (only include allowed servers)\n        allowed_mcp_servers: Final[list[MCPServer]] = []\n        for allowed_server_id in allowed_server_ids_set:\n            server = global_mcp_server_manager.get_mcp_server_by_id(allowed_server_id)","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/_experimental/mcp_server/rest_endpoints.py#L462-L498","documentation":"The REST tool-call route could not resolve server_id to any registered MCP server (looked up by id and by name), so it returns 404 error=server_not_found. The server is unknown to this proxy instance's registry (config.yaml + DB), distinct from 403 which means known-but-not-allowed.","triggerScenarios":"POST tool call with a server_id that is a typo, refers to a removed server, was added to config.yaml after the proxy started (no reload), or lives in a DB the proxy is not connected to; also using a server alias/name that was renamed.","commonSituations":"Environment mix-ups (dev server_id against prod proxy); renaming servers; adding servers via config without restart; pointing at a proxy without the Prisma DB that stores DB-registered servers.","solutions":["List what this proxy actually knows: GET /mcp/tools/list (or check config.yaml / the dashboard) and use the exact server_id.","If you just added the server, restart or hot-reload the proxy so the registry picks it up.","Confirm you are hitting the right proxy instance/environment and that the DB-backed servers are visible (database connected)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"async def server_exists(client, server_id: str) -> bool:\n    listing = await client.get(f\"{proxy}/mcp/tools/list\", headers=headers)\n    known = {t.get(\"server_info\", {}).get(\"server_id\") for t in listing.json().get(\"tools\", [])}\n    known |= set(listing.json().get(\"mcp_servers\", []))\n    return server_id in {k for k in known if k}","typeGuard":null,"tryCatchPattern":"resp = await client.post(f\"{proxy}/mcp/tool-call\", json=payload, headers=headers)\nif resp.status_code == 404 and resp.json().get(\"detail\", {}).get(\"error\") == \"server_not_found\":\n    raise UnknownMCPServer(payload[\"server_id\"]) from None  # surface the bad id, never blind-retry\nresp.raise_for_status()","preventionTips":["Discover server ids at runtime via tools/list instead of hardcoding them.","Re-check ids after proxy config changes, restarts, and environment promotions.","Treat 404 server_not_found as a permanent configuration error in callers - do not retry."],"tags":["mcp","http-404","server-not-found","configuration"],"backgroundTag":"resource-not-found","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}