UNPKG

mcp-use

Version:

Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents, Clients and Servers with support for ChatGPT Apps, Code Mode, OAuth, Notifications, Sampling, Observability and more.

54 lines 2.58 kB
import type { OAuthClientInformation, OAuthTokens, OAuthClientMetadata } from "@mcp-use/modelcontextprotocol-sdk/shared/auth.js"; import type { OAuthClientProvider } from "@mcp-use/modelcontextprotocol-sdk/client/auth.js"; /** * Browser-compatible OAuth client provider for MCP using localStorage. */ export declare class BrowserOAuthClientProvider implements OAuthClientProvider { readonly serverUrl: string; readonly storageKeyPrefix: string; readonly serverUrlHash: string; readonly clientName: string; readonly clientUri: string; readonly callbackUrl: string; private preventAutoAuth?; private useRedirectFlow?; readonly onPopupWindow: ((url: string, features: string, window: globalThis.Window | null) => void) | undefined; constructor(serverUrl: string, options?: { storageKeyPrefix?: string; clientName?: string; clientUri?: string; callbackUrl?: string; preventAutoAuth?: boolean; useRedirectFlow?: boolean; onPopupWindow?: (url: string, features: string, window: globalThis.Window | null) => void; }); get redirectUrl(): string; get clientMetadata(): OAuthClientMetadata; clientInformation(): Promise<OAuthClientInformation | undefined>; saveClientInformation(clientInformation: OAuthClientInformation): Promise<void>; tokens(): Promise<OAuthTokens | undefined>; saveTokens(tokens: OAuthTokens): Promise<void>; saveCodeVerifier(codeVerifier: string): Promise<void>; codeVerifier(): Promise<string>; /** * Generates and stores the authorization URL with state, without opening a popup. * Used when preventAutoAuth is enabled to provide the URL for manual navigation. * @param authorizationUrl The fully constructed authorization URL from the SDK. * @returns The full authorization URL with state parameter. */ prepareAuthorizationUrl(authorizationUrl: URL): Promise<string>; /** * Redirects the user agent to the authorization URL, storing necessary state. * This now adheres to the SDK's void return type expectation for the interface. * @param authorizationUrl The fully constructed authorization URL from the SDK. */ redirectToAuthorization(authorizationUrl: URL): Promise<void>; /** * Retrieves the last URL passed to `redirectToAuthorization`. Useful for manual fallback. */ getLastAttemptedAuthUrl(): string | null; clearStorage(): number; private hashString; getKey(keySuffix: string): string; } //# sourceMappingURL=browser-provider.d.ts.map