/ 目錄 / 演練場 / Design Extract
● 社群 Manavarya09 ⚡ 即開即用

Design Extract

作者 Manavarya09 · Manavarya09/design-extract

將任意網站 URL 交給 Claude,取回可直接使用的設計系統——DTCG token、基礎層、語義層,以及 iOS / Android / Tailwind / Figma 的平台匯出。

Design Extract 使用 Playwright 爬取目標網站,審計已渲染的 CSS,將其提煉成符合 DTCG 規範的三層 token(基礎層 / 語義層 / 複合層),並輸出可直接使用的程式碼:SwiftUI、Jetpack Compose、Flutter、Tailwind v4、WordPress theme.json、Figma 變數及 shadcn/ui 對應。專為需要在幾分鐘內(而非整個 Sprint)複製或審計現有視覺識別的設計師和工程師而生。

為什麼要用

核心特性

即時演示

實際使用效果

design-extract-mcp.replay ▶ 就緒
0/0

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "design-extract-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "design-extract-mcp"
      ]
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "design-extract-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "design-extract-mcp"
      ]
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "design-extract-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "design-extract-mcp"
      ]
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "design-extract-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "design-extract-mcp"
      ]
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "design-extract-mcp",
      "command": "npx",
      "args": [
        "-y",
        "design-extract-mcp"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "design-extract-mcp": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "design-extract-mcp"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add design-extract-mcp -- npx -y design-extract-mcp

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: Design Extract

如何將品牌視覺系統複製為 DTCG token

👤 設計工程師、代理商團隊、品牌對齊的產品團隊 ⏱ ~25 min intermediate

何時使用: 你正在依據參考網站重建行銷頁或應用程式,需要在 10 分鐘內取得 token,而非進行一場 Figma 擷取會議。

前置條件
  • 參考網站的公開 URL — 例如 https://stripe.com——必須可公開存取
步驟
  1. 擷取
    Use design-extract on https://stripe.com. Output DTCG tokens, SwiftUI, and Tailwind v4. Save to /tokens/.✓ 已複製
    → tokens.json + tokens.swift + tailwind.css 已寫入;覆蓋範圍報告
  2. 審計
    Run the CSS health pass and the WCAG remediation. Flag everything below AA.✓ 已複製
    → 列出不合格配對與建議的審計報告
  3. 套用
    Now generate a starter Next.js page using these tokens — nav, hero, 3 feature cards.✓ 已複製
    → 頁面以品牌視覺識別渲染

結果: 一組 token、一份審計報告與一個起始頁面,全部從一個 URL 衍生而來。

注意事項
  • 網站有大量 SSR 閘道或需要登入 — 透過擴充功能提供已登入的 cookie,或使用自訂 Playwright 前置步驟
搭配使用: filesystem

審計自家網站的設計系統偏移情況

👤 內部設計系統維護人員 ⏱ ~30 min intermediate

何時使用: 你懷疑 47 個未授權的顏色偷偷進了正式環境。確認它。

步驟
  1. 盤點
    Run design-extract against https://yoursite.com. Don't emit code — just report unique colors, font stacks, spacing values used.✓ 已複製
    → 各類別的不同值數量
  2. 與來源比對
    Compare against /design/tokens.json. Flag every value used in production that's not in the source-of-truth.✓ 已複製
    → 含檔案/元件參照的偏移表格
  3. 規劃清理
    Group drift by likely cause (legacy CSS, ad-hoc style, wrong token). Suggest a 3-PR cleanup plan.✓ 已複製
    → PR 計畫已撰寫

結果: 可交給工程團隊的具體偏移報告,而非「我們有不一致」的模糊抱怨。

注意事項
  • 工具因 CSS 變數在執行期解析而過度回報 — 傳入 --resolve-vars 讓它在計數前追蹤 var(--x) 鏈
搭配使用: filesystem

從上線網站生成 Figma 變數

👤 需要在 Figma 中鏡像程式碼的設計師 ⏱ ~15 min beginner

何時使用: 程式碼先行發布;設計端需要在 Figma 中跟上進度。

步驟
  1. 輸出 Figma JSON
    Use design-extract on https://yoursite.com with output=figma-variables. Save to /design/figma-vars.json.✓ 已複製
    → 可匯入的 Figma 變數 JSON
  2. 匯入
    Walk me through importing this with the Figma Variables Import plugin.✓ 已複製
    → 逐步的外掛操作說明

結果: Figma 檔案與已發布程式碼同步,無需手動用滴管取色。

注意事項
  • Token 名稱與現有 Figma 變數衝突 — 使用 --prefix 標旗加上命名空間,例如 site/color.bg.primary

組合

與其他 MCP 搭配,撬動十倍槓桿

design-extract-mcp + filesystem

將 token 輸出持久化到版本庫,以便後續執行時進行差異比對

Run extract every Friday and save under /design/snapshots/$(date +%F)/.✓ 已複製
design-extract-mcp + Figma-Context-MCP

雙向同步——從上線環境擷取,再推回 Figma

After extract, push the token file to Figma via Figma-Context-MCP.✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
extract url, output_format[]: dtcg|swiftui|compose|flutter|tailwind|figma|wordpress|shadcn 主要進入點 1 Playwright crawl
audit_css_health url 目標是健康檢查而非複製時,在 extract 之後或代替 extract 使用 1 crawl
wcag_remediate tokens 在 extract 之後、發布 token 之前 free (post-process)
diff_tokens url, source_tokens_path 對自家網站進行偏移審計 1 crawl

成本與限制

運行它的成本

API 配額
本地端——取決於你的機器
每次呼叫 Token 數
每次擷取摘要 1500–6000 個 token
費用
免費(MIT)
提示
不要每次 PR 都執行擷取——快取結果並在有變更時才執行

安全

權限、密鑰、影響範圍

憑證儲存: 無,除非目標需要驗證(此時透過 cookie 檔案)
資料出站: 僅發送至你指定的 URL。Playwright 在本地端執行。

故障排查

常見錯誤與修復

Playwright Chromium 無法啟動

執行一次 npx playwright install chromium

驗證: `npx playwright --version` 顯示版本號
網站封鎖 headless 瀏覽器

傳入 --headed,或提供住宅代理 / cookie 檔案

輸出 token 看起來不完整

網站使用大量 CSS-in-JS——試著加上 --wait-for-selector main 以確保 SPA 完成渲染

替代方案

Design Extract 對比其他方案

替代方案何時用它替代權衡
Figma-Context-MCP (GLips)真實來源是 Figma 而非上線網站Figma MCP 需要 Figma 檔案;design-extract 可從任何 URL 取用
Tokens Studio 外掛你已在 Figma 中並想要 token 管理 UI手動操作;design-extract 自動化了初始擷取

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills