designer-mcp

designer-mcp

A visual designer pen for Claude Code that lets users click, drag, or draw on webpages to get source code locations and screenshots for direct editing and verification.

Category
访问服务器

README

designer-mcp

Cursor-style designer pen for Claude Code. Click, marquee, or draw on any webpage in a headed Chromium and Claude gets back the exact source file, line number, CSS selector, and a screenshot — ready to edit and verify.

What it does

Three modes of visual-to-source:

Mode Interaction Claude gets back
element Hover + click one element { selector, tag, classes, text, html, rect, source: { fileName, lineNumber, componentName }, screenshot_path }
area Drag a marquee { rect, elements: [{ selector, source, rect, ... }], screenshot_path }
draw Freeform red pen, Enter to finish { strokes, viewport, screenshot_path (pen only), viewport_screenshot_path (page + ink) }

All screenshots are saved as PNG files in /tmp and returned as paths — your MCP client never hits a context limit on base64.

React source resolution works in Next.js dev mode via the _debugSource fiber property (attached by @babel/plugin-transform-react-jsx-source). Production builds strip this; see Production source mapping below.

Demo

You:     "Make this button rounder"
Claude:  [designer_open http://localhost:3000/dashboard]
Claude:  [designer_pick mode=element]
You:     *click the button*
Claude:  → source: Button.tsx:42
Claude:  [Edit Button.tsx add rounded-full]
Claude:  [designer_screenshot selector=#cta-btn]  ← after screenshot for verification

Install

Prereqs: Node 18+, Claude Code, a working macOS/Linux (Playwright Chromium).

git clone https://github.com/YOUR_USER/designer-mcp.git
cd designer-mcp
npm install
npx playwright install chromium      # one-time browser download

Register the MCP with Claude Code (user-scope = available in every session):

claude mcp add --scope user designer-mcp node "$(pwd)/index.js"

Install the Claude skill so future sessions know the workflow:

mkdir -p ~/.claude/skills/designer
cp SKILL.md ~/.claude/skills/designer/SKILL.md

Restart Claude Code. You should see designer_* tools and a designer: skill in your session.

Usage

Start your Next.js dev server (for source mapping):

cd your-nextjs-app && npm run dev

Then, in Claude Code:

"Open http://localhost:3000/settings in the designer and let me pick the header."

Claude will call designer_open(...), then designer_pick({ mode: "element" }). Chromium pops to the front, your cursor becomes crosshairs, you click the header. Claude gets source.fileName + lineNumber and can edit directly.

Modes cheat sheet

  • Single element — use element
  • Multiple related elements in one region — use area (drag a box; returns every element whose center falls inside)
  • Annotate / explain visually — use draw (red pen, Enter to finish, Esc to cancel)

Production source mapping

_debugSource is dev-only. To use the picker on a production build, enable source maps in next.config.js:

module.exports = {
  productionBrowserSourceMaps: true,
  // ...
};

The picker currently returns source: null in prod; a future version will resolve the selector through the deployed sourcemap. PRs welcome.

Tool reference

All tools are exposed over MCP; Claude Code sees them as mcp__designer-mcp__*.

designer_open(url: string)

Launch or reuse the headed Chromium instance and navigate. Foregrounds the window on macOS via bringToFront() + an AppleScript nudge.

designer_pick({ mode?: "element" | "area" | "draw" })

Activate the picker overlay. Returns when the user completes the interaction (or Esc cancels, or 180s timeout).

designer_screenshot({ selector?: string })

PNG of the page or a specific element. Returns { path, bytes }.

designer_close()

Tear down the browser and release Playwright resources.

How it works

  1. A Playwright-controlled Chromium is launched headed. Singleton per process.
  2. designer_pick injects a small vanilla-JS overlay (picker.js) into the page. The overlay:
    • element mode — tracks mousemove/click, outlines the hover target in blue, resolves a unique-ish CSS selector, walks the React fiber chain for _debugSource, returns to the MCP.
    • area mode — rubber-band marquee; on mouseup, any element whose center falls inside the box is collected (dedup by selector).
    • draw mode — full-viewport canvas overlay; captures strokes as point arrays; Enter finishes.
  3. The server polls window.__designerResult every 200ms for up to 180 seconds.
  4. On completion, an appropriate screenshot (element / area clip / full viewport) is saved to /tmp and the path returned.

Contributing

  • PRs welcome, especially around:
    • Production sourcemap resolution
    • Kestrel/React Native picker (currently web only)
    • Multi-element accumulation in element mode (Cmd-click to add)
    • VS Code "reveal in editor" integration

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选