op-product-design-mcp
This MCP server lets AI assistants create, view, update, validate, preview, and export HTML prototypes following the Spark OP design spec.
get_brief: read the mandatory workflow, SKILL.md, and visual rules before generating or modifying a prototype.create_prototype: create a new prototype from a slug/title, with optional template scaffolding or example-based start, then open a live preview.get_prototype: read the current prototype HTML for incremental edits.update_prototype: overwrite a prototype and hot-reload the open preview.start_preview: start the local hot-reload HTTP server and return the browser URL.list_prototypes: list generated prototypes and their preview URLs.validate_prototype: statically check HTML or an existing slug against the skill's hard rules without writing files.export_prototype: export a self-contained single-file HTML (inline CSS, no hot-reload script) for developer handoff.get_bundled_css: get the concatenated tokens + theme + layout CSS that must be inlined in generated HTML.Multi-editor coordination: automatically elects a Leader/Follower to share the preview port across multiple AI IDEs.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@op-product-design-mcp 按火花 OP 规范,做一个用户管理页原型"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OP 原型 MCP
按火花 OP 设计规范生成可预览 HTML。Skill 负责触发和工作流,MCP 负责校验、落盘、预览和导出。
用户需求 → Skill → MCP → http://127.0.0.1:5179/<slug>/ → 修改仍走 MCP → 热更新 → 导出给开发MCP 不自己画页面。宿主 AI 读 Skill 写 HTML;MCP 是唯一出口。
flowchart LR
Agent1[AI_IDE_1] -->|stdio_MCP| Proc1[MCP_Process_1]
Agent2[AI_IDE_2] -->|stdio_MCP| Proc2[MCP_Process_2]
Proc1 -->|Election| Role1{Leader}
Proc2 -->|Election| Role2{Follower}
Role1 -->|HTTP_5179| Preview[Preview_Server]
Role2 -->|RPC_via_Leader| Role1多编辑器支持:多个 AI IDE(Cursor、Codex、Claude Code、Trae 等)可同时运行本 MCP。通过 Leader/Follower 选举,只有 Leader 占用 5179 端口,Follower 通过 Leader 协调预览。参见 多 IDE 协调。
完整接入说明(Codex / Cursor / Claude Code / Trae / Qoder / CodeBuddy / WorkBuddy): docs/usage.md
环境要求(先装 Node.js)
本工具跑在你自己的电脑上,预览是本机 127.0.0.1:5179,不是云端。
必须先安装 Node.js ≥ 18(会自带 npm / npx)。没装 Node 时,MCP 和 Skill 的安装命令都执行不了。
英文官网:https://nodejs.org/
macOS 也可用:
brew install node
装完新开终端检查:
node -v # 应 ≥ v18
npx -v用的人不必装 pnpm、也不必 clone 仓库。改本仓库才需要 pnpm。配置里不要钉死版本。
Related MCP server: framery
快速开始
先接 MCP,再装 Skill。Skill 两种安装方式都支持,选一种即可。
1. 接入 MCP(任选一)
Codex ~/.codex/config.toml:
[mcp_servers.op-prototype]
command = "npx"
args = ["-y", "op-product-design-mcp"]codex mcp add op-prototype -- npx -y op-product-design-mcpCursor / Trae / WorkBuddy / 多数编辑器,用户级或项目级 mcp.json:
{
"mcpServers": {
"op-prototype": {
"command": "npx",
"args": ["-y", "op-product-design-mcp"]
}
}
}平台 | 配置位置 |
Codex |
|
Cursor |
|
Claude Code |
|
Trae | Settings → MCP;或 |
Qoder | Settings → MCP → Add |
CodeBuddy | Settings → MCP |
WorkBuddy |
|
逐步说明见 docs/usage.md。
2. 安装 Skill(两种方式都支持)
效果相同:自动拷到 Codex 的 ~/.agents/skills,以及本机已有的 Cursor / Claude / Trae / CodeBuddy / WorkBuddy 目录。
方式一,npx:
npx -y op-product-design-mcp install方式二,curl 脚本(类似 brew / oh-my-zsh):
curl -fsSL https://raw.githubusercontent.com/ChinaCarlos/op-product-design-mcp/main/scripts/install.sh | bash只配 MCP、忘了跑上面两条时,服务启动也会静默注入一次。
指定目录:
npx -y op-product-design-mcp install .cursor/skills兼容旧命令:npx -y op-product-design-mcp install-skill。装完请新开一轮对话。
3. 使用
对 AI 说:「按火花 OP 规范,做/改 xxx 管理页原型」。
Skill 被选中,先
get_briefcreate_prototype/update_prototype内置浏览器打开
http://127.0.0.1:5179/<slug>/(不要file://)定稿
export_prototype,把out/<slug>/<slug>.html丢给开发
禁止绕开 MCP 改 hop src/,禁止 antd 5 / Tailwind / 真实接口。
工具
工具 | 作用 |
| Skill + 硬规则 + 工作流 |
| 创建并打开预览 |
| 读当前 HTML,供增量修改 |
| 覆盖写入并热更新 |
| 只启动/返回预览 URL |
| 已有原型 |
| 静态规范检查 |
| 导出可转发单文件 HTML 给开发 |
| 应内联的 tokens/theme/layout |
Resources:op-prototype://skill、visual、template、example、CSS。
预览默认只占 5179 一个端口,多页面用路径区分。写盘后按 slug 热更新。
工作稿:当前工作区 out/<slug>/preview.html。
交付件:out/<slug>/<slug>.html(无热更新脚本、无下载按钮)。
本仓库开发
pnpm install
pnpm build
node dist/cli.js # MCP stdio
npx -y op-product-design-mcp install
pnpm smoke
pnpm smoke:multi # 多进程 Leader/Follower规范包:skills/spark-op-prototype/SKILL.md、references/visual.md、styles/、templates/preview.html、examples/wall-manage.preview.html。
架构细节见 docs/architecture.md。
环境变量:OP_PROTOTYPE_OUT 覆盖工作区根目录;OP_PROTOTYPE_ROOT 覆盖包根(一般不用);OP_PROTOTYPE_SKIP_SKILL_INSTALL=1 关闭 MCP 启动时自动注入 Skill;OP_PROTOTYPE_PORT 覆盖预览端口。
多 IDE 协调(Leader / Follower)
当多个 AI IDE(Cursor、Codex、Claude Code、Trae、Qoder、CodeBuddy、WorkBuddy 等)同时安装并运行本 MCP 时,会自动进行 Leader/Follower 选举,避免端口冲突。
工作原理
sequenceDiagram
participant P1 as MCP_Process_A
participant P2 as MCP_Process_B
participant Port as localhost_5179
participant Browser as 预览浏览器
P1->>Port: 尝试监听
Note over P1: 成功 → 成为 Leader
P2->>Port: 尝试监听
Note over P2: 失败(端口被占)
P2->>P1: GET /__health
Note over P2: 确认是本服务 → 成为 Follower
Browser->>P1: 打开预览
P2->>P1: POST /__rpc(转发工具调用)
P1-->>P2: 返回结果Leader:绑定 5179 端口,提供 HTTP 预览服务,处理来自 Follower 的 RPC 请求
Follower:文件操作(创建/修改原型)在本地执行,预览相关操作通过 Leader 协调
故障转移:Leader 退出后,Follower 会尝试接管成为新 Leader(轮询间隔 3-5 秒)
单实例使用
单个 IDE 运行时,该进程自动成为 Leader,行为与之前完全一致。
验证多进程协调
# 终端 1:启动第一个 MCP(将成为 Leader)
node dist/cli.js
# 输出:[election] elected as leader
# 终端 2:启动第二个 MCP(将成为 Follower)
node dist/cli.js
# 输出:[election] following existing leader两个进程都能正常响应工具调用,但只有 Leader 占用端口 5179。
环境变量
变量 | 作用 |
| 覆盖默认端口 5179 |
更新记录
版本 | 说明 |
1.1.0 | 多 IDE 同时运行时自动 Leader/Follower 选举,共用 5179 预览口,Leader 退出后可接管 |
1.0.2 | 一条命令安装 Skill,改用 pnpm 管理依赖 |
1.0.0 | 首个 npm 包:MCP 落盘、预览、导出 |
License
MIT
Available Tools
9 toolscreate_prototype创建原型A
按 Skill 创建 out//preview.html,内联 CSS,校验硬规则,启动预览并返回内置浏览器 URL。html 省略时用模板脚手架。
Inputs: slug (required), title (required), html, from_example.
export_prototype导出给开发A
把已生成的原型导出为可转发的单文件 HTML:CSS 内联、去掉热更新脚本。写入 out//.html,给开发打开即可,不依赖 MCP 预览服务。
Inputs: slug (required).
get_brief读取 Skill 与规则A
返回强制工作流、SKILL.md 全文和 visual 规则摘要。生成或修改原型前必须先调用。
Inputs: no named parameters.
get_bundled_css读取应内联的 CSSA
返回 tokens + theme + layout 拼接结果,生成 HTML 时必须按此顺序内联进 style。
Inputs: no named parameters.
get_prototype读取当前原型 HTMLC
修改前读取 out//preview.html,基于当前稿增量改,不要每次从空白重写。
Inputs: slug (required).
list_prototypes列出原型B
列出 out/ 下已生成的原型及预览 URL。
Inputs: no named parameters.
start_preview打开预览服务B
启动 127.0.0.1 热更新 HTTP 服务,返回给 Codex 内置浏览器打开的 URL。
Inputs: slug.
update_prototype更新原型并热更新A
覆盖已有原型 HTML。校验通过后写入并通知已打开的预览页 reload。
Inputs: html (required), slug (required).
validate_prototype校验规范A
按 Skill 硬规则静态检查 HTML 或已有 slug,不写盘。
Inputs: html, slug.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools have distinct roles: get_brief (mandatory preamble), get_bundled_css (style tokens), validate_prototype (read-only check), export_prototype (single-file output). However create_prototype overlaps with start_preview since it also launches preview and returns a URL, and create/update_prototype boundary is only clarified by the overwrite wording. Boundaries are mostly clear but one pair needs the description to disambiguate.
All nine tools follow a consistent snake_case verb_noun pattern (get_brief, create_prototype, update_prototype, get_prototype, start_preview, list_prototypes, validate_prototype, export_prototype) with only get_bundled_css deviating slightly in noun form. The convention is predictable and uniform.
Nine tools is well-scoped for a prototype authoring workflow, covering fetch/read/create/update/validate/preview/export/list with no redundant filler. Each tool earns its place in the lifecycle.
The surface covers the core lifecycle (read brief, get/read prototype, create, update, validate, preview, export, list) with no dead ends for the main flow. Minor gaps: no delete_prototype to remove stale drafts and no explicit preview-stop, but these are workable around.
Maintenance
Related MCP Connectors
Deploy AI-generated HTML/CSS/JS to instant public HTTPS URLs from any MCP-compatible agent.
Serves your design system and coding standards to coding agents, so they stop guessing.
Live React design-system APIs, patterns, and code validation so AI agents build real UI, not slop.
Deploy HTML pages and built web apps (React, Vue, Vite) to a live HTTPS link from your AI agent.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceGives AI assistants a fully offline toolchain for FlyThings OS human-machine interface development: converting HTML prototypes into JSON/FTU layouts, packaging and deploying firmware to devices, capturing real-device screenshots for pixel-diff acceptance, and generating i18n, tests, and bug reports. It also bundles a local vector-plus-BM25 knowledge base covering hardware models, UI control semantics, dependency manifests, and reusable components.MIT
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to build and edit a local-first design board of HTML screens, flows, components, design-system pages, and plan tables, then review it in a browser with undo/restore, rendering, and export tools.MIT
- AlicenseNot gradedqualityAmaintenanceEnables coding agents to ground UI work in real product screens by returning inline reference screenshots, recorded design-system details (colors, typography, components, provenance), and licensed font or icon materials for unresolved visual questions. It also serves bundled design-skill documents, command prompts, and connection diagnostics through a token-free local adapter.MIT
- AlicenseBqualityCmaintenanceEnables AI agents to build and audit web UIs by serving a fixed workflow and rule-priority guide, running deterministic static linting of source, rendering pages headlessly at multiple widths for screenshots and accessibility snapshots, and gathering element-level design feedback. All output is written only to a local log folder, leaving project files untouched and external network access blocked by default.6MIT