import type { ViewConfig } from "../react/runtime/view-config.js"; import type { DisplayMode } from "../react/types/host-types.js"; import type { McpUiResourceCsp, McpUiResourcePermissions } from "@modelcontextprotocol/ext-apps"; /** * Sandbox permissions a view may request from the host. * * Alias of the canonical MCP Apps spec type * {@link McpUiResourcePermissions} from `@modelcontextprotocol/ext-apps`. * Type-only — no runtime import of ext-apps enters the server bundle. */ export type UiPermissions = McpUiResourcePermissions; /** * Resource-level facts declared on a bound tool's `view:` config and emitted * on the view resource at registration time. */ export interface ViewResourceFacts { /** Human-readable description → the resource's `description`. */ description?: string; /** * CSP domains the host must allow → resource `_meta.ui.csp`. The framework * appends the server origin to `connectDomains` and the configured assets * origin (or server origin) to `resourceDomains` at emission time. * `frameDomains` and `baseUriDomains` merge authored and category-specific * environment lists; each field is omitted when its merged list is empty. * Other author-set fields pass through. */ csp?: McpUiResourceCsp; /** Sandbox permissions the view needs → `_meta.ui.permissions`. */ permissions?: UiPermissions; /** * Dedicated UI origin for ChatGPT and other hosts → `_meta.ui.domain`. * Use an HTTPS origin such as `https://app.example.com`. HTTP(S) URL values * are normalized to their origin for compatibility with older configs. * On Claude resource reads, the framework instead hashes the full public * MCP endpoint resolved from `MCP_URL` (origin + server `basePath`, or a full * endpoint URL) or the forwarded/request URL. Omit to use the host default. * Do not overwrite the generated domain in response middleware. */ domain?: string; /** Ask the host to draw a border around the view → `_meta.ui.prefersBorder`. */ prefersBorder?: boolean; /** Supported modes extracted from the frontend named `viewConfig` export. */ displayModes?: readonly DisplayMode[]; /** Initial ChatGPT display preference extracted from frontend config. */ preferredDisplayMode?: "inline" | "fullscreen"; } /** * Manifest entry whose JS and CSS are embedded in the synthesized HTML * document. * * The production CLI emits this shape for `mcp-use build --inline`. */ export interface InlineViewManifestEntry { /** Discriminant for the embedded bundle shape. */ kind: "inline"; /** Static frontend configuration captured by build tooling. */ viewConfig?: ViewConfig | undefined; /** * Minified ES module source embedded in the generated view document's * `