🐛 fix: Restore MCP App Rendering and Startup - #16382
Draft
dustinhealy wants to merge 1 commit into
Draft
dustinhealy wants to merge 1 commit into
dustinhealy wants to merge 1 commit into
Conversation
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.
Summary
PR #13831 was rebased and retargeted to
canaryimmediately before merge. Following that integration, MCP Apps could be detached from their originating tool calls and rendered at the bottom of the message, fail their initial bridge initialization until Retry, fail when bundled code resolved against ablob:document URL, or be blocked by an inheritedX-Frame-Optionsheader. Validation could also be delayed or blocked while loading unrelated MCP server configurations.This change restores tool-owned inline rendering, makes bridge initialization safe under React Strict Mode and iframe navigation races, loads opaque inner App documents through
srcdoc, binds bridge messages to the exact live iframe and sandbox origin, removes conflicting inherited frame headers at the sandbox boundary, and resolves only the MCP server referenced by the persisted App binding.How it works
The inner View remains origin-opaque and retains the existing CSP injection, nonce attestation, liveness heartbeat, parent-origin binding, and bounded message queues.
Type of change
Testing
srcdocView.Tested environments/configuration:
canaryAutomated tests:
npm run typecheckinclientnpx tsc --noEmitinpackages/apiScreenshots / recordings
These captures show the local MCP App reference and integration servers rendering in LibreChat after the fix. The pre-fix failures occurred on the rebased and retargeted
canaryintegration and are reproduced by the regression tests above.Risk / compatibility
The bridge transport and sandbox boundary are security-sensitive. Incoming messages must match both the live iframe window and its exact origin, and the inner App View remains origin-opaque. There are no database migrations, configuration changes, new dependencies, or changes to the MCP App model-context contract.
Checklist