Repository navigation
fix(example): isolate MCP app preview origin - #7999
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Sandbox permissions examples/showcases/open-mcp-client/apps/web/app/components/McpAppPreview.tsx |
The iframe sandbox retains allow-scripts and no longer grants allow-same-origin. |
Priority:
Estimated code review effort: 1 (Trivial) | ~3 minutes
Change: Bug fix · Severity of issue fixed: High
Possibly related issues
- Issue 6910 describes the same host-origin access problem for MCP Apps. This change removes same-origin access from the open-mcp-client preview.
- Issue 7119 requests origin isolation for MCP Apps examples. This change applies opaque-origin sandboxing to the preview.
Possibly related PRs
- CopilotKit/CopilotKit#7896: Both changes remove
allow-same-originfrom MCP app iframe sandboxing. PR 7896 updates the shared renderer; this PR updates the standalone preview.
Merge Risk: 
Minimal · up to 7f0bb
-
The preview now isolates connected app content from the host origin as intended, with no merge-blocking risk identified.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title "fix(example): isolate MCP app preview origin" matches the main change. The PR removes allow-same-origin from the McpAppPreview iframe sandbox, so the preview gets an opaque origin. The title names the area (example), the component effect (origin isolation), and the fix type. It is specific and concise, and it does not use vague terms.
Full details: Linked Issues check
-
Explanation
Issue
#7997requires theopen-mcp-clientpreview iframe to stop inheriting the host origin. The diff changessandbox="allow-scripts allow-same-origin"tosandbox="allow-scripts"inMcpAppPreview.tsx. This preserves script execution and removesallow-same-origin, which gives thesrcDocdocument an opaque origin. No additional coding or test requirement appears in the linked issue.
Full details: Out of Scope Changes check
-
Explanation
The pull request changes one sandbox attribute in the exact file and iframe identified by issue
#7997. The change directly implements origin isolation. No unrelated changes are present in the reviewed diff.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
BenTaylorDev
left a comment
There was a problem hiding this comment.
Verified: the host side matches on event.source and posts with targetOrigin "*", so the preview's messaging doesn't depend on the iframe's origin, and dropping allow-same-origin gives the app an opaque origin, the same default #7896 set for @copilotkit/mcp-apps-renderer. The public/sandbox.html proxies in the other MCP Apps examples are tracked separately in #7119. Thanks for the quick fix.
I bless the code with a glad heart
What does this PR do?
Removes
allow-same-originfrom the MCP app preview iframe. Connected app HTML keeps script execution and preview messaging but receives an opaque origin, preventing access to the host app's cookies and storage.Related PRs and Issues
Fixes #7997
Validation
srcDocorigin-isolation probe passed.git diff --checkpassed.react-hooks/set-state-in-effectfinding at unchanged line 29; targeted lint passes with that rule suppressed.tsc --noEmitis blocked by the existing missing./image.pngimport inapp/page.tsx.Checklist
Summary by CodeRabbit