/** * HTML pages the OAuth proxy serves: the consent page and error pages. * * @internal */ /** * Values handed to a custom consent page (the `consent.page` option of * `oauthProxy`). * * The page must render a form that posts to `form.action` with the method * `post` and submit buttons named `decision` with the values `allow` and * `deny`. `form.action` carries the single-use CSRF token, so the form * needs no hidden fields. * * @example * ```tsx * import type { ConsentPageProps } from "mcp-use/oauth"; * * export function Consent({ client, upstream, form }: ConsentPageProps) { * return ( *
*

Allow {client.name ?? "this app"} to sign in with {upstream}?

* * *
* ); * } * ``` */ export interface ConsentPageProps { /** The MCP client that asks for access. */ client: { /** Client identifier. For a metadata-document client, this is its URL. */ id: string; /** Name the client gave. A registered (DCR) client chose it itself. */ name?: string; /** Host of the client's metadata document, when the client used one. */ host?: string; /** * Whether the client is identified by its own HTTPS metadata document * or by server configuration. A dynamically registered client names * itself, so it is not verified. */ verified: boolean; }; /** Host (or custom scheme) that the browser returns to after sign-in. */ redirectHost: string; /** Name of the upstream identity provider, for example `GitHub`. */ upstream: string; /** Scopes that the server requests from the upstream provider. */ scopes: string[]; /** * Host of this MCP server's public URL, for example `mcp.acme.com` or * `localhost:3000`. The page names the server by it, because the user can * check it in the address bar. */ serverHost: string; /** Form target. */ form: { /** * URL to post the decision to. It includes the CSRF token that ties the * decision to this page, so post to it unchanged. */ action: string; }; } /** @internal Content Security Policy for every proxy HTML page. */ export declare const PAGE_CSP: string; /** @internal Renders the built-in consent page. */ export declare function renderDefaultConsentPage(props: ConsentPageProps): string; /** @internal Renders a custom consent page component with react-dom/server. */ export declare function renderCustomConsentPage(component: (props: ConsentPageProps) => unknown, props: ConsentPageProps): Promise; /** @internal Renders an error page for requests that cannot redirect. */ export declare function renderErrorPage(title: string, message: string): string; /** @internal Escapes text for HTML element and attribute content. */ export declare function escapeHtml(value: string): string;