Repository navigation
Add an MCP App runtime for front components - #32461
Draft
FelixMalfait wants to merge 2 commits into
Draft
FelixMalfait wants to merge 2 commits into
FelixMalfait wants to merge 2 commits into
Conversation
MCP Apps hosts (Claude, ChatGPT, VS Code...) render a tool's UI in a sandboxed iframe whose CSP forbids blob workers and blob or data module imports, so the worker renderer cannot run there. The iframe already is the sandbox, so this runtime renders the component on its real DOM: component bundles are DOM-agnostic and fall back to plain React JSX when no remote-dom tag map is installed. - `src/mcp-app/bootFrontComponentMcpApp.ts` connects the ext-apps `App`, turns tool input, result and cancellation notifications into the execution context's `toolCall`, maps the host theme and locale, and installs the host communication API over MCP: Twenty pages open in Twenty through `openLink`, `unmountFrontComponent` requests teardown, `closeSidePanel` leaves fullscreen, and actions without an MCP equivalent reject with `FRONT_COMPONENT_MCP_APP_HOST_ACTION_UNAVAILABLE`, as previews do. - The reader's application token and public variables come from an app-only session tool, called on boot and on token refresh, so the document itself stays cacheable and user-agnostic. - The contract between this runtime and the server (session tool name, boot config, session) lives in `twenty-shared/application`. - The server does not build the renderer, so the runtime is bundled by `mcp-app:generate` into a JSON module the server links into each document, with a test that fails when it drifts from its source, as the AI front component SDK module does. - The environment utilities and host API state move out of `remote/worker` since both renderers now share them; `setWorkerEnvironmentVariables` becomes `setFrontComponentEnvironmentVariables`.
This was referenced Dec 5, 2026
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
🔍 Visual Regression Review —
|
| Story | Verdict | Confidence | Explained by | |
|---|---|---|---|---|
| 🟡 | ui-surfaces-dialog--non-modal-page-interaction |
uncertain | 60% | none |
| 🟡 | ui-components-codeeditor--auto-height |
uncertain | 55% | none |
| 🟡 | ui-components-codeeditor--model-lifecycle |
uncertain | 55% | none |
| 🟡 | ui-components-codeeditor--default |
uncertain | 60% | none |
| 🟡 | ui-components-codeeditor--editing |
uncertain | 55% | none |
| 🟡 | ui-components-codeeditor--theme-precedence |
uncertain | 55% | none |
| 🟡 | ui-components-codeeditor--dark |
uncertain | 55% | none |
| 🟡 | ui-components-codeeditor--bounded-resizable |
uncertain | 55% | none |
| 🟡 | ui-components-codeeditor--css-height-resizable |
uncertain | 55% | none |
| 🟡 | ui-components-codeeditor--resizable |
uncertain | 55% | none |
Changed stories
| Story | Diff % |
|---|---|
| ui-components-codeeditor--default | 1% |
| ui-surfaces-dialog--non-modal-page-interaction | 1% |
| ui-components-codeeditor--auto-height | 1% |
| ui-components-codeeditor--model-lifecycle | 1% |
| ui-components-codeeditor--dark | 0% |
| ui-components-codeeditor--bounded-resizable | 0% |
| ui-components-codeeditor--css-height-resizable | 0% |
| ui-components-codeeditor--editing | 0% |
| ui-components-codeeditor--theme-precedence | 0% |
| ui-components-codeeditor--resizable | 0% |
| ui-components-codeeditor--controlled-value | 0% |
View run details · advisory mode
🔍 Visual Regression Review —
|
| Story | Verdict | Confidence | Explained by | |
|---|---|---|---|---|
| 🟡 | ui-data-field-input-richtextfieldinput--default |
uncertain | 60% | none |
| 🟡 | modules-objectrecord-recordform-recordformfieldinputs--address |
uncertain | 60% | none |
| 🟡 | ui-data-field-form-input-formmultirecordpicker--multiple-selection-and-session-r… |
uncertain | 60% | none |
| 🟡 | modules-settings-applications-settingsapplicationiframemediapermissionssection--… |
uncertain | 65% | none |
| 🟡 | modules-recordexport-connection--page-hide |
uncertain | 70% | none |
| 🟡 | modules-pagelayout-widgets-recordpagenotewidget--dashboard-selection |
uncertain | 60% | none |
| 🟡 | modules-pagelayout-widgets-recordpagenotewidget--align-text |
uncertain | 60% | none |
| 🟡 | modules-ai-aichattab--new-chat-suggested-prompt |
uncertain | 70% | none |
Changed stories
| Story | Diff % |
|---|---|
| ui-data-field-input-richtextfieldinput--default | 16% |
| modules-objectrecord-recordform-recordformfieldinputs--address | 11% |
| ui-data-field-form-input-formmultirecordpicker--multiple-selection-and-session-reset | 5% |
| modules-settings-applications-settingsapplicationiframemediapermissionssection--reports-failed-refresh | 4% |
| modules-recordexport-connection--page-hide | 2% |
| modules-pagelayout-widgets-recordpagenotewidget--dashboard-selection | 1% |
| modules-pagelayout-widgets-recordpagenotewidget--align-text | 1% |
| modules-sidepanel-composerpages--calendar-event-without-account-permission | 0% |
| modules-sidepanel-composerpages--calendar-event-without-accounts | 0% |
| modules-ai-aichattab--new-chat-suggested-prompt | 0% |
| modules-sidepanel-recordcreationflow--submit-with-command-enter | 0% |
| modules-sidepanel-recordcreationflow--submit-with-button | 0% |
| modules-sidepanel-recordcreationflow--submit-with-control-enter | 0% |
| modules-sidepanel-recordcreationflow--retry-after-failed-creation | 0% |
| modules-sidepanel-snoozeaichat--day-and-time-picker | 0% |
| modules-sidepanel-composerpages--calendar-event | 0% |
| modules-activities-files-videopreview--player | 0% |
| modules-activity-taskgroups--empty | 0% |
| modules-ai-aichattab--open-original-from-reply | 0% |
| modules-ai-aichattab--reply-to-teammate | 0% |
View run details · advisory mode
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.
Stack (MCP Apps, Twenty as an MCP Apps server), merge in order: 1. runtime → 2. resources → 3. tool binding → 4. generic mode → 5. findMany through a view → 6. View Cards app.
What
Front components can now render inside MCP Apps hosts (Claude, ChatGPT, VS Code…), not only inside Twenty. This PR adds the runtime that runs in the host's iframe.
Why a second runtime
MCP Apps hosts render a tool's UI in a sandboxed iframe whose CSP forbids blob workers and blob/data module imports, so the worker renderer cannot run there. Since the iframe already is the sandbox, this runtime renders the component on its real DOM: component bundles are DOM-agnostic and fall back to plain React JSX when no remote-dom tag map is installed.
Changes
src/mcp-app/bootFrontComponentMcpApp.tsconnects the ext-appsAppand turns tool input, result and cancellation notifications into the execution context'stoolCall. It maps the host's theme and locale and installs the host communication API over MCP:openLink(navigate,openSidePanelPage).unmountFrontComponentrequests teardown.closeSidePanelleaves fullscreen.FRONT_COMPONENT_MCP_APP_HOST_ACTION_UNAVAILABLE, as previews do.twenty-shared/application.mcp-app:generatebundles the runtime into a JSON module the server links into each document. A test fails when it drifts from its source, as with the AI front component SDK module.remote/workerbecause both renderers share them;setWorkerEnvironmentVariablesbecomessetFrontComponentEnvironmentVariables.Regenerating the runtime
https://claude.ai/code/session_01BC19MT31DvLYvxzeBBUKWi
Generated by Claude Code