Skip to content

Conversation

@antonpk1
Copy link
Collaborator

@antonpk1 antonpk1 commented Dec 9, 2025

Summary

  • Fix RESOURCE_MIME_TYPE constant to match spec: text/html;profile=mcp-app (was incorrectly text/html;profile=mcp)
  • Add CSP field to McpUiSandboxResourceReadyNotification type and schema for passing security policy from resources to sandbox
  • Update basic-host to extract and pass CSP metadata from resource _meta.ui.csp
  • Update sandbox.ts to dynamically inject CSP meta tag into inner iframe based on resource metadata
  • Remove static CSP from sandbox.html (now dynamic per-resource)
  • Update QR server to use custom read_resource handler for _meta injection (FastMCP workaround)
  • Update requirements.txt to require mcp[cli]>=1.23.3

Test plan

  • Build project with npm run build
  • Start QR server: cd examples/qr-server && python server.py
  • Start basic-host: cd examples/basic-host && SERVERS='["http://localhost:3108/mcp"]' bun serve.ts
  • Open http://localhost:8080, select QR Server, call generate_qr with {"text": "https://example.com"}
  • Verify QR code renders in widget (SDK loads from unpkg.com via CSP)

🤖 Generated with Claude Code

- Fix RESOURCE_MIME_TYPE to match spec: "text/html;profile=mcp-app"
- Add CSP field to McpUiSandboxResourceReadyNotification type and schema
- Update basic-host to extract and pass CSP metadata from resources
- Update sandbox.ts to dynamically inject CSP meta tag into inner iframe
- Remove static CSP from sandbox.html (now dynamic based on resource metadata)
- Update QR server to use custom read_resource handler for _meta injection
- Update requirements.txt to require mcp[cli]>=1.23.3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@antonpk1 antonpk1 force-pushed the fix-qr-server-widget branch from 8345658 to b6cf699 Compare December 9, 2025 19:10
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 9, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/ext-apps@111

commit: b6cf699

Copy link
Collaborator

@ochafik ochafik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Anton!

@ochafik ochafik merged commit 6a8f503 into main Dec 9, 2025
8 checks passed
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.

3 participants