Merged
Conversation
jonathanlab
approved these changes
Mar 19, 2026
Contributor
jonathanlab
left a comment
There was a problem hiding this comment.
Nice! Tested that this works for me locally, great stuff 🚢
Member
Author
Merge activity
|
Let's support MCP Apps inside PostHog Code. This is done via a new service that's triggered when we start a new Code session. The best way to understand how this works is in the Archtiecture file. We use `AppBridge` provided by Anthropic to handle this. Integrating with ACP is not trivial because we don't have the raw tool call with us and we have to go through the ACP protocol, but this looks good!
decb327 to
595bc95
Compare
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.

This pull request adds comprehensive support for MCP Apps, which allows MCP servers to ship interactive HTML UIs alongside their tools. When a tool has an associated
ui://resource, the app renders the HTML inside a sandboxed iframe instead of showing raw tool input/output.Key Features
mcp-sandbox:protocol_meta.ui.resourceUrifields in MCP tool definitions@modelcontextprotocol/ext-appsAppBridgeArchitecture
The implementation spans both main and renderer processes:
Main Process:
McpAppsServicemanages server connections and acts as a proxy between renderer and MCP serversAgentServiceto apps via tRPC subscriptionsmcp-sandbox://proxyRenderer Process:
McpAppHostcomponent manages iframe lifecycle and AppBridge communicationuseAppBridgehook handles the complete bridge setup, context synchronization, and message routingSecurity Model
Apps run in a double-iframe sandbox where the outer iframe has an isolated origin (
mcp-sandbox://proxy) preventing access to the host's DOM, storage, or cookies. The inner iframe usesdocument.write()instead ofsrcdocto preserve origin for WebGL operations while maintaining security boundaries.Developer Experience