deskhand
v1.1.0Claude in your Figma file.
Deskhand is a fork of magic-spells/figma-mcp-bridge (MIT), extended with a licence, installer and update check. A Model Context Protocol (MCP) server that enables Claude to read and manipulate Figma design files and FigJam files in real-time through a WebSocket bridge to a Figma plugin. One Deskhand server runs per machine, however many Claude sessions are open. Each session launches a small shim (a few MB) that starts the server if nothing is running and relays messages to it over a local socket. The server exits a minute after the last session closes.
Summary extracted from the README.
Deskhand
Deskhand is a fork of magic-spells/figma-mcp-bridge (MIT), extended with a licence, installer and update check.
A Model Context Protocol (MCP) server that enables Claude to read and manipulate Figma design files and FigJam files in real-time through a WebSocket bridge to a Figma plugin.
Features
- 113 operations - 88 Figma design tools + 19 FigJam tools (sticky notes, flowchart shapes, connectors, tables, code blocks, link previews) + 4 Prototype tools (reactions, flow starting points) + 2 licence tools + arbitrary Plugin API scripts with background jobs, inline screenshots, reference pixel diff, batch export, Lucide icons and iOS chrome, structural lint and brand scan, cookbook and design rules
- Works in both editors, plus read-only Dev Mode - Auto-detects whether you're in a Figma design file or FigJam, and gates editor-specific commands accordingly (FigJam-only sticky/connector/table tools; Figma-Design-only prototype tools). In Dev Mode the plugin runs read-only — see Dev Mode support
- Real-time bidirectional communication - Changes appear instantly in Figma/FigJam
- Token-optimized queries - Compact JSON, capped/paged results, and a measured token budget for a standard call set (see Token Optimization and
docs/token-budget.md) - Full Figma API access - Styles, variables, auto-layout, boolean operations, plus FigJam diagrams and documentation
- Built-in skills and cookbook - Ships its operating guide and a cookbook of runnable recipes as MCP resources (
skill://deskhand/SKILL.md,skill://deskhand/COOKBOOK.md);figma_get_design_rulesreturns one cookbook section. Connected agents are directed to read the skill before write-heavy work, so no separate skill install is needed
Architecture
Claude session A ←─stdio─→ shim ─┐
Claude session B ←─stdio─→ shim ─┼─→ Deskhand server ←──WebSocket──→ Figma Plugin ←──→ Figma API
Claude session C ←─stdio─→ shim ─┘ (one per machine) localhost:3055 (runs in Figma)
One Deskhand server runs per machine, however many Claude sessions are open. Each session launches a small shim (a few MB) that starts the server if nothing is running and relays messages to it over a local socket. The server exits a minute after the last session closes. npx deskhand status shows it; npx deskhand stop ends it.
Dev Mode Support
The plugin also runs in Figma Dev Mode (e.g. on a Developer seat, or a view-only file opened in Dev Mode). It appears in the inspect panel's plugin area with a read-only badge next to the port field.
Dev Mode plugins get a read-only document — this is a Figma platform restriction, not a bridge limitation — so only the read tools work there:
figma_get_context,figma_list_pages,figma_get_nodes,figma_get_childrenfigma_search_nodes,figma_search_components,figma_search_styles,figma_search_variablesfigma_get_local_styles,figma_get_local_variablesfigma_export_nodefigma_set_selection,figma_set_current_page(selection/navigation, not document edits)
Every mutation tool returns a READ_ONLY_EDITOR error naming the tool. To edit the file, open it in the Figma Design editor with an editor seat.
If you only need read access to designs and tokens, also consider Figma's official MCP server, which specializes in design-to-code extraction. This bridge's Dev Mode support exists so bridge users keep one consistent tool surface — its real differentiator (writing to the document) requires the Design editor.
Install
Four steps. You need Node.js 18+, the Figma desktop app, and Claude Code or Claude Desktop.
1. Run setup
npx deskhand@latest setup
Setup does four things:
- Copies this version of Deskhand into
~/.deskhand/app/<version>and points~/.deskhand/currentat it. - Registers the server with Claude Code (
claude mcp add), Claude Desktop, or both, whichever you have. If both are present, setup asks which to register;--clientor--yesskips the question. - Asks for a licence key. Press Enter to start the 14-day trial instead.
- Prints the path of the plugin manifest for the next step.
Setup options:
| Flag | Effect |
|---|---|
--client code|desktop|both |
Register with that client without asking |
--profile design|figjam|all |
Tool profile for the registered server (default design) |
--licence <key> |
Activate this licence key |
--trial |
Start the 14-day trial without asking for a key |
--yes |
Accept the defaults without prompting (registers with both clients when both are present) |
2. Import the plugin
In Figma: Plugins → Development → Import plugin from manifest, then choose:
~/.deskhand/current/node_modules/deskhand/plugin/manifest.json
3. Run the plugin
Open any Figma or FigJam file and run Plugins → Development → Deskhand. The panel finds the server by itself and shows Connected with the file name. One server serves every Claude session on the machine; it starts with the first session and stops a minute after the last one closes. The port input sits under Advanced.
4. Ask Claude
In Claude, ask it to call figma_get_context. If it returns the file name and current page, you are set.
Licence
Deskhand is free for 14 days from the first run. After that it needs a licence key (£5 a month or £50 a year from deskhand.studio). Paste the key into the Licence key field in the plugin panel, or run npx deskhand@latest setup --licence <key>. Deskhand checks the key online and caches the result. It keeps working offline for 7 days after the last check, warns from day 7, and stops at 30 days until it can reach the licence server again.
Updating
npx deskhand@latest update
The plugin panel's settings also have a Check for updates button, which compares your version with the latest on npm.
A server that is already running keeps its version until it exits. It stops on its own a minute after the last Claude session closes, or stop it yourself:
npx deskhand@latest status
npx deskhand@latest stop
Profiles
A profile limits which tools the server registers, which keeps the tool list small. Setup defaults to design. Pass --profile figjam or --profile all to setup to change it, or set DESKHAND_PROFILE for the server.
| Profile | Registers |
|---|---|
design |
Figma design tools and prototype tools; no FigJam-only tools |
figjam |
Figma tools and FigJam tools; no prototype tools |
all |
Everything |
Uninstall
claude mcp remove -s user deskhand
rm -rf ~/.deskhand
If you use Claude Desktop, also remove the deskhand entry from its claude_desktop_config.json. Then remove the plugin from Figma under Plugins → Development.
Configuration
Environment Variables
The old FIGMA_BRIDGE_* names still work as fallbacks.
| Variable | Default | Description |
|---|---|---|
DESKHAND_HOME |
~/.deskhand |
Settings, licence cache, brand cache, results and exports. Settings from the old ~/.figma-bridge are copied across once |
DESKHAND_PORT |
3055 |
WebSocket port for the plugin. The server binds exactly this port; set it in the registered server's environment so every session agrees |
DESKHAND_IDLE_EXIT_MS |
60000 |
How long the server stays up after the last Claude session closes |
DESKHAND_NODE |
node |
Node binary the shell shim uses to start the server (setup fills this in) |
DESKHAND_PROFILE |
all |
Tool profile: design, figjam or all |
DESKHAND_LICENCE_KEY |
(none) | Licence key to use when none is set in the panel's Licence key field |
DESKHAND_LICENCE_ENV |
production |
Polar environment for licence checks: production or sandbox |
DESKHAND_LICENCE_KEY (signed) |
Keys starting DESKHAND-SK1. are owner-issued, verified offline with the public key in src/licence.js, and never contact Polar. Issue one with node scripts/sign-key.mjs (owner only). |
Auto-approve Figma Tools
Add to .claude/settings.local.json:
{
"permissions": {
"allow": ["mcp__deskhand__*"]
}
}
Commands Reference
Query Commands
figma_server_info
Get information about the MCP server: package version, WebSocket port, connection state, and connected document info. Useful for confirming which version of the server is running after a code change or upgrade.
| Parameter | Type | Description |
|---|---|---|
| (none) |
Returns: { version, protocolVersion, port, connected, documentInfo, lastRejectedPlugin, eventsBuffered }
figma_get_selection_history
Recent selection changes in Figma, newest first, with timestamps. By default only the user's own selections; pass source: 'all' to include selections made by bridge commands. Served from a server-side buffer.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
limit |
number | No | 10 |
Maximum entries (1–50) |
source |
'user' | 'all' |
No | 'user' |
'user' hides selections made by bridge commands; 'all' includes them |
Returns: { count, items: [{ seq, ts, page, count, nodes, source }] }
figma_bridge_diagnostics
Check the bridge end to end: versions, handshake, buffered events, and a plugin→server→plugin round trip with timing.
| Parameter | Type | Description |
|---|---|---|
| (none) |
Returns: { serverVersion, protocolVersion, port, connected, documentInfo, lastRejectedPlugin, eventsBuffered, reverseChannel }
figma_get_context
Get the current Figma document context including file info, current page, and selection. Call it once per conversation and again only to read a new selection: every tool returns NOT_CONNECTED when the plugin is down, and script results carry the current page.
| Parameter | Type | Description |
|---|---|---|
| (none) |
figma_list_pages
List all pages in the current Figma document.
| Parameter | Type | Description |
|---|---|---|
| (none) |
Returns: { pages: [{ id, name }] } — the current page is available from figma_get_context's currentPage, so it isn't repeated here.
figma_get_nodes
Get detailed information about specific nodes by their IDs.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nodeIds |
string[] | Yes | Array of node IDs (e.g., ["1:23", "4:56"]) |
|
depth |
string | No | full |
Detail level: minimal, compact (adds x/y/width/height), or full |
verbose |
boolean | No | false |
Include default-valued props (visible: true, opacity: 1, rotation: 0, …) and skip the caps on long fields (characters 2000 chars, childIds 200, fills/strokes/effects 20 entries) |
full includes boundVariables, explicitVariableModes, layoutWrap, counterAxisSpacing, clipsContent and per-side stroke weights. Without verbose: true, default-valued props are omitted and long fields are capped, each flagged with a matching <field>Truncated when cut. Every full node shape in any response (create, clone, group, search with compact: false, get_children) is compacted the same way; only figma_get_nodes takes verbose.
Composite instance-sublayer IDs (I<instanceId>;<childId>) resolve reliably — if the direct lookup misses, the instance root is resolved and its subtree searched. IDs that genuinely don't exist are returned in notFound, with an explanation in notFoundDetails.
figma_get_local_styles
List all local styles defined in the document.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
type |
string | No | ALL |
Filter: PAINT, TEXT, EFFECT, GRID, or ALL |
limit |
number | No | 100 |
Maximum styles to return, per category |
offset |
number | No | 0 |
Pagination offset, per category |
verbose |
boolean | No | false |
Paint styles return the full paints array instead of the compact { id, name, key, hex[] } shape |
limit/offset apply to EACH category independently, so a page full of PAINT styles never starves TEXT/EFFECT/GRID out of the response. Returns: adds totals (per-category counts: paintStyles, textStyles, effectStyles, gridStyles), total (the sum of all four), offset, truncated (true if any category has more beyond the page) and next (offset + limit when truncated, else null) alongside the style buckets.
figma_get_local_variables
Get all local variables and variable collections.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
type |
string | No | ALL |
Filter: COLOR, FLOAT, STRING, BOOLEAN, or ALL |
limit |
number | No | 100 |
Maximum variables to return (collections are always returned in full) |
offset |
number | No | 0 |
Pagination offset |
Returns: adds total, offset, truncated and next. Can still be large on big files — prefer figma_search_variables for efficiency.
figma_get_children
Get immediate children of a node. Efficient for browsing hierarchy one level at a time.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
parentId |
string | Yes | Node ID to get children of | |
compact |
boolean | No | true |
Return minimal data: id, name, type, x, y, parentId, childCount |
limit |
number | No | 100 |
Maximum children to return |
offset |
number | No | 0 |
Pagination offset |
Compact results include x/y, so they can be used to measure layout (for example, which children share a row after wrapping) without dropping to the full serialization. Returns: adds totalChildren, offset, truncated and next.
figma_search_nodes
Search for nodes by name within a scope. Preferred for finding specific frames, sections, or elements.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
parentId |
string | Yes | Scope to search (page/frame/section ID) | |
nameContains |
string | No | Case-insensitive substring match | |
namePattern |
string | No | Glob pattern with wildcards (e.g., *button*) |
|
types |
string[] | No | Filter by node types: FRAME, TEXT, SECTION, COMPONENT, INSTANCE, GROUP, etc. |
|
maxDepth |
number | No | -1 |
Search depth (-1 = unlimited, 1 = immediate children) |
compact |
boolean | No | true |
Return minimal data |
limit |
number | No | 50 |
Maximum results |
offset |
number | No | 0 |
Pagination offset |
Returns: adds truncated and next (the offset for the following page, or null).
Returns ~50 tokens/node vs ~500 for full node data.
figma_search_components
Search local components by name. Use when looking for specific components like "Button", "Header", etc.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nameContains |
string | No | Case-insensitive substring match | |
namePattern |
string | No | Glob pattern with wildcards | |
includeVariants |
boolean | No | false |
Include individual variants from component sets |
compact |
boolean | No | true |
Return minimal data |
limit |
number | No | 50 |
Maximum results |
offset |
number | No | 0 |
Pagination offset |
Returns: adds truncated and next (the offset for the following page, or null).
figma_search_styles
Search local styles by name. More efficient than figma_get_local_styles when looking for specific styles.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nameContains |
string | No | Case-insensitive substring match | |
type |
string | No | "ALL" |
Filter: PAINT, TEXT, EFFECT, GRID, ALL |
compact |
boolean | No | true |
Return minimal data |
limit |
number | No | 50 |
Maximum results |
offset |
number | No | 0 |
Pagination offset |
Returns: adds truncated and next (the offset for the following page, or null).
figma_search_variables
Search variables by name pattern. Preferred over figma_get_local_variables — compact results, far fewer tokens.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
namePattern |
string | No | Glob pattern with wildcards (e.g., tailwind/orange/*) |
|
nameContains |
string | No | Case-insensitive substring match | |
type |
string | No | "ALL" |
Filter: COLOR, FLOAT, STRING, BOOLEAN, ALL |
collectionName |
string | No | Filter by collection name (exact or partial) | |
compact |
boolean | No | true |
Minimal data (id, name, hex/value only) |
limit |
number | No | 50 |
Maximum results |
offset |
number | No | 0 |
Pagination offset |
Returns: { variables, returned, offset, truncated, next, query }.
Script Execution
figma_execute
Run JavaScript inside the plugin with the full Plugin API. The code is the body of an async function with figma and bridge in scope. Return plain data (ids, names, numbers), never nodes.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
code |
string | Yes | Function body; await works |
|
job |
boolean | No | false |
Run as a background job; returns { jobId } at once |
label |
string | No | Job label shown in the plugin panel | |
lint |
boolean | No | false |
Attach _lint findings for top-level frames the script created (_lintTotal, _lintTruncated, _lintNote, _lintFixes); empty means clean. |
timeoutMs |
number | No | 30000 |
Synchronous timeout, 1000–600000. A script still running then continues as a job: the reply is { jobId, state: 'running', promoted: true }; wait on it with figma_job_status instead of running it again. A promoted script cannot be cancelled. |
screenshot |
boolean or string | No | Render a node in the same reply: a node id, or true for the id (or nodeId, frameId) the script returns. The response is the result text first, then the image; the text gains screenshot: { nodeId, path, width, height }, or screenshotError when there is nothing to render or the render fails (the script result is kept either way). In job mode the render comes with the finished figma_job_status. |
bridge helpers: log(...args) (returned as logs), sleep(ms), progress(message, fraction) and cancelled() (job mode), request(name, payload) (server-side handlers).
Returns: { result, logs, durationMs, page: { id, name } } (page is the current page when the script ended) or { error: { code, message, line?, column?, stack?, logs? } } with codes EXECUTE_SYNC_API, EXECUTE_SYNTAX, EXECUTE_FAILED, EXECUTE_BAD_RETURN. EXECUTE_SYNC_API is raised by the server before the script reaches Figma: the plugin runs with documentAccess: dynamic-page, so figma.getNodeById(), figma.getStyleById(), figma.getLocal*Styles(), the synchronous figma.variables.get* calls, figma.currentPage = page, instance.mainComponent and node.<kind>StyleId = id all throw inside Figma; the error lists each line with the async form to use instead (comments and strings are ignored). An error's logs field, when present, is what the script logged via bridge.log(...) before it failed. A synchronous call that exceeds timeoutMs on the server side (the plugin never replied in time) becomes a job (see timeoutMs); it surfaces as code TIMEOUT only when another job already holds the slot. In job mode { jobId, state: 'running' }. Results over 32 KB are written to ~/.deskhand/results/<id>.json (only the newest 20 result files are kept; older ones are pruned automatically) and the response becomes { truncated: true, resultPath, resultBytes, preview, note, logs, durationMs } — logs and lint summary fields (_lintTotal, _lintTruncated, _lintNote, _lintFixes) stay inline; result moves to disk, and _lint moves with it too (lintSpilled: true) if the findings alone would still leave the response over the cap. preview is a truncated prefix of the result JSON, not valid JSON. Return ids and counts from scripts, not whole nodes, to avoid the spill.
figma_job_status
| Parameter | Type | Required | Description |
|---|---|---|---|
jobId |
string | Yes | From figma_execute with job: true |
waitMs |
number | No | Wait up to this long for the job to end, 0–30000 (default 20000). Returns as soon as it ends; progress alone does not end the wait. 0 returns at once. |
Returns: { jobId, label, state, startedAt, endedAt, cancelRequested, progress[], result, error, durationMs, logs } where state is running | done | error | cancelled | timeout. logs are the script's bridge.log(...) lines, kept for the job's whole life (last 200). Jobs are capped at 10 minutes and one runs at a time. state: 'cancelled' is reported whether the cancel came from figma_job_cancel or from the plugin panel's own Cancel button — both set the same cancelRequested flag. The same 32 KB result spill as figma_execute applies: an oversize result is replaced with { truncated: true, resultPath, resultBytes, preview, note }.
figma_job_cancel
| Parameter | Type | Required | Description |
|---|---|---|---|
jobId |
string | Yes | The job to stop |
Sets the flag bridge.cancelled() returns; the script must check it.
Also inside scripts: await bridge.image(pathOrUrl, { node, scaleMode }) fills a node with an image the server loads (same limits as figma_set_image_fill), and await bridge.snapshot(nodeId, label) is figma_snapshot.
Images
figma_screenshot
Render a node (or the selection) as PNG and return it inline as an image, plus the file path.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nodeId |
string | No | selection | Node to render |
scale |
number | No | 1 |
Requested scale; reduced to fit maxPixels |
maxPixels |
number | No | 1000000 |
Pixel budget (width × height) |
inline |
boolean | No | true |
false writes to disk only |
Returns: an image block (only when the PNG is ≤ 200 KB, retrying once at half scale — reducedForInline: true when that retry was needed) and { nodeId, name, path, bytes, scale, requestedScale, width, height, scaleClamped?, reducedForInline?, inline?, note? }. width/height are read from the PNG itself, not computed from the node's size — render bounds include effects like shadows and blurs, so they can exceed the node's own dimensions. When a half-scale retry happens, the on-disk path is the half-scale file too — there is no separate full-scale file on disk. A render still over 200 KB after the retry stays on disk only, with note explaining why.
figma_compare_to_reference
Deterministic pixel diff of a built frame against a reference node.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
refNodeId |
string | Yes | Reference node | |
builtNodeId |
string | Yes | Built frame | |
scale |
number | No | 1 |
Requested export scale; the built frame is rendered at the reference's effective scale |
threshold |
number | No | 0.1 |
pixelmatch colour threshold |
maxPixels |
number | No | 1000000 |
Pixel budget per export |
inlineDiff |
boolean | No | false |
Also return the diff image inline |
Returns: { mismatchPercent, mismatchedPixels, diffByQuadrant: { tl, tr, bl, br }, sizeDelta, width, height, scale, requestedScale, scaleClamped?, scaleMismatch?, threshold, diffPath, refPath, builtPath, note }. Files go to ~/.deskhand/diffs/. inlineDiff is subject to the same 200 KB inline cap as figma_screenshot — a diff image over that size is written to diffPath only, with no inline image block.
figma_export_batch
Export many nodes in one call at a scale or a target width.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
items |
array | Yes | { nodeId, format?, scale?, targetWidth?, name? }, 1–100 |
|
outputDir |
string | No | ~/.deskhand/exports/<stamp>/ |
Absolute directory |
namePattern |
string | No | {name}@{scale}x.{ext} |
Tokens {name} {id} {scale} {ext} {index} |
Returns: { outputDir, count, ok, failed, rows[] }; each row has nodeId, name, path, bytes, format, scale, width, height, scaleClamped?, renamedFrom? or nodeId, error. Rows for SVG/PDF omit scale/width/height (vector formats have no pixel dimensions); PNG width/height are read from the file itself, not computed from the node's size (render bounds include effects). Colliding output names are suffixed -2, -3, … (case-insensitively, so Card and card collide) and the row carries renamedFrom with the original name. namePattern may not contain path separators or .. — either would let a name escape the output directory. Existing files in a caller-supplied outputDir are overwritten.
figma_set_image_fill
Put an image from disk or the web onto a node.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nodeId |
string | Yes | Any node with fills | |
source |
string | Yes | Absolute path (~/ allowed) or http(s) URL |
|
scaleMode |
FILL FIT CROP TILE |
No | FILL |
How the image sits in the node |
Returns: { nodeId, name, imageHash, scaleMode, format, width, height, bytes, source }. PNG, JPEG, GIF and WebP; at most 4096 px on either side (Figma's limit) and 20 MB. The bytes are sniffed, not decoded, and travel to the plugin as base64. Errors: IMAGE_NOT_FOUND, IMAGE_FETCH_FAILED, IMAGE_TOO_LARGE, IMAGE_UNREADABLE, NODE_NOT_FOUND, READ_ONLY_EDITOR (Dev Mode), SET_IMAGE_FILL_FAILED (the plugin call itself failed for a reason not covered by the codes above), INVALID_PARAMS (relative path, other scheme, node without fills). Inside a script, bridge.image gives a remote image 25 s to load (timeoutMs has no effect on this); use job: true for slow URLs — job-mode scripts get 2 minutes there instead.
Snapshots
Save points for risky edits. A snapshot clones the node onto a page named 🗄 Bridge Snapshots (created last in the file on demand) and records where it came from in the file's plugin data. Ten per file; the oldest clone is deleted when an eleventh is taken.
figma_snapshot
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Scene node to copy |
label |
string | No | Note shown in the list |
Returns: { snapshotId, cloneId, sourceId, sourceName, parentId, pageId, index, x, y, label, ts, count }. SNAPSHOT_FAILED when Figma refuses to clone the node. FIGMA_DESIGN_ONLY in FigJam.
figma_restore_snapshot
| Parameter | Type | Required | Description |
|---|---|---|---|
snapshotId |
string | Yes | From figma_snapshot or the list |
Returns: { snapshotId, restoredId, name, parentId, index, sourceRemoved, warning?, count }. The current node is removed if it still exists; the clone goes back to the recorded parent, index and position (position is ignored under auto-layout) with its original name. restoredId is a new id. The entry is consumed. SNAPSHOT_NOT_FOUND if the id is unknown or someone deleted the clone.
figma_list_snapshots
No parameters. Returns: { count, page: { id, name } | null, snapshots: [{ ...entry, exists }] }, newest first.
Inside scripts: const s = await bridge.snapshot(frame.id, 'before restyle') then figma_restore_snapshot({ snapshotId: s.snapshotId }) if the step goes wrong.
Icons and Chrome
figma_resolve_icon
Check concepts against the bundled Lucide set. Never hand-draw an icon.
| Parameter | Type | Required | Description |
|---|---|---|---|
concepts |
string[] | Yes | e.g. ["search", "close", "chevron-right"] |
Returns: { results: [{ requested, concept, source: 'alias' | 'exact', svgBytes } | { requested, suggestions }] }. Aliases map invented names to Lucide names (close → x, hamburger → menu, bin → trash-2); the table lives in src/assets/icon-aliases.json.
figma_place_icon
Insert a Lucide icon as a frame named icon/<concept>.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
concept |
string | Yes | Resolved like figma_resolve_icon |
|
parentId |
string | No | current page | Parent frame |
x, y |
number | No | Position inside the parent | |
size |
number | No | 24 |
Rendered size |
color |
string | No | #000000 |
Hex stroke/fill colour |
Returns: { id, name, concept, requested, source, width, height, x, y, warning? }; ICON_NOT_FOUND with suggestions for unknown concepts. When the parent is an auto-layout frame, x/y are ignored, the node is appended as the last child, and warning says so.
size rescales the whole icon uniformly, including stroke weight — a 32 px icon inherits Lucide's 2 px stroke at 24 px scaled up, so it renders at 2 * 32 / 24 = 2.67 px. For a constant hairline stroke regardless of size, set absoluteStrokeWeight (or strokeWeight) on the icon's vector children after placing it.
figma_place_chrome
Insert an iOS template: status-bar (393×54), home-indicator (393×34) or keyboard (393×291), light or dark.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
kind |
enum | Yes | status-bar, home-indicator, keyboard |
|
theme |
enum | No | light |
light or dark |
parentId |
string | No | current page | Scaled to the parent width |
y |
number | No | top/bottom | Override the vertical position |
Returns: { id, name, kind, theme, width, height, x, y, warning? }. When the parent is an auto-layout frame, x/y are ignored, the node is appended as the last child, and warning says so.
Inside figma_execute, the same artwork is available as await bridge.icon(concept, { size, color, parent, x, y }), await bridge.statusBar({ theme, parent }), await bridge.homeIndicator({ theme, parent }), await bridge.keyboard({ theme, parent }); parent may be a node object or an id.
Lint and Brand
figma_review_screen
Deterministic structural lint of one frame. Call it on every screen before declaring it done.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The frame to review |
checks |
string[] | No | Restrict to these codes |
Returns: { pass, findings: [{ code, severity, nodeId, message, name?, fix? }], fixes: { [code]: fixText }, counts: { error, warning, info }, checked, truncated, total }. message is capped at 160 chars; name is omitted when it's still the node's Figma-assigned default (e.g. "Frame 12"). fixes maps each code to its fix; a finding carries its own fix only when it differs — most findings for a code share identical remediation text and rely on the map, but node-specific text (a component name, restored pixel sizes) is kept on the finding rather than dropped. pass is false when any finding is an error, and counts/pass always reflect the full set found — findings is capped at 200 (errors first, then warnings, then info) with truncated: true and total giving the real count whenever there were more than that. Codes: INVISIBLE_TEXT, TEXT_OVERFLOW, ZERO_SIZE, COLLAPSED_CHILD, LOW_CONTRAST (errors); MISALIGNED_ROW, HAND_DRAWN_ICON, PLACEHOLDER_AVATAR, RAW_FILL, RAW_TEXT_STYLE, DETACHED_INSTANCE (warnings); UNNAMED_LAYER (info). figma_execute with lint: true runs the same checks over frames the script created and returns them as _lint, with a merged _lintFixes map (same first-text-per-code dedupe, applied across every linted frame) — but if the script changes the current page, nothing is linted (_lint: [], _lintFixes: {}) and _lintNote says so; run figma_review_screen on the frames you built instead. TEXT_OVERFLOW is the one check that touches the document: it measures a fixed-size text box by switching it to auto-height, reading the height and switching straight back, then verifies the node is the size it started at. It is skipped in Dev Mode, on locked text, and on text inside instances. If a restore ever fails the lint reports it as a TEXT_OVERFLOW error naming the original size. Every other check is read-only.
figma_brand_styles
Read the file's own brand system: paint/text/effect styles, every component and component set (keys, sizes, variant properties), common frame sizes; samples fills and fonts when the file has no styles. Cached to ~/.deskhand/brands/<fileKey>.json.
| Parameter | Type | Description |
|---|---|---|
| (none) |
Returns: { path, fileKey, fileName, scannedAt, counts, paintStyles, textStyles, effectStyles, frameSizes, components (≤ 100, no width/height — full data is in the cache file at path), componentsTruncated?, componentsTotal?, sampled? }.
Inside figma_execute: await bridge.instance(nameOrKey, props, { parent, x, y }) finds a local component or set by name, imports a cached library component by name or a 40-char key, sets variant props, and returns { id, name, componentKey, componentName, source }; await bridge.text(content, { font, fallback, size, color, parent, x, y, width }) loads the font or substitutes the fallback (default Inter Regular) and reports substituted. Every COMPONENT_NOT_FOUND carries candidates; a stale cached key says to re-run figma_brand_styles in the library file. Within one script the local component index is built once and reused.
Cookbook and Design Rules
skills/deskhand/COOKBOOK.md is a set of runnable figma_execute recipes with the rules they demonstrate. It is served as the MCP resource skill://deskhand/COOKBOOK.md, and npm run test:integration executes every recipe, so a recipe that is in the file works against the current plugin.
figma_get_design_rules
Return one section of the cookbook as markdown. Needs no plugin connection.
| Parameter | Type | Required | Description |
|---|---|---|---|
section |
helpers auto-layout components variants text lint jobs reference-match |
Yes | Which section |
Returns: the section's markdown (heading, rules, recipe). Unknown keys are rejected with INVALID_PARAMS and the valid list.
Recipe format, for adding your own: a heading ## Title {#key} (key from the list above), then <!-- recipe: <key>-<name> [job] [lint] --> on its own line followed by a ```js fence containing a complete script body that returns { ok: true, ... }. job runs it through figma_execute({ job: true }); lint runs it with lint: true and requires zero error-level findings.
Creation Commands
figma_create_rectangle
Create a new rectangle.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
width |
number | No | 100 |
Width in pixels |
height |
number | No | 100 |
Height in pixels |
name |
string | No | "Rectangle" |
Node name |
fills |
color | No | Fill color | |
parentId |
string | No | Parent node ID |
figma_create_ellipse
Create an ellipse, circle, arc, or ring.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
width |
number | No | 100 |
Width (diameter for circle) |
height |
number | No | 100 |
Height |
name |
string | No | "Ellipse" |
Node name |
fills |
color | No | Fill color | |
parentId |
string | No | Parent node ID | |
arcData.startingAngle |
number | No | Starting angle in radians | |
arcData.endingAngle |
number | No | Ending angle in radians | |
arcData.innerRadius |
number | No | Inner radius ratio (0-1) for rings |
figma_create_line
Create a line.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
length |
number | No | 100 |
Line length |
rotation |
number | No | 0 |
Rotation in degrees |
strokeWeight |
number | No | 1 |
Stroke weight |
strokes |
color | No | Stroke color | |
strokeCap |
string | No | "NONE" |
Cap: NONE, ROUND, SQUARE, ARROW_LINES, ARROW_EQUILATERAL |
name |
string | No | "Line" |
Node name |
parentId |
string | No | Parent node ID |
figma_create_frame
Create a frame container (supports auto-layout).
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
width |
number | No | 100 |
Width |
height |
number | No | 100 |
Height |
name |
string | No | "Frame" |
Node name |
fills |
color | No | Fill color | |
parentId |
string | No | Parent node ID |
figma_create_text
Create a text node.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
text |
string | No | "Text" |
Text content |
fontSize |
number | No | 16 |
Font size |
fontFamily |
string | No | "Inter" |
Font family |
fontStyle |
string | No | "Regular" |
Font style |
fills |
color | No | Text color | |
name |
string | No | "Text" |
Node name |
parentId |
string | No | Parent node ID |
figma_clone_nodes
Clone (duplicate) nodes.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nodeIds |
string[] | Yes | Node IDs to clone | |
parentId |
string | No | Parent for clones | |
offset.x |
number | No | 20 |
X offset from original |
offset.y |
number | No | 20 |
Y offset from original |
figma_create_component
Create a reusable component.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
fromNodeId |
string | No | Convert existing node to component | |
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
width |
number | No | 100 |
Width |
height |
number | No | 100 |
Height |
name |
string | No | "Component" |
Component name |
fills |
color | No | Fill color | |
parentId |
string | No | Parent node ID | |
description |
string | No | Component description |
figma_create_instance
Create an instance of a component.
| Parameter | Type | Required | Description |
|---|---|---|---|
componentId |
string | Yes | Component ID to instantiate |
x |
number | No | X position |
y |
number | No | Y position |
parentId |
string | No | Parent node ID |
name |
string | No | Instance name |
Style Commands
figma_set_fills
Set fill color on a node.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node to modify |
fills |
color | Yes | Fill color |
Color formats:
- Hex:
{ color: "#FF0000" }or{ color: "#FF0000AA" }(with alpha) - RGB:
{ r: 1, g: 0, b: 0, a: 0.5 } - Full array:
[{ type: "SOLID", color: { r, g, b }, opacity: 1 }]
figma_set_strokes
Set stroke color on a node.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node to modify |
strokes |
color | Yes | Stroke color |
strokeWeight |
number | No | Stroke weight in pixels |
figma_set_text
Set text content on a text node.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Text node to modify |
text |
string | Yes | New text content |
figma_set_opacity
Set node transparency.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node to modify |
opacity |
number | Yes | Opacity (0-1) |
figma_set_visible
Show or hide nodes. Use this rather than binding a BOOLEAN variable or setting opacity to 0 just to hide something.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Nodes to show or hide |
visible |
boolean | Yes | true to show, false to hide |
figma_set_clips_content
Set whether frame-like nodes clip their children to the frame bounds. Works on FRAME, COMPONENT, COMPONENT_SET, INSTANCE, SLOT, SLIDE.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Nodes to modify |
clipsContent |
boolean | Yes | true to clip, false to let children overflow |
figma_set_corner_radius
Set corner radius.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node to modify |
radius |
number | No | Uniform radius for all corners |
topLeft |
number | No | Top-left corner radius |
topRight |
number | No | Top-right corner radius |
bottomLeft |
number | No | Bottom-left corner radius |
bottomRight |
number | No | Bottom-right corner radius |
figma_set_effects
Set effects (shadows, blurs).
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node to modify |
effects |
array | Yes | Array of effect objects |
Shadow effect:
{
"type": "DROP_SHADOW",
"color": { "color": "#000000" },
"offset": { "x": 0, "y": 4 },
"radius": 8,
"spread": 0,
"visible": true
}
Blur effect:
{
"type": "LAYER_BLUR",
"radius": 10,
"visible": true
}
figma_apply_style
Apply a local style to a node.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node to apply style to |
styleId |
string | Yes | Style ID |
property |
string | Yes | Property: fills, strokes, text, effects, grid |
figma_set_variable
Set variable value or bind to node property.
| Parameter | Type | Required | Description |
|---|---|---|---|
variableId |
string | Yes | Variable ID |
modeId |
string | No | Mode ID (for setting value) |
value |
any | No | Value to set |
nodeId |
string | No | Node ID (for binding) |
field |
string | No | Field to bind (opacity, cornerRadius, fills, etc.) |
paintIndex |
number | No | Paint array index for fills/strokes (default 0) |
figma_set_text_style
Set text font properties on an existing text node.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Text node ID |
fontSize |
number | No | Font size in pixels |
fontFamily |
string | No | Font family (e.g., "Inter") |
fontStyle |
string | No | Font style (e.g., "Bold", "Regular") |
textCase |
string | No | ORIGINAL, UPPER, LOWER, TITLE |
textDecoration |
string | No | NONE, UNDERLINE, STRIKETHROUGH |
lineHeight |
object | No | { unit: "AUTO" } or { unit: "PIXELS", value: 24 } |
letterSpacing |
object | No | { unit: "PIXELS", value: 1 } or { unit: "PERCENT", value: 5 } |
textAlignHorizontal |
string | No | LEFT, CENTER, RIGHT, JUSTIFIED |
textAlignVertical |
string | No | TOP, CENTER, BOTTOM |
figma_create_paint_style
Create a local paint (color) style.
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Style name (use / for folders, e.g., "Brand/Primary") |
fills |
color | Yes | Fill color |
description |
string | No | Style description |
figma_create_text_style
Create a local text style.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | Yes | Style name (use / for folders) |
|
fontFamily |
string | No | "Inter" |
Font family |
fontStyle |
string | No | "Regular" |
Font style |
fontSize |
number | No | 16 |
Font size in pixels |
lineHeight |
object | No | Line height | |
letterSpacing |
object | No | Letter spacing | |
textCase |
string | No | Text case transformation | |
textDecoration |
string | No | Text decoration | |
description |
string | No | Style description |
figma_delete_style
Delete a local style (paint, text, effect or grid). Library styles return REMOTE_STYLE. Nodes using the style keep their resolved values but lose the link. Find IDs with figma_search_styles.
| Parameter | Type | Required | Description |
|---|---|---|---|
styleId |
string | Yes | Style ID to delete (e.g. "S:abc123...") |
Layout Commands
figma_set_auto_layout
Configure auto-layout on a frame.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Frame to configure |
layoutMode |
string | No | NONE, HORIZONTAL, VERTICAL |
primaryAxisSizingMode |
string | No | FIXED, AUTO |
counterAxisSizingMode |
string | No | FIXED, AUTO |
primaryAxisAlignItems |
string | No | MIN, CENTER, MAX, SPACE_BETWEEN |
counterAxisAlignItems |
string | No | MIN, CENTER, MAX, BASELINE |
paddingTop |
number | No | Top padding |
paddingRight |
number | No | Right padding |
paddingBottom |
number | No | Bottom padding |
paddingLeft |
number | No | Left padding |
itemSpacing |
number | No | Space between items |
counterAxisSpacing |
number | No | Space between rows when wrapped |
layoutWrap |
string | No | NO_WRAP, WRAP |
figma_set_layout_align
Set child alignment in auto-layout.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Child node to modify |
layoutAlign |
string | No | MIN, CENTER, MAX, STRETCH, INHERIT |
layoutGrow |
number | No | Growth factor (0-1) |
layoutPositioning |
string | No | AUTO, ABSOLUTE |
Transform Commands
figma_move_nodes
Move nodes to a new position.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Nodes to move |
x |
number | No | X position or offset |
y |
number | No | Y position or offset |
relative |
boolean | No | If true, x/y are offsets (default false) |
figma_resize_nodes
Resize nodes. The resulting size is verified (RESIZE_NO_OP when nothing changed), and width/height variable bindings are captured before the write and re-applied afterwards — recovered binds appear in rebound, unrecoverable ones in warnings. Resizing a node inside an INSTANCE returns INSTANCE_SUBLAYER_RESTRICTED rather than a false success; use figma_set_layout_align: STRETCH, which works inside instances and preserves binds.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Nodes to resize |
width |
number | No | New width |
height |
number | No | New height |
figma_set_size_limits
Set or clear min/max size limits. Pass a positive number to set, explicit null to remove — so maxWidth is no longer a one-way door. Limits apply to auto-layout frames and their direct children; anything else gets a warning. Every write is verified (LIMIT_NOT_APPLIED / LIMIT_NOT_CLEARED).
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Nodes to update |
minWidth |
number/null | No | Minimum width; null clears, omit to leave unchanged |
maxWidth |
number/null | No | Maximum width; null clears, omit to leave unchanged |
minHeight |
number/null | No | Minimum height; null clears, omit to leave unchanged |
maxHeight |
number/null | No | Maximum height; null clears, omit to leave unchanged |
figma_delete_nodes
Delete nodes.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Nodes to delete |
figma_group_nodes
Group multiple nodes.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nodeIds |
string[] | Yes | Nodes to group | |
name |
string | No | "Group" |
Group name |
figma_ungroup_nodes
Ungroup group nodes.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Group nodes to ungroup |
figma_rename_node
Rename nodes.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | No | Single node ID |
nodeIds |
string[] | No | Batch node IDs |
name |
string | Yes | New name |
figma_reorder_node
Change z-order (layer order) among siblings.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node to reorder |
position |
string/number | Yes | "front", "back", or the final zero-based index |
A numeric position is the final index the node ends up at — ask for 2 and it is at 2 when the call returns. Figma sorts children back-to-front, so 0 is the bottom of the layer stack and childCount - 1 is the top; "back" is 0 and "front" is the last index. Out-of-range indices are clamped and the response reports clamped: true with a message. The final index is read back and verified — a mismatch fails with REORDER_FAILED instead of reporting success.
Reordering children of an INSTANCE is blocked by Figma and returns INSTANCE_SUBLAYER_RESTRICTED; reorder on the component master instead.
figma_set_constraints
Set resize constraints (non-auto-layout frames only).
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node to configure |
horizontal |
string | No | MIN, CENTER, MAX, STRETCH, SCALE |
vertical |
string | No | MIN, CENTER, MAX, STRETCH, SCALE |
Navigation Commands
figma_set_selection
Set the current selection.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Nodes to select (empty to clear) |
figma_set_current_page
Switch to a different page.
| Parameter | Type | Required | Description |
|---|---|---|---|
pageId |
string | Yes | Page ID to switch to |
Export Commands
figma_export_node
Export a node as an image. The image is written to disk and the file path is returned — read that file to view the render.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nodeId |
string | Yes | Node to export | |
format |
string | No | "PNG" |
Format: PNG, SVG, JPG, PDF |
scale |
number | No | 1 |
Export scale (1 = 100%) |
outputPath |
string | No | Absolute file path to write to. Parent directories are created. | |
returnBase64 |
boolean | No | false |
Return base64 data inline instead of writing a file |
Returns: { success, nodeId, path, format, scale, bytes } — no inline image data.
Omit outputPath and the file lands at <tmpdir>/deskhand/<node-id>-<timestamp>.<ext>. This is file-first by design: inline base64 can't be viewed, which used to force callers to inflate scale until the response was large enough to spill to a readable file. An unwritable path fails with EXPORT_WRITE_FAILED rather than silently losing the export.
Component Commands
figma_detach_instance
Detach instance from component (converts to frame).
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Instance to detach |
figma_swap_instance
Swap a component instance to use a different component.
| Parameter | Type | Required | Description |
|---|---|---|---|
instanceId |
string | Yes | Instance node ID to swap |
newComponentId |
string | Yes | Component ID to swap to |
figma_combine_as_variants
Combine multiple components into a component set with variants.
| Parameter | Type | Required | Description |
|---|---|---|---|
componentIds |
string[] | Yes | Array of component IDs (minimum 2). Components must use variant naming (e.g., "Size=Large") |
Variable Management Commands
figma_create_variable_collection
Create a new variable collection to organize variables.
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Collection name |
modes |
string[] | No | Mode names (defaults to ["Mode 1"]) |
figma_create_variable
Create a new variable in a collection.
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionId |
string | Yes | Variable collection ID |
name |
string | Yes | Variable name (use / for groups, e.g., "colors/primary") |
type |
string | Yes | COLOR, FLOAT, STRING, or BOOLEAN |
value |
any | No | Initial value for default mode |
aliasOf |
string | No | Variable ID to alias (instead of direct value) |
description |
string | No | Variable description |
scopes |
string[] | No | Where this variable can be used |
figma_rename_variable
Rename an existing variable.
| Parameter | Type | Required | Description |
|---|---|---|---|
variableId |
string | Yes | Variable ID to rename |
name |
string | Yes | New name (use / for groups) |
figma_delete_variables
Delete one or more variables.
| Parameter | Type | Required | Description |
|---|---|---|---|
variableIds |
string[] | Yes | Array of variable IDs to delete |
figma_rename_variable_collection
Rename a variable collection.
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionId |
string | Yes | Collection ID to rename |
name |
string | Yes | New name |
figma_delete_variable_collection
Delete a variable collection and all its variables.
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionId |
string | Yes | Collection ID to delete |
figma_add_mode
Add a new mode to a variable collection.
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionId |
string | Yes | Collection ID to add mode to |
name |
string | Yes | Name for the new mode |
figma_rename_mode
Rename a mode in a variable collection.
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionId |
string | Yes | Collection ID containing the mode |
modeId |
string | Yes | Mode ID to rename |
name |
string | Yes | New name for the mode |
figma_delete_mode
Delete a mode from a variable collection.
| Parameter | Type | Required | Description |
|---|---|---|---|
collectionId |
string | Yes | Collection ID containing the mode |
modeId |
string | Yes | Mode ID to delete |
figma_set_variable_mode
Pin an explicit variable mode on nodes or pages, or clear an existing pin. This is how a preview/page frame is made to resolve a particular mode (e.g. a mobile frame pinned to the Spacing collection's mobile mode) — no more cloning a frame just to inherit its mode. Pins are per-collection and travel through clones and instances, so clear: true is the fix for a bad inherited pin. The response echoes each node's resulting explicitVariableModes ({} means nothing is pinned).
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nodeIds |
string[] | Yes | Node IDs or page IDs to pin/unpin | |
collectionId |
string | Yes | Variable collection the pin applies to | |
modeId |
string | No | Mode to pin. Required unless clear is true |
|
clear |
boolean | No | false |
Remove this collection's pin instead of setting one |
figma_unbind_variable
Remove a variable binding from a node property. On a min/max size field it also clears the residual literal (reported as previousLiteral / clearedLiteral) — without that, unbinding maxWidth freezes the last resolved number as a permanent clamp.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nodeId |
string | Yes | Node ID to unbind from | |
field |
string | Yes | Field to unbind (fills, strokes, opacity, maxWidth, etc.) |
|
paintIndex |
number | No | 0 |
Paint array index for fills/strokes |
Page Management Commands
FigJam restriction:
figma_create_pageandfigma_duplicate_pageare Figma Design only. The FigJam plugin runtime does not exposefigma.createPage()orPageNode.clone(). FigJam files can have multiple pages, but they must be created via the FigJam UI — plugins cannot create them programmatically. Calling these tools in FigJam returnsFIGMA_DESIGN_ONLY. Other page operations (rename, delete, list, switch current page) work in both editors.
figma_create_page
Create a new page in the document. Figma Design only.
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Name for the new page |
index |
number | No | Position in the page list (0 = first). Defaults to end. |
figma_rename_page
Rename an existing page.
| Parameter | Type | Required | Description |
|---|---|---|---|
pageId |
string | Yes | Page ID to rename |
name |
string | Yes | New name for the page |
figma_delete_page
Delete a page from the document.
| Parameter | Type | Required | Description |
|---|---|---|---|
pageId |
string | Yes | Page ID to delete |
Note: Cannot delete the last remaining page.
figma_duplicate_page
Clone an entire page including all its contents. Figma Design only.
| Parameter | Type | Required | Description |
|---|---|---|---|
pageId |
string | Yes | Page ID to duplicate |
name |
string | No | Name for the new page (defaults to "original name + copy") |
FigJam Commands
These tools target FigJam-only node types (sticky notes, flowchart shapes, connectors, tables, code blocks, link previews). They return WRONG_EDITOR if called against a Figma design file. Sections (figma_create_section / figma_set_section) are the exception — they work in both editors.
figma_create_sticky
Create a sticky note. Default size is fixed (240×240); width/height are not configurable. Text is set via the embedded sublayer (font auto-loaded).
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
text |
string | No | Sticky note body text | |
fills |
color | No | Background color of the sticky | |
isWideWidth |
boolean | No | Use the wide rectangular sticky variant | |
parentId |
string | No | Parent node ID (defaults to current page) |
Author info is read-only at runtime. Figma's plugin docs list
authorNameandauthorVisibleas R/W onStickyNode, but the FigJam runtime rejects writes with "no setter for property". Figma auto-populates both from the active user's identity, so the labeling works correctly without programmatic control.
figma_set_sticky
Toggle a sticky between square and wide-rectangle variants. Use figma_set_text to change the body text.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The STICKY node ID |
isWideWidth |
boolean | No | Wide vs square sticky |
figma_create_shape_with_text
Create a flowchart shape with embedded text. Use ROUNDED_RECTANGLE for processes, DIAMOND for decisions, ENG_DATABASE for data stores. cornerRadius is fixed by shapeType and cannot be set.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
width |
number | No | 208 |
Width in pixels |
height |
number | No | 208 |
Height in pixels |
shapeType |
string | Yes | See list below | |
text |
string | No | Embedded text content | |
fills |
color | No | Shape fill color | |
strokes |
color | No | Shape stroke color | |
strokeWeight |
number | No | Stroke weight in pixels | |
parentId |
string | No | Parent node ID |
Shape types (30 values): SQUARE, ELLIPSE, ROUNDED_RECTANGLE, DIAMOND, TRIANGLE_UP, TRIANGLE_DOWN, PARALLELOGRAM_RIGHT, PARALLELOGRAM_LEFT, ENG_DATABASE, ENG_QUEUE, ENG_FILE, ENG_FOLDER, TRAPEZOID, PREDEFINED_PROCESS, SHIELD, DOCUMENT_SINGLE, DOCUMENT_MULTIPLE, MANUAL_INPUT, HEXAGON, CHEVRON, PENTAGON, OCTAGON, STAR, PLUS, ARROW_LEFT, ARROW_RIGHT, SUMMING_JUNCTION, OR, SPEECH_BUBBLE, INTERNAL_STORAGE.
figma_set_shape_type
Change the shape variant of an existing shape-with-text node.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The SHAPE_WITH_TEXT node ID |
shapeType |
string | Yes | New shape type (see list above) |
figma_create_connector
Create an arrow / connector between nodes. Default endCap is ARROW_EQUILATERAL so connectors look like arrows without configuration. Endpoints can attach via magnets, fixed positions on a node, or be free-floating on the canvas.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
start |
endpoint | No | Start endpoint (see endpoint shape below) | |
end |
endpoint | No | End endpoint | |
lineType |
string | No | "ELBOWED" |
ELBOWED, STRAIGHT, or CURVED |
startCap |
string | No | "NONE" |
Decoration at start |
endCap |
string | No | "ARROW_EQUILATERAL" |
Decoration at end |
text |
string | No | Center label text | |
strokes |
color | No | Line color | |
strokeWeight |
number | No | Line thickness | |
parentId |
string | No | Parent node ID |
Endpoint shapes (one of):
{ nodeId, magnet }— attach to a node with a magnet (AUTO,TOP,LEFT,BOTTOM,RIGHT,CENTER,NONE){ nodeId, position: { x, y } }— attach to a node at a fixed position relative to it{ position: { x, y } }— free-floating on canvas at absolute coordinates
Stroke caps: NONE, ARROW_EQUILATERAL, ARROW_LINES, TRIANGLE_FILLED, CIRCLE_FILLED, DIAMOND_FILLED.
Magnet rule:
STRAIGHTconnectors only supportCENTERorNONEmagnets.ELBOWEDandCURVEDaccept all six. Validation runs server-side.
figma_set_connector
Modify an existing connector's endpoints, line type, end caps, or label.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The CONNECTOR node ID |
start |
endpoint | No | Replacement start endpoint |
end |
endpoint | No | Replacement end endpoint |
lineType |
string | No | New line routing type |
startCap |
string | No | New start decoration |
endCap |
string | No | New end decoration |
text |
string | No | Replacement label text |
figma_create_section
Create a labeled section. Works in both Figma design files and FigJam. Supports Dev Mode handoff status.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
width |
number | No | 600 |
Width in pixels |
height |
number | No | 400 |
Height in pixels |
name |
string | No | Section label | |
fills |
color | No | Section background fill | |
sectionContentsHidden |
boolean | No | Visually collapse the section's contents | |
devStatus |
string | No | READY_FOR_DEV or COMPLETED (only valid directly under a page or another section) |
|
devStatusDescription |
string | No | Optional description shown with the dev status | |
parentId |
string | No | Parent node ID |
figma_set_section
Update a section's name, dev status, or content visibility. Pass devStatus: null to clear it.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The SECTION node ID |
name |
string | No | New section label |
sectionContentsHidden |
boolean | No | Show or hide section contents |
devStatus |
string|null | No | READY_FOR_DEV, COMPLETED, or null |
devStatusDescription |
string | No | Description shown with dev status |
figma_create_table
Create a table for documentation or structured data. Optionally seed initial cell content.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
numRows |
number | No | 2 |
Number of rows |
numColumns |
number | No | 2 |
Number of columns |
cells |
array | No | Initial cells: [{ row, column, text?, fills? }] |
|
fills |
color | No | Table background fill | |
parentId |
string | No | Parent node ID |
figma_set_table_cell
Set the text and/or fill color of a single table cell.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The TABLE node ID |
row |
number | Yes | Row index (0-based) |
column |
number | Yes | Column index (0-based) |
text |
string | No | New cell text |
fills |
color | No | New cell background fill |
figma_insert_table_row / figma_insert_table_column
Insert a row/column at the given index (existing rows/columns at and after the index shift).
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The TABLE node ID |
rowIndex / columnIndex |
number | Yes | Insert position (0 = top/leftmost) |
figma_remove_table_row / figma_remove_table_column
Remove a row/column.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The TABLE node ID |
rowIndex / columnIndex |
number | Yes | Index to remove |
figma_resize_table_row / figma_resize_table_column
Set row height / column width.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The TABLE node ID |
rowIndex / columnIndex |
number | Yes | Target index |
height (row) / width (column) |
number | Yes | New dimension in pixels |
figma_move_table_row / figma_move_table_column
Reorder rows/columns.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The TABLE node ID |
fromIndex |
number | Yes | Source index |
toIndex |
number | Yes | Destination index |
figma_create_code_block
Create a syntax-highlighted code block for documentation.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
code |
string | Yes | Code text content | |
codeLanguage |
string | No | "PLAINTEXT" |
Syntax highlighting language |
parentId |
string | No | Parent node ID |
Languages (17 values): TYPESCRIPT, CPP, RUBY, CSS, JAVASCRIPT, HTML, JSON, GRAPHQL, PYTHON, GO, SQL, SWIFT, KOTLIN, RUST, BASH, PLAINTEXT, DART.
figma_set_code_block
Update an existing code block's code text or language.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | The CODE_BLOCK node ID |
code |
string | No | New code text |
codeLanguage |
string | No | New syntax-highlighting language |
figma_create_link_preview
Create a rich link preview from a URL. Returns either an EMBED (iframe; works for OEmbed providers like YouTube/Spotify) or a LINK_UNFURL (rich card from OpenGraph/Twitter Card metadata) — the response includes nodeType so callers know which.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x |
number | No | 0 |
X position |
y |
number | No | 0 |
Y position |
url |
string | Yes | The URL to preview | |
parentId |
string | No | Parent node ID |
Building a flowchart end-to-end
// 1. Section to wrap the diagram
figma_create_section({ x: 0, y: 0, width: 1000, height: 600, name: "User signup flow" })
// → returns { node: { id: 'XX:1', ... } }
// 2. Process steps as shapes-with-text
figma_create_shape_with_text({
x: 40, y: 80, width: 200, height: 80,
shapeType: 'ROUNDED_RECTANGLE',
text: 'Start',
parentId: 'XX:1'
})
figma_create_shape_with_text({
x: 320, y: 80, width: 200, height: 120,
shapeType: 'DIAMOND',
text: 'Email valid?',
parentId: 'XX:1'
})
// ...etc.
// 3. Connectors between them
figma_create_connector({
start: { nodeId: 'XX:2', magnet: 'AUTO' },
end: { nodeId: 'XX:3', magnet: 'AUTO' },
lineType: 'ELBOWED',
parentId: 'XX:1'
})
// endCap defaults to ARROW_EQUILATERAL — you get an arrow without specifying
// 4. Add a sticky for context
figma_create_sticky({
x: 600, y: 80,
text: 'TODO: rate-limit this endpoint',
parentId: 'XX:1'
})
FigJam node types not creatable via this MCP
STAMP, HIGHLIGHT, WASHI_TAPE, WIDGET, and MEDIA cannot be created from a non-widget plugin (Figma's API doesn't expose factory methods, or requires a pre-uploaded image hash). They can still be cloned, moved, deleted, and serialized through existing tools — they just can't be created from scratch.
Prototype Commands
These tools set up prototype interactions on Figma Design nodes. They operate on the reactions array (read/written via setReactionsAsync) and the page-level flowStartingPoints list. They are not applicable to FigJam files.
figma_get_reactions
Read all reactions currently set on a node.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node ID to read reactions from |
Returns the full reactions array including trigger and actions details for each reaction.
figma_add_reaction
Add a prototype interaction to a node. Existing reactions are preserved — each call appends one new reaction.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node ID to add the reaction to |
trigger |
object | Yes | What initiates the interaction (see Trigger types below) |
action |
object | Yes | What happens when the trigger fires (see Action types below) |
Trigger types:
type |
Extra fields | Description |
|---|---|---|
ON_CLICK |
— | Tap / click |
ON_HOVER |
— | Hover |
ON_PRESS |
— | Press and hold |
ON_DRAG |
— | Drag |
ON_MEDIA_END |
— | Media playback ends |
AFTER_TIMEOUT |
timeout (ms) |
Auto-advance after delay |
MOUSE_UP |
delay (ms) |
Mouse button released |
MOUSE_DOWN |
delay (ms) |
Mouse button pressed |
MOUSE_ENTER |
delay (ms) |
Cursor enters element |
MOUSE_LEAVE |
delay (ms) |
Cursor leaves element |
ON_KEY_DOWN |
keyCodes (number[]), device |
Key pressed |
ON_MEDIA_HIT |
mediaHitTime (seconds) |
Media reaches timestamp |
device values for ON_KEY_DOWN: KEYBOARD (default), XBOX_ONE, PS4, SWITCH_PRO, UNKNOWN_CONTROLLER.
Action types:
type |
Key fields | Description |
|---|---|---|
NODE |
destinationId, navigation, transition |
Navigate to / open / scroll to a frame |
BACK |
— | Go back to previous frame |
CLOSE |
— | Close the current overlay |
URL |
url, openInNewTab (bool) |
Open a URL — set openInNewTab: true to open in a new tab |
For NODE actions, the navigation field controls the behaviour:
navigation |
Description |
|---|---|
NAVIGATE |
Navigate to destination frame (default) |
OVERLAY |
Open destination as an overlay |
SWAP |
Swap the current frame with destination |
SCROLL_TO |
Scroll to destination within the current frame |
CHANGE_TO |
Change component to a different variant |
Transition object (optional, for NODE actions):
| Field | Values | Notes |
|---|---|---|
type |
DISSOLVE, SMART_ANIMATE, SCROLL_ANIMATE |
Simple transitions — no direction |
type |
MOVE_IN, MOVE_OUT, PUSH, SLIDE_IN, SLIDE_OUT |
Directional — requires direction |
direction |
LEFT, RIGHT, TOP, BOTTOM |
Required for directional types |
matchLayers |
boolean (default false) |
Smart-match shared layers — directional types only |
duration |
number (seconds) | Default 0.3 |
easing.type |
LINEAR, EASE_IN, EASE_OUT, EASE_IN_AND_OUT, EASE_IN_BACK, EASE_OUT_BACK, EASE_IN_AND_OUT_BACK, CUSTOM_CUBIC_BEZIER, GENTLE, QUICK, BOUNCY, SLOW, CUSTOM_SPRING |
GENTLE/QUICK/BOUNCY/SLOW are spring presets |
Example — click to navigate with a slide transition:
figma_add_reaction({
nodeId: '10:5',
trigger: { type: 'ON_CLICK' },
action: {
type: 'NODE',
destinationId: '10:20',
navigation: 'NAVIGATE',
transition: {
type: 'SLIDE_IN',
direction: 'LEFT',
duration: 0.3,
easing: { type: 'EASE_OUT' }
}
}
})
Example — auto-advance after 3 seconds:
figma_add_reaction({
nodeId: '10:5',
trigger: { type: 'AFTER_TIMEOUT', timeout: 3000 },
action: {
type: 'NODE',
destinationId: '10:30',
navigation: 'NAVIGATE',
transition: { type: 'DISSOLVE', duration: 0.5, easing: { type: 'EASE_IN_AND_OUT' } }
}
})
figma_remove_reaction
Remove a reaction from a node by its zero-based index. Use figma_get_reactions first to identify the index.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeId |
string | Yes | Node ID to remove the reaction from |
index |
number | Yes | Zero-based index of the reaction to remove |
figma_set_flow_starting_point
Set or clear a prototype flow starting point. Flow starting points are page-level — Figma stores them on the parent PageNode as a list of { nodeId, name } entries. The first entry is the default when entering Presentation view with nothing selected.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
nodeId |
string | Yes | FRAME, COMPONENT, or COMPONENT_SET node ID |
|
flowName |
string | No | "Flow 1" |
Display name for the flow. If the frame is already a starting point, its name is updated. |
clear |
boolean | No | If true, removes the flow starting point for this frame from the page |
Top-level frames (direct children of a page) are the typical starting points. The Figma typings mark
PageNode.flowStartingPointsasReadonlyArray, but the runtime accepts direct assignment — that's the documented (if quirky) pattern this tool uses internally.
Structure Commands
figma_reparent_nodes
Move nodes to a different parent container.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Array of node IDs to move |
newParentId |
string | Yes | New parent node ID (must be a frame, group, or page) |
index |
number | No | Position within the new parent (0 = bottom/back). Defaults to top/front. |
figma_move_to_page
Move nodes from their current page to a different page.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Array of node IDs to move |
targetPageId |
string | Yes | Destination page ID |
x |
number | No | X position on target page |
y |
number | No | Y position on target page |
figma_set_rotation
Set the rotation of one or more nodes.
| Parameter | Type | Required | Description |
|---|---|---|---|
nodeIds |
string[] | Yes | Array of node IDs to rotate |
rotation |
number | Yes | Rotation in degrees (-180 to 180) |
Token Optimization
Every response is compact JSON with null fields dropped. docs/token-budget.md is the measured budget for a standard call set (regenerate with npm run token-report; --baseline resets the baseline, --check enforces the total is no more than a target ratio of it via --target <ratio>, default 0.6).
Measured outcome (2026-09-12): the standard call set went from 175,478 to 134,263 bytes — a 23% cut (77% of baseline), not the 40% target the spec set out. tools/list alone is 84,162 of that 134,263 (63%); roughly 41 KB of it is JSON-schema structure the MCP SDK generates from the Zod schemas, and the description budgets are already at their floor (15,888 tool-description chars / 13,951 parameter-description chars). Closing the rest of the gap would need fewer tools or a tools/list override that strips SDK-generated schema keys — see spec §16.1.
- Node reads:
figma_get_nodesomits default-valued props and caps long fields (characters2000 chars,childIds200, fills/strokes/effects 20 entries, each flagged with<field>Truncated); passverbose: truefor everything. Usedepth: "minimal"or"compact"to traverse. - Lists page: the search tools,
figma_get_children,figma_get_local_stylesandfigma_get_local_variablestakelimitandoffsetand returntruncatedwithnext(the offset for the following page). Preferfigma_search_variablesoverfigma_get_local_variableson large files. - Big results leave the context:
figma_execute/figma_job_statusresults over 32 KB are written to~/.deskhand/results/<id>.json; the response carriestruncated: true,resultPath,resultBytesand a 4 KBpreview. Return ids and counts, not whole nodes. - Images:
figma_screenshotinlines PNGs up to 200 KB (one retry at half scale, reported asreducedForInline); larger renders stay on disk.figma_export_batchnever inlines. - Descriptions: tool descriptions are ≤ 400 characters and the server instructions ≤ 2,500; the operating guidance is in
skill://deskhand/SKILL.md.
Known Limitations
- No ES6 spread operator in plugin code
- Boolean operations require nodes with same parent
- Constraints don't work on auto-layout children (use
layoutAlign) - Lines have height=0, use
lengthparameter - Vectors only support M, L, Q, C, Z commands (no arcs)
detachInstance()also detaches ancestor instances- Instance sublayers can't be resized, size-bound, or reordered — Figma blocks these, and the bridge returns
INSTANCE_SUBLAYER_RESTRICTEDrather than a false success. Act on the component master, or usefigma_set_layout_align: STRETCH - 30-second timeout on all commands
Troubleshooting
Plugin Not Connecting
- Check a Claude session with Deskhand is open: the server starts with the first one and stops a minute after the last one closes.
npx deskhand@latest statusshows whether it is running. - The plugin panel connects to port 3055 by itself. If it cannot find a server, click Reconnect.
- If
statusshows a different port (aDESKHAND_PORToverride), set that port under Advanced in the panel. - Re-run the plugin in Figma (
Cmd+Option+P).
Port Already in Use
The server binds exactly one port, 3055 by default, and exits if another program holds it (~/.deskhand/daemon.log says so). Free the port, or set DESKHAND_PORT in the registered server's environment so every session uses the same alternative:
claude mcp add --scope user deskhand -e DESKHAND_PORT=3057 -e DESKHAND_NODE=$(command -v node) -- /bin/sh ~/.deskhand/current/node_modules/deskhand/src/shim.sh
Multiple Claude Sessions
Every Claude Code and Claude Desktop session shares the one server. Each session gets its own MCP connection and tool profile; the Figma plugin connection, the job queue and the licence are shared, and figma_bridge_diagnostics lists the open sessions. Commands from different sessions interleave at the plugin, and jobs run one at a time, so a second session gets JOB_BUSY while another's figma_execute job runs.
npx deskhand@latest status # pid, version, uptime, port, sessions, connected file
npx deskhand@latest stop # refuses while sessions are open
npx deskhand@latest stop --force # ends it anyway; those sessions lose their Figma tools
After npx deskhand@latest update, the running server keeps its version until it exits; the next one to start runs the new code.
If the server stops while a session is open (stop --force, or a crash), that session's shim exits and Claude lists Deskhand as failed. Claude Code does not restart a stopped server on its own: run /mcp and reconnect Deskhand, or start a new session. Claude Desktop starts it again when the app relaunches.
Commands Timing Out
- Commands have a 30-second timeout
- Large exports may timeout; try smaller scales
- Check plugin is still connected (green status)
Font Errors
Text operations require font loading. The plugin handles this automatically, but if a font isn't installed, it will fail. Use fonts available on your system.
License
MIT. Copyright (c) 2026 Duncan Bottrill; portions Copyright (c) 2024 Magic Spells.
Icon artwork from Lucide (ISC).