@@ -44,8 +44,8 @@ export type AddClientAuthentication = (
4444export interface OAuthClientProvider {
4545 /**
4646 * The URL to redirect the user agent to after authorization.
47- * Return undefined for non-interactive flows that don't require user interaction
48- * (e.g., client_credentials, jwt-bearer).
47+ * Return ` undefined` for non-interactive flows that don't require user interaction
48+ * (e.g., ` client_credentials`, ` jwt-bearer` ).
4949 */
5050 get redirectUrl ( ) : string | URL | undefined ;
5151
@@ -74,7 +74,7 @@ export interface OAuthClientProvider {
7474 /**
7575 * If implemented, this permits the OAuth client to dynamically register with
7676 * the server. Client information saved this way should later be read via
77- * ` clientInformation()` .
77+ * { @linkcode OAuthClientProvider. clientInformation | clientInformation()} .
7878 *
7979 * This method is not required to be implemented if client information is
8080 * statically known (e.g., pre-registered).
@@ -154,11 +154,11 @@ export interface OAuthClientProvider {
154154 * any grant-specific parameters needed for the token exchange.
155155 *
156156 * If not implemented, the default behavior depends on the flow:
157- * - For authorization code flow: uses code, code_verifier, and redirect_uri
158- * - For client_credentials: detected via grant_types in clientMetadata
157+ * - For authorization code flow: uses ` code`, ` code_verifier` , and ` redirect_uri`
158+ * - For ` client_credentials` : detected via ` grant_types` in { @linkcode OAuthClientProvider. clientMetadata | clientMetadata}
159159 *
160160 * @param scope - Optional scope to request
161- * @returns Grant type and parameters, or undefined to use default behavior
161+ * @returns Grant type and parameters, or ` undefined` to use default behavior
162162 *
163163 * @example
164164 * // For client_credentials grant:
@@ -206,9 +206,9 @@ const AUTHORIZATION_CODE_CHALLENGE_METHOD = 'S256';
206206 * Determines the best client authentication method to use based on server support and client configuration.
207207 *
208208 * Priority order (highest to lowest):
209- * 1. client_secret_basic (if client secret is available)
210- * 2. client_secret_post (if client secret is available)
211- * 3. none (for public clients)
209+ * 1. ` client_secret_basic` (if client secret is available)
210+ * 2. ` client_secret_post` (if client secret is available)
211+ * 3. ` none` (for public clients)
212212 *
213213 * @param clientInformation - OAuth client information containing credentials
214214 * @param supportedMethods - Authentication methods supported by the authorization server
@@ -253,9 +253,9 @@ export function selectClientAuthMethod(clientInformation: OAuthClientInformation
253253 * Applies client authentication to the request based on the specified method.
254254 *
255255 * Implements OAuth 2.1 client authentication methods:
256- * - client_secret_basic: HTTP Basic authentication (RFC 6749 Section 2.3.1)
257- * - client_secret_post: Credentials in request body (RFC 6749 Section 2.3.1)
258- * - none: Public client authentication (RFC 6749 Section 2.1)
256+ * - ` client_secret_basic` : HTTP Basic authentication (RFC 6749 Section 2.3.1)
257+ * - ` client_secret_post` : Credentials in request body (RFC 6749 Section 2.3.1)
258+ * - ` none` : Public client authentication (RFC 6749 Section 2.1)
259259 *
260260 * @param method - The authentication method to use
261261 * @param clientInformation - OAuth client information containing credentials
@@ -323,12 +323,12 @@ function applyPublicAuth(clientId: string, params: URLSearchParams): void {
323323 * Parses an OAuth error response from a string or Response object.
324324 *
325325 * If the input is a standard OAuth2.0 error response, it will be parsed according to the spec
326- * and an OAuthError will be returned with the appropriate error code.
327- * If parsing fails, it falls back to a generic ServerError that includes
326+ * and an { @linkcode OAuthError} will be returned with the appropriate error code.
327+ * If parsing fails, it falls back to a generic { @linkcode OAuthErrorCode. ServerError | ServerError} that includes
328328 * the response status (if available) and original content.
329329 *
330330 * @param input - A Response object or string containing the error response
331- * @returns A Promise that resolves to an OAuthError instance
331+ * @returns A Promise that resolves to an { @linkcode OAuthError} instance
332332 */
333333export async function parseErrorResponse ( input : Response | string ) : Promise < OAuthError > {
334334 const statusCode = input instanceof Response ? input . status : undefined ;
@@ -526,7 +526,7 @@ async function authInternal(
526526
527527/**
528528 * SEP-991: URL-based Client IDs
529- * Validate that the client_id is a valid URL with https scheme
529+ * Validate that the ` client_id` is a valid URL with ` https` scheme
530530 */
531531export function isHttpsUrl ( value ?: string ) : boolean {
532532 if ( ! value ) return false ;
@@ -564,7 +564,7 @@ export async function selectResourceURL(
564564}
565565
566566/**
567- * Extract resource_metadata, scope, and error from WWW-Authenticate header.
567+ * Extract ` resource_metadata`, ` scope` , and ` error` from ` WWW-Authenticate` header.
568568 */
569569export function extractWWWAuthenticateParams ( res : Response ) : { resourceMetadataUrl ?: URL ; scope ?: string ; error ?: string } {
570570 const authenticateHeader = res . headers . get ( 'WWW-Authenticate' ) ;
@@ -599,10 +599,10 @@ export function extractWWWAuthenticateParams(res: Response): { resourceMetadataU
599599}
600600
601601/**
602- * Extracts a specific field's value from the WWW-Authenticate header string.
602+ * Extracts a specific field's value from the ` WWW-Authenticate` header string.
603603 *
604604 * @param response The HTTP response object containing the headers.
605- * @param fieldName The name of the field to extract (e.g., "realm", "nonce").
605+ * @param fieldName The name of the field to extract (e.g., ` "realm"`, ` "nonce"` ).
606606 * @returns The field value
607607 */
608608function extractFieldFromWwwAuth ( response : Response , fieldName : string ) : string | null {
@@ -626,8 +626,8 @@ function extractFieldFromWwwAuth(response: Response, fieldName: string): string
626626}
627627
628628/**
629- * Extract resource_metadata from response header.
630- * @deprecated Use ` extractWWWAuthenticateParams` instead.
629+ * Extract ` resource_metadata` from response header.
630+ * @deprecated Use { @linkcode extractWWWAuthenticateParams} instead.
631631 */
632632export function extractResourceMetadataUrl ( res : Response ) : URL | undefined {
633633 const authenticateHeader = res . headers . get ( 'WWW-Authenticate' ) ;
@@ -770,7 +770,7 @@ async function discoverMetadataWithFallback(
770770 * If the server returns a 404 for the well-known endpoint, this function will
771771 * return `undefined`. Any other errors will be thrown as exceptions.
772772 *
773- * @deprecated This function is deprecated in favor of ` discoverAuthorizationServerMetadata` .
773+ * @deprecated This function is deprecated in favor of { @linkcode discoverAuthorizationServerMetadata} .
774774 */
775775export async function discoverOAuthMetadata (
776776 issuer : string | URL ,
@@ -888,7 +888,7 @@ export function buildDiscoveryUrls(authorizationServerUrl: string | URL): { url:
888888 * metadata was not found.
889889 * @param options - Configuration options
890890 * @param options.fetchFn - Optional fetch function for making HTTP requests, defaults to global fetch
891- * @param options.protocolVersion - MCP protocol version to use, defaults to LATEST_PROTOCOL_VERSION
891+ * @param options.protocolVersion - MCP protocol version to use, defaults to { @linkcode LATEST_PROTOCOL_VERSION}
892892 * @returns Promise resolving to authorization server metadata, or undefined if discovery fails
893893 */
894894export async function discoverAuthorizationServerMetadata (
@@ -1016,13 +1016,13 @@ export async function startAuthorization(
10161016/**
10171017 * Prepares token request parameters for an authorization code exchange.
10181018 *
1019- * This is the default implementation used by fetchToken when the provider
1020- * doesn't implement prepareTokenRequest.
1019+ * This is the default implementation used by { @linkcode fetchToken} when the provider
1020+ * doesn't implement { @linkcode OAuthClientProvider. prepareTokenRequest | prepareTokenRequest} .
10211021 *
10221022 * @param authorizationCode - The authorization code received from the authorization endpoint
10231023 * @param codeVerifier - The PKCE code verifier
10241024 * @param redirectUri - The redirect URI used in the authorization request
1025- * @returns URLSearchParams for the authorization_code grant
1025+ * @returns URLSearchParams for the ` authorization_code` grant
10261026 */
10271027export function prepareAuthorizationCodeRequest (
10281028 authorizationCode : string ,
@@ -1039,7 +1039,7 @@ export function prepareAuthorizationCodeRequest(
10391039
10401040/**
10411041 * Internal helper to execute a token request with the given parameters.
1042- * Used by exchangeAuthorization, refreshAuthorization, and fetchToken.
1042+ * Used by { @linkcode exchangeAuthorization}, { @linkcode refreshAuthorization} , and { @linkcode fetchToken} .
10431043 */
10441044async function executeTokenRequest (
10451045 authorizationServerUrl : string | URL ,
@@ -1157,7 +1157,7 @@ export async function exchangeAuthorization(
11571157 *
11581158 * @param authorizationServerUrl - The authorization server's base URL
11591159 * @param options - Configuration object containing client info, refresh token, etc.
1160- * @returns Promise resolving to OAuth tokens (preserves original refresh_token if not replaced)
1160+ * @returns Promise resolving to OAuth tokens (preserves original ` refresh_token` if not replaced)
11611161 * @throws {Error } When token refresh fails or authentication is invalid
11621162 */
11631163export async function refreshAuthorization (
@@ -1197,17 +1197,17 @@ export async function refreshAuthorization(
11971197}
11981198
11991199/**
1200- * Unified token fetching that works with any grant type via provider .prepareTokenRequest() .
1200+ * Unified token fetching that works with any grant type via { @linkcode OAuthClientProvider .prepareTokenRequest | prepareTokenRequest()} .
12011201 *
12021202 * This function provides a single entry point for obtaining tokens regardless of the
1203- * OAuth grant type. The provider's prepareTokenRequest() method determines which grant
1203+ * OAuth grant type. The provider's ` prepareTokenRequest()` method determines which grant
12041204 * to use and supplies the grant-specific parameters.
12051205 *
1206- * @param provider - OAuth client provider that implements prepareTokenRequest()
1206+ * @param provider - OAuth client provider that implements ` prepareTokenRequest()`
12071207 * @param authorizationServerUrl - The authorization server's base URL
12081208 * @param options - Configuration for the token request
12091209 * @returns Promise resolving to OAuth tokens
1210- * @throws {Error } When provider doesn't implement prepareTokenRequest or token fetch fails
1210+ * @throws {Error } When provider doesn't implement ` prepareTokenRequest` or token fetch fails
12111211 *
12121212 * @example
12131213 * ```typescript
@@ -1235,7 +1235,7 @@ export async function fetchToken(
12351235 } : {
12361236 metadata ?: AuthorizationServerMetadata ;
12371237 resource ?: URL ;
1238- /** Authorization code for the default authorization_code grant flow */
1238+ /** Authorization code for the default ` authorization_code` grant flow */
12391239 authorizationCode ?: string ;
12401240 fetchFn ?: FetchLike ;
12411241 } = { }
0 commit comments