BerriAI/litellm · error · ValueError
Invalid config for MCP server '{server_name or server_id}':
Error message
Invalid config for MCP server '{server_name or server_id}': auth_type oauth2 requires an explicit oauth2_flow (got {config_oauth2_flow!r}). Set oauth2_flow: client_credentials for machine-to-machine servers (the proxy mints a shared token at token_url using client_id/client_secret, no user interaction) or oauth2_flow: authorization_code for interactive servers (per-user tokens via browser sign-in, including delegate_auth_to_upstream). What it means
Error "Invalid config for MCP server '{server_name or server_id}': auth_type oauth2 requires an explicit oauth2_flow (got {config_oauth2_flow!r}). Set oauth2_flow: client_credentials for machine-to-machine servers (the proxy mints a shared token at token_url using client_id/client_secret, no user interaction) or oauth2_flow: authorization_code for interactive servers (per-user tokens via browser sign-in, including delegate_auth_to_upstream)." thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/_experimental/mcp_server/mcp_server_manager.py:1705
resolved_authorization_url = manual_authorization_url or (
gated_oauth_metadata.authorization_url if gated_oauth_metadata else None
)
resolved_token_url = manual_token_url or (gated_oauth_metadata.token_url if gated_oauth_metadata else None)
resolved_registration_url = manual_registration_url or (
gated_oauth_metadata.registration_url if gated_oauth_metadata else None
)
discovered_issuer = (
gated_oauth_metadata.discovered_issuer
if gated_oauth_metadata and not gated_oauth_metadata.from_origin_fallback
else None
)
effective_issuer = manual_issuer or discovered_issuer
if auth_type == MCPAuth.oauth2 and config_oauth2_flow not in (
"client_credentials",
"authorization_code",
):
raise ValueError(
f"Invalid config for MCP server '{server_name or server_id}': auth_type oauth2 "
f"requires an explicit oauth2_flow (got {config_oauth2_flow!r}). Set "
"oauth2_flow: client_credentials for machine-to-machine servers (the proxy mints "
"a shared token at token_url using client_id/client_secret, no user interaction) "
"or oauth2_flow: authorization_code for interactive servers (per-user tokens via "
"browser sign-in, including delegate_auth_to_upstream)."
)
config_dcr_bridge = server_config.get("dcr_bridge", None)
if config_dcr_bridge is not None and not isinstance(config_dcr_bridge, bool):
raise ValueError(
f"Invalid config for MCP server '{server_name or server_id}': dcr_bridge "
f"must be a boolean (got {config_dcr_bridge!r})."
)
if config_dcr_bridge and auth_type not in (
MCPAuth.true_passthrough,
MCPAuth.oauth_delegate,
):View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set oauth2_flow to client_credentials (machine-to-machine) or authorization_code (interactive) in the server config.
Example fix
oauth2_flow: client_credentials
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/_experimental/mcp_server/mcp_server_manager.py:1705 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/380958368cfebcdc.
Report an issue: GitHub.