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 11import pkceChallenge from "pkce-challenge" ;
22import { z } from "zod" ;
3+ import { LATEST_PROTOCOL_VERSION } from "../types.js" ;
34
45export const OAuthMetadataSchema = z
56 . object ( {
@@ -229,9 +230,15 @@ export async function auth(
229230 */
230231export async function discoverOAuthMetadata (
231232 serverUrl : string | URL ,
233+ opts ?: { protocolVersion ?: string } ,
232234) : Promise < OAuthMetadata | undefined > {
233235 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+
235242 if ( response . status === 404 ) {
236243 return undefined ;
237244 }
You can’t perform that action at this time.
0 commit comments