import { type AuthInfo, type OAuthTokenVerifier } from "@modelcontextprotocol/server"; export { invalidToken } from "./errors.js"; /** Record of claims extracted from a verified JWT. */ export type VerifiedPayload = Record; /** Configures issuer, keys, and claims enforced by a JWT verifier. */ export interface JwtVerifierOptions { /** * Expected `iss` claim. Tokens from any other issuer are rejected. * A list accepts any of the listed issuers. */ issuer: string | string[]; /** JWKS endpoint the signing keys are fetched from and cached. */ jwksUrl: URL; /** Canonical URL of this MCP resource, matched against the token binding. */ resource: URL; /** Provider-specific JWT audience, when it differs from the MCP resource. */ audience?: string | string[]; /** * Treat successful issuer validation as the provider's resource binding. * Use only for providers whose access-token model is scoped by issuer rather * than an aud/resource claim. */ issuerBoundAccessTokens?: boolean; /** Permitted JWS algorithms. Defaults to whatever the JWKS advertises. */ algorithms?: readonly string[]; /** Symmetric key material, for providers that sign without a JWKS. */ key?: Uint8Array; } /** * Creates a verifier that rejects JWTs with invalid signatures or required claims. * * Use this when implementing a custom OAuth provider with * {@link oauthCustomProvider}, so a provider that issues standard JWTs does not * have to reimplement signature, issuer, audience and expiry checking. * * @param options - Issuer, keys, and claims to enforce. * @returns A verifier accepted anywhere an `OAuthTokenVerifier` is taken. * @throws TypeError if `resource` is not an absolute HTTPS URL, or an HTTP URL * for localhost, without credentials, query, or fragment. * @throws TypeError if `audience` is combined with `issuerBoundAccessTokens`. */ export declare function createJwtVerifier(options: JwtVerifierOptions): OAuthTokenVerifier; /** Validates and canonicalizes an authorization-server URL before JWKS setup. */ export declare function normalizedProviderUrl(value: URL | string, name: string): URL; /** @internal Resolves a provider endpoint without losing an issuer path prefix. */ export declare function providerEndpoint(issuer: string | URL, path: string): string; /** @internal Reads the verified JWT payload from SDK auth information. */ export declare function payloadFromAuthInfo(authInfo: AuthInfo): VerifiedPayload; /** @internal Returns a non-blank string claim when present. */ export declare function requiredString(claims: VerifiedPayload, name: string): string | undefined; /** @internal Returns a string claim without coercion. */ export declare function stringValue(claims: VerifiedPayload, name: string): string | undefined; /** @internal Returns a boolean claim without coercion. */ export declare function booleanValue(claims: VerifiedPayload, name: string): boolean | undefined; /** @internal Returns a finite numeric claim without coercion. */ export declare function numberValue(claims: VerifiedPayload, name: string): number | undefined; /** @internal Returns an object claim and excludes arrays. */ export declare function recordValue(claims: VerifiedPayload, name: string): Record | undefined; /** @internal Normalizes scope-like strings or arrays into non-empty strings. */ export declare function normalizedStrings(value: unknown): string[]; /** @internal Returns a future numeric claim or raises an invalid-token error. */ export declare function requiredFutureNumber(claims: VerifiedPayload, name: string): number;