File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 1
1
import pkceChallenge from "pkce-challenge" ;
2
2
import { z } from "zod" ;
3
+ import { LATEST_PROTOCOL_VERSION } from "../types.js" ;
3
4
4
5
export const OAuthMetadataSchema = z
5
6
. object ( {
@@ -229,9 +230,15 @@ export async function auth(
229
230
*/
230
231
export async function discoverOAuthMetadata (
231
232
serverUrl : string | URL ,
233
+ opts ?: { protocolVersion ?: string } ,
232
234
) : Promise < OAuthMetadata | undefined > {
233
235
const url = new URL ( "/.well-known/oauth-authorization-server" , serverUrl ) ;
234
- const response = await fetch ( url ) ;
236
+ const response = await fetch ( url , {
237
+ headers : {
238
+ "MCP-Protocol-Version" : opts ?. protocolVersion ?? LATEST_PROTOCOL_VERSION
239
+ }
240
+ } ) ;
241
+
235
242
if ( response . status === 404 ) {
236
243
return undefined ;
237
244
}
You can’t perform that action at this time.
0 commit comments