Repository navigation
Conversation
Adds an extension that lets an ACP client show MCP Apps (SEP-1865) for the
MCP servers that the agent connects to:
- `_meta.mcpApp` on the tool call of a tool with a `ui://` resource: the
server, the tool, the resource and the server's own result;
- `_session/mcp/resources/read`: reads the `ui://` resource through the agent;
- `_session/mcp/tools/call`: runs a tool for the app on the live session,
with the result kept out of the model's context.
The client opts in with `_meta.mcpApps: {version: 1}` in its initialize
capabilities; the agent advertises the methods in its own. See
docs/mcp-apps.md.
Adds `_session/mcp/tools/list`: the tools of one MCP server of the session with their annotations and MCP Apps `_meta.ui`, so a host can run an app's read-only calls at once and ask the user about the others. Advertised as `toolsList` in `_meta.mcpApps`.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
MCP servers increasingly ship an app with their tools: a chart for an analytics query, a map for a location search, a form to confirm an order, a picker to choose between results. Hosts like Claude, ChatGPT, VS Code and Goose already show these next to the tool call. An ACP client today only gets the text summary, so a user of an editor, a desktop chat app or a phone client built on ACP gets "Here are 3 flights" instead of the flight picker the server built.
With this extension, any ACP client can show the same app, and the app's buttons work: they run the server's tools through the agent's live session, with the client asking the user first when a call isn't read-only. Nothing changes for clients that don't opt in.
A minimal demo ACP client, using the
get-timeexample from ext-apps, with real output from this branch.Summary
MCP Apps (SEP-1865) lets an MCP tool declare a
ui://resource that the host shows next to the tool's result, in a sandboxed frame that can call the server's tools. Codex already supports this in its app server: MCP tool call items carrymcpAppUi, and the app server servesmcpServer/resource/readandmcpServer/tool/call. An ACP client has no way to reach any of it yet.This PR passes that support through to ACP clients with a small, opt-in extension. It uses only
_metaand_-prefixed methods, so clients that don't declare it see no change apart from one new key in the agent'sinitialize_meta._meta.mcpApps: {version: 1}in itsinitializecapabilities. The agent advertises_meta.mcpApps: {version, resourcesRead, toolsCall}, inagentCapabilities._metaon v1 andcapabilities._metaon v2._meta.mcpAppon app tool calls. A finishedmcpToolCallwith aui://resource (mcpAppUi.resourceUri, or the oldermcpAppResourceUri) gets{server, tool, resourceUri, toolResult}on its completion report, or on itstool_callwhen a session is replayed. It is sent only to clients that declared the capability, on v1 (AIR and standard reports) and v2._session/mcp/resources/readmaps tomcpServer/resource/readon the session's thread. It is limited toui://URIs and passes an optionaltoolCallIdon asoriginCallId._session/mcp/tools/callmaps tomcpServer/tool/callon the session's thread. Its result goes to the client, not the model. Codex runs these calls without an approval, socheckPermissions: trueis refused with Invalid request instead of running unchecked. The client can then ask the user itself.The same extension is proposed for claude-agent-acp, so a client can host apps for both agents the same way. The full description is in
docs/mcp-apps.md.Changes
src/McpApps.ts: the capability, the_meta.mcpAppbuilder from the thread item, the request parsers, and the result mapping.src/tool-calls/ClientCapabilities.ts,ToolFacts.ts,AcpToolCallRenderer.ts,reporters/McpToolReporter.ts: a newmcpAppfact, rendered as_meta.mcpAppfor clients withmcpApps.src/CodexAppServerClient.ts:mcpResourceReadandmcpServerToolCall.src/CodexAcpServer.ts,src/AcpAgentRouter.ts: the capability ininitialize, and the two methods on v1 and v2.src/__tests__/McpApps.test.ts: unit tests.src/__tests__/scenarios/baseline.ts:_meta.mcpAppsininitializeis an allowed difference from the baseline. The AIR golden files and theinitializefixtures change only in that key.docs/mcp-apps.md.Testing
npm run typecheckandnpm run buildpass.npm test: 2807 passed, 0 failed.@modelcontextprotocol/server-basic-vanillajs(theget-timeapp from ext-apps) over stdio, on ACP v1 and v2. The model turn ran against a local stub of the Responses API that callsget_timein themcp__basicnamespace. Results:initializeadvertises the capability;_meta.mcpAppwithserver: "basic",tool: "get-time",resourceUri: "ui://get-time/mcp-app.html"and the full result, includingstructuredContent;_session/mcp/resources/readreturns the 243,811-charactertext/html;profile=mcp-apppage;_session/mcp/tools/callreturnsstructuredContent;checkPermissions: trueis refused, an unknown tool fails with Codex's message, and a non-ui://read is refused;Notes
_meta.mcpAppstill comes, with the review's message as anisErrorresult. The frame can show the failure.mcpServer/tool/callas an Internal error withdata.details, not as anisErrorresult._meta.ui.visibility) from the model.