feat: MCP Apps (ext-apps) UI rendering support#2706
Closed
wesleysanjose wants to merge 1 commit intoarchestra-ai:mainfrom
Closed
feat: MCP Apps (ext-apps) UI rendering support#2706wesleysanjose wants to merge 1 commit intoarchestra-ai:mainfrom
wesleysanjose wants to merge 1 commit intoarchestra-ai:mainfrom
Conversation
Implement end-to-end MCP Apps support following the ext-apps spec: Backend: - Preserve _meta from MCP tool call results through the entire pipeline (mcp-client → CommonToolResult → mcp-gateway.utils → chat-mcp-client) - Add readResource() method to McpClient for fetching ui:// resources - When _meta.ui.resourceUri is detected, automatically read the HTML resource and embed it in the tool result for frontend rendering Frontend: - Extract _mcpMeta and _appHtml from wrapped tool output in ToolOutput - Render MCP App HTML in sandboxed iframe via srcdoc attribute - Support postMessage-based iframe resize (100-800px range) Tests: - Add _meta preservation tests (with and without _meta) - Add readResource tests (success, empty contents, tool not found) - All 2402 backend tests pass Closes archestra-ai#1301 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
|
Collaborator
📊 Reputation Summary
How is the score calculated? Read about it in the Reputation Bot repository 🤖 |
Contributor
|
hi there @wesleysanjose 👋 do you have a demo video showing how this works with two MCP servers which return "MCP-UI compatible responses"? |
Closed
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.
Summary
_metafrom MCPCallToolResultthrough the entire backend pipeline (mcp-client→CommonToolResult→mcp-gateway.utils→chat-mcp-client)readResource()toMcpClientfor fetchingui://resources via the MCP SDKresources/readmethodsrcdocattributepostMessage-based iframe resize per the ext-apps specHow it works
_meta.ui.resourceUri, the backend immediately reads the HTML resource from the same MCP server connection_mcpMetain the tool result JSON that flows to the frontendToolOutputcomponent detects the_appHtmlfield and renders it in a sandboxed iframeallow-scripts— no access to parent page, cookies, or navigationFiles changed
common-llm-format.ts_metafield toCommonToolResultmcp-client.ts_metaincreateSuccessResult, addreadResource()methodmcp-gateway.utils.ts_metain MCP Gateway tool call responseschat-mcp-client.ts_mcpMeta+_appHtmlin tool output, readui://resourcestool.tsxMcpAppFramewithsrcdocmcp-client.test.ts_metapreservation andreadResourceplatform-chat.mdTest plan
_meta.ui.resourceUriCloses #1301
🤖 Generated with Claude Code