/** * Verify access tokens from the Convex OAuth Provider component. * * @packageDocumentation */ import { type OAuthProvider, type OAuthResourceOptions } from "./provider.js"; /** Verified Convex claims exposed to authenticated MCP callbacks. */ export interface ConvexOAuthUser { /** Convex subject identifier from the access token's `sub` claim. */ id: string; /** * Registered OAuth client the token was issued to, from the `cid` claim * (falls back to `client_id` when present). */ clientId?: string; } /** Configures Convex JWT verification and protected-resource metadata. */ export interface ConvexOAuthProviderOptions extends OAuthResourceOptions { /** * Complete Convex OAuth issuer URL, including the mounted base path. * * @example `https://example.convex.site/oauth` * @defaultValue `MCP_USE_OAUTH_CONVEX_AUTH_URL` */ authURL?: URL | string; } /** * Creates a provider that verifies Convex OAuth Provider access tokens. * * Convex owns registration, authorization, consent, and token issuance. * mcp-use advertises those endpoints and verifies the resulting access-token * JWTs against Convex's JWKS endpoint. Dynamic Client Registration is off by * default in the Convex component; enable it there so the advertised * `registration_endpoint` works for MCP clients. * * @param options - Convex issuer URL 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 issuer URL is configured, or a `TypeError` if it is not a valid HTTP or HTTPS URL. * * @example * ```ts * import { oauthConvexProvider } from "mcp-use/oauth/convex"; * * const oauth = oauthConvexProvider({ * authURL: "https://example.convex.site/oauth", * }); * ``` */ export declare function oauthConvexProvider(options?: ConvexOAuthProviderOptions): OAuthProvider;