figma-bridge-mcp
figma-bridge-mcp connects an MCP-capable AI client to the open Figma Desktop document over a localhost bridge, enabling both design generation and design-to-code extraction.
Check bridge/plugin connection, active file/page, and sessions with
figma_status.Load Figma API/design guidance with
figma_docsand generate a design-system rule sheet withfigma_rules.Create or modify designs by running sandboxed JavaScript against the
figma.*API: frames, text, vectors, components, variables/tokens, styles, images/icons, prototypes, and scroll behavior.Read design data: node trees, selections, page nodes, CSS, resolved tokens/variables, styles, components, component maps, node details, reactions, and viewport.
Capture screenshots or export SVGs/base64 images for visual inspection and verification.
Export frames to PNG/JPG/SVG files on disk within allowed folders.
Target a specific open Figma file/tab with
sessionIdwhen multiple plugin sessions are connected.Works locally over
127.0.0.1; no Figma API key or cloud service is required.
Provides a bidirectional bridge to Figma Desktop, allowing AI assistants to create and modify designs via the figma.* API and read design data such as node trees, design tokens, CSS, component maps, and screenshots for design-to-code workflows.
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., "@figma-bridge-mcp Create a responsive pricing card in my open Figma file"
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.
Let AI draw on your Figma canvas — and read your designs back as code.
A bidirectional Model Context Protocol bridge for Figma Desktop.
No Figma API key. No cloud. Everything runs on localhost.
Quick start · How it works · Tools · Security · Troubleshooting · Changelog
Not affiliated with, endorsed by, or sponsored by Figma, Inc. "Figma" is a trademark of Figma, Inc., used here only to describe compatibility.
Overview
figma-bridge-mcp connects an AI assistant to the document you have open in Figma Desktop.
✍️ Write | The AI runs JavaScript against a |
👀 Read | The AI extracts node trees, resolved design tokens, CSS, component maps and screenshots — ready for design-to-code. |
🔒 Local | The bridge listens on |
🧩 Any MCP client | ✅ Tested with Claude Code and Antigravity. 🔧 Compatible with Cursor, VS Code, Windsurf, Zed and any stdio MCP client. |
Requires Figma Desktop. The plugin talks to the server over
localhost, which Figma's web app does not allow.
Related MCP server: finish-line
How it works
Three parts cooperate: your AI client, the MCP server (Node), and the Figma plugin (inside Figma Desktop). The plugin polls the server, so no inbound connection to Figma is ever needed.
flowchart LR
subgraph Client["AI client"]
A["Claude Code · Cursor · Windsurf<br/>VS Code · Antigravity · any MCP client"]
end
subgraph Server["figma-bridge-mcp (Node)"]
B["MCP server<br/>6 tools · stdio"]
C["Code sandbox<br/>runs figma_write code"]
D["HTTP bridge<br/>127.0.0.1:47451"]
end
subgraph Figma["Figma Desktop"]
E["Plugin UI<br/>long-poll client"]
F["Plugin main thread<br/>67 operations"]
G[("Figma document")]
end
A <-->|"MCP / stdio"| B
B --> C
C --> D
B --> D
D <-->|"HTTP long-poll"| E
E <-->|postMessage| F
F <--> GOne round trip
The server holds each poll open for up to 8 s and answers the moment work is queued, so latency is typically under 100 ms.
sequenceDiagram
autonumber
participant AI as AI client
participant S as MCP server
participant B as Bridge :47451
participant P as Figma plugin
AI->>S: figma_write { code }
S->>S: run code in sandbox
S->>B: queue operation (create, modify, …)
P->>B: GET /poll (held up to 8 s)
B-->>P: operations
P->>P: apply to the Figma document
P->>B: POST /response { id, data }
B-->>S: resolve operation
S-->>AI: result + logsSeveral Figma files at once
Each open plugin instance registers its own session. Pass the optional sessionId to figma_write / figma_read to target a specific file; if that session is not connected the call fails instead of writing into another file.
Quick start
1 · Add the MCP server to your client
claude mcp add figma-bridge-mcp -- npx @hanoilab/figma-bridge-mcp # this project
claude mcp add --scope user figma-bridge-mcp -- npx @hanoilab/figma-bridge-mcp # all projectsEdit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"figma": { "command": "npx", "args": ["-y", "@hanoilab/figma-bridge-mcp"] }
}
}Edit .cursor/mcp.json (project) or ~/.cursor/mcp.json (global) with the same mcpServers block shown for Claude Desktop.
Edit .vscode/mcp.json, or add to settings.json:
{
"mcp": {
"servers": {
"figma": { "command": "npx", "args": ["-y", "@hanoilab/figma-bridge-mcp"] }
}
}
}Edit ~/.codeium/windsurf/mcp_config.json with the same mcpServers block shown for Claude Desktop.
Agent panel "…" menu → Manage MCP Servers → View raw config, then add the same mcpServers block to mcp_config.json.
git clone https://github.com/nguyendinhphongdx/figma-bridge-mcp
cd figma-bridge-mcp && npm install
# point your MCP client at: node /path/to/figma-bridge-mcp/server/index.jsRestart your client after editing its config. MCP servers load only at startup.
2 · Install the Figma plugin
⬇ Download the plugin and unzip it anywhere.
In Figma Desktop: Plugins → Development → Import plugin from manifest… and pick
manifest.json.Run Plugins → Development → Bridge MCP for Figma.
The plugin window shows a green dot once it reaches the server.
3 · Connect and design
Tell your assistant:
"Connect to figma-bridge-mcp"
It calls figma_status and confirms the file, page and plugin version. Then just describe what you want:
"Draw a mobile login screen with Apple and Google sign-in buttons."
flowchart LR
P["Your prompt"] --> D["figma_docs<br/>load API + design rules"]
D --> R["figma_read<br/>inspect the canvas"]
R --> W["figma_write<br/>draw / modify"]
W --> S["figma_read screenshot<br/>verify"]
S -->|"needs fixes"| W
S -->|"looks right"| Done(["Done"])Prompt | What happens |
"Draw a mobile login screen with social buttons" | A 390×844 frame with inputs and buttons |
"Read the selected frame and describe the design" | Colors, typography, spacing from your selection |
"Convert my selected frame to Tailwind" | Reads the node tree, generates code |
"Create a dark dashboard with KPI cards" | A full layout with stats and charts |
"Take a screenshot of the current frame" | An inline image the AI can analyze |
Name the style (
dark,glassmorphism,minimal white) and the platform (mobile390×844,tablet768×1024,desktop1440×900).Iterate: "make the buttons bigger" works on existing nodes — the AI reads before it modifies.
Use selection: select a frame, then ask "improve this design".
Updating
npx @hanoilab/figma-bridge-mcp@latest --version # prints the new version and the plugin pathRestart your client, then re-import manifest.json from the printed path (Plugins → Development → Manage plugins in development). The Figma plugin does not auto-update. Run figma_status and check that pluginVersion matches.
Tools
The server exposes six MCP tools.
Tool | Purpose |
| Connection check, active file/page, sessions. Call first. |
| The full API reference and design rules. Call before drawing. |
| Run JavaScript against the |
| Extract design data: trees, tokens, CSS, components, screenshots. |
| One markdown rule sheet: color tokens, text styles, variables, components. Call once per session. |
| Save frames as PNG, JPG or SVG files on disk and get back their paths (not the images). Select by |
Design to code
flowchart LR
F["Select a frame<br/>in Figma"] --> A["get_design_context<br/>layout · tokens · typography"]
F --> B["get_css<br/>ready-to-paste CSS"]
F --> C["get_component_map<br/>instances + import paths"]
A --> AI(["AI generates<br/>React · Vue · Swift · Tailwind"])
B --> AI
C --> AIfigma_write — 47 operations
Code runs in a sandbox with the figma object; each call is isolated, so re-query node IDs at the start of every call.
const root = await figma.create({
type: "FRAME", name: "Dashboard", width: 1440, height: 900, fill: "#0f172a",
});
const sidebar = await figma.create({
type: "FRAME", name: "Sidebar", parentId: root.id,
width: 240, height: 900, fill: "#1e293b", stroke: "#334155", strokeWeight: 1,
});
await figma.create({
type: "TEXT", parentId: sidebar.id, x: 20, y: 24,
content: "My App", fontSize: 16, fontWeight: "SemiBold", fill: "#f8fafc",
});Area | Operations |
Nodes |
|
Pages & view |
|
Components |
|
Tokens & styles |
|
Images & icons |
|
Prototyping |
|
Property | Example |
Solid fill |
|
Gradient |
|
Corners |
|
Effects |
|
Vector path |
|
Insert position |
|
applyVariable binds FLOAT, COLOR, STRING and BOOLEAN variables to fills, strokes, geometry, corner radii, auto-layout spacing, typography, font family/style, text content and visibility.
figma_read — 20 operations
Operation | Returns |
| Node trees for the selection, a frame/page, or the top-level frames |
| AI-optimized payload: flex layout, token-resolved fills as |
| Every instance with set name, variant label and suggested import path; instances with no code mapping yet |
| One node's properties with variables and styles resolved to names and values, plus a full list of instance overrides |
| A ready-to-use CSS string for a node |
| Shareable Figma URL for a node, the selection, or the file: |
| Inline PNG, base64 PNG/JPG ( |
| Local styles, design tokens (all modes), components, viewport |
| Prototype interactions of a node; variant, boolean, text and instance-swap properties of a component or instance |
| Find nodes by type, name, color, font, size; progressive scan of large files |
Hidden layers are skipped by default; pass includeHidden: true to get_selection, get_design, search_nodes or scan_design to include them.
Read before you draw, then bind to what exists:
const vars = await figma.get_variables();
const varMap = {};
vars.collections.forEach(c => c.variables.forEach(v => { varMap[v.name] = v.id; }));
const card = await figma.create({
type: "FRAME", name: "Card", width: 360, height: 200,
layoutMode: "VERTICAL", paddingTop: 16, paddingLeft: 16, paddingBottom: 16, paddingRight: 16, itemSpacing: 12,
});
await figma.applyVariable({ nodeId: card.id, field: "fill", variableId: varMap["bg-surface"] });
await figma.applyVariable({ nodeId: card.id, field: "cornerRadius", variableId: varMap["radius-md"] });Prefer figma.instantiate({ componentId, parentId, overrides }) over redrawing existing components, and pin frames to a mode with setFrameVariableMode to preview Light and Dark side by side. The complete reference is one figma_docs call away.
Security model
The bridge has no login, so access is controlled at the network edge, and figma_write code is treated as having your user's trust level.
flowchart LR
R["HTTP request"] --> O{"Origin missing<br/>or 'null'?"}
O -->|no| X1["403 — web page"]
O -->|yes| H{"Host is<br/>loopback?"}
H -->|no| X2["403 — DNS rebinding"]
H -->|yes| A{"Operation on<br/>the allowlist?"}
A -->|no| X3["400"]
A -->|yes| Q["Queued for the plugin"]Layer | Protection |
Network | Binds |
Allowlist | Only the 67 named operations are accepted, on the MCP path and on |
Sandbox |
|
Outbound fetch |
|
Disk writes |
|
Sessions | A pinned |
Limits | 5 MB request body · 30 s sandbox execution · 60–90 s per plugin operation. |
Found a vulnerability? See SECURITY.md.
Configuration
Variable | Default | Purpose |
|
| Bridge port. If taken, the next 9 ports are tried. |
|
| Bind address. Changing it exposes an unauthenticated bridge — avoid. |
|
| How long an idle poll is held open. |
| unset | Set to |
| unset | Extra folders |
Troubleshooting
Symptom | Fix |
| Run the plugin in Figma Desktop (Plugins → Development → Bridge MCP for Figma). The web app cannot reach |
Tools missing in the AI client | Restart the client fully after editing its MCP config. |
Green dot never appears | Check nothing else holds port |
Every port in | Find the owner with |
| Use a path inside |
Plugin and server versions differ | Re-import |
| The targeted Figma file is closed or its plugin stopped. Open it, or omit |
| Each call is isolated. Re-query node IDs at the start of every call. |
| Use Ionicons names in kebab-case ( |
Project layout
figma-bridge-mcp/
├── server/ npm package: MCP server + bridge
│ ├── index.js MCP entry (stdio) and tool handlers
│ ├── bridge-server.js HTTP bridge: long-poll, sessions, origin gate
│ ├── code-executor.js sandbox for figma_write
│ ├── figma-proxy.js the figma.* API seen by user code
│ ├── http-fetch.js guarded fetch for images and icons
│ ├── allowed-ops.js operation allowlist
│ └── docs/ reference served by figma_docs
├── src/plugin/ plugin source (plain files, concatenated)
├── plugin/ manifest.json, ui.html, code.js (generated)
└── scripts/ build, test runner, regression testsDevelopment
npm install
npm run build:plugin # src/plugin/*.js → plugin/code.js (generated — never edit by hand)
npm test # every scripts/test-*.mjs; no live Figma neededPlugin files share one scope when concatenated; their order lives in scripts/lib/plugin-files.mjs. See CLAUDE.md for the invariants worth knowing before you change anything.
Releasing: bump version in package.json, rename the top CHANGELOG.md heading to ## [x.y.z] — date, push to main. CI runs the tests, publishes to npm, tags the commit, creates a GitHub Release with the plugin zip attached, and updates the MCP Registry.
License
MIT © nguyendinhphongdx. Forked from TranHoaiHung/figma-ui-mcp; the original copyright notice is preserved in LICENSE.
Available Tools
6 toolsfigma_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_export_filesA
Export frames from the current Figma page to image files ON DISK and return their paths, not the images. Use it to save mockups for docs, PRDs or attachments; use figma_read screenshot to LOOK at a frame instead. Select nodes with nodeIds, or with namePattern (wildcard * on the node name, e.g. "Workspace/*"; current page only). Files are written only inside the allowed export folders: ./figma-exports (relative to the MCP client's working directory) plus any folders listed in the FIGMA_EXPORT_ROOTS environment variable. Omit outputDir to use ./figma-exports. File names come from the node names (lowercase, ASCII, hyphens) unless fileNames is given; the extension always follows format. An existing file is never replaced unless overwrite is true. At most 50 files per call.
Inputs: scale, format, nodeIds, fileNames, +4 more.
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_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. Use the figma proxy object — all methods return Promises, use async/await. REUSE BEFORE DRAWING: check get_local_components / figma_rules first. Shared pieces → figma.instantiate({ componentId, parentId, overrides }); a frame to start from → figma.clone({ id, parentId, overrides }) (both return the copy's layers). Never redraw what already exists; create() warns when a component of that name exists. 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
Scored across 6 tools
Most tools have clearly delineated roles: figma_read inspects nodes, figma_write mutates the canvas, figma_export_files writes images to disk, and figma_status checks connectivity. The overlap is between figma_read, figma_rules, and figma_docs, which all return reference-style information, but the descriptions explicitly clarify (e.g., screenshot in figma_read to LOOK, export to save files; docs for API reference, rules for the file's design system).
All tools share a consistent figma_ prefix with short, readable snake_case labels, so the namespace is predictable. There is a minor inconsistency in that read/write/export_files are verbs while docs/rules/status are nouns, but the pattern remains easy to scan and infer.
Six tools is a well-scoped surface for a Figma bridge: one read path, one write path, one export path, one status check, and two documentation/rule helpers. Each tool earns its place and none feels redundant or decorative.
The lifecycle is largely covered: connectivity check, design inspection, mutation (including delete/clone/batch), and export. Minor gaps exist, such as reading beyond the current page only for exports, and no dedicated tool for comments/annotations or file/page enumeration, which agents would have to work around via figma_read.
Maintenance
Related MCP Connectors
The Figma MCP server brings Figma design context directly into your AI workflow.
Keeps Figma in sync with your Storybook and sends designers' changes to your coding agent.
Connect AI assistants to your approved computer for files, commands, browser and desktop tasks.
Draw architecture diagrams, UML, planning boards and clickable wireframes from your AI assistant.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI coding assistants to draw UI directly on a Figma Desktop canvas and read existing designs back as structured JSON, tokens, CSS, and screenshots, all over a localhost bridge without external API keys.299 npm2MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to inspect Figma selections, navigate pages, render previews, generate starter code, and submit user-approved canvas edits through a local bridge.3 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to read, create, edit, and organize Figma documents directly through a local plugin bridge, without needing a Figma AI subscription.3Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI coding agents to read and edit the file currently open in Figma Desktop through a local development plugin, supporting node inspection, JSON/image exports, and arbitrary Plugin API scripts without REST API rate limits.79 npmMIT