mirror of
https://github.com/vercel-labs/json-render.git
synced 2026-09-14 13:41:32 +08:00
9adcc09204
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
MCP App Example
A json-render MCP App that serves interactive shadcn/ui-based UIs directly inside Claude, ChatGPT, Cursor, VS Code, and other MCP-capable clients.
Setup
pnpm install
pnpm build
Usage
With Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"json-render": {
"command": "npx",
"args": ["tsx", "examples/mcp/server.ts", "--stdio"]
}
}
}
With Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"json-render": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/examples/mcp/server.ts", "--stdio"]
}
}
}
HTTP Transport
pnpm start
# Server listens on http://localhost:3001/mcp
Stdio Transport
pnpm start:stdio
How It Works
- The Vite build bundles the React app (with shadcn components and
useJsonRenderApphook) into a single self-contained HTML file - The MCP server registers a
render-uitool with the catalog prompt as its description - When the LLM calls the tool, it generates a json-render spec constrained to the catalog
- The host renders the bundled HTML in a sandboxed iframe
- The iframe receives the spec via the MCP Apps protocol and renders it with json-render