Before you begin
- Who: an agent builder who can edit the agent, and the owner of the MCP server code.
- Where: your MCP server, then Agent Factory.
- Requires: an MCP server attached to the agent as a tool (see Capabilities). A server hosted in a workspace of the platform works as is. An external server must be listed by a platform administrator in
config.mcpApps.allowedServersof the Agent Factory workspace (URL prefixes), editable in Builder with Edit Workspace YAML (index.yml). - Impact: every conversation of the agent that calls the tool shows the view.
Declare the view on your server
1
Point the tool to a view
In the tool definition returned by
tools/list, add _meta.ui.resourceUri with a ui:// URI of your server, for example ui://notes/board. URIs under ui://agent-factory/ are reserved to the platform and ignored.2
Serve the view
Answer
resources/read for that URI with one content of mime type text/html;profile=mcp-app whose text is the HTML page of the view (at most 2,000,000 characters). The page talks to the chat over postMessage, as defined by MCP Apps.3
Choose who can call each tool
Set
_meta.ui.visibility on each tool: ["model", "app"] (the default) lets both the model and the view call it; ["app"] keeps it for the view only, hidden from the model. A view can only call tools whose visibility lists app.4
Declare the external origins the view needs
Optional: the view cannot load scripts, images or fonts from other origins, nor fetch anything, unless the resource declares them in
_meta.ui.csp (resourceDomains, connectDomains, frameDomains).The view runs without the user’s session: it cannot download a private file, such as the view of a private isolated app stored as a workspace asset. Put the code in the page instead. A server hosted on the platform is called as the user who talks to the agent, so its
resources/read can read the file with that user’s rights and send it inline; a user who cannot open the app gets no view. The Builder starter’s mcp automation does this for its hello-card view.resourceDomains.
The view declares where it can show in ui/initialize (appCapabilities.availableDisplayModes): inline (in the thread, the default) and fullscreen (in the side panel, which adds Open alongside under the view).
Govern the actions of the view
In Agent Factory, set the tool permissions of the server’s tools as for any tool. When a view calls a tool withannotations.destructiveHint and the agent has no rule for it, the call asks for approval (this applies to calls made by a view, not to the model’s own calls). When a view calls a tool that needs approval, the approval card appears under the view and the call runs only after Approve.
The chat also asks the user before a view acts on the conversation:
A view can keep values in the browser, per app, across reloads (at most 100 KB, 200 keys, 20 KB per value). They stay in that browser: they are not shared between devices.
Verify the result
- In the agent’s playground, send a message that makes the agent call the tool. The view appears under the tool call, with App: <app> (via <server>).
- In the view, trigger an action that calls a tool marked
["app"]. The view shows the result, and the tool does not appear in the tools the model can call. - Reload the conversation. The view appears again from the history.
Troubleshooting
The app returned no view., The app view is not a web page.
Cause: resources/read returns no content, or a content that is not text/html.
Owner: the owner of the MCP server.
Resolution: return one content with mime type text/html;profile=mcp-app and the HTML in text, then reload the conversation.
The app did not answer in time. The action may still be running.
Cause: the tool took longer than the request timeout. The tool may still finish on the server.
Owner: the owner of the MCP server.
Resolution: return quickly with an identifier, and give the view a tool marked ["app"] that reports the progress. Do not let the user repeat the action blindly.
The app could not be displayed
This title comes with every view that fails to load. The line under it tells the cause:
The entries above cover the other details: no view, not a web page, and a timeout.
The tool result shows no view
Cause: the tool definition has no_meta.ui.resourceUri, or its URI is under the reserved ui://agent-factory/ prefix.
Owner: the owner of the MCP server.
Resolution: fix the tool definition, then send the message again. The agent keeps the server’s tool list for up to 5 minutes: save the agent to refresh it at once.