Package-level declarations
Types
What an app does with its views' requests; the chat-level part of McpAppHost (the view handles sizing, display modes and tool approval itself).
The host side of one MCP App view (MCP Apps 2026-01-26, §"Communication Protocol"): it answers the view's JSON-RPC over send / receive as an MCP server that proxies client — the connection of the server that owns the view — and drives the lifecycle (ui/initialize, tool input and result, host context, teardown).
The origins a view may reach (MCP Apps McpUiResourceCsp). Empty lists are the secure default: no connections, no external resources, no nested frames, same-origin base URIs.
A view that cannot be shown: not a ui:// resource, not text/html;profile=mcp-app, or empty.
What the host does for a view. Every method has a safe default (decline, ignore), so a host implements only what it offers.
What a view wants the model to know (ui/update-model-context): its latest content blocks and structuredContent. Attach toDataPart to the next user turn; each view's newest replaces its previous one.
The live views of a chat, by tool call. A view keeps running while it scrolls out of sight or its message recomposes — its sandbox, connection and state live here, not in the composition — and is torn down (ui/resource-teardown) when evicted (beyond capacity, least recently shown first) or on close. rememberMcpAppSessions closes them with the composition.
Functions
Renders DataPart.MCP_APP parts — added by MCP tools that have a view (_meta.ui.resourceUri) — as their MCP App (McpAppView). clientFor returns the connection of the part's server (by the server id the part names; reuse the instances the agent uses); a part whose server is unknown renders nothing. The views live in sessions: keep one per chat screen.
MCP Apps for a chat screen: content gets the renderer for DataPart.MCP_APP (register it in AiElementsRenderers.data), and the views' dialogs — tool approvals, full screen — show at this level, whether or not their view is scrolled into sight. Views are torn down with this.
Shows the MCP App view resourceUri of one tool call: it reads the view from client (the connection of the server that owns it), runs it in a sandbox and connects it to the chat through actions. input is the call's arguments and result its CallToolResult once it returns.
Read and validate the MCP App view at uri.
McpAppSessions that close when this leaves the composition.