figma-lupa
Reads Figma designs through the Lupa plugin and exposes frame trees, design tokens, assets, screenshots, and comparison feedback so agents can rebuild designs faithfully.
Lupa lets a coding agent read a Figma design and rebuild it faithfully. It is a CLI (lupa) plus a small Figma plugin, with an optional MCP server. It is read-only: the plugin never edits the file.
One command gives the agent what it needs for a frame:
lupa design "<figma link>" -d src/assets --screenshotA compact tree of the frame. It holds the layout as flex/grid, exact sizes and CSS values, design tokens by name, and each repeated component once, with per-instance overrides.
The frame's icons and images, written to
src/assets, with each file named on its layer.Your codebase's own names. Run in your project, it puts the project's variable or class next to each colour, font and text style (
#ffffff → var(--color-bg), or*-grey-200andtext-sm font-mediumwith Tailwind v4). It says where a component already exists and which props it takes (Reactcvavariants, Phoenixattrs). Icons the project already has, as files or from Lucide or Heroicons, point at those instead of new copies.A screenshot for the agent to look at.
After building, lupa compare renders the page, diffs it against Figma and names the Figma layers where they differ.
How good is it
In the benchmark an agent (Claude Opus 5.5) builds a Figma screen as HTML/CSS, reading the design with one tool. Mean of 3 runs per tool on a card-grid screen:
Lupa | Official Figma MCP | Framelink | figwright | |
Pixel mismatch vs Figma | 0.40% | 0.42% | 2.12% (0.41–3.86%) | 0.41% |
Text layers within 1 px vertically | 100% | 100% | 66% (15–100%) | 100% |
Design data read from Figma | 28k chars | 80k | 29k | 110k |
Context added | 28k tokens | 63k | 30k | 82k |
Agent turns | 10 | 25 | 10 | 24 |
Against the official Figma MCP: the same quality with less than half the context and turns.
Against Framelink: just as lean, without its layout drift. In 2 of 3 Framelink runs the grid rows ended up several pixels off.
Consistency: all 6 runs of the current Lupa version rendered pixel-identically.
A second screen (a table page) gave the same picture.
In an existing project, the agent adds a page and a two-state component to a small HTML/CSS project that has its own tokens, components and icons. One run per tool, two for Lupa:
Lupa | Official Figma MCP | Framelink | |
Pixel mismatch, page / component | 2.09% / 3.02% | 2.67% / 12.86% | 1.95% / 3.02% |
Text layers within 1 px vertically | 90% | 68% | 93% |
Hard-coded colours left in new code | 1 | 3 | 14 |
New SVG files | 2–3 | 10 | 7 |
Context added | 59k tokens | 105k | 64k |
Agent turns | 28 | 57 | 27 |
Lupa names the project's variable for each design colour and points at the icons the project already has, so the agent writes almost no literal colours and few duplicate icons. For the method, the screens and how to re-run it, see bench/README.md.
Related MCP server: Figma Context MCP
What the agent reads
npm run demo, shortened: a product card whose raw plugin JSON is 19.4k characters becomes about 870 tokens.
## tokens
colors:
$color/bg/surface = #ffffff var(--bg-surface)
$color/text/primary = #101828 var(--text-primary)
$color/brand/500 = #4f46e5 var(--brand-500)
typography (family weight size/line-height letter-spacing …):
$Heading/H3 = Inter 600 20/28 ls:-0.005em — Card titles
T1 = Inter 400 14/20
…
## components (instances below list only what differs)
Button{Variant=Primary} #7:1 120×40 hug; row; gap:8; justify:center; align:center; p:10,16; bg:$color/brand/500; radius:8
// props: Variant: Primary*|Secondary; Label: text="Button"; Has icon: bool=false
text "Label" #8:1 56×20 hug; font:T4; color:#ffffff; "Button"
// bound: text←Label
svg "Icon/Arrow right" #9:1 16×16 color:#ffffff; hidden
// bound: visible←Has icon
## design
frame "Product card" #13:1 360×640 h:hug; col; gap:16; p:24,24,24,$space/4; bg:$color/bg/surface; radius:16; shadow:$Elevation/2; clip
img "Hero" #14:1 312×180 w:fill; src:abc123def4 cover; radius:12
text "Title" #15:1 312×28 w:fill; h:hug; font:$Heading/H3; color:$color/text/primary; "Wireless headphones"
frame "Rating" #17:1 96×16 hug; row; gap:4
svg "Icon/Star" #34:1 16×16 color:#f5a524
+4 more like ↑: #35:1 #36:1 #37:1 #38:1
frame "Specs" #18:1 312×120 w:fill; h:hug; col; gap:8
frame "Row" #19:1 312×20 w:fill; h:hug; row; justify:between
text #20:1 60×20 hug; font:T1; color:#667085; "Battery"
text #21:1 40×20 hug; font:T3; color:#101828; "30 h"
+3 more like ↑, content:
#22:1 "Weight" "250 g"
#25:1 "Bluetooth" "5.3"
#28:1 "Colour" "Black"
frame "Actions" #31:1 312×40 w:fill; h:hug; row; gap:12
instance Button{Variant=Primary} #39:1 150×40 Label="Add to cart"; Has icon=true; w:fill; h:hugThe full format is in docs/FORMAT.md.
Setup (once per machine)
Requirements: Node 20+ and the Figma desktop app (Figma runs imported plugins only there, not in the browser).
npm install -g figma-lupa
lupa setuplupa setup does the rest and says what it did. You can run it again at any time.
The skill: it links Lupa's skill into
~/.claude/skills(or$CLAUDE_CONFIG_DIR/skills). The skill teaches Claude the commands and the output format. It loads only for Figma work, so Lupa costs no context in other sessions.The plugin: it prints the path of the plugin's manifest. Import it once: in any Figma file, Plugins → Development → Import plugin from manifest….
Browser for
compare --url: it checks for one. Lupa looks forLUPA_BROWSER, then Playwright's browsers, then Google Chrome. If you have none, runnpx playwright install chromium.
Optional MCP server, for clients without a shell: claude mcp add --scope user lupa -- lupa mcp.
Updating
lupa updateThen close the Lupa plugin in Figma and run it again. The skill and the plugin's manifest stay at the same paths, so there is nothing to copy or re-import. The next lupa command replaces the background hub with the new version.
Lupa asks npm for a newer version once a day, and a command mentions it when there is one. Set LUPA_NO_UPDATE_CHECK=1 to turn this off.
Daily use
Open the design in Figma, run Plugins → Development → Lupa, and keep its small window open.
Select a frame or copy its link.
Ask Claude, for example: "Implement the selected Figma frame in
src/components/ProductCard.tsxwith our Tailwind tokens."
Start Claude in your project's root folder. lupa design then reads the project's own colour and font variables, text style classes, components and icons, and points the design at them. Use --project DIR for another folder, or --project none to turn this off.
The first lupa command starts a background hub for the plugin to connect to. It exits after an hour without requests. Several Claude sessions and several open Figma files can share it.
Commands
A target is a Figma URL (in quotes), node ids like 12:34, or nothing for the current selection. Each command has an MCP tool of the same purpose. Run lupa help for every option.
Command | What it does |
| The tree above, within a token budget ( |
| PNG at up to 2×, sized for vision models and tiled when tall. |
| Icons as SVG and images as their original files, deduplicated. Use |
| Renders your page at the design's width and diffs it against Figma. Prints the mismatch and the differing regions by Figma layer, and writes a design / page / diff image. A |
| Variables (all modes) and styles, as a list, CSS or JSON. |
| Pages and frames, and search by layer name (add |
| Figma's own Dev Mode CSS, as a cross-check. |
| Connected files and selections. |
Troubleshooting
"No Figma file is connected": run the plugin in the file and keep its window open. After updating Lupa, run the plugin again.
"the Lupa plugin … is version X": Figma runs the old plugin code until you close the plugin and run it again. If it keeps the old version, Figma loads it from an old folder: run
lupa setupand import the manifest it shows."used Figma's SVG export": Figma stops rendering PNGs while its window is hidden or covered, so Lupa rendered the SVG export in Chromium instead. Layout and text match; blur, some newer effects and occasionally a stroke can be missing. For an exact render, bring Figma to the front and run the command again.
Port in use: set
LUPA_PORT, change the port inplugin/src/ui.htmlandplugin/manifest.json, and rebuild.Logs: the hub logs every request to
$TMPDIR/lupa/hub.log. SetLUPA_DEBUG=1for bridge events.
More
docs/internals.md: how the output stays faithful, the architecture, security, development.
docs/landscape.md: other Figma tools and why Lupa is built this way.
bench/README.md: the benchmark.
License
GPL-3.0-or-later. See LICENSE.
Available Tools
9 toolscompare_screenshotCompare with implementationARead-only
Pixel-diffs your implementation against the Figma render of the target. Pass url (+ selector) to have Lupa render your running page at the design's width, or image = a PNG screenshot. Returns the mismatch %, the differing regions mapped to Figma layers, and a design | implementation | diff image.
Inputs: url, file, image, target, +4 more.
export_assetsExport assetsBRead-only
Writes the icons (SVG) and images (original files) used inside the target to a folder, deduplicated, and lists which file belongs to which layer / src hash. as:"svg"|"png" exports the target layers themselves instead.
Inputs: as, dir, file, scale, +2 more.
find_nodesFind layersARead-only
Search layers by name (or text content with text:true) across the file, a page, or inside a node.
Inputs: query (required), file, page, text, +3 more.
get_cssFigma's CSSARead-only
Figma's own generated CSS (as in Dev Mode) for specific layers — a cross-check, not a layout description.
Inputs: file, target.
get_designRead a designARead-only
The main tool: a compact, exact description of a frame/component (layout, sizes, colours, typography, tokens, components, overrides) for reproducing it in code. Output is breadth-first within a token budget; cut subtrees say how to fetch them.
Inputs: file, depth, budget, target, +6 more.
get_outlinePage outlineARead-only
Lists pages and their top-level frames (ids, sizes) — a cheap map of the file for finding what to implement.
Inputs: file, page, depth.
get_screenshotScreenshotARead-only
Renders the target as PNG image(s) you can look at. Wide renders are scaled to what vision can read; tall ones are split into tiles. Optionally saves the full-resolution PNG.
Inputs: file, scale, target, save_to.
get_tokensDesign tokensBRead-only
The file's local variables (all modes) and styles — as a readable list, CSS custom properties, or JSON.
Inputs: file, filter, format.
statusConnection statusBRead-only
Which Figma files are connected through the Lupa plugin, their current page and selection.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools target clearly different needs: navigation (status, get_outline, find_nodes), extraction (get_design, get_tokens), assets (export_assets), visuals (get_screenshot), and verification (compare_screenshot). The only genuinely fuzzable pair is get_css vs get_design, since both emit styling information for layers, but the descriptions explicitly frame get_css as a cross-check rather than a layout description. An agent can pick correctly with the descriptions in hand.
Nearly all names follow a verb_noun pattern (get_tokens, get_css, get_screenshot, get_outline, get_design, find_nodes, export_assets, compare_screenshot), and the verbs map sensibly to the action type. The lone deviation is the bare noun 'status', which breaks the pattern but remains unambiguous and readable.
Nine tools is well within the ideal band and each one covers a distinct stage of the design-to-code loop: discovery, extraction, asset export, visual inspection, and pixel comparison. There is no filler or redundant tool in the set.
Coverage of the read/inspect/verify lifecycle is strong: map the file, search layers, pull exact layout+tokens, export assets, view renders, and diff against an implementation. Minor gaps remain, such as no direct fetch-by-node-id (agents must go through get_outline/find_nodes first) and no inspection of prototypes/interactions or component-variant catalogs as a first-class surface. Writing back to Figma is absent, but that appears outside this server's stated purpose.
Maintenance
Related MCP Connectors
Keeps Figma in sync with your Storybook and sends designers' changes to your coding agent.
Turn any website into a design system your coding agent follows, then catch off-brand UI code.
Deterministic Figma to Elementor, Gutenberg, Oxygen, Etch, Divi and HTML layouts for AI agents.
A design agent in your coding agent's loop: briefs each screen, reviews UX and visual quality.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides AI coding agents with access to Figma design data through the Figma API. Enables accurate one-shot implementation of designs in any framework by translating Figma files into simplified layout and styling information.1MIT
- AlicenseAqualityDmaintenanceConverts Figma designs into structured code context with token-aware styling, enabling AI agents to generate production-level frontend code.18 npmMIT
- FlicenseNot gradedqualityCmaintenanceEnables AI coding agents to inspect the currently selected Figma element or find layers by name, extracting layout, colors, typography, borders, and shadows as compact design tokens while exporting SVG and PNG assets straight into the local project. It connects over a local WebSocket to a running Figma session, so no API key, Dev Mode subscription, or manual ZIP export is required.-
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to read Figma designs through a local plugin and then verify the sections they build in a headless browser, comparing layer-by-layer numbers and screenshots, plus responsive widths, motion and accessibility, until the build matches the design. Works on Figma's free Starter plan with no API key or monthly read limit.MIT