Skip to content

MCP Apps in the task window: design ​

Status: phase 1 (read-only viewer) is built behind CULLY_MCP_APPS=1; phases 2 to 5 are design only. Date: 2026-11-27.

What MCP Apps are ​

MCP Apps is an official extension (SEP-1865, id io.modelcontextprotocol/ui, spec dated 2026-01-26, marked stable; the flat ui/resourceUri key is deprecated). A tool declares _meta.ui.resourceUri pointing at a ui:// resource. The resource is HTML (text/html;profile=mcp-app), read with resources/read. The host renders it in a sandboxed iframe and talks to it with JSON-RPC over postMessage: ui/initialize, then the host pushes ui/notifications/tool-input and tool-result; the app may call tools/call and resources/read (proxied by the host, same server only, and only tools whose _meta.ui.visibility includes app), and may send ui/message, ui/open-link, ui/update-model-context. The resource's _meta.ui declares csp (connectDomains, resourceDomains, frameDomains, baseUriDomains), permissions (camera, microphone, geolocation, clipboardWrite) and prefersBorder. Omitted means no external access. Web hosts must serve the app through a sandbox proxy on a different origin. Claude, VS Code Copilot, Goose and others render apps today. The ext-apps SDK (@modelcontextprotocol/ext-apps) has an AppBridge for hosts.

What Cully can and cannot do ​

Cully supervises; the harness owns the model loop and the MCP connection. Cully sees only stream-json tool_use and tool_result events, not the server's tool definitions. So a new capability, mcp-app, is not "the harness supports it" but "Cully can reach the server itself".

CapabilityClaudeCodexCursor
See the tool call and resultyes (stream)partial (transcript, afterwards)partial
Tool name maps to a serveryes (mcp__server__tool)yes (server and tool fields)partial
Cully reads the server definitionyes, from .mcp.json / ~/.claude.json (already done for the Harness page)from config.tomlfrom mcp.json
Cully reads resources/read itselfyes if stdio or unauthenticated HTTPsamesame
Harness itself renders or forwards app callsnonono

Cully cannot make the harness accept ui/message or update-model-context; the model never hears from the app. Apps are therefore a viewing and direct-action surface for the user, not a channel to the model, unless the user presses "Send to task", which posts a normal user message.

Read-only viewer, Claude tasks, servers Cully can already start:

  1. When a mcp__server__tool result arrives, Cully looks up the tool's _meta.ui.resourceUri with tools/list against that server (cached; reuses the probe's connection details in ui_mcpdetail.go).
  2. If present, Cully calls resources/read for the ui:// URI and keeps the HTML and _meta.ui in memory.
  3. The tool row gets an "Open app" button. The app opens in a sandboxed frame, receives tool-input and tool-result from the event, and nothing else. Its tools/call and resources/read requests are answered with an error ("not enabled") in this step.

This needs an MCP client in Go (initialize, tools/list, resources/read over stdio and streamable HTTP, plus the server's auth). That is well over 150 lines with tests, and OAuth servers need token handling Cully avoids by design. Phase 1 implements it for stdio and unauthenticated HTTP servers (ui_mcpapp.go).

Security model ​

Risks, stated plainly:

  • The HTML comes from a third-party server and is untrusted code in the user's browser, next to a UI that holds a bearer token for agents with write access to repositories.
  • Token exposure: the app must never see the Cully token, cookies, or server credentials. Cully fetches the resource with its own connection; credentials never enter the page.
  • Prompt injection: app text and ui/message can carry instructions aimed at the model; apps can also spoof Cully UI (fake approval cards).
  • Exfiltration through connectDomains, and clickjacking through large overlays.

Controls:

  • Sandbox: <iframe sandbox="allow-scripts"> with no allow-same-origin, no top navigation, no popups, no forms. This gives a null origin, so no cookie or storage access to Cully. The existing diagram frame (ui_static/diagram/frame.html, uiDiagramCSP) is the pattern. Unlike the spec's same-origin-needed proxy for web hosts, a null origin plus a served frame path is enough for the first step; a distinct port is the later hardening.
  • CSP: served per app by a /mcpapp/<id> route as default-src 'none' plus only the declared resourceDomains; connect-src is added only for declared connectDomains after the user approves each domain on a card. Default is no network. The page CSP (script-src 'self', style-src 'self') does not change; the app's inline script lives only inside the framed document.
  • Messages: the parent checks event.source is that frame, validates the JSON-RPC shape and method allowlist, rate-limits, and logs each call.
  • App-initiated tools/call: routed through the existing permission relay, shown as a card with the tool name and arguments, default deny, same server only, visibility must include app. Read-only calls may be allowed per server after one approval.
  • ui/message and update-model-context are shown to the user as a draft, never sent automatically. ui/open-link shows the URL for confirmation.
  • Resource hash pinned on first view; a changed hash asks again. Size cap on the HTML. Camera, microphone, geolocation are never granted.
  • Off by default behind CULLY_MCP_APPS=1, and per server.

UI ​

In the task window, the tool row shows "Open app" after a result; the app expands inline under the row, with a visible border and the server name. On the right side panel, an "Apps" tab lists apps from this task; selecting one gives a larger pane with the approval cards for its calls above it. A banner states "Content from server X, running sandboxed".

Phases ​

  1. Viewer: Go MCP client for stdio and unauthenticated HTTP, tools/list and resources/read, frame route and CSP, event-to-app push, flag and tests.
  2. Approved calls: proxy tools/call and resources/read through the permission relay; log to the journal.
  3. Declared domains with approval cards, hash pinning, and a separate-origin frame.
  4. Codex and Cursor transcripts (read afterwards), and "Send to task" drafts.
  5. Optional: use the ext-apps AppBridge bundle vendored under ui_static instead of a hand-written bridge.

Open questions ​

  • Which servers does the user have that ship apps? Value depends on this.
  • Can Cully reuse an OAuth session for HTTP servers without storing tokens? If not, those servers are excluded.
  • Should an app state change (for example a form submit) be fed back to the model automatically, or always by an explicit user message?
  • Does the harness list _meta in its init event, which would remove the need for a second connection?

Built in the open. Apache 2.0 licensed.