/** * Verify Clerk access tokens for an mcp-use resource server. * * @packageDocumentation */ import { type OAuthProvider, type OAuthResourceOptions } from "./provider.js"; /** Verified Clerk user and organization claims exposed to authenticated MCP callbacks. */ export interface ClerkOAuthUser { /** Clerk subject identifier. */ id: string; /** Primary email address, when included in the access token. */ email?: string; /** Display name, when included in the access token. */ name?: string; /** Clerk username, when included in the access token. */ username?: string; /** Profile image URL, when included in the access token. */ picture?: string; /** Whether Clerk has verified {@link ClerkOAuthUser.email}. */ emailVerified?: boolean; /** Active Clerk organization identifier. */ organizationId?: string; /** Role in the active Clerk organization. */ organizationRole?: string; /** Slug of the active Clerk organization. */ organizationSlug?: string; /** Active organization role as a normalized list. */ roles: string[]; } /** Configures Clerk JWT verification and protected-resource metadata. */ export interface ClerkOAuthProviderOptions extends OAuthResourceOptions { /** * Clerk Frontend API URL used as the token issuer. * * @defaultValue `MCP_USE_OAUTH_CLERK_FRONTEND_API_URL` */ frontendApiUrl?: URL | string; /** Expected Clerk access-token audience, when the application emits one. */ audience?: string; } /** * Creates a provider that verifies Clerk access tokens and maps their claims. * * @param options - Clerk frontend API URL, optional token audience, and resource-server settings. Defaults to v1 environment variables. * @returns A provider that verifies Clerk-issued access tokens and explicit resource claims. * @throws An `Error` if no frontend API URL is configured, or a `TypeError` if it is invalid or `audience` is empty. * * @example * ```ts * import { oauthClerkProvider } from "mcp-use/oauth/clerk"; * * const oauth = oauthClerkProvider({ * frontendApiUrl: "https://example.clerk.accounts.dev", * }); * ``` */ export declare function oauthClerkProvider(options?: ClerkOAuthProviderOptions): OAuthProvider;