fix: Add Accept header to auth metadata request (#901)

This commit is contained in:
Simon Vestergaard Laursen 2025-10-13 16:29:47 +02:00 • committed by GitHub
commit 8f4150e5a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -863,7 +863,8 @@ describe('OAuth Authorization', () => {
const calls = mockFetch.mock.calls;
const [, options] = calls[0];
expect(options.headers).toEqual({
'MCP-Protocol-Version': '2025-01-01'
'MCP-Protocol-Version': '2025-01-01',
Accept: 'application/json'
});
});

View file

@ -738,7 +738,10 @@ export async function discoverAuthorizationServerMetadata(
protocolVersion?: string;
} = {}
): Promise<AuthorizationServerMetadata | undefined> {
const headers = { 'MCP-Protocol-Version': protocolVersion };
const headers = {
'MCP-Protocol-Version': protocolVersion,
Accept: 'application/json'
};
// Get the list of URLs to try
const urlsToTry = buildDiscoveryUrls(authorizationServerUrl);