localfig
localfig is an MCP server that gives AI agents full read/write control over the currently open Figma file through a local plugin bridge — no cloud API or tokens needed.
figma_status — check plugin connection, open file/page, selection, top-level frames, driver, and whether dynamic code execution is available.
figma_eval — run arbitrary Plugin API JavaScript with helpers for text, auto-layout, tokens, components, viewport reveal, and more; each mutating call becomes one undo step.
figma_metadata — inspect node subtrees with optional styles, bound variables, named styles, component info, and Figma-computed CSS.
figma_tokens — list local variable collections, modes, per-mode values, and paint/text/effect styles.
figma_find — search the current or all pages by node type, layer-name regex, or text regex.
figma_changes — track what changed in the file since the last call, hiding plugin-made edits by default.
figma_history — snapshot named restore points and undo the last tool call within 60 seconds.
figma_library — list team library collections, import components/styles/variables by key, and place instances.
figma_export — export nodes to PNG/JPG/SVG/PDF/JSON, with PNG/JPG attached inline as images and SVG/JSON returned as text.
figma_place_image — put local images (PNG, JPG, WebP, GIF, BMP, AVIF…) into node fills with automatic downscaling.
Provides tools for interacting with the Figma desktop app through its Plugin API, enabling AI agents to read and modify design files, manage layers, variables, components, extract metadata, export assets, and more.
localfig
The Figma desktop app as an MCP server. localfig gives an AI agent the full Figma Plugin API on the file you have open — through a tiny dev plugin and a loopback HTTP bridge, entirely on your machine.
Reads and writes. Frames, text, auto-layout, variables, components, image fills, exports, undo — anything the Plugin API can do, the agent can do.
No Figma cloud API, no personal access token, no per-account quota.
Zero dependencies. Node built-ins only. Nothing leaves your machine.
Works with any MCP client that can launch a stdio server: Claude Code, Cursor, Windsurf, Cline, Claude Desktop and more.
MCP client --stdio JSON-RPC--> localfig --http localhost:8765--> Figma plugin --> Plugin APIWhy localfig
localfig | Official Figma MCP | REST-API servers | Fixed-command plugin bridges | |
Writes to the file | anything the Plugin API can | limited | no — the REST API cannot write nodes | a fixed menu of commands |
Arbitrary Plugin API JavaScript | yes ( | no | no | no |
Quota / login | none | plan-dependent | token + rate limits | none |
Tokens, styles, components read back |
| yes, incl. Code Connect | partial | rarely |
Agent can see the design as an image | yes, inline in the response | yes | files or links, not inline | varies |
Undo per agent step, change tracking | yes | no | no | no |
Related MCP server: Figma Bridge MCP
Requirements
Node.js 18 or newer
The Figma desktop app — dev plugins cannot be imported in the browser
An MCP client: Claude Code, Cursor, Windsurf, Cline, Claude Desktop, …
Install (once)
npx -y localfig --setupThat generates your local secret, writes the plugin to ~/.localfig/plugin/, registers localfig with every MCP client it finds on your machine, and prints the manifest path for the next step. --dry-run shows what it would do without touching anything, and --clients=cursor,vscode limits it to the clients you name. Prefer a clone? git clone https://github.com/LucasGorgal/localfig.git && cd localfig && node server.mjs --setup does the same.
Client | Where setup registers localfig |
Claude Code |
|
Claude Desktop |
|
Cursor |
|
Windsurf |
|
VS Code (Copilot agent mode) | user |
Cline (extension and CLI) |
|
Gemini CLI |
|
Codex |
|
opencode |
|
Zed |
|
LM Studio |
|
A client counts as installed when its config folder exists. Setup merges into existing files instead of replacing them: other servers and settings stay, an existing localfig entry keeps its env, and a .localfig.bak copy is written before any change. Files it cannot safely rewrite, such as a settings.json with comments, are left untouched and reported with the entry to paste. Restart any client that was already open.
For a client that is not in the list, add this to its MCP configuration:
{ "mcpServers": { "localfig": { "command": "npx", "args": ["-y", "localfig"] } } }On Windows, use "command": "cmd", "args": ["/c", "npx", "-y", "localfig"] instead: most clients start servers without a shell, and npx is a .cmd script there.
Then import the plugin into Figma (once):
Open any design file in the desktop app. The Plugins menu only exists inside a file, not on the home screen.
Figma menu (the logo, top-left) → Plugins → Development → Import plugin from manifest… — or press
Ctrl/(Cmd/) and type import plugin from manifest.Pick
~/.localfig/plugin/manifest.json(the setup output prints the full path).
The manifest asks for two permissions — teamlibrary (library components and tokens) and currentuser (who is driving) — and registers a relaunch button.
Use (every session)
Open the file you want to work on.
Run the plugin:
Ctrl/→ localfig — orCtrlAltP(CmdOptP) to re-run the last plugin, or the Reconnect localfig button in the properties panel of a file it has run in. A small panel appears and says Connected to localfig once the MCP server is up. Leave it open.Ask your agent to do Figma work. Every tool acts on the file where the plugin is running — there is no file key, which is why nothing touches the cloud.
Closing the panel (or the file) disconnects; re-run the plugin to reconnect. This is the one manual step: Figma provides no way to launch a plugin from outside.
Tools
Tool | What it does |
| Plugin connected? File, page, selection, top-level frames, who is driving, and whether dynamic code execution is available |
| Run arbitrary Plugin API JavaScript in the file — the workhorse |
| Structural dump of a subtree: ids, names, types, geometry, text. |
| Every local variable collection with its modes and per-mode values, plus paint / text / effect styles |
| Search the current page or every page by type, layer-name regex and text regex |
| What changed since your last call — creations, deletions, property changes, per-node summary; edits made by tool calls are tagged and hidden by default, so this is what the person did in Figma meanwhile |
|
|
| Team library: list variable collections and their variables, import components / styles / variables by key, place instances |
| Export nodes to PNG/JPG/SVG/PDF/JSON on disk. PNG/JPG come back inline as images; JSON (the subtree in Figma REST API shape) and SVG come back inline as text |
| Put a local image into a node's fill. Any format the browser decodes — PNG, JPG, WebP, GIF, BMP, AVIF. Images over 4096px per side are downscaled automatically ( |
figma_eval environment
Code runs inside the plugin sandbox, wrapped in an async function: top-level await and return both work.
const n = await figma.getNodeByIdAsync('10:59'); // sync getNodeById is unavailable (dynamic-page access)
await helpers.setText(n.findOne(x => x.type === 'TEXT'), 'new copy');
helpers.reveal(n); // put it on the person's screen
return { id: n.id, w: n.width }; // JSON-serialized back to the agentGlobals: figma and helpers.
helpers.createText({characters, font: {family, style}, fontSize, color: '#hex', width, lineHeight, letterSpacing, textCase, textAlign, name, parent, x, y})— loads the font and ordersresize()beforetextAutoResize.helpers.setText(node, chars)— loads the node's real fonts, then sets characters.helpers.loadNodeFonts(node).helpers.set(node, props)— batch assign;layoutModefirst,width/heightviaresize, sizing modes after.helpers.rgb('#rrggbb'),helpers.rgba('#rrggbbaa')— hex to the{r, g, b[, a]}fills want.helpers.reveal(nodes)— scroll and zoom the viewport to what you just made.helpers.notify(msg)— a toast.helpers.collection(name, [modes]),helpers.token(collection, name, type, value | {mode: value}),helpers.bind(node, 'fills' | 'strokes' | prop, variable)— create design tokens and bind properties to them, one line each.helpers.importComponent(key),helpers.instance(key, parent, props)— team-library components.helpers.query(root, sel)— minimal selectors:TEXT,[name=X],[name*=X],A B,a, b.helpers.createAutoLayout(dir, props).helpers.command(kind, payload)— run any typed command (tokens,metadata,find,changes,export…) from inside a script:(await helpers.command('tokens', { collection: 'Brand' })).result.
Plugin API gotchas the helpers protect you from
resize()on a TEXT node resetstextAutoResizetoNONE; on an auto-layout frame it sets both sizing modes toFIXED. Resize first, then set the sizing.Return plain data from
figma_eval. Real Figma nodes are collapsed to{id, name, type}so a stray node reference cannot flood the result — usefigma_metadatato inspect a subtree.Load fonts before any text mutation.
figma.notify()works here (the cloud MCP blocks it).
Design-system awareness
figma_tokens returns the file's variables the way a design system thinks about them:
{ "collections": [{ "name": "Brand", "modes": ["Light", "Dark"], "defaultMode": "Light",
"variables": [{ "name": "color/bg", "type": "COLOR", "values": { "Light": "#ffffff", "Dark": "#04060c" } },
{ "name": "space/md", "type": "FLOAT", "values": { "Light": 16, "Dark": 16 } },
{ "name": "color/accent", "type": "COLOR", "values": { "Light": "{color/blue-500}", "Dark": "{color/blue-300}" } }] }],
"styles": { "paint": [...], "text": [...], "effect": [...] } }figma_metadata with styles: true then reports, per node, boundVariables (which token drives each property), fillStyle / textStyle / effectStyle names, and for instances the main component and its componentProperties; css: true adds the CSS Figma computes for each node. Together they let an agent build on a design system instead of hard-coding values — and hand code off from a real file.
Images
In:
figma_place_imagesends the file's bytes to the plugin UI, which is a full Chromium iframe. It decodes any browser-supported format, downscales tomaxSide(default 4096, Figma's hard limit) with high-quality smoothing, converts non-native formats to PNG, and hands the result to the main thread. The tool result reports what happened (prepared).Out:
figma_exportwrites files to~/.localfig/exports/and attaches PNG/JPG (≤ 2 MB each) to the result as images, so the agent sees the render without another call.JSONexports the subtree in Figma REST API shape.
Undo, versions and change tracking
Every mutating tool call is checkpointed with figma.commitUndo, so it lands in the file's undo history as one step a person can Ctrl+Z (the most recent call is committed 60 s after it finishes, or at the next call). Within that window figma_history {action: "undo"} reverts the last call from the agent side — triggerUndo reverts to the last checkpoint — and {action: "snapshot"} saves a named version before risky edits. The plugin also records node changes on every page it has seen (Figma delivers them batched, after the fact): figma_changes returns what changed since a seq, with edits caused by tool calls tagged byPlugin by a time-window heuristic and hidden by default — the agent can notice what the person changed in Figma between calls instead of overwriting it.
Multiple sessions
The first localfig process owns the bridge port; later ones detect it via /health, run as clients, and proxy through it — same tools either way. If the owner dies, the next tool call on a client re-binds the port and takes over ("re-election" in the log); the plugin re-registers when it reconnects.
Files and configuration
~/.localfig/
token local secret (generated on first run)
plugin/ manifest.json + code.js + ui.html — import THIS manifest into Figma
exports/ where figma_export writesVariable | Default | Notes |
|
| Where the token, plugin and exports live |
|
| Also change |
|
| Where |
node server.mjs --help lists the flags.
Security
The bridge binds loopback only (127.0.0.1 and ::1). Every endpoint except /health requires a 32-hex secret generated on first run into ~/.localfig/token and baked into ~/.localfig/plugin/ui.html. Edit plugin/ui.template.html in the package, never the generated ui.html. Nothing is sent to any server.
Design notes
Why a plugin? It is the only local surface with full read/write access to an open Figma document. The REST API is cloud, needs a token, and cannot write nodes.
Why HTTP long-poll and not WebSocket? The plugin main thread has no network at all; only the UI iframe does. Long-poll needs no dependency and no framing code, and
http://localhostis exempt from mixed-content blocking. Figma's manifest validator rejects raw IPs innetworkAccess, hencelocalhost— and the IPv6 mirror listener, because Windows resolveslocalhostto::1first.Binary stays binary on the plugin channel. Exports leave as
POST /blob; images enter viaGET /assetinto aUint8Array. Only JSON goes through the command channel. (Renders are base64-encoded once, in the MCP result, where the protocol requires it.)Why a home directory? The package may live in the npx cache or a read-only global install; the plugin folder you import must not move when the package updates, and per-user state must not live in a package.
Platform notes
Developed and tested on Windows 11 with the Figma desktop app. macOS and Linux should work unchanged — Node built-ins only, no native code — but have not been exercised yet. Reports and fixes welcome.
Test
node test-e2e.mjsSpawns the server in an isolated home, speaks MCP over stdio, and impersonates the plugin over HTTP — covering the handshake, all ten tools, file round-trips, inline images, owner re-election, and setup against sandboxed MCP client configs, without Figma running. 55 assertions.
Layout
server.mjs MCP (stdio) + bridge (http), single process; --setup, --help
plugin/manifest.json copied to ~/.localfig/plugin on start
plugin/code.js main thread: executes commands against the Plugin API
plugin/ui.template.html UI source; token/port get baked into ~/.localfig/plugin/ui.html
test-e2e.mjs end-to-end test without FigmaLicense
MIT — see LICENSE.
Available Tools
10 toolsfigma_changesARead-only
What changed in the file since a previous call: node creations, deletions and property changes recorded by the plugin, with a per-node summary. Changes made by tool calls are tagged byPlugin (heuristic: they arrive during, or within 2 s after, a mutating call) and hidden by default, so this shows what the person edited in Figma between your calls. Pass back the returned seq as since.
Inputs: limit, since, includePlugin.
figma_evalA
Run JavaScript inside the Figma plugin sandbox, against the file where the bridge plugin is running.
The code body is wrapped in an async function: top-level await and return both work.
Globals: figma (full Plugin API) and helpers.
Use figma.getNodeByIdAsync(id) — the sync getNodeById is unavailable under dynamic-page access.
Switch pages with: await figma.setCurrentPageAsync(page)
Load fonts before ANY text mutation, or use helpers.setText / helpers.loadNodeFonts.
The return value is JSON-serialized (figma.mixed -> "mixed", cycles pruned). Real Figma nodes collapse to {id,name,type}; return plain data (ids, numbers, strings) instead.
resize() RESETS sizing: on TEXT it sets textAutoResize to NONE (resize first, then set textAutoResize = "HEIGHT"); on auto-layout frames it sets both sizing modes to FIXED (set them after resizing, or use helpers.set / helpers.createText, which order this correctly).
Heights of text and hug-sized frames read back correctly right after the change — if you see h=10 on a text you resized, the auto-resize was reset (see above).
Each mutating tool call becomes ONE undo step for the person (checkpointed with figma.commitUndo); figma_history {action:"undo"} reverts the last call if asked within 60 s. Call helpers.reveal(nodes) at the end so what you built is on their screen.
For structure + styles (fills, fonts, effects, auto-layout, bound variables, components) of an existing frame, prefer figma_metadata with styles:true over a hand-written walker; figma_tokens lists the file's variable collections and styles.
helpers: setText(node, chars), loadNodeFonts(node), createText({characters, font:{family,style}, fontSize, color:"#hex", width, lineHeight(%), letterSpacing(px), textCase, textAlign, name, parent, x, y}), rgb("#hex"), set(node, props), query(root, selector), createAutoLayout(dir, props), reveal(nodes), notify(msg), rgba("#hex8"), collection(name, [modes]), token(collection, name, "COLOR"|"FLOAT"|"STRING"|"BOOLEAN", value | {mode: value}), bind(node, "fills"|"strokes"|prop, variable), importComponent(key), instance(key, parent, props), command(kind, payload) — runs a typed command (tokens, metadata, find, changes...) from inside eval and returns {result}.
Inputs: code (required), timeoutMs.
figma_exportAIdempotent
Export nodes to local files. PNG/JPG (up to 2 MB each) are attached inline as images — the screenshot path. JSON = the subtree in Figma REST API shape (JSON_REST_V1), for design-to-code tooling; SVG and JSON also come back inline as text (up to 200 KB).
Inputs: scale, format, inline, nodeIds, +2 more.
figma_findARead-only
Search the current page (or all pages) for nodes by type, layer-name pattern and/or text content. Returns ids, names and positions — the way to locate things in a big file before editing.
Inputs: name, text, limit, scope, +1 more.
figma_historyA
snapshot: save a named version to the file's version history — a restore point before risky edits. undo: revert the edits of the last mutating tool call (figma_eval / figma_place_image / library import) if it ran within the last 60 s; after that they are committed to the file's undo history as one step per call, where the person can Ctrl+Z them.
Inputs: action (required), title, description.
figma_libraryA
Team library access (the plugin manifest asks for the "teamlibrary" permission). collections: list the library variable collections available to this file. variables: list the variables in one collection (collectionKey). import: bring a component / componentSet / style / variable into the file by its library key; for components, instance:true also places an instance (figma_metadata reports component keys on instances).
Inputs: action (required), x, y, key, +4 more.
figma_metadataARead-only
Structural dump of a node subtree (id, name, type, x/y/w/h, text characters). Omit nodeId for the current page. Cheap way to find node IDs before editing. Pass styles:true to also get fills, strokes, effects, opacity, corner radius, auto-layout and text styles per node — plus bound variables (token names), named styles, and for instances the main component and its property values. css:true adds the CSS Figma computes per node.
Inputs: css, depth, nodeId, styles, +1 more.
figma_place_imageA
Put a local image file into a node as an image fill. Any format the browser decodes (PNG, JPG, WebP, GIF, BMP, AVIF...): images over 4096px per side are downscaled automatically in the plugin UI and non-native formats are converted to PNG. The result reports what was done (prepared).
Inputs: nodeId (required), filePath (required), maxSide, scaleMode.
figma_statusARead-only
Bridge + plugin health: is the Figma plugin connected, which file/page is open, current selection, and whether dynamic code execution is available.
Inputs: no named parameters.
figma_tokensARead-only
Design tokens and styles of the open file: every local variable collection with its modes and per-mode values (colors as hex, aliases as {name}), plus local paint/text/effect styles. Read this before generating code or building on a design system; figma_metadata with styles:true then tells you what each node is bound to.
Inputs: collection, maxVariables, includeStyles.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool targets a clearly distinct concern: connection status, arbitrary plugin execution, structural metadata, design tokens, search, change tracking, history, library access, export, and image placement. Even the overlap between metadata and find is resolved by their descriptions: metadata dumps subtree structure, find locates nodes by criteria.
All tools share the figma_ prefix, which makes the family recognizable. There is slight inconsistency in grammatical form—nouns like figma_metadata and figma_tokens versus verbs like figma_find and figma_place_image—but the pattern is still predictable and readable.
Ten tools is well within the ideal 3–15 range and matches the server's scope: a Figma bridge needs status, inspection, mutation, search, history, assets, and library access. Each tool earns its place without redundancy or bloat.
The surface covers the full workflow: inspect the file, find nodes, read tokens, run arbitrary mutations via figma_eval, track changes, snapshot/undo, import from libraries, export files, and place images. figma_eval acts as a well-documented escape hatch for anything not explicitly exposed, so there are no obvious dead ends.
Maintenance
Related MCP Connectors
The Figma MCP server brings Figma design context directly into your AI workflow.
Official Fibery MCP server: query and update your workspace from any AI client via OAuth.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseAqualityDmaintenanceLocal-first MCP server that connects AI coding agents to the currently open Figma file through a local plugin bridge, requiring no Figma API token.8MIT
- AlicenseBqualityCmaintenanceLocal MCP server connecting AI clients to the Figma desktop app for inspecting and editing Figma documents via the Plugin API.1616 npm1MIT
- AlicenseAqualityDmaintenanceFigma MCP server that lets agents execute arbitrary JavaScript inside a running Figma desktop app via a local development plugin, enabling real-time document inspection and manipulation while avoiding REST API rate limits.3MIT
- AlicenseNot gradedqualityBmaintenanceLocal MCP server exposing Figma REST API tools to AI agents, enabling file reads, comments, variables, and other resource operations. Works with personal access tokens and integrates with Claude, Cursor, Codex, and more.MIT