figmcp
v1.8.1Local Figma MCP server: frames to Flutter, SwiftUI, React and HTML code, and design in Figma.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_design_context 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…
| Parameter | Type | Description |
|---|---|---|
assetsDir | string | Folder of the asset files in the code. Flutter default: the svg/png/images folders of the project's pubspec.yaml, else assets/figma. SwiftUI: the asset catalog to add image sets to (default: the proje… |
clientFrameworks | string | Comma separated frameworks of the client, e.g. "flutter" or "swiftui" (picks the framework). |
clientLanguages | string | Comma separated languages of the client, e.g. "dart" or "swift" (picks the framework). |
disableCodeConnect | boolean | Draw mapped components from their layers instead of naming the code component. |
exactLineHeights | boolean | SwiftUI: set Figma's default line heights too, which Figma rounds to whole points, so text matches the design to the pixel (default: true). false leaves default-height text at the face's own line heig… |
excludeScreenshot | boolean | Leave the screenshot out of the response. |
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
forceCode | boolean | Always return code, even for very large nodes. |
framework | string | Code to generate: react, html, flutter or swiftui. Default: from clientFrameworks / clientLanguages, else FIGMA_LOCAL_MCP_FRAMEWORK, else flutter when the project has a pubspec.yaml, swiftui when it h… |
nodeId | string | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. |
page | boolean | React and HTML: draw the node as a web page that fills the viewport, never narrower than the design, with full-width sections stretching (default: frames 768 or more wide). |
screen | boolean | Draw the node as a phone screen that fills the screen and scrolls when tall (default: portrait frames 300-480 wide). |
screenUtil | boolean | Flutter: write lengths with flutter_screenutil (.w, .h, .r, .sp) so the layout scales from the design size (default: when the project's pubspec.yaml depends on flutter_screenutil). |
skillNames | string | Accepted for compatibility (logging only). |
get_metadata 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.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
nodeId | string | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. |
get_screenshot 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.
| Parameter | Type | Description |
|---|---|---|
contentsOnly | boolean | Render the node in isolation, without overlapping content. |
enableBase64Response | boolean | Also include the PNG inline as base64. |
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
maxDimension | integer | Longest edge of the PNG in pixels (default 1024, at most 4096). |
nodeId | string | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. |
get_variable_defs Get Variable Definitions
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.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
nodeId | string | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. |
download_assets 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).
| Parameter | Type | Description |
|---|---|---|
defaultFormat | string | |
defaultScale | number | |
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
nodeId | string | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. |
get_code_connect_map Get Code Connect Mapping
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).
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
nodeId | string | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. |
add_code_connect_map Add Code Connect Mapping
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.
| Parameter | Type | Description |
|---|---|---|
componentName * | string | Code component name, e.g. AppPrimaryButton. |
nodeId * | string | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. |
source * | string | Path of the code component in the project. |
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
label | string | Framework, e.g. Flutter, SwiftUI or React. |
remove_code_connect_map Remove Code Connect Mapping
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.
| Parameter | Type | Description |
|---|---|---|
nodeId * | string | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. |
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
whoami Connection Status
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 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.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path of the export JSON file. |
save_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.
| Parameter | Type | Description |
|---|---|---|
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
nodeId | string | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. |
path | string | Absolute .json path to write (default: the data folder). |
use_figma Edit Design
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…
| Parameter | Type | Description |
|---|---|---|
code * | string | Body of an async function run with `figma` in scope. |
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
timeoutMs | integer | How long to wait for the script, in ms (default 60000). |
place_image 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.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path of the image file (absolute, or relative to the project). |
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
height | number | |
keepFills | boolean | With nodeId: add the image above the existing fills instead of replacing them. |
name | string | Layer name (default: the file name). |
nodeId | string | Set the image as the fill of this layer instead of making a new one (not for SVG). |
parentId | string | Frame or group to put the new layer in. |
scaleMode | string | How the image fills the layer (default FILL). |
width | number | |
x | number | |
y | number |
verify_code 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…
| Parameter | Type | Description |
|---|---|---|
clientFrameworks | string | Comma separated frameworks of the client, e.g. "flutter" or "swiftui" (picks the framework). |
clientLanguages | string | Comma separated languages of the client, e.g. "dart" or "swift" (picks the framework). |
css | string | React: a CSS file to load with the component, e.g. its global stylesheet with the design tokens. |
device | string | SwiftUI: the simulator to render in, by udid or name (default: a booted iPhone 17 Pro, another booted iPhone, else an iPhone Pro it boots). Renders are 2x and light mode on any device. |
dynamicType | string | SwiftUI: render at this text size to check the layout under Dynamic Type (default large; the pixel comparison stays with the design at the default size). |
file | string | Flutter: the .dart file with the widget, under the project's lib/. SwiftUI: the .swift file with the view. React: the .jsx/.tsx component file. HTML: the .html page. Absolute, or relative to the proje… |
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
flutter | string | Flutter: path of the flutter tool, when it is not on PATH. |
fonts | array | Folders with font files (default: the project's assets/fonts and the system fonts). |
framework | string | What to check (default: from the file's extension, else as get_design_context picks: the client, then the project). |
interact | boolean | SwiftUI, generated code: after rendering, tap every button of the screen and report what each did (redrew the screen, asked its owner through the Action enum, did nothing visible, or hung). |
nodeId | string | The ID of the node, eg. "123:456" or "123-456" (instance ids like "I1:2;3:4" work too). Omit it to use the current selection in Figma. |
tailwind | React: the Tailwind major version (default: the project's, else 4). | |
viewport | string | Flutter: lay the code out on a screen of this size, e.g. "360x780", and report runtime errors (overflows) and layers pushed off screen instead of comparing. |
widget | string | The widget class or SwiftUI view struct in `file` (default: its first one). |
search_design_system 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.var…
| Parameter | Type | Description |
|---|---|---|
allPages | boolean | Search components on every page, not just the current one (slower on large files). |
fileKey | string | The key of the Figma file. Accepted for compatibility; the file open in Figma Desktop is always used. |
kinds | array | What to search (default: all of components, styles, variables). |
limit | integer | Most results per kind (default 50). |
query | string | Words to look for, e.g. "button primary". |