Skip to main content
Glama
figma-ui-mcp

figma-ui-mcp

Figma UI MCP Bridge

Kiettt8 Custom Edition

Figma UI MCP Bridge giúp Codex, Claude Code, Cursor, VS Code và các MCP client khác đọc hoặc chỉnh sửa thiết kế trực tiếp trong Figma Desktop.

Bản này có giao diện plugin tùy chỉnh và bridge chạy ngầm. Sau khi cài đặt một lần, người dùng chỉ cần mở plugin trong Figma, không phải mở Terminal hoặc chạy npx figma-ui-mcp.

Figma UI MCP Bridge

Yêu cầu

  • Node.js 20 trở lên

  • Git

  • Figma Desktop

  • Một MCP client như Codex, Claude Code, Cursor, VS Code hoặc Windsurf

Figma bản web không dùng được với bridge local này.

Related MCP server: Figma Codex Bridge

Cách đơn giản nhất: nhờ AI cài

Gửi link repository này cho Codex, Claude Code hoặc Cursor Agent:

Cài repository này giúp tôi:
https://github.com/kiettt8-product/figma-ui-mcp

Hãy clone vào một thư mục cố định, chạy npm install, cấu hình MCP cho client
hiện tại, cài background bridge và kiểm tra port 38451. Không dùng package npm
của repository upstream.

AI có thể thực hiện phần cài đặt bằng Terminal. Người dùng chỉ cần import development plugin vào Figma một lần theo hướng dẫn bên dưới.

Claude Desktop dạng chat thông thường không có quyền Terminal nên không tự cài được. Hãy dùng Claude Code hoặc một agent có quyền chạy lệnh.

Tự cài đặt

1. Clone và setup

git clone https://github.com/kiettt8-product/figma-ui-mcp.git
cd figma-ui-mcp
npm install
npm run setup

Setup wizard sẽ:

  • Tìm MCP client đang có trên máy.

  • Thêm cấu hình figma-ui-mcp vào client được chọn.

  • Giữ nguyên các MCP server khác.

  • Tạo backup trước khi sửa file cấu hình.

  • Cài bridge chạy ngầm khi đăng nhập máy.

  • Khởi động bridge ngay sau khi setup.

Khi wizard hỏi cài background bridge, chọn Y hoặc nhấn Enter.

Nếu muốn chạy setup không cần trả lời:

npm run setup -- --client codex --yes

Thay codex bằng một trong các giá trị:

claude-code
claude-desktop
cursor
vscode
windsurf

Có thể cấu hình nhiều client cùng lúc:

npm run setup -- --client codex,claude-code,cursor --yes

2. Import plugin vào Figma

Mở Figma Desktop:

Plugins
→ Development
→ Manage plugins in development
→ Import plugin from manifest

Chọn file:

figma-ui-mcp/plugin/manifest.json

Chỉ cần import một lần. Không di chuyển hoặc xóa thư mục repository sau khi import vì Figma lưu đường dẫn đến file manifest.

3. Chạy plugin

Mở một Figma design file, sau đó chọn:

Plugins
→ Development
→ Figma UI MCP Bridge · Kiettt8

Plugin cần hiển thị trạng thái Connected.

Cách sử dụng hằng ngày

Sau khi đã setup:

  1. Mở Figma Desktop.

  2. Mở design file cần làm việc.

  3. Chạy Figma UI MCP Bridge · Kiettt8.

  4. Prompt cho Codex, Claude Code, Cursor hoặc MCP client đang dùng.

Không cần mở Terminal. Không cần chạy npm start hoặc npx figma-ui-mcp.

Bridge đã được hệ điều hành chạy ngầm từ trước:

Đăng nhập máy
→ background bridge chạy tại 127.0.0.1:38451
→ mở Figma plugin
→ plugin tự kết nối
→ MCP client gửi lệnh đến Figma

Figma vẫn yêu cầu người dùng tự mở development plugin. Plugin không thể tự khởi chạy process hệ điều hành do giới hạn sandbox của Figma.

Dùng kèm design system nội bộ

Design system không được commit vào repository public. Team đóng gói nó thành một thư mục bundle nội bộ, tải bundle về máy rồi setup một lần:

npm run setup -- \
  --client codex,claude-code,cursor \
  --bundle "/duong-dan/zalopay-design-system-3.0.0" \
  --yes

Bundle tối thiểu có cấu trúc:

zalopay-design-system-3.0.0/
├── manifest.json
├── semantic/catalog.json
├── fonts/manifest.json
└── recipes/

Sau khi cấu hình, MCP tự thực hiện luồng sau:

kiểm tra bundle và font
→ hiểu prompt và chọn intent, screen pattern, recipe, state, asset
→ đưa đúng phần product knowledge vào context cho AI
→ AI tạo màn hình bằng Figma component và Auto Layout
→ validator kiểm tra và yêu cầu sửa trước khi handoff

Các tool liên quan:

  • design_system_status: kiểm tra bundle, version và font bắt buộc.

  • design_system_plan: nhận prompt đầy đủ và tự chọn recipe, pattern, state, asset, prototype flow cùng checklist QA.

  • design_system_context: lấy rule và recipe trước khi thiết kế.

  • design_system_assets: tìm icon, logo merchant và ảnh trong bundle.

  • figma_validate: kiểm tra frame sau khi thiết kế; phải sửa hết lỗi trước khi handoff.

Khi bundle đã được cấu hình, figma_write sẽ từ chối chạy nếu AI chưa gọi design_system_plan hoặc chưa đọc context. Vì vậy người dùng không cần nhớ tên recipe hay nhắc AI dùng design system trong từng prompt.

Ví dụ prompt hằng ngày:

Thiết kế journey quản lý và sử dụng voucher trên ZaloPay Mobile, bắt đầu từ
entry point Ví ưu đãi ở Home và nối prototype tới Payment Success. Tự bổ sung
state và edge case, kiểm tra lại kết quả trước khi bàn giao.

AI client sẽ tự gọi design_system_plan, dùng context đã chọn và lấy asset qua figma.loadBundleAsset(...). Asset được giới hạn trong thư mục bundle và kiểm tra SHA-256 trước khi import vào Figma.

figma.loadIcon(...) cũng ưu tiên semantic alias trong bundle. Mỗi asset được gắn bundle ID, version và checksum vào node; figma_validate báo lỗi nếu icon được tự vẽ hoặc dùng thư viện ngoài trong khi bundle đã có icon tương ứng.

Nếu thiếu font bắt buộc, MCP sẽ dừng thao tác ghi thay vì âm thầm thay font và làm lệch layout.

Golden reference trong bundle chỉ nên để trạng thái candidate cho tới khi được team Design duyệt. Không đóng gói screenshot có dữ liệu cá nhân hoặc dữ liệu production.

Kiểm tra kết nối

Kiểm tra bridge:

curl http://127.0.0.1:38451/health

Nếu plugin đang mở, kết quả cần có:

{
  "pluginConnected": true
}

Trong MCP client, có thể yêu cầu:

Kiểm tra kết nối Figma bằng figma_status.

Nối prototype

MCP có thể tạo và đọc prototype interaction thật trong Figma:

  • Navigate giữa các frame.

  • Open, swap hoặc close overlay.

  • Back, scroll to và change to component variant.

  • Click, hover, press, drag, delay và keyboard trigger.

  • Instant, Dissolve, Smart Animate, Move, Push và Slide transition.

  • Cấu hình scroll ngang, dọc hoặc cả hai hướng.

Ví dụ prompt:

Nối nút Dùng ngay sang frame Voucher Detail bằng Smart Animate 300ms.
Nút Điều kiện mở Conditions Bottom Sheet dưới dạng overlay trượt từ dưới lên.
Nút đóng trong bottom sheet dùng Close.
Sau khi nối, đọc lại reactions để xác minh tất cả destination còn tồn tại.

Cập nhật phiên bản mới

Trong thư mục repository:

git pull origin main
npm install
npm run setup:background

Lệnh cuối sẽ cập nhật và restart background bridge. Không cần import lại manifest nếu repository vẫn nằm ở đường dẫn cũ.

Xử lý lỗi nhanh

Plugin báo chạy npx figma-ui-mcp

Cài lại background bridge:

npm run setup:background
curl http://127.0.0.1:38451/health

Plugin vẫn hiện giao diện cũ

  1. Mở Manage plugins in development.

  2. Xóa đăng ký Figma UI MCP Bridge cũ.

  3. Import lại đúng file plugin/manifest.json trong repository này.

  4. Đóng và chạy lại plugin.

MCP client đang dùng nhầm bản npm

Không dùng cấu hình:

{
  "command": "npx",
  "args": ["figma-ui-mcp"]
}

Chạy lại:

npm run setup

Wizard sẽ cấu hình client dùng trực tiếp server/index.js trong repository này.

Port 38451 không hoạt động

Trên macOS:

launchctl print gui/$(id -u)/io.github.kiettt8-product.figma-ui-mcp-bridge
tail -50 ~/Library/Logs/FigmaUIMCP/bridge.error.log

Trên Linux:

systemctl --user status figma-ui-mcp-bridge.service

Sau đó chạy lại:

npm run setup:background

Phát triển source

  • Giao diện plugin: plugin/ui.html

  • Logic plugin: src/plugin/

  • MCP adapter: server/index.js

  • Product intent và generation plan: server/product-knowledge.js

  • Bundle asset resolver: server/asset-resolver.js

  • Background bridge: server/bridge-daemon.js

  • Setup wizard: scripts/setup-mcp.js

Build lại plugin sau khi sửa logic:

npm run build:plugin

Chạy test:

npm test

Test phụ thuộc Internet cho icon library được tách riêng:

npm run test:network

Xuất metadata từ một file design system đang mở trong Figma:

npm run bundle:export -- --session <session-id> --output <thu-muc-output>

Exporter tạo catalog kỹ thuật ban đầu. Các semantic role và recipe theo từng product vẫn cần được review trước khi phát hành bundle nội bộ.

Product knowledge có thể được đóng gói thêm tại product/catalog.json; semantic asset alias tại assets/semantic-catalog.json. Khi chạy bundle:pack, exporter tự thêm các entrypoint này vào manifest mà không phá bundle schema cũ.

Sau khi review hoặc sửa semantic/, fonts/ hay recipes/, đóng gói lại mà không cần quét Figma lần nữa:

npm run bundle:pack -- --output <thu-muc-bundle>

Bảo mật

  • Bridge mặc định chỉ chạy tại 127.0.0.1.

  • Không expose port 38451 lên Internet.

  • Không đổi bridge sang public host nếu chưa có authentication và firewall.

  • Không commit bundle, asset nội bộ hoặc file font có license vào repository public.

  • Kiểm tra thao tác do AI tạo trước khi áp dụng lên design file quan trọng.

Nguồn và giấy phép

Repository này là bản phát triển độc lập dựa trên TranHoaiHung/figma-ui-mcp.

  • Nền tảng MCP và Figma plugin: dự án gốc

  • Custom UI, background setup và tài liệu: Kiettt8

  • License: MIT

Available Tools

10 tools
design_system_assetsA

Search the configured portable bundle for checksum-addressable semantic assets, component SVGs, icons, merchant marks, and raster images. Prefer an exact semantic asset ID from design_system_plan. Import a result inside figma_write with figma.loadBundleAsset(asset.id, opts); never draw a placeholder when a required bundled asset exists.

Inputs: query (required), limit, reload, source, +1 more.

design_system_contextA

Load prompt-ready semantic design-system rules from the configured bundle. Includes font dependencies, spacing tokens, typography roles, component roles, generation policies, and an optional screen recipe with an Auto Layout blueprint. Use this instead of guessing values from screenshots.

Inputs: recipe, reload, sessionId.

design_system_planA

Turn the user's natural-language design request into a deterministic, bundle-backed generation plan. Resolves product intent, screen patterns, recipes, states, candidate golden references, bundled assets, prototype flow, and the validation/repair checklist. MANDATORY before figma_write whenever a design-system bundle is configured. Pass the user's complete request, not a shortened keyword.

Inputs: prompt (required), recipe, reload, maxAssets, +1 more.

design_system_statusA

Inspect the configured portable design-system bundle and run dependency preflight. Returns bundle version, available semantic recipes, required fonts, missing weights, and readiness. Call this before generating a design that must follow an internal design system.

Inputs: reload.

figma_docsA

Get the API reference and design rules for figma_write. Call with no args first — returns quick-start guide + critical rules. Then load specific sections as needed: section='rules' (design principles, token rules, layer order, component-first), section='layout' (auto-layout, button/card/badge/progress/mobile rules), section='api' (create/modify/delete/clone/batch/read operations + workflow), section='tokens' (variables, multi-mode, paint styles, text styles), section='icons' (loadImage, loadIcon, loadIconIn, icon libraries, coloring, sizing). Always call figma_docs BEFORE any figma_write code.

Inputs: section.

figma_readA

READ design data from Figma — extract node trees, colors, typography, spacing, and screenshots. Use to understand an existing design before generating code, or to inspect what's on the canvas.

Inputs: operation (required), depth, scale, detail, +5 more.

figma_rulesA

Generate a design system rule sheet from the current Figma file — aggregates color tokens, typography styles, variables (all modes), and component catalog into a single markdown block. Equivalent to official Figma MCP's create_design_system_rules. Call once at the start of a design-to-code session to give the AI full context: what tokens to use, what text styles exist, which components are available. Re-run when the design system changes.

Inputs: sessionId.

figma_statusA

Check whether the Figma plugin bridge is connected. Always call this first to confirm the plugin is running before any other tool.

Inputs: no named parameters.

figma_validateA

Validate a generated Figma frame against the configured design-system bundle. Checks fonts, typography roles, token colors, viewport, component dimensions, repeated-item spacing, vertical rhythm, and recipe-specific padding. Fix every error and re-run before handing the design to the user.

Inputs: nodeId, recipe, nodeName, sessionId.

figma_writeA

Execute JavaScript code to CREATE or MODIFY designs in Figma. ⚠️ MANDATORY: Call figma_docs BEFORE writing any design code. Skipping figma_docs causes hardcoded colors, wrong sizing, broken layouts, and low-quality UI. When a design-system bundle is configured, call design_system_plan with the user's full request before writing; the server enforces this gate. Use figma.loadBundleAsset(reference, opts) for resolved internal SVG or raster assets, then call figma_validate after writing. Use the figma proxy object — all methods return Promises, use async/await. Operations: create, modify, delete, clone, group, ungroup, flatten, resize, set_selection, set_viewport, batch (multiple ops in one call). Design Tokens: createVariableCollection, createVariable, setVariableValue, addVariableMode, renameVariableMode, removeVariableMode, applyVariable, setFrameVariableMode, clearFrameVariableMode, createPaintStyle, createTextStyle, createComponent. Prototyping: setReactions, getReactions, removeReactions (click/hover/press → navigate/overlay/swap with Smart Animate transitions). Scroll: setScrollBehavior (overflowDirection: NONE/HORIZONTAL/VERTICAL/BOTH). Variants: setComponentProperties, swapComponent, getComponentProperties. Component property definitions (master-side, required for instance text overrides to recalc auto-layout): addComponentProperty (TEXT/BOOLEAN/INSTANCE_SWAP), bindComponentPropertyToText, removeComponentProperty. The code runs in a sandboxed VM: no access to require, process, fs, fetch, or network.

Inputs: code (required), sessionId.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes: read, write, validate, docs, assets, status, plan. The only overlap is between figma_rules and design_system_context, both providing design rules but from different sources, which could cause minor confusion.

    Naming Consistency4/5

    The consistent 'figma_' and 'design_system_' prefixes create clear namespaces. However, the second part mixes nouns (status, docs, rules, assets, context) and verbs (read, write, validate, plan), preventing a fully uniform verb_noun pattern.

    Tool Count5/5

    10 tools is perfectly within the ideal range and each tool serves a distinct step in the design workflow—status check, planning, reading, writing, validation, and design-system management. No tool feels redundant or excessive.

    Completeness5/5

    The set covers the complete lifecycle: connectivity check, design context gathering, planning, code generation, asset import, and validation. There are no obvious missing operations for the intended purpose of generating Figma UI from a design system.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables Codex and other MCP clients to read design context from Figma Desktop via a local bridge, providing design tokens, component trees, and screenshots without an API token.
      7
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP-compatible AI clients to read and modify the user's currently open Figma file by executing JavaScript in Figma's sandbox, all through a local bridge with status monitoring, node jumping, and automatic rollback on errors.
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients to read and modify the currently open Figma design file through a paired local Figma plugin, supporting operations like creating nodes, editing properties, and exporting PNG/SVG.
      539 npm
      2
      MIT