BerriAI/litellm · error · HTTPException

client_id is required but was not supplied and is not stored

Error message

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.

What it means

After server resolution and the oauth2-only check, the flow needs a client_id but the query parameter was absent and the server record stores none. For persisted-client oauth2 servers this means the caller must supply its registered client_id.

Source

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

            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,
        redirect_uri=redirect_uri,
        state=state,
        code_challenge=code_challenge,
        code_challenge_method=code_challenge_method,
        response_type=response_type,
        scope=scope,
    )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide client_id as a query parameter, or configure it on the MCP server record.

Example fix

?client_id=<id> or set client_id in server config.
Defensive patterns

Strategy: validation

When it happens

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