MCP TypeScript SDK (V2)
    Preparing search index...
    • Discovers the authorization server for an MCP server following RFC 9728 (OAuth 2.0 Protected Resource Metadata), with fallback to treating the server URL as the authorization server.

      This function combines two discovery steps into one call:

      1. Probes /.well-known/oauth-protected-resource on the MCP server to find the authorization server URL (RFC 9728).
      2. Fetches authorization server metadata from that URL (RFC 8414 / OpenID Connect Discovery).

      Use this when you need the authorization server metadata for operations outside the auth orchestrator, such as token refresh or token revocation.

      Parameters

      • serverUrl: string | URL

        The MCP resource server URL

      • Optionalopts: { fetchFn?: FetchLike; resourceMetadataUrl?: URL }

        Optional configuration

        • OptionalfetchFn?: FetchLike

          Custom fetch function for HTTP requests

        • OptionalresourceMetadataUrl?: URL

          Override URL for the protected resource metadata endpoint

      Returns Promise<OAuthServerInfo>

      Authorization server URL, metadata, and resource metadata (if available)