@modelcontextprotocol/sdk
    Preparing search index...

    Function discoverAuthorizationServerMetadata

    • Discovers authorization server metadata with support for RFC 8414 OAuth 2.0 Authorization Server Metadata and OpenID Connect Discovery 1.0 specifications.

      This function implements a fallback strategy for authorization server discovery:

      1. Attempts RFC 8414 OAuth metadata discovery first
      2. If OAuth discovery fails, falls back to OpenID Connect Discovery

      Parameters

      • authorizationServerUrl: string | URL

        The authorization server URL obtained from the MCP Server's protected resource metadata, or the MCP server's URL if the metadata was not found.

      • options: { fetchFn?: FetchLike; protocolVersion?: string } = {}

        Configuration options

        • OptionalfetchFn?: FetchLike

          Optional fetch function for making HTTP requests, defaults to global fetch

        • OptionalprotocolVersion?: string

          MCP protocol version to use, defaults to LATEST_PROTOCOL_VERSION

      Returns Promise<AuthorizationServerMetadata | undefined>

      Promise resolving to authorization server metadata, or undefined if discovery fails