Repository navigation
Description
Summary
The MCP Apps host is currently re-implemented once per frontend framework, each hand-rolling the app↔host protocol:
- React:
packages/react-core/src/v2/components/MCPAppsActivityRenderer.tsx - Vue:
packages/vue/src/v2/components/MCPAppsActivityRenderer.ts - Angular:
packages/angular/src/mcp-apps/lib/*
This triplication is the root cause of recurring drift between hosts. #6707 migrated the React host onto @modelcontextprotocol/ext-apps (AppBridge + PostMessageTransport), which ties it to the spec at compile time — but Vue and Angular still hand-roll everything, so the same widget now behaves differently depending on the host framework.
Proposal: a shared mcp-apps-support package
Extract a single, framework-agnostic package (working name @copilotkit/mcp-apps-support) that owns the whole host protocol layer on top of @modelcontextprotocol/ext-apps, and have each framework renderer become a thin adapter that only:
- creates/attaches the sandbox iframe in its own render model, and
- wires framework-specific glue (agent access, state updates).
The shared core would own everything that is currently copy-pasted and drifting:
AppBridge+PostMessageTransportwiring and the sandbox-proxy relay (buildSandboxHTML)- protocol-version negotiation (single
LATEST_PROTOCOL_VERSIONsource) - host-context seeding (theme/platform, and later display-mode / available-display-modes)
- the CopilotKit behaviors:
tools/callproxy + request queue,ui/messagerole/followUp extensions via_meta.copilotkit, thread-capture semantics (🐛 Bug: MCP app ui/message follow-up work can lose its enqueue-time thread context #5819),ui/open-linkscheme denylist, tool-input/result forwarding
Why now (concrete drift this removes)
Protocol version is the clearest example. After #6707, React negotiates the MCP Apps protocol version 2026-01-26 (via ext-apps LATEST_PROTOCOL_VERSION), while Vue and Angular still hardcode 2025-06-18:
packages/vue/src/v2/components/MCPAppsActivityRenderer.ts:9—const PROTOCOL_VERSION = "2025-06-18";packages/angular/src/mcp-apps/lib/mcp-apps-widget.ts:25—const PROTOCOL_VERSION = "2025-06-18";
Note 2025-06-18 is a base MCP protocol version, independent from the MCP Apps protocol (2026-01-26) — so these hosts are not just behind, they are advertising a version from a different spec line. Historically the same duplication produced other drift too (e.g. size-change vs the spec's size-changed, CSP directive mapping, incomplete capabilities). A shared package fixes this class of bug by construction.
Scope / sequencing
- React is the pilot (feat(react-core): migrate MCP Apps host to @modelcontextprotocol/ext-apps (AppBridge) #6707); it already consumes ext-apps directly and can be refactored to consume the shared package once it exists.
- Vue and Angular migrate onto the shared package next, deleting their hand-rolled protocol code.
- Follow-up work (display-mode, update-model-context, theme host-context) then lands once in the shared package and is available to all three frameworks.
Refs: #6707
Activity
copilotkit-outpost-bot commentedon Sep 1, 2026
Thanks for the detailed write-up. I want to be upfront about what I can and can't do here before responding.
What I can see vs. what I can't
My documentation context covers the user-facing MCP Apps integration (middleware setup,
MCPAppsMiddleware,serverIdconfiguration, etc.) — not CopilotKit's internal package structure or source files. So I haven't read the files you're referencing (MCPAppsActivityRenderer.tsx,mcp-apps-widget.ts, etc.), and I can't verify the specific drift you're describing.That said, the architectural proposal itself is something I can engage with meaningfully.
On the proposal
The core argument — that triplicating a protocol implementation across React/Vue/Angular creates a structural drift problem that a shared package fixes by construction — is a sound software engineering position. The protocol-version example you cite is a concrete, falsifiable illustration of the problem class, not just a theoretical concern.
A few things worth the team considering as they evaluate scope:
Iframe lifecycle ownership is the trickiest part of "thin adapter" claims. Each framework has meaningfully different opinions about when DOM nodes are created, destroyed, and re-used (React's reconciler, Vue's virtual DOM, Angular's change detection +
ViewContainerRef). The shared package's API surface will need to be designed so the adapter boundary is at the right level — too high and you leak framework assumptions into the core, too low and adapters still hand-roll too much.The
buildSandboxHTML/ CSP surface is a good candidate for shared ownership precisely because it's security-relevant and currently the kind of thing that gets quietly diverged (as you note with the CSP directive mapping history).Sequencing risk: if React is already on
ext-appsand Vue/Angular are not, there's a window where the shared package is being built while two frameworks are still on the old path. Worth being explicit about whether Vue/Angular get a direct migration or go through an intermediate "shared package v1" step.What I'd suggest
Since this is an architectural proposal touching internals across multiple packages, the right people to evaluate the tradeoffs are the CopilotKit maintainers directly — which is exactly where this issue already is. I don't have visibility into the team's current roadmap, package ownership, or whether there are constraints (e.g., bundle-size targets, monorepo tooling) that would affect the design.
The proposal is well-structured and the drift evidence is specific — that's the right format for the team to act on it. If you haven't already, tagging the maintainers who worked on #6707 would get it in front of the people with the most context on the
ext-appsmigration.Was there a specific technical question about the user-facing MCP Apps behavior I can help with in the meantime?
🤖 Generated by CopilotKit AI Support · Documentation
Was this helpful? React with 👍 or 👎
yannj-fr commentedon Sep 4, 2026
PR #6884 delivers the shared package + React pilot for this. Two pieces are deliberately deferred to the Vue/Angular follow-up and tracked here so they are not lost:
<copilotkit-mcp-app>web component (the intended shared consumption path for React/Vue/Angular): built, then pulled from the React-pilot PR since nothing consumes it there. Lands with the Vue/Angular adapters, its first real consumer.bindMcpAppis push-driven in the pilot (the adapter forwards tool input/result). The framework-agnostic end state is a self-subscribing core (messageId+onActivitySnapshotEvent/onActivityDeltaEvent+ self-push, unsubscribe in teardown), landing alongside the Vue/Angular adapters that benefit most from it.yannj-fr commentedon Sep 9, 2026
Status update
The React pilot (PR #6884) is essentially done and awaiting approval. Progress against this issue:
Delivered in #6884
@copilotkit/mcp-apps-rendererowning the whole app/host protocol layer on top of@modelcontextprotocol/ext-apps(bindMcpApp: AppBridge + PostMessage transport, sandbox proxy, per-thread request queue, ui/message role/followUp with 🐛 Bug: MCP app ui/message follow-up work can lose its enqueue-time thread context #5819 thread capture, ui/open-link scheme denylist, tools/call + resources/read proxy, tool input/result forwarding).bindMcpApp(786 -> ~250 LOC), dropping its direct@modelcontextprotocol/ext-appsdependency and the@modelcontextprotocol/sdkpeer (FR-007). The package is now the sole owner of the MCP libraries../activitysubpath so registering the activity never pulls the ext-apps bundle (the lazyimport()keeps the bridge out of the eager chunk; measured zero net bundle cost).LATEST_PROTOCOL_VERSION, sourced from the bridge itself (no hand-maintained literal).Next (own PRs, behavior-changing for their users)
PROTOCOL_VERSION(this is what removes the2025-06-18vs2026-01-26drift described above).<copilotkit-mcp-app>web component (the intended shared consumption path) lands with the Vue/Angular PR, its first real consumer.bindMcpAppgains an optional self-subscribing mode (messageId+ activity subscription + self-push) so all three adapters inherit forwarding for free.Related follow-up
srcdocapproach makes them same-origin). Pre-existing behavior, worth fixing once in the shared package.feat(mcp-apps-renderer): extract shared framework-agnostic MCP Apps h…
yannj-fr commentedon Sep 15, 2026
Vue and Angular are now migrated in #7161, which completes the sequencing described above: React was the pilot (#6707, #6884), and the two remaining hosts delete their hand-rolled protocol code rather than keeping a second copy.
Status against the scope listed in this issue:
AppBridge+PostMessageTransport+ sandbox relay2025-06-18literals quoted above are gone from both hostshostInfo/hostCapabilities/hostContext), which absorbs Angular'sMCP_APPS_CONFIGtools/callproxy + request queueui/messagerole/followUp via_meta.copilotkitresources/readandtools/callproxies, which no host guardedui/open-linkscheme denylistTwo things worth recording, because they were not simply a move:
The extraction happened before Vue and Angular moved onto it, so the shared host carried React's behaviour and none of the protections those two enforced locally. Migrating as-is would have dropped them. The queue now owns per-widget cancellation and agent+thread keying (from Angular) and the busy-agent timeout (from Vue); the session owns URI-based resource selection and UTF-8 base64 decoding (from Angular, where React and Vue had the bug:
atobmangled non-ASCII widget HTML).The link policy diverged rather than converged at first. Angular restricted to http(s), which predated the decision to allow app-defined deep links. Keeping that as a per-framework option would have meant the same widget behaving differently depending on the host, with no way for an application to choose, since no adapter exposed the setting. The policies are merged instead: the denylist stays, and the two guarantees only Angular had (embedded credentials refused, relative paths resolved) now apply everywhere.
Follow-up work named in this issue (display-mode, update-model-context, theme host-context) can now land once in the shared package.
feat(mcp-apps): consolidate the Vue and Angular hosts onto the shared…
feat(mcp-apps): fullscreen display mode through ui/request-display-mo…