Skip to content

open-mcp-client example: the MCP app preview iframe runs on the host origin (srcdoc + allow-same-origin) #7997

Closed

Description

@BenTaylorDev

examples/showcases/open-mcp-client/apps/web/app/components/McpAppPreview.tsx:199 renders the MCP server's app HTML like this:

<iframe srcDoc={htmlSource} sandbox="allow-scripts allow-same-origin" />

A srcdoc document with allow-same-origin runs on the host page's origin. An app from any MCP server that the user connects can then read the host's cookies and storage. It can also write into the host page. This is the same defect as #6910, which #7896 fixes in @copilotkit/mcp-apps-renderer. This example builds its own iframe, so that fix does not reach it.

Fix: drop allow-same-origin so that the app gets an opaque origin. Another option is to render the preview through the renderer package. This is example code, but users copy examples.

Activity

  1. copilotkit-outpost-bot commented on Oct 26, 2026

    @copilotkit-outpost-bot

    ⚠️ This is an AI-generated response.

    This needs a maintainer review to give you a reliable next step.


    🤖 Generated by CopilotKit AI Support · Documentation


    Was this helpful? React with 👍 or 👎

  2. added a commit that references this issue on Oct 28, 2026
    f491212
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions