File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -163,11 +163,20 @@ export async function discoverOAuthMetadata(
163163 opts ?: { protocolVersion ?: string } ,
164164) : Promise < OAuthMetadata | undefined > {
165165 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
166+ let response : Response ;
167+ try {
168+ response = await fetch ( url , {
169+ headers : {
170+ "MCP-Protocol-Version" : opts ?. protocolVersion ?? LATEST_PROTOCOL_VERSION
171+ }
172+ } ) ;
173+ } catch {
174+ try {
175+ response = await fetch ( url ) ;
176+ } catch {
177+ return undefined ;
169178 }
170- } ) ;
179+ }
171180
172181 if ( response . status === 404 ) {
173182 return undefined ;
You can’t perform that action at this time.
0 commit comments