ReadonlyonCallback invoked immediately before an authorization popup opens.
Optional ReadonlypreventWhether initial connection waits for explicit authentication.
ReadonlyserverProtected MCP server URL associated with this provider.
Optional ReadonlystaticPre-registered public client information, when configured.
OAuth redirect URI.
Metadata about this OAuth client.
External URL the server should use to fetch client metadata document
Human-readable OAuth client name.
Public website describing the OAuth client.
Whether an authorization flow is awaiting completion.
Public OAuth client logo URL.
The URL to redirect the user agent to after authorization.
Return undefined for non-interactive flows that don't require user interaction
(e.g., client_credentials, jwt-bearer).
Space-delimited OAuth scopes requested by the client.
Stable hash used to namespace storage for this server.
Prefix used for persisted OAuth keys.
Removes OAuth state stored for this server.
The number of storage entries removed.
Returns the configured or dynamically registered OAuth client information.
Optionalctx: OAuthClientInformationContext
Optional registration context.
OAuth client information, or undefined when not registered.
Loads the PKCE code verifier for the current session, necessary to validate the authorization result.
Return previously saved OAuth discovery state, or undefined.
Return the stored public OAuth client ID. Browser providers do not retain client secrets.
Returns a provider-scoped storage key.
Suffix identifying the stored value.
Namespaced storage key.
Retrieves the last URL passed to redirectToAuthorization. Useful for manual fallback.
Returns a fetch function, scoped to this provider, that routes OAuth
metadata and non-browser OAuth endpoint requests through the configured
oauthProxyUrl to bypass CORS. Authorization endpoints are navigated by
the browser and all unrelated requests pass through unchanged.
Unlike patching the global fetch, the returned function only affects the
transport/auth calls it is explicitly handed to (via the SDK transport's
fetch option or auth({ fetchFn })). Connecting one server "Via Proxy"
therefore never alters fetch behavior for other servers, other
connections, or the rest of the page.
OAuth metadata is always fetched with cache: "no-store", including in
direct mode. Authorization servers commonly vary CORS headers by Origin;
bypassing the browser HTTP cache prevents a revalidated response cached
for another localhost origin from poisoning discovery. When OAuth proxying
is disabled or no oauthProxyUrl is configured, all requests still go
directly to their original URLs.
OptionalbaseFetch: {The fetch used for non-OAuth requests and for the
underlying proxy calls. Defaults to the global fetch.
Optionalinit: RequestInitOptionalinit: RequestInitOptionalinit: RequestInitOptionalinit: RequestInitReturn the protected-resource URL selected during OAuth discovery.
Return the token endpoint from the SDK's persisted discovery state.
Returns null before a successful authorization discovery.
If implemented, provides a way for the client to invalidate (e.g. delete) the specified credentials, in the case where the server has indicated that they are no longer valid. This avoids requiring the user to intervene manually.
Marks the current authorization flow as complete.
Generates and persists StoredState for an authorization request,
and returns the sanitized URL with the state param appended. Does NOT
open a popup or redirect —
use redirectToAuthorization for that.
Redirects the user agent to the authorization URL, storing necessary state.
The fully constructed authorization URL from the SDK.
Persists public OAuth client registration information.
Static client configuration takes precedence, and browser providers discard any client secret returned for a public client.
Registration information to save.
Optionalctx: OAuthClientInformationContext
Optional registration context.
Saves a PKCE code verifier for the current session, before redirecting to the authorization flow.
Persist OAuth discovery state (SEP-2352). Delegated to the session store; implementing this silences the SDK's per-callback warning and enables the authorization-server mix-up defense on the callback leg.
Stores new OAuth tokens for the current session, after a successful authorization.
Optionalctx: OAuthClientInformationContext
Carries the resolved authorization-server issuer. Providers
that persist tokens per authorization server should store the entry
keyed by ctx.issuer.
Loads any existing OAuth tokens for the current session, or returns
undefined if there are no saved tokens.
Optionalctx: OAuthClientInformationContext
Carries the resolved authorization-server issuer. Providers
that persist tokens per authorization server should return the entry
keyed by ctx.issuer. Providers with a single token set may ignore it.
When called with no ctx — the transport's per-request bearer-token
read — return the most-recently-saved token set; do not return
undefined for ctx === undefined.
Browser-compatible OAuth client provider for MCP using localStorage.