mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
fix(mcp): restrict passthrough probe challenge to OAuth passthrough servers
The probe filter previously matched any server with Authorization in extra_headers, including gateway-managed OAuth2 servers. Those would then receive the resource_metadata= WWW-Authenticate challenge meant for pass-through servers, instead of the authorization_uri= challenge pointing at the gateway AS metadata. Use srv.is_oauth_passthrough so only genuine pass-through servers get the resource-metadata challenge. Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
parent
719adfd043
commit
7ba78155d7
1 changed files with 6 additions and 2 deletions
|
|
@ -3025,8 +3025,12 @@ if MCP_AVAILABLE:
|
|||
passthrough_servers = [
|
||||
srv
|
||||
for srv in allowed_servers
|
||||
if srv.extra_headers
|
||||
and any(h.lower() == "authorization" for h in srv.extra_headers)
|
||||
# Restrict to genuine OAuth pass-through servers (auth_type none +
|
||||
# Authorization in extra_headers). Gateway-managed OAuth2 servers
|
||||
# must not receive the ``resource_metadata=`` challenge emitted
|
||||
# below — they require ``authorization_uri=`` pointing at the
|
||||
# gateway AS metadata.
|
||||
if srv.is_oauth_passthrough
|
||||
# Exclude M2M servers: _prepare_mcp_server_headers skips caller
|
||||
# Authorization when has_client_credentials is set, so probing
|
||||
# those with the caller's token would send the wrong credential.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue