Merge branch 'modelcontextprotocol:main' into fix-required

This commit is contained in:
Ola Hungerford 2025-06-01 12:37:44 -07:00 • committed by GitHub
commit 73c0c13bda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -304,7 +304,14 @@ export function useConnection({
bearerToken || (await serverAuthProvider.tokens())?.access_token;
if (token) {
const authHeaderName = headerName || "Authorization";
headers[authHeaderName] = `Bearer ${token}`;
// Add custom header name as a special request header to let the server know which header to pass through
if (authHeaderName.toLowerCase() !== "authorization") {
headers[authHeaderName] = token;
headers["x-custom-auth-header"] = authHeaderName;
} else {
headers[authHeaderName] = `Bearer ${token}`;
}
}
// Create appropriate transport