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
parent df081c02d6
commit 2ee38a5857

View file

@ -211,6 +211,8 @@ class MCPClient:
headers["Authorization"] = self._mcp_auth_value
elif self.auth_type == MCPAuth.oauth2:
headers["Authorization"] = f"Bearer {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)