From e6256d6dc89fc8329e2fb7dc03f0687cf4484cc1 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 13 Feb 2026 11:05:29 -0800 Subject: [PATCH] feat(mcp): add oauth2_token_exchange auth type enum and credential fields Adds the new `oauth2_token_exchange` value to MCPAuth enum and MCPAuthType literal, plus `audience`, `token_exchange_endpoint`, and `subject_token_type` fields to MCPCredentials TypedDict to support RFC 8693 token exchange. Co-Authored-By: Claude Opus 4.6 --- litellm/types/mcp.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/litellm/types/mcp.py b/litellm/types/mcp.py index ebabf3fb6f8..21d4da82041 100644 --- a/litellm/types/mcp.py +++ b/litellm/types/mcp.py @@ -37,6 +37,7 @@ class MCPAuth(str, enum.Enum): oauth2 = "oauth2" aws_sigv4 = "aws_sigv4" token = "token" + oauth2_token_exchange = "oauth2_token_exchange" # MCP Literals @@ -54,6 +55,7 @@ MCPAuthType = Optional[ MCPAuth.oauth2, MCPAuth.aws_sigv4, MCPAuth.token, + MCPAuth.oauth2_token_exchange, ] ] @@ -117,6 +119,22 @@ class MCPCredentials(TypedDict, total=False): aws_session_name: Optional[str] """Session name for STS AssumeRole (used in CloudTrail). Not a secret — stored unencrypted.""" + audience: Optional[str] + """ + Target audience for OAuth 2.0 Token Exchange (RFC 8693) + """ + + token_exchange_endpoint: Optional[str] + """ + IDP token endpoint for OAuth 2.0 Token Exchange (RFC 8693) + """ + + subject_token_type: Optional[str] + """ + Subject token type for OAuth 2.0 Token Exchange (RFC 8693). + Default: urn:ietf:params:oauth:token-type:access_token + """ + class MCPServerCostInfo(TypedDict, total=False): default_cost_per_query: Optional[float]