Skip to content

[Proposal] Features for speeding up slow Python/ Pyodide based apps #513

@MarcSkovMadsen

Description

@MarcSkovMadsen

MCP Apps: Pyodide/WASM apps take >2 minutes to load in Claude.ai webview

Summary

MCP Apps that use Pyodide (Python in WebAssembly) take over 2 minutes to load in Claude.ai's MCP App webview. The same app loads in ~5 seconds in VS Code Copilot Chat.

Claude believes the root cause is that Claude.ai's webview does not set Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers, so window.crossOriginIsolated is false and Pyodide cannot use SharedArrayBuffer.

Reproduction

  1. Start an MCP server that returns an MCP App using Pyodide:
    pip install "panel-live[mcp] @ git+https://github.com/panel-extensions/panel-live.git"
    panel-live mcp --transport streamable-http --port 5002
  2. Expose via ngrok: ngrok http 5002
  3. In Claude.ai: Settings > Connectors > Add custom connector > paste ngrok URL + /mcp
  4. Ask: "Create an interactive sine wave with a frequency slider"
  5. Observe: the MCP App webview shows "Loading Python runtime..." for >2 minutes

The same flow in VS Code Copilot Chat (which Claude claims provides COOP/COEP headers) loads in ~5 seconds.

Expected behavior

MCP App webviews should set these HTTP headers on the iframe/webview:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

This enables window.crossOriginIsolated = true, which allows SharedArrayBuffer, which Pyodide uses for efficient memory sharing between the main thread and workers.

Why this matters

Pyodide (Python in WebAssembly) is the runtime behind panel-live MCP tool that render interactive data apps in chat.

Without cross-origin isolation, Pyodide falls back to a slow single-threaded path. The 2+ minute load time makes the experience impractical for users.

Environment

  • Claude.ai web (Pro plan)
  • MCP server: panel-live with FastMCP 3.0.2, streamable-http transport
  • Tunnel: ngrok
  • Browser: Chrome (latest)

Gif

This gif is speeded up 10 times. You can see that panel-live can load. But it takes +2 mins.

Image

Workaround

According to Claude VS Code Copilot Chat provides COOP/COEP headers

Panel Live loads in ~5 seconds.

Image

Claude.ai

Reported in 215473300183121.

Latest Updates

Please refer to https://panel-extensions.github.io/panel-live/tutorials/getting-started-mcp/ for the latest updates for installing and using the panel-live MCP server.

Please report issues at https://github.com/panel-extensions/panel-live.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions