We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 80e1484 commit 1b8e94cCopy full SHA for 1b8e94c
src/client/auth.ts
@@ -163,11 +163,20 @@ export async function discoverOAuthMetadata(
163
opts?: { protocolVersion?: string },
164
): Promise<OAuthMetadata | undefined> {
165
const url = new URL("/.well-known/oauth-authorization-server", serverUrl);
166
- const response = await fetch(url, {
167
- headers: {
168
- "MCP-Protocol-Version": opts?.protocolVersion ?? LATEST_PROTOCOL_VERSION
+ let response: Response;
+ try {
+ response = await fetch(url, {
169
+ headers: {
170
+ "MCP-Protocol-Version": opts?.protocolVersion ?? LATEST_PROTOCOL_VERSION
171
+ }
172
+ });
173
+ } catch {
174
175
+ response = await fetch(url);
176
177
+ return undefined;
178
}
- });
179
180
181
if (response.status === 404) {
182
return undefined;
0 commit comments