Skip to content

Embed visualizations inline in Claude Desktop via (CSP bypass)#13

Open
SuMayaBee wants to merge 12 commits into
panel-extensions:mainfrom
SuMayaBee:feature/two-endpoint-approach
Open

Embed visualizations inline in Claude Desktop via (CSP bypass)#13
SuMayaBee wants to merge 12 commits into
panel-extensions:mainfrom
SuMayaBee:feature/two-endpoint-approach

Conversation

@SuMayaBee
Copy link
Copy Markdown
Collaborator

@SuMayaBee SuMayaBee commented May 23, 2026

Description

Claude Desktop blocks localhost iframes via CSP, so visualizations never loaded there.

This PR fixes that by rendering each snippet as a self-contained HTML page and injecting it directly via iframe.srcdoc instead of loading it by URL. The HTML is compressed before delivery to stay within context limits. If the code uses Python callbacks that won't work without a live server, a placeholder is shown instead of a broken widget.

Other clients (Cursor, VS Code) are unaffected.

Screen Recording

Claude Desktop

  1. generate 2 random cols and plot a scatter plot (will show inline)
  2. plot a sine wave (will show inline)
  3. create a click me button and it will show how many times I clicked (Need server, showed a button to open in browser)
Claude.Desktop.mp4

Cursor/VScode (Not affected)

(Ask anything, it won't changed and always shows inline with iframe)

  1. generate 2 random cols and plot a scatter plot.
  2. plot a sine wave.
  3. create a click me button and it will show how many times I clicked.
Cursor.mp4

AI Disclosure

  • Tool & Model: Claude Code + Sonnet 4.6
  • I have tested all AI-generated content in my PR.
  • I take responsibility for all AI-generated content in my PR.

Checklist

  • Tests added and are passing
  • Added documentation

@ahuang11
Copy link
Copy Markdown
Contributor

Looks great! Can you run https://holoviz-dev.github.io/holoviz-skills/contributing-to-holoviz/cleanup/ before I review in depth?

@ahuang11
Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants