-
Notifications
You must be signed in to change notification settings - Fork 19
Add MCP Apps protocol support for Chartifact embeddings #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Create MCP adapter package with JSON-RPC 2.0 protocol implementation - Add MCP-compatible viewer at /mcp-view/ - Implement guest messenger for iframe communication - Add example MCP server with chart and dashboard tools - Update README with MCP Apps information - Add comprehensive documentation Co-authored-by: danmarshall <[email protected]>
- Create interactive test harness for local development - Add comprehensive integration guide for developers - Document architecture with diagrams and message flows - Add .gitignore for mcp-adapter package Co-authored-by: danmarshall <[email protected]>
Co-authored-by: danmarshall <[email protected]>
- Update @modelcontextprotocol/sdk from 0.5.0 to ^1.25.2 - Fixes ReDoS vulnerability (CVE in versions < 1.25.2) - Fixes DNS rebinding protection issue (< 1.24.0) - Add security notes to documentation - Update example server README with security information Co-authored-by: danmarshall <[email protected]>
|
@copilot any reason to create https://microsoft.github.io/chartifact/mcp-view/ and not just add functionality to our existing https://microsoft.github.io/chartifact/view/ ? |
Good point! You're right that we could consolidate. The existing I initially created a separate endpoint for:
However, we could merge them by detecting Would you prefer I consolidate into |
|
@copilot /view/ uses the |
- Add MCP JSON-RPC 2.0 protocol handling to host package - Detect MCP mode via ?mcp URL parameter - Automatically disable clipboard, drag-drop, file upload in MCP mode - Remove separate /mcp-view/ endpoint - use single /view/ for both - Update all documentation and examples to use /view/?mcp - Remove mcp-adapter package and mcp-view directory Per feedback: integrate MCP into host package with protocol detection Co-authored-by: danmarshall <[email protected]>
Done! Consolidated MCP protocol into the existing
The single |
Chartifact can now be embedded as an interactive UI in MCP-compatible clients (Claude, VS Code, ChatGPT) via the Model Context Protocol Apps extension. This leverages the existing sandboxed renderer architecture with a JSON-RPC 2.0 protocol adapter integrated into the host package.
Implementation
Protocol Layer (
packages/host/src/)message.jsonrpc === '2.0'for MCP vsmessage.typefor standard messagesinitialize,ui/render,ui/get-content,ui/clearViewer (
docs/view/)/view/endpoint with MCP support via?mcpURL parameterui/readynotification when in MCP contextExample Server (
demos/mcp-server/)create_chartandcreate_dashboardtoolsUsage
MCP servers return Chartifact visualizations as UI resources:
The MCP client embeds the viewer iframe with the
?mcpparameter, which handles JSON-RPC protocol translation and delegates to the existing Chartifact host for rendering.Architecture Decisions
/view/endpoint handles both standard and MCP protocolsjsonrpcproperty?mcpparameter disables interactive features for embeddingpackages/host/src/where postMessage logic existsTesting
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.