- It detects whether the connecting host supports MCP Apps.
- It registers
ui://HTML resources with thetext/html;profile=mcp-appMIME type. - It links tools to those resources with
_meta.ui.resourceUri.
Server Checklist
Before you test in a host, confirm these items:- The server checks
getUiCapability(clientCapabilities)before adding UI metadata. - Every UI resource URI starts with
ui://. - Every UI resource returns
mimeType: RESOURCE_MIME_TYPE. - Each UI tool points at an existing resource with
_meta.ui.resourceUri. - Tool results include a short
contentsummary for the model. - Tool results put UI data in
structuredContent. - The resource declares every external origin it needs in
_meta.ui.csp. - UI-only actions use
visibility: ["app"]so they do not appear in the model tool list.
Complete Example
Why the Fallback Matters
MCP Apps is negotiated through the MCP extensions capability. A server should not assume every host can render Views. If the host does not advertise support forRESOURCE_MIME_TYPE, register a normal MCP tool that returns useful text.
The fallback tool can use the same name as the UI tool because only one branch is registered for a connection.
Resource and Tool Links
Theui:// resource is a template. The tool result is data. Keeping those separate lets hosts inspect, cache, and prefetch HTML before the tool runs.
_meta.ui.resourceUri, it cannot render the View.
content vs structuredContent
Use both fields in UI tool results:
contentis the model-visible summary. Keep it short and readable.structuredContentis the data your View renders.
content. It makes the model context harder to use and gives the View less predictable data.
CSP and External Assets
MCP App HTML runs in a sandboxed iframe. By default, hosts block undeclared network and asset origins. Declare what the View needs:connectDomains for fetch, XHR, and WebSockets. Use resourceDomains for scripts, styles, images, fonts, and media. See Resource _meta for the full CSP reference.
App-only Tools
Use app-only tools for user actions that happen inside the View and do not need to appear in the model’s tool list:callServerTool(), but the host must hide it from the model. This is a good fit for refresh buttons, pagination, saving UI edits, and polling.
Related Pages
Capability Detection
Check whether a host supports MCP Apps before registering UI tools.
registerAppResource
Register HTML resources with CSP and iframe metadata.
registerAppTool
Register tools that render MCP App Views.
MCP App Patterns
Use app-only tools, polling, large data, and model context well.