genui-mockup

genui-mockup

Enables Claude to generate and iterate on UI mockups using OpenUI Lang against a shadcn/ui palette, with live preview and auto-persisted assemblies that can be updated in place.

Category
访问服务器

README

Gen UI Mockup Tool (L1)

Fast, low-token UI wireframing and design iteration with Claude.

Normally, asking Claude to mock up a UI means one of two things: bad ASCII art, or an entire HTML/JSX page hand-written from scratch — hundreds of lines, thousands of output tokens, tens of seconds of streaming, every single time, even for a layout it's "drawn" a dozen times before.

This tool takes a different approach. Claude composes the mockup in a compact, line-oriented language (OpenUI Lang) that references a fixed, pre-registered palette of 42 real shadcn/ui primitives — buttons, cards, tables, forms, plus page-level layout primitives like Container/PageHeader/AppShell. It isn't your design system or a general-purpose exporter — it's one specific, registered shadcn/ui palette this tool ships with. A full page comes out to roughly 15–40 lines instead of hundreds, renders live in a connected browser in well under a second, and — because the model can only reference primitives that are actually registered — never contains invented markup.

What it's like to use

Ask Claude (through the MCP tools below) to mock something up — "a pricing page," "a settings screen," "a dashboard with a sidebar." It renders live in the browser tab you have open, typically in tens of milliseconds. Ask for a tweak and only the changed lines get re-sent, not the whole page, so iterating stays cheap and fast. Every version is auto-saved under a stable id, so you can rename it, switch between saved designs instantly in the sidebar, come back to one later, or delete the ones you don't want. Once you like something, ask Claude to write the actual React/shadcn code for it — see Getting code out below.

Key features

  • Live, in-browser rendering — ask, watch it render in well under a second.
  • Low-token by design — a full page is ~15–40 lines of a compact language, not hundreds of lines of hand-written markup.
  • Always real components — every element comes from the registered shadcn/ui palette; nothing invented, nothing off-system.
  • Assemblies persist automatically — rename, revisit, switch between, or delete saved designs without a separate save step.
  • Code on demand — ask for the code once you're happy with something; no export button, no separate build step.

See the full design rationale and roadmap in docs/superpowers/specs/2026-07-11-genui-mockup-tool-design.md.

Setup

Prerequisites

  • Node.js >=24 (see root package.json engines)

Install & build

npm install
npm run build

npm run build runs build in every workspace (packages/*, apps/*) via npm run build --workspaces --if-present — this compiles @genui/core@genui/mcp@genui/preview in turn.

Running it

1. Start the preview

npm run dev:preview

This root script first builds @genui/core (npm run build -w @genui/core) and then starts the preview's Vite dev server (npm run dev -w @genui/preview). The core build is required up front because the preview imports @genui/core/browser from its compiled dist/ output, not from source. Open the URL Vite prints (typically http://localhost:5173).

2. Register the MCP server with Claude

The MCP server isn't started manually — it's launched by the MCP client (Claude). Local stdio servers like this one are configured via JSON, not a URL — this is a project-scoped dev tool (paired to this repo's live preview and its data/assemblies folder), not a hosted/remote capability, so JSON config is the correct mechanism, not a legacy one.

Claude Code picks this up automatically from the root .mcp.json (relative paths are fine — Claude Code runs from the repo root):

{
  "mcpServers": {
    "genui-mockup": {
      "command": "node",
      "args": ["packages/mcp/dist/server.js"],
      "env": { "WS_PORT": "7337", "DATA_DIR": "./data/assemblies" }
    }
  }
}

Claude Desktop requires an entry in claude_desktop_config.json — but Desktop does not run from this repo's directory, so paths must be absolute, not the relative ones above:

{
  "mcpServers": {
    "genui-mockup": {
      "command": "/absolute/path/to/node",
      "args": ["/absolute/path/to/this/repo/packages/mcp/dist/server.js"],
      "env": {
        "WS_PORT": "7337",
        "DATA_DIR": "/absolute/path/to/this/repo/data/assemblies"
      }
    }
  }
}

Find your node path with which node. The config file lives at ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows). Fully quit and relaunch Claude Desktop (not just close the window) after editing it.

Either way, a Claude session gets the five genui-mockup tools below once connected. The server spawns a WebSocket bridge on WS_PORT (7337) that the preview connects to, and persists assemblies as JSON files under DATA_DIR.

Only run the server from one client at a time — it's a single process binding port 7337, so starting it from both Claude Code and Claude Desktop simultaneously will fail on the second one.

Operational note — reload the preview after (re)starting the server

The preview's WS client connects once on mount and does not auto-reconnect. Each new MCP client session spawns a fresh packages/mcp/dist/server.js process — i.e. a fresh bridge on port 7337 — so if the server restarts after the preview tab is already open, reload the preview tab once the server is back up to pick up the new bridge connection. The preview must be open and connected for render_assembly to succeed; otherwise it correctly reports "No preview connected."

The five MCP tools

  • list_primitives — returns the shadcn primitive list, param signatures, and the OpenUI Lang system prompt Claude must follow (including the lang→shadcn code mappings — see below).
  • render_assembly(lang, id?, name?) — renders an OpenUI Lang assembly live in the connected web preview. Every render is auto-persisted. Omit id to start a new assembly (its id is returned — reuse it on later calls to keep editing the same design in place instead of creating a duplicate). Pass id to update that existing assembly's tree (and optionally rename it) in place. name is optional and can be set/changed on any call — that's how naming/"saving" works, there's no separate save tool.
  • list_assemblies() — lists saved assemblies (id, name, createdAt, updatedAt). If a user references an existing design ambiguously by name, call this first and ask them to clarify rather than guessing which one they mean.
  • get_assembly(id) — fetches a saved assembly's OpenUI Lang source by id (used for Way 2 code generation — see below).
  • delete_assembly(id) — deletes a saved assembly by id. Deleting something already gone isn't an error.

Getting code out (Way 2)

There's no export button. To get real source for a saved assembly, ask Claude to get_assembly <id> and write the corresponding React/shadcn code from the returned OpenUI Lang.

The non-obvious lang→shadcn translations (e.g. OpenUI's Button variant "primary" mapping to shadcn's variant="default", since shadcn has no "primary" variant; the Table row pipe encoding; the CardHeaderCardTitle/CardDescription split) are documented directly in the system prompt returned by list_primitives, so this works even for a Claude session with only the MCP tools and no repo file access. When Claude does have repo access (e.g. Claude Code running inside this repo), it can additionally cross-check against apps/preview/src/library/renderers.tsx and apps/preview/src/library/layout-renderers.tsx directly for full fidelity.

Repo layout

  • packages/core — library/palette definitions (42 primitives), OpenUI Lang parsing, the assembly store.
  • packages/mcp — the MCP server (server.ts) exposing the five tools, plus the WS bridge to the preview.
  • apps/preview — the Vite/React web preview that renders assemblies live via the shadcn library (atom renderers in library/renderers.tsx, page-level layout renderers in library/layout-renderers.tsx).
  • docs/ — the design spec and supporting verification notes.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选