feat(playground): support MCP Apps with sandboxed iframe views#1937
Merged
feat(playground): support MCP Apps with sandboxed iframe views#1937
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds MCP Apps support to the chat playground by discovering UI-enabled MCP tools, fetching their UI resources via IPC, and rendering interactive HTML UIs in a sandboxed iframe alongside tool call output.
Changes:
- Advertises the MCP UI extension capability to MCP servers and caches per-tool UI metadata for each stream.
- Adds IPC surface to fetch UI resources / proxy tool calls and streams UI metadata to the renderer.
- Introduces renderer hook + view component to render MCP App UIs (inline/fullscreen) with CSP meta injection and permissions allowlist.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| renderer/src/features/chat/hooks/use-mcp-app-metadata.ts | New hook to read cached tool→UI metadata and subscribe to stream updates. |
| renderer/src/features/chat/hooks/tests/use-mcp-app-metadata.test.ts | Unit tests for the metadata hook behavior and subscriptions. |
| renderer/src/features/chat/components/mcp-app-view.tsx | New iframe-based MCP App renderer + AppBridge integration + fullscreen mode. |
| renderer/src/features/chat/components/tests/mcp-app-view.test.tsx | Component tests covering loading/error, CSP injection, toolbar, and callbacks. |
| renderer/src/features/chat/components/chat-message.tsx | Renders McpAppView after tool output when UI metadata is present. |
| preload/src/api/chat.ts | Exposes new chat IPC methods for UI metadata/resources and proxy tool calls. |
| main/src/utils/mcp-tools.ts | Adds buildRawTransport() to create SDK transports for raw MCP Client usage. |
| main/src/utils/tests/mcp-tools.test.ts | Fixes import path for utils transport tests. |
| main/src/chat/mcp-tools.ts | Implements UI capability advertisement, UI metadata cache, UI resource fetch, and tool-call proxying. |
| main/src/chat/tests/mcp-tools.test.ts | Adds test coverage for new UI metadata/resource/proxy behavior and capability advertising. |
| main/src/ipc-handlers/chat/mcp-apps.ts | New IPC handlers for UI metadata fetch, UI resource fetch, tool call proxy, and external link opening. |
| main/src/ipc-handlers/chat/index.ts | Registers the new MCP Apps IPC handlers. |
| main/src/chat/streaming.ts | Emits tool UI metadata at the start of each streaming session. |
| main/src/csp.ts | Relaxes Electron CSP to allow blob/self frames/children for app iframe requirements. |
| main/src/chat/types.ts | Adds optional uiResourceUri field to tool metadata type. |
| package.json | Adds @modelcontextprotocol/ext-apps dependency. |
| pnpm-lock.yaml | Locks @modelcontextprotocol/ext-apps@1.5.0. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
…id per-message subscriptions
peppescg
reviewed
Apr 9, 2026
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.
Adds support for MCP Apps in the playground chat, allowing MCP tools that declare a
uiresource to render interactive sandboxed HTML interfaces alongside their tool call results.mcp-apps/2026-01-26capability when connecting to MCP serversUiResourceMetadata(HTML, CSP, permissions,prefersBorder) via a newchat:fetch-ui-resourceIPC handlerchat:stream:tool-ui-metadatasrcdociframes with server-declared CSP injected via<meta>tagsinline/fullscreen) usingAppBridgeand a host-side toolbarblob:iframes required by the specKapture.2026-04-08.at.17.21.48.mp4