From 8f4150e5a028f6583b9156405f4d8ece52e8bd44 Mon Sep 17 00:00:00 2001 From: Simon Vestergaard Laursen Date: Mon, 13 Oct 2025 16:29:47 +0200 Subject: [PATCH] fix: Add Accept header to auth metadata request (#901) --- src/client/auth.test.ts | 3 ++- src/client/auth.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/auth.test.ts b/src/client/auth.test.ts index c38f1933..f2dadbb1 100644 --- a/src/client/auth.test.ts +++ b/src/client/auth.test.ts @@ -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' }); }); diff --git a/src/client/auth.ts b/src/client/auth.ts index 3c04f7cb..1e90f34b 100644 --- a/src/client/auth.ts +++ b/src/client/auth.ts @@ -738,7 +738,10 @@ export async function discoverAuthorizationServerMetadata( protocolVersion?: string; } = {} ): Promise { - 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);