BerriAI/litellm · error · HTTPException

MCP Server {server_id} not found

Error message

MCP Server {server_id} not found

What it means

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.

Source

Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:2293

    ) -> LiteLLM_MCPServerTable:
        """Resolve the MCP server a caller may manage their own per-user state for.

        Looks the server up in the DB, then the in-memory registry, so a
        config-defined server (which never gets a DB row) resolves too. Admins
        may reach any server and get a 404 for an unknown id. A non-admin may
        only reach a server in their allowed set and otherwise gets 403 (never
        404, so server ids can't be enumerated), using the same allowed-server
        resolution the MCP gateway enforces on tool calls.
        """
        server = await get_mcp_server(prisma_client, server_id)
        if server is None:
            registry_server: Final = global_mcp_server_manager.get_mcp_server_by_id(server_id)
            if registry_server is not None:
                server = global_mcp_server_manager._build_mcp_server_table(registry_server)

        if _user_has_admin_view(user_api_key_dict):
            if server is None:
                raise HTTPException(
                    status_code=status.HTTP_404_NOT_FOUND,
                    detail={"error": f"MCP Server {server_id} not found"},
                )
            return server

        allowed_server_ids: Final[set[str]] = set()
        for auth_context in await build_effective_auth_contexts(user_api_key_dict):
            allowed_server_ids.update(await global_mcp_server_manager.get_allowed_mcp_servers(auth_context))
        if server is None or server.server_id not in allowed_server_ids:
            raise HTTPException(
                status_code=status.HTTP_403_FORBIDDEN,
                detail={
                    "error": (
                        f"User does not have permission to access mcp server with id {server_id}. "
                        "You can only manage mcp servers that you have access to."
                    )
                },
            )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the server_id in the request path.
  2. List servers via GET /mcp/servers to find the correct id.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:2293 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/c62edb75f256ecea. Report an issue: GitHub.