# @irshad.io/figma-local-mcp [Health: Active]

**Category:** 📐 Architecture & Design  
**Repository:** https://github.com/irshadio/figmcp  
**GitHub Stars:** 5  
**npm Downloads (last month):** 862  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/irshad-io-figma-local-mcp

## Description
Local MCP server for Figma: a development plugin streams the open file over a localhost WebSocket, so design reads never touch the Figma API. Writes Flutter, React or HTML reference code.

## Tools
Capabilities this server exposes over MCP:

- **get_design_context** — Get design context for a Figma node — the primary tool for design-to-code workflows. Returns reference code (Flutter widgets for Flutter projects, SwiftUI views for Swift packages and Xcode projects, HTML + Tailwind for static sites, React + Tailwind otherwise), the assets it uses, a screenshot and the variables in the node. SwiftUI code comes with a Structure block naming what each part is (tab bar, segmented control, chips, carousel, grid, buttons, fields) and the pattern used for it. The code must be adapted to the target project. Use the nodeId parameter to specify a node id; from a URL like https://figma.com/design/:fileKey/:fileName?node-id=1-2 the node id is 1:2. With no nodeId the current selection in Figma is used. Large nodes return metadata instead of code unless forceCode is set.
- **get_metadata** — IMPORTANT: Always prefer to use get_design_context. Get metadata for a node or page in XML format: node IDs, layer types, names, positions and sizes, useful for an overview of the structure. nodeId can be a page id (e.g. 0:1). When nodeId is omitted, returns the pages of the document (and saved snapshots) instead. When something is selected in Figma, the response starts with a "Currently selected nodes:" block.
- **get_screenshot** — Generate a screenshot for a given node or the currently selected node in Figma. maxDimension (default 1024) caps the longer edge of the PNG (up to 2x the node size). The response gives a local URL and file path plus width/height and original_width/original_height. Set enableBase64Response to also get the image inline.
- **get_variable_defs** — Get variable definitions for a given node id. E.g. {'icon/default/secondary': #949494}. Variables and styles are reusable values applied to colours, fonts, sizes and spacings. Values resolve for the node's own mode. Read-only; with no nodeId it uses the selection. Use it for design tokens, and get_design_context for the layout. Without the plugin, a saved snapshot gives the raw values only, without names.
- **download_assets** — Download assets for a single node: an exported render (`export`), the original images used as fills (`rawImages`, up to 20) and SVGs of the vector layers (`svgAssets`, up to 20). defaultFormat and defaultScale set the export format (png, jpg, svg, pdf) and scale (default png at 1).
- **get_code_connect_map** — Get the mapping from the component instances in a node to code components: { nodeId: { codeConnectName, codeConnectSrc, label } }, plus the components that are not mapped yet. Mappings live in the project (.figma-local/code-connect.json under the working directory).
- **add_code_connect_map** — Map a design component to a code component, so get_design_context names the code component for every instance of it. Pass an instance, component or component set id; a component in a set maps the whole set.
- **remove_code_connect_map** — Remove the code component mapping saved by add_code_connect_map, so get_design_context stops naming that code component. Pass an instance, component or component set id. Only the local mapping file changes, never the design; returns how many mappings were removed (0 when none existed). Add it again with add_code_connect_map to undo.
- **whoami** — Status of the local Figma connection: whether the plugin is connected, the pairing code it needs, the open file, page and selection, the project and its Code Connect file, and the saved snapshots. Use it when a read fails.
- **import_design_export** — Save a design export JSON (frames with node trees, as the plugin produces) as a snapshot, so its nodes can be read without the plugin. Use it for an export made earlier with save_design_export or the plugin. Copies the file into the local snapshot store, replacing an earlier snapshot of the same frames; the source file and the Figma file are not changed. Fails if the JSON is not a design export.
- **save_design_export** — Write a full design export of a node (default: the selection) to a JSON file: the node tree with every layout, paint, text, variable, style, component and interaction detail, icon SVGs, renders of masked or rotated groups, image fills and a 2x preview. Mapped components carry their code component. Use it to hand a frame to a build script.
- **use_figma** — Create or edit designs in the file open in Figma Desktop by running JavaScript against the Figma plugin API. `code` is the body of an async function with `figma` in scope: use await, and `return` a value (nodes come back as {id, name, type, x, y, width, height}); console.log output is returned too. The whole run is one undo step. If the script throws, the changes it made before the error stay.

Rules of the plugin API here:
- The file uses dynamic page loading: use figma.getNodeByIdAsync, figma.setCurrentPageAsync, await page.loadAsync() before reading another page, getMainComponentAsync, and the *Async style/variable getters.
- Load every font before setting text or text properties: await figma.loadFontAsync({ family: "Inter", style: "Regular" }). Check figma.listAvailableFontsAsync() when unsure a font exists.
- Colours are 0-1 RGB: fills = [{ type: "SOLID", color: { r: 1, g: 0.4, b: 0 } }]. Paint arrays are immutable: assign a new array.
- Prefer auto layout: layoutMode, itemSpacing, padding*, primaryAxisAlignItems, counterAxisAlignItems; set layoutSizingHorizontal/Vertical ("FILL", "HUG", "FIXED") only after the node is appended to an auto-layout parent.
- New nodes land on the current page: place top-level frames clear of existing ones, and append children with parent.appendChild(node).
- Reuse what the file has: find its components, styles and variables with search_design_system first, and set bound variables with figma.variables.setBoundVariableForPaint.
- Images from the web: const img = await figma.createImageAsync(url), then fills = [{ type: "IMAGE", imageHash: img.hash, scaleMode: "FILL" }]. fetch(url) works too (e.g. an SVG for figma.createNodeFromSvg). Local files go in with place_image.
- figma.currentPage.selection = [node] and figma.viewport.scrollAndZoomIntoView([node]) show the result.

Build a screen in a few calls (structure, then sections), return the ids, and check each step with get_screenshot.
- **place_image** — Put an image file from this computer into the file open in Figma Desktop: a PNG, JPG or GIF becomes a rectangle with the image fill (or the fill of the layer `nodeId`), and an SVG becomes editable vector layers. Use it for the project's own assets (logos, icons, photos) while designing; use_figma with figma.createImageAsync(url) takes images from the web. The new layer goes into `parentId` (default: the current page, right of its content), sized by `width`/`height` (one keeps the aspect ratio; default: the image's own size). Images larger than 4096 px on a side are scaled down by Figma.
- **verify_code** — Check Flutter, SwiftUI or React + Tailwind code against the design and compare the render with Figma's own 2x render of the node: Flutter code is analyzed and rendered with `flutter test`; SwiftUI code is compiled and rendered in the booted iOS simulator (Xcode needed); React and HTML render in headless Chrome with Tailwind. Returns compiler or analyzer errors, runtime errors (Flutter: overflows, missing assets; React: broken images), the share of differing pixels and a diff image (the design in grey, differing pixels in red). The framework comes from `framework`, else from the file's language, else from the client and the project like get_design_context.

React and HTML: without `file` it checks the code get_design_context generates and compares every layer's box too. With `file` (a .jsx or .tsx under a folder with package.json, or an .html page) it renders that file's default export or page: it must be self-contained apart from React and image imports; images load from the project's public folder. Pass `css` for the stylesheet with its tokens. React and Tailwind load from a CDN and the fonts from the system or Google Fonts. Needs Chrome and the puppeteer-core package.

Flutter and SwiftUI: with `file`, it checks that widget or view inside its own project: a Flutter widget with the project's packages and assets, inside a MaterialApp, scaled by flutter_screenutil to the frame size when the project uses it; a SwiftUI view compiled with the project's DesignSystem.swift and asset catalogs, so it must build without the rest of the project. The widget or view needs an init without arguments. Without `file`, it checks the reference code get_design_context generates and compares every layer's box with the design. Use it after implementing a frame, and fix what it reports. Text in fonts it cannot find is drawn in a fallback font, and emoji have no colour font in the Flutter test, so text after them shifts. The design's status bar and home indicator belong to the phone and are left out of the SwiftUI comparison. A run takes from 20 seconds to a few minutes.

Every result has a coverage block: what the run checked, and for each interactive element (from its role and the states its Figma component defines) the states, keyboard and screen-reader behaviour it did not check, plus screen-wide items (dark mode, other widths and text sizes, right-to-left). React and HTML runs also press Tab through the page: the Tab order, missing focus indicators, controls Enter or Space does not activate, missing accessible names and clickable elements the keyboard cannot reach. Hand the not-checked list back with the implementation.
- **search_design_system** — Search the design system of the file open in Figma Desktop: local components and component sets (with their properties and variant options), library components the file already uses (with an instance to copy), and local paint, text and effect styles and variables (with their default-mode values). Every word of `query` must appear in the name or description; leave it empty to list everything. Call it before designing with use_figma, and reuse what it finds: figma.getNodeByIdAsync(id) then component.createInstance(), instance.clone() for a library component, figma.getStyleByIdAsync and figma.variables.getVariableByIdAsync. Libraries the file does not use yet are not visible to the plugin; instancesNotScanned means the page was too large to look through all its instances. Needs the plugin and Design mode.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "figma-local-mcp": {
    "command": "npx",
    "args": ["-y","@irshad.io/figma-local-mcp@latest"]
  }
}
```

## Documentation

## What @irshad.io/figma-local-mcp does

@irshad.io/figma-local-mcp gives an MCP-compatible coding agent access to the Figma file currently open in Figma Desktop. Its main design-to-code operation returns implementation-oriented reference code, assets, a screenshot, and variables for a selected node. Output targets include Flutter, SwiftUI, React with Tailwind, and HTML with Tailwind.

The server also exposes the structure and styling details behind a design. Agents can inspect layer metadata, retrieve screenshots and variable definitions, download image and SVG assets, and search components, styles, variables, properties, and variants in the open file. Code Connect tools associate design components with code components and return those mappings when instances are inspected.

Figma editing is supported as well. Agents can execute Figma plugin API scripts, add or modify designs, place local images into the file, and save or restore complete node exports as JSON snapshots.

## How it works

A development plugin runs inside Figma Desktop and communicates with the local Node.js server over a paired WebSocket on localhost. The server exposes the resulting operations to a coding agent through MCP over stdio. Reads therefore use the open Figma document rather than the Figma REST API, so the workflow does not require a Figma access token or REST API quota.

The plugin remains connected while live work is taking place. If it is closed, read operations can use the newest saved snapshot instead. Scripts sent through `use_figma` are applied as individual undo steps, and the agent can use screenshots to inspect the result after each change.

`verify_code` compares rendered implementation output with Figma's render. It can run Flutter checks with `flutter test`, SwiftUI checks in the iOS simulator, or React and HTML plus Tailwind checks in headless Chrome. Results include errors, layout mismatches, pixel differences, and a diff image, along with the interaction and accessibility areas that were not checked.

## Setup and configuration

The workflow requires Node.js 18 or newer and Figma Desktop on macOS or Windows. Run the package setup command with `npx`:

```bash
npx -y @irshad.io/figma-local-mcp@latest setup
```

Setup registers the server with Claude Code, copies the development plugin into the user's home directory, and displays a pairing code plus configuration for other MCP clients. Import the generated `manifest.json` into Figma Desktop through **Plugins › Development › Import plugin from manifest…**. On macOS it is under `~/.figma-local-mcp/plugin/`; on Windows it is under `%USERPROFILE%\\.figma-local-mcp\\plugin\\`.

Start the `figmcp` development plugin, enter the pairing code, and restart the coding agent. Cursor and Claude Desktop use the MCP configuration printed by setup; Claude Code is configured by the setup command. The plugin window should stay open for live operations.

## Tools and capabilities

- `get_design_context` returns target-framework reference code, assets, a screenshot, and variables.
- `get_metadata` exposes layer IDs, types, names, positions, and dimensions as XML.
- `get_screenshot` captures a node or the current selection as PNG.
- `get_variable_defs` resolves variables and styles for a node's active mode.
- `download_assets` retrieves rendered exports, original image fills, and vector SVGs.
- `verify_code` renders supported project types and reports visual differences.
- `use_figma` runs plugin API scripts that create or edit the open design.
- `search_design_system` finds reusable components, styles, variables, properties, and variants.
- `place_image` inserts local PNG, JPG, GIF, or SVG files into the document.
- Code Connect tools add, inspect, and remove design-to-code mappings.
- `whoami` reports pairing and connection details, the open file, selection, and snapshots.
- `save_design_export` and `import_design_export` manage complete node exports as JSON.

## Limitations and notes

The live workflow depends on Figma Desktop and the development plugin. The server supports macOS and Windows. Generated code is reference output for an agent to adapt to the project, rather than a claim that the target application is production-ready without changes. Visual verification does not cover every interaction state, keyboard behavior, or screen-reader behavior for each control. The server can use saved snapshots for reads when the plugin is closed, but live design edits require the plugin connection.

_Full upstream README: https://allmcps.com/mcp/irshad-io-figma-local-mcp/readme_

