BerriAI/litellm · error · HTTPException

MCP server not found

Error message

MCP server not found

What it means

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.

Source

Thrown at litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py:1686

            client_id=client_id,
            redirect_uri=redirect_uri,
            state=state,
            code_challenge=code_challenge,
            code_challenge_method=code_challenge_method,
            response_type=response_type,
            session_user_id=_session_cookie_user_id(request),
            resource=resource,
        )

    lookup_name: Final[str | None] = mcp_server_name or client_id
    client_ip: Final = IPAddressUtils.get_mcp_client_ip(request)
    mcp_server = (
        global_mcp_server_manager.get_mcp_server_by_name(lookup_name, client_ip=client_ip) if lookup_name else None
    )
    if mcp_server is None and mcp_server_name is None:
        mcp_server = _resolve_oauth2_server_for_root_endpoints(client_ip=client_ip)
    if mcp_server is None:
        raise HTTPException(status_code=404, detail="MCP server not found")
    _raise_if_not_oauth2(mcp_server)
    # Use server's stored client_id when caller doesn't supply one.
    # Raise a clear error instead of passing an empty string — an empty
    # client_id would silently produce a broken authorization URL.
    resolved_client_id: Final[str] = mcp_server.client_id or client_id or ""
    if not resolved_client_id:
        raise HTTPException(
            status_code=400,
            detail={
                "error": "client_id is required but was not supplied and is not "
                "stored on the MCP server record. Provide client_id as a query "
                "parameter or configure it on the server."
            },
        )
    return await authorize_with_server(
        request=request,
        mcp_server=mcp_server,
        client_id=resolved_client_id,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check the server_id/name exists in the proxy's MCP server registry.

Example fix

List configured MCP servers and use an existing name.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py:1686 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/4526d3c46407bd63. Report an issue: GitHub.