MCP Apps
Some MCP servers ship their own interactive UI with a tool: a chart you
can click, a picker, a small dashboard. This is the MCP Apps standard
(io.modelcontextprotocol/ui), and Trellaris can draw those
apps as cards in chat. Because an app is code written by a third party,
it is reviewed and pinned before it renders, runs in a sandbox on a
separate origin, and every call it makes goes through the same governance
as any other tool call.
A2UI or MCP Apps?
| A2UI | MCP Apps | |
|---|---|---|
| Who writes the UI | The agent, as a JSON description | The tool vendor, as an HTML page |
| What can appear | Only components in the trusted catalog | Whatever the vendor's page draws |
| How it is kept safe | Catalog validation on every surface | Review and pinning, a sandboxed origin, a strict CSP, governed calls |
| Switched on | Always (in web chat) | Per organization, off by default |
Review and pinning
When an MCP server is registered in the Tools
Library, discovery reads every ui:// resource its tools
name. Each app waits for an org_admin to approve it
(GET /mcp-servers/{slug}/apps, then โฆ/approve or
โฆ/reject). Approval pins three things together:
- the SHA-256 hash of the page;
- the Content Security Policy the page declares (which domains it may connect to, load from or frame);
- the browser permissions it asks for.
If the server later serves anything else (new HTML, a wider CSP, a new permission) that is drift: the app stops rendering, the server's owner is notified, and it waits for approval again. An MCP server with an unreviewed app cannot be promoted to a shared ring.
Switching it on
MCP Apps are off for every organization until an org_admin switches them
on (PUT /admin/mcp-apps). The same setting holds four
browser-permission switches (camera, microphone, geolocation, clipboard
write), all off by default; an app that asks for one gets it only if the
org allows it. A tool_allowlist policy can also say
render_apps: false for any scope, and any such row wins:
the tool still runs, but the person sees its text result instead of the
card.
Apps render only in a web chat. Slack, Teams and automations always get the tool's text result.
The sandbox
The app's page never runs on the product's origin. The card frames a
proxy page on a separate sandbox origin
(MCP_APPS_SANDBOX_ORIGIN), and the proxy frames the app with
the CSP that was approved. The product's session cookie is host-only and
__Host- prefixed, so code on the sandbox origin can neither
read it nor overwrite it. If a deployment has no sandbox origin set, the
card says apps are not configured and nothing renders.
What an app can do
The app talks to the chat over postMessage (JSON-RPC). The
host answers only these methods:
| Method | What happens |
|---|---|
tools/call | Calls a tool on the same server through /mcp-apps/instances/{id}/tools-call. Only the person who started the run may call it. A tool from another server is refused (403). A write is refused (409, mcp_app.approval_required) and never runs: an app call can arrive after the run has ended, so there is nothing to park. |
resources/read | Reads a resource on the same server, through the same endpoint family. |
ui/update-model-context | Tells the agent what is on screen. It reaches the model on the next turn, inside an <app_context> block. |
ui/message | Proposes a message. It fills the composer and is never sent without the person pressing Send. |
ui/open-link | Shows the URL; it opens only when the person clicks it. |
ui/request-display-mode | Inline or fullscreen. The host's own exit button and Escape always leave fullscreen. |
ui/initialize, ping | The handshake, which carries the product's theme so the app can match light or dark. |
A tool marked visibility: ["app"] is app-only:
the app may call it, and the model is never offered it.
Governance on every call
- DLP both ways: arguments are redacted before they reach the server, results before they reach the app.
- Data perimeter: app calls are the
mcp_appchannel; with no rule of its own it follows themcp_externalrules. See Data perimeter. - Audit: every call is audited, without its arguments.
- Trace: every render, call, context push and message is on the turn's trace in Observe, after the run too (app events are kept in their own log because they can arrive after the run ends).
Try it: the Sales Chart Demo
The repository carries a small MCP server with one app, a regional sales bar chart, so you can see all of this in a real chat. In a local compose stack:
- Start it:
docker compose -f infra/docker-compose.workload.yml up -d --no-deps mcp-app-demo. - Seed one organization (the user must be an org_admin):
docker exec trellis-api-1 python scripts/seed_mcp_app_demo.py you@example.com. It registers the server, approves the app, switches MCP Apps on for that org and creates a personal agent, Sales Chart Demo. - Open the product at
http://localhost:3000(the sandbox is127.0.0.1:3100, which must be a different host), chat with Sales Chart Demo and ask "show EMEA sales".
On the card, the region buttons call an app-only tool through the governed endpoint, Ask about this chart fills the composer, and Full screen asks the host for fullscreen. Change the app's HTML and restart the server to see drift: the card stops rendering until the seed script approves it again.