Skip to content

Render upstream MCP Apps views through imported MCP apps - #2607

Open
dnevzorov wants to merge 5 commits into
UsefulSoftwareCo:v2from
dnevzorov:feat/mcp-apps-upstream-ui-2584
Open

dnevzorov wants to merge 5 commits into
UsefulSoftwareCo:v2from
dnevzorov:feat/mcp-apps-upstream-ui-2584

Conversation

@dnevzorov

@dnevzorov dnevzorov commented Nov 27, 2026 •

Copy link
Copy Markdown

Renders upstream MCP Apps (SEP-1865) from imported remote MCP servers in MCP Apps hosts, as the issue linked below proposes. Before this, an imported server's tools worked through Executor, but its widget never reached the client: _meta.ui was not listed, and Executor did not proxy resources/read.

Part of #2584 (not all of it; see the gaps below). It adds only the ui:// part of the upstream resources/read that #2603 proposes, and does not close that issue: no readResource code-mode tool, no resource_link reads, no resources/list.

What it does

  • Upstream negotiation. Executor's upstream MCP client declares io.modelcontextprotocol/ui (mimeTypes: ["text/html;profile=mcp-app"]), because servers can omit _meta.ui for a client without it. The MCP catalog cache key moves to mcp-catalog-v4, so catalogs read before the change are read again once.
  • Discovery. When the connecting client declares the same extension, tools/list adds each tool of the caller's apps that has _meta.ui, under its upstream name, so the rendered view can call it by that name. _meta.ui.resourceUri becomes ui://executor/<app slug>/<upstream path>. openai/outputTemplate (OpenAI Apps SDK servers, such as Trello) gets the same URI when it names the same resource. visibility and other _meta pass through unchanged; the host keeps visibility: ["app"] tools away from the model. The upstream outputSchema is not listed, because Executor's describes the whole result object. A client without the extension still sees exactly the six Executor tools.
  • Resource proxy. resources/read on ui://executor/<app>/… reads the upstream resource through the app's own connection and the caller's account. Contents, mimeType and _meta.ui (CSP, permissions, prefersBorder) are returned unchanged; only uri is rewritten. Only a ui:// resource that one of the app's listed tools declares is read. Any other URI is -32002 and never reaches the upstream server.
  • Any imported MCP server. Nothing is specific to one service: every imported server whose tools declare _meta.ui is handled the same way.
  • Calls from the view. A view calls its server's tools by name, including tools without _meta.ui. Those are accepted, but not listed, when exactly one app with UI tools has a tool of that name. A tools/call for a UI tool runs as call does: same catalog, accounts, policies and invocation. Destructive tools use ask approvals (never the native call auto-accept). A client with form elicitation gets the approval prompt. A client without it gets an isError result, and the pending interaction is discarded.
  • Executor's own tools carry _meta.ui.visibility: ["model"].
  • Results. Executor drops a text block that repeats structuredContent. A view call puts one JSON text block back when that leaves content empty, because MCP Apps hosts and models read content.

How

  • apps/mcp: mcpClient.read(uri) sends resources/read over the same connection, timeout and failure mapping as call. Every mcpRouter resolves, but never lists, a resources/read operation (mcpUiResourceTool). It reads only declared ui:// URIs, so it is reached through the normal tool invocation, with accounts and approvals. MCP tool names have no /, so it never shadows an upstream tool.
  • [email protected] adds McpServer.toolCatalog({ list, call }) and McpServer.resourceCatalog({ read }), per-request hooks like the existing skillCatalog (patches/effect-mcp-request-catalogs.md).
  • packages/telemetry records the new provider.mcp.read span name.
  • packages/mcp/src/implementation/mcp-apps.ts implements both catalogs over McpBackend. accountRouter tools take { accountId, input }; the UI tool is listed with the caller's one account's input schema and wraps the view's arguments.

Security

  • The server cannot tell a call from a rendered view from a call by the model. visibility: ["model"] on Executor's tools keeps a view away from execute and call only in hosts that enforce visibility, as the spec requires.
  • All UI tools share one Executor server connection. A view from app A can call app B's UI tools, and the spec's "same server" rule does not stop it. Approvals still apply to destructive tools. Each view could be limited to its own app with a per-app MCP endpoint or session.
  • resources/read reads only ui:// URIs that the app's listed tools declare. The mcpRouter operation checks this again, so a direct REST call cannot read other resources either.

Known gaps

  • Helper names shared by two apps. A view's call to a tool without _meta.ui fails when two apps with UI tools both have a tool of that name.
  • The model must call the UI tool. The widget renders only when the model calls the listed UI tool directly. Calls through call or execute return the data, but no widget.
  • Several accounts, one view. For an app with several of the caller's linked accounts, a UI tool takes an optional executorAccount. Without it, a call or a widget read uses the account the caller last used with that app (kept in memory per server process), else the first linked one. A view cannot pick an account itself.
  • Hosts that do not declare the extension. Claude Code declares io.modelcontextprotocol/ui only when its host sets CLAUDE_CODE_MCP_APPS_HOST, and Codex 0.172 never declares it, although both render MCP Apps from tool _meta. Such a client opts in with the header X-Executor-MCP-Apps: 1 in its MCP server config. Without the extension or the header, a client keeps the six Executor tools.
  • No notifications/tools/list_changed. It is not sent when imports or accounts change. The host sees new UI tools on its next tools/list.
  • Tool count. Every tool with _meta.ui is listed to an MCP Apps client. Some servers mark nearly all their tools: on one install, PostHog alone added about 80, and the list grew from 6 to 111 tools. Per-app control of which UI tools are listed may be worth adding.
  • Listing cost. tools/list and each view call read the caller's catalog of every app. Cached catalogs are reused, and listing is bounded to 5 s, after which UI tools are left out with a warning.
  • Existing apps need a rebuild. The upstream read runs in each app's bundle, which holds its credentials. A version built with an earlier apps framework (such as beta.148) has no resources/read operation, so its widgets list but do not load until it is redeployed with this framework.
  • renameTools apps are not handled.
  • Restricted grants. For the unlisted resources/read operation, grants that restrict tools are checked only by the product's normal callTool.
  • Not tested with Trello in T3 Code, on the local or Cloud targets, or with the 2026-07-28 protocol. bun run pr:check and the description check do not run in the public mirror: it has no main history and no .github/workflows.
mcp-apps.spec.ts
mcp-direct-calls.spec.ts
mcp-skills-extension.spec.ts
mcp-catalog.spec.ts

Tests

mcp-apps.spec.ts imports a sample upstream MCP App server in the shape Executor generates for an OAuth import (accountRouter + withApprovals + mcpRouter), with a key account. The server shows _meta.ui only to a client that declares the extension. The scenario checks that:

  • a client without the extension lists only the six Executor tools and cannot read the widget, and the same client with X-Executor-MCP-Apps: 1 lists the UI tools;
  • a UI client lists show_board and the app-only move_card with rewritten resourceUri and visibility kept;
  • Executor's tools are model-only;
  • a ~1.5 MB widget reads back byte-for-byte, with its CSP _meta unchanged;
  • an undeclared ui:// URI is refused without an upstream request, through MCP and through the REST tool call;
  • view calls, including one to a tool without _meta.ui, reach upstream with the caller's token;
  • with two linked accounts, the listed tool offers executorAccount, an explicit choice is used, and the next view call and widget read reuse it;
  • a result keeps its JSON text block, and the destructive call asks once;
  • a UI client without elicitation gets an error and upstream is not called.

Tested locally on self-host with Node 24: mcp-apps.spec.ts, plus 10 neighbor scenarios in mcp-direct-calls, mcp-catalog, mcp-skills-extension, mcp-protocol-versions and mcp-tool-input (all pass). bun run e2e:effect-mcp (6 pass) and bun run check (19 steps) pass. The Rust telemetry collector was not built (no cargo here).

Also checked by hand on a self-host install running this branch, with real imported apps: in T3 Code, both a Claude session and a Codex session (Codex sending X-Executor-MCP-Apps: 1) listed the Trello and Superhuman UI tools, and direct trelloReadCard and get_draft calls returned data. An MCP Apps client read Trello's 679 KB widget through ui://executor/trello/widget/trello-widget.html with its CSP intact. After redeploying 19 imported MCP apps on this framework, an MCP Apps client listed 127 tools and read all 45 of their widgets (Trello, Superhuman, Atlassian, Datadog, Clerk, CodeRabbit, Fastmail, PostHog), and T3 Code rendered Datadog's dataviz widget from a call through Executor.

MCP Apps hosts that declare io.modelcontextprotocol/ui now list the UI
tools of the caller's imported MCP servers, read their ui:// resources
through the caller's account, and send view calls through the normal
invocation with approvals. Executor's own tools are model-only.

Release-note: Feature: MCP clients that support MCP Apps now show the interactive views of imported MCP servers, with reads and calls made through your linked account.
A rendered view calls its server's tools by name, including tools
without _meta.ui. Accept those calls, unlisted, when one app with
UI tools has a tool of that name.
@dnevzorov
dnevzorov marked this pull request as ready for review November 27, 2026 15:57
Servers built for the OpenAI Apps SDK, such as Trello, also name the
widget in openai/outputTemplate. Rewrite it like ui.resourceUri when
it names the same resource.
A view cannot choose an account. The listed tool takes an optional
executorAccount; without it, a call or widget read uses the account
the caller last used with that app, else the first linked one.
Claude Code and Codex render MCP Apps from tool _meta but do not
declare io.modelcontextprotocol/ui. X-Executor-MCP-Apps: 1 lists the
UI tools for such a client; other clients keep the six tools.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant