feat: add mcp app renderer (#6095)

Co-authored-by: Douwe Osinga <douwe@block.xyz>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Andrew Harvard
2025-12-22 18:01:21 -05:00
committed by GitHub
parent 762b2cf54d
commit 91a6b21f39
29 changed files with 1786 additions and 95 deletions
+70
View File
@@ -53,6 +53,7 @@ export type CallToolRequest = {
};
export type CallToolResponse = {
_meta?: unknown;
content: Array<Content>;
is_error: boolean;
structured_content?: unknown;
@@ -137,6 +138,21 @@ export type CreateScheduleRequest = {
recipe_source: string;
};
/**
* Content Security Policy metadata for MCP Apps
* Specifies allowed domains for network connections and resource loading
*/
export type CspMetadata = {
/**
* Domains allowed for connect-src (fetch, XHR, WebSocket)
*/
connectDomains?: Array<string> | null;
/**
* Domains allowed for resource loading (scripts, styles, images, fonts, media)
*/
resourceDomains?: Array<string> | null;
};
export type DeclarativeProviderConfig = {
api_key_env: string;
base_url: string;
@@ -397,6 +413,38 @@ export type LoadedProvider = {
is_editable: boolean;
};
/**
* MCP App Resource
* Represents a UI resource that can be rendered in an MCP App
*/
export type McpAppResource = {
_meta?: ResourceMetadata | null;
/**
* Base64-encoded binary content (alternative to text)
*/
blob?: string | null;
/**
* Optional description of what this resource does
*/
description?: string | null;
/**
* MIME type (should be "text/html;profile=mcp-app" for MCP Apps)
*/
mimeType: string;
/**
* Human-readable name of the resource
*/
name: string;
/**
* Text content of the resource (HTML for MCP Apps)
*/
text?: string | null;
/**
* URI of the resource (must use ui:// scheme)
*/
uri: string;
};
/**
* A message to or from an LLM
*/
@@ -708,6 +756,13 @@ export type ResourceContents = {
uri: string;
};
/**
* Resource metadata containing UI configuration
*/
export type ResourceMetadata = {
ui?: UiMetadata | null;
};
export type Response = {
json_schema?: unknown;
};
@@ -1016,6 +1071,21 @@ export type TunnelInfo = {
export type TunnelState = 'idle' | 'starting' | 'running' | 'error' | 'disabled';
/**
* UI-specific metadata for MCP resources
*/
export type UiMetadata = {
csp?: CspMetadata | null;
/**
* Preferred domain for the app (used for CORS)
*/
domain?: string | null;
/**
* Whether the app prefers to have a border around it
*/
prefersBorder?: boolean | null;
};
export type UpdateCustomProviderRequest = {
api_key: string;
api_url: string;