/** * Verify WorkOS AuthKit access tokens for an mcp-use resource server. * * @packageDocumentation */ import { type OAuthProvider, type OAuthResourceOptions } from "./provider.js"; /** Verified WorkOS user and organization claims exposed to authenticated MCP callbacks. */ export interface WorkOSOAuthUser { /** WorkOS subject identifier. */ id: string; /** Primary email address, when included in the access token. */ email?: string; /** Whether WorkOS has verified {@link WorkOSOAuthUser.email}. */ emailVerified?: boolean; /** Display name, when included in the access token. */ name?: string; /** Preferred username, when included in the access token. */ preferredUsername?: string; /** Given name, when included in the access token. */ firstName?: string; /** Family name, when included in the access token. */ lastName?: string; /** Profile image URL, when included in the access token. */ picture?: string; /** Roles from the access token's `roles` claim. */ roles: string[]; /** Active WorkOS organization identifier. */ organizationId?: string; /** WorkOS session identifier. */ sessionId?: string; } /** Configures WorkOS JWT verification and protected-resource metadata. */ export interface WorkOSOAuthProviderOptions extends OAuthResourceOptions { /** * AuthKit subdomain, with or without the `https://` scheme. * * @defaultValue `MCP_USE_OAUTH_WORKOS_SUBDOMAIN` */ subdomain?: string; } /** * Creates a provider that verifies WorkOS access tokens and maps their claims. * * @param options - WorkOS AuthKit origin and resource-server settings. Defaults to v1 environment variables. * @returns A provider that rejects tokens not issued for the resolved MCP resource. * @throws An `Error` if no subdomain is configured, or a `TypeError` if it is empty or uses a non-HTTPS URL. * * @example * ```ts * import { oauthWorkOSProvider } from "mcp-use/oauth/workos"; * * const oauth = oauthWorkOSProvider({ * subdomain: "example.authkit.app", * }); * ``` */ export declare function oauthWorkOSProvider(options?: WorkOSOAuthProviderOptions): OAuthProvider;