SuperAPI AI 工具集

json-render-mcp

智能体与模型

查看项目

更新于 10-16 04:53

技能介绍

用途:@json-render/mcp 是 json-render 的 MCP Apps 集成,用于构建在 Claude、ChatGPT、Cursor、VS Code 等支持 MCP 的客户端中渲染交互式 UI 的 MCP 服务器。在 pmx-canvas 中,优先使用原生的 canvas_add_json_render_node 与 canvas_add_graph_node 工具,它们把校验后的规格直接存入 canvas 节点状态,并通过本地 pmx-canvas 查看器路由渲染,无需单独的 sidecar 服务器。

主要能力:createMcpApp() 创建 McpServer,注册 render-ui 工具和 ui:// HTML 资源;工具描述包含 catalog 提示,使 LLM 能生成有效规格;HTML 资源是经 Vite 打包的单文件 React 应用,内含 json-render 渲染器;iframe 内 useJsonRenderApp() 通过 postMessage 连接宿主并渲染规格。

服务端 API:createMcpApp(options) 主入口,创建完整 MCP 服务器;registerJsonRenderTool(server, options) 在已有服务器上注册 json-render 工具;registerJsonRenderResource(server, options) 注册 UI 资源。客户端 API(@json-render/mcp/app):useJsonRenderApp(options?) 返回 { spec, loading, connected, error, callServerTool };buildAppHtml(options) 从打包的 JS/CSS 生成 HTML。

使用方式:服务端安装 npm install @json-render/mcp @json-render/core @modelcontextprotocol/sdk;客户端安装 npm install @json-render/react @json-render/shadcn react react-dom;构建工具安装 npm install -D vite @vitejs/plugin-react vite-plugin-singlefile。用 Vite + vite-plugin-singlefile 将 React 应用打包为单个自包含 HTML 文件。客户端配置示例:Cursor 在 .cursor/mcp.json 中配置 mcpServers,Claude Desktop 在配置中设置 command 为 npx、args 为 tsx 与 server.ts --stdio。

适用场景:需要在 MCP 客户端内呈现交互式 UI 的 MCP 服务器开发,或集成 json-render 渲染能力。

限制:资料未提供收费、价格、平台支持范围、性能与效果等信息;具体版本兼容性、错误处理细节暂未提供。