figma-lupa
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LUPA_PORT | No | Port to use if the default port is in use. Note: also requires changing the port in plugin/src/ui.html and plugin/manifest.json, and rebuilding. | |
| LUPA_DEBUG | No | Set to 1 to log bridge events for debugging. | |
| LUPA_BROWSER | No | Browser to use for `compare --url`. Lupa looks for LUPA_BROWSER first, then Playwright's browsers, then Google Chrome. | |
| LUPA_NO_UPDATE_CHECK | No | Set to 1 to turn off the daily npm check for a newer version. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Lupa reads Figma designs (read-only) for faithful implementation.
Workflow: get_design with assets_dir and screenshot: true (structure, exact styles, icon/image files, a PNG to look at) → build → compare_screenshot with your running page (url) or a screenshot of it, fix the listed regions, repeat. Targets: a Figma URL, node ids ("12:34", comma-separated), or nothing = the user's current selection in Figma.
get_design format — one line per layer, children indented:
["name"] #id W×H props… kinds: frame group section component set instance text svg img rect ellipse line
Props are CSS-like, separated by "; ". A bare word is a flag.
Size: W×H are px. w:/h: fill|hug (bare "fill"/"hug" = both axes); no w/h = fixed. Instances say w:fixed/h:fixed (or bare "fixed") where their component hugs. h:fixed(content N) = a fixed box its N px content overflows: set the size anyway; justify places the spill. minw/maxw/minh/maxh.
Flow (auto layout): row|col|grid, gap, rowgap, wrap, p (CSS padding shorthand, commas), justify (center|end|between), align (center|end|baseline). Children of a flow parent are positioned by the flow.
Free position: at:x,y = CSS left/top inside the parent; abs = absolutely positioned inside a flow parent; pin:right|bottom|center-x|left+right… = constraints (how it moves when the parent resizes); rotate: (CSS sign).
Style: bg (CSS background, topmost layer first), border: [dashed(…)] [outside|center] (default inside → box-sizing: border-box; p and at: already count from inside it), radius (full = pill), smooth (corner smoothing), shadow/text-shadow (CSS), blur/backdrop (CSS blur() radius, already halved from Figma), opacity, blend, clip (overflow hidden), mask.
img: src: cover|contain|crop|tile. svg: vector graphic; color: its fill. With an assets folder (assets_dir, CLI -d), src: is the file written for that layer; otherwise export_assets writes them.
Text: font:; color; text-align; valign; ellipsis; content last as a JSON string. "" lines under text = styled runs that differ from the base style. In a typography token, "≈17" after a line height (normal≈17, 135%≈19) = what Figma renders it at, measured: write line-height 17px.
$name = design token (Figma variable/style); see "## tokens". T1, E1 = repeated typography/effect values listed there. "$name=value" = token bound but resolved to another value here (mode/override).
Components: "## components" prints each repeated component once. "instance Name{Variant=…} Prop=value" uses it; " path: changes" lines list only what that instance overrides (path = layer names, or #id for unnamed layers of the definition).
"+N more like ↑" / "+N more alternating like the 2 above" = siblings with the same structure as the layer(s) just printed; the lines under it give each one's id and its own texts/images.
"… +N layers not shown → get_design #id" = cut by the token budget; fetch that subtree when you need it.
// lines = designer notes, prototype interactions, component props, exports.
Codebase: "→ var(--x)" after a colour or font = the project's own variable for that value; "→ .class" after a typography token = its text style class. Tailwind theme (v4 @theme or v3 tailwind.config): "→ *-grey-200" = that colour's utilities (bg-grey-200, text-grey-200, border-grey-200…), "→ font-sans" = the font utility, "→ text-sm font-medium leading-[20px]" = utility classes for a typography token. "// project has: …" = where the project defines that component, with its props when Lupa can read them ( for React cva/tv variants or string-union props, <.button variant="primary"> <:actions> for Phoenix attrs and slots; * = default). A src: outside the assets folder = the project's own icon with the same drawing; src: (components/icons/plus.tsx) = the project's own icon component; src: from lucide-react or src:<.icon name="hero-x-mark" /> = that icon from the project's icon library (no file written).
Reproduce exact values (sizes, spacing, colours, type). Before writing any colour, $token or raw (#hex, rgba), look for the codebase's own token with that name or value (Tailwind theme, CSS variables, theme object) and use it; hardcode only when none matches.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| statusB | Which Figma files are connected through the Lupa plugin, their current page and selection. |
| get_outlineA | Lists pages and their top-level frames (ids, sizes) — a cheap map of the file for finding what to implement. |
| find_nodesA | Search layers by name (or text content with text:true) across the file, a page, or inside a node. |
| get_designA | 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. |
| get_screenshotA | 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. |
| export_assetsB | 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. |
| get_tokensB | The file's local variables (all modes) and styles — as a readable list, CSS custom properties, or JSON. |
| get_cssA | Figma's own generated CSS (as in Dev Mode) for specific layers — a cross-check, not a layout description. |
| compare_screenshotA | 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. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
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.