feat(mcp): handle oauth2_token_exchange in MCP client auth headers

Adds the oauth2_token_exchange case to _get_auth_headers() so the
exchanged token is sent as a Bearer token to the MCP server.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ishaan Jaffer 2026-02-13 11:06:17 -08:00 • committed by Ishaan Jaffer
parent 306841dffc
commit 2dae6cb82d
No known key found for this signature in database

View file

@ -366,6 +366,8 @@ class MCPClient:
headers["Authorization"] = f"Bearer {self._mcp_auth_value}"
elif self.auth_type == MCPAuth.token:
headers["Authorization"] = f"token {self._mcp_auth_value}"
elif self.auth_type == MCPAuth.oauth2_token_exchange:
headers["Authorization"] = f"Bearer {self._mcp_auth_value}"
elif isinstance(self._mcp_auth_value, dict):
headers.update(self._mcp_auth_value)
# Note: aws_sigv4 auth is not handled here — SigV4 requires per-request