figcraft-app-mcp
Exposes a Figma-compatible tool surface—get_metadata, get_design_context, get_screenshot, get_code_connect_map, get_variable_defs, and get_code—mirroring the names and semantics of the Figma desktop MCP. This lets agents already familiar with Figma MCP workflows drive design documents with the same vocabulary: reading layer hierarchies, design context (geometry, auto-layout, fills, strokes, effects, fonts, styles, variables, component links), screenshots of layers or pages, component-to-code Code Connect mappings, variable and style definitions, and generated code (CSS/HTML/React/Leptos/SwiftUI/Compose).
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@figcraft-app-mcp screenshot the selected frame and export it as a PNG"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
figcraft-app-mcp
figcraft 开源设计软件的 MCP 工具
一个本地 MCP Server(stdio / JSON-RPC 2.0 / MCP 2025-06-18),通过 FigCraft 桌面版的本地控制通道驱动正在运行的 FigCraft 应用。
它同时暴露两套工具面:
FigCraft 原生工具:与上游
figcraft-mcp(crates/mcp)同名同义,可直接替换上游实现。Figma 兼容工具:
get_metadata/get_design_context/get_screenshot/get_code_connect_map/get_variable_defs/get_code,与 Figma 桌面版 MCP 同名,已习惯 Figma MCP 的 agent 可以直接用同一套词汇驱动 FigCraft。
架构
MCP 客户端 (Claude Code / Cursor / MiniMax Code / Codex …)
│ stdio, JSON-RPC 2.0
▼
figcraft-app-mcp (本项目, Node/TS)
│ TCP 127.0.0.1:<port>, 换行分隔 JSON
▼
FigCraft 桌面应用 (--control <port>)控制通道的报文格式(上游 docs/control-protocol.md):
请求: {"id": 1, "method": "engine.execute", "params": {"command": "node.create", "params": {...}}}
回复: {"id": 1, "ok": true, "result": ...}
{"id": 1, "ok": false, "error": "message"}请求排队后在 UI 线程的下一次帧处理,因此回复反映真实 UI 状态;应用 60 秒不答则返回超时错误。
Related MCP server: Writable Figma MCP Bridge
前置条件
装好 FigCraft 桌面版(本机为
/Applications/FigCraft.app)。用带控制通道的方式启动它(见下)。
⚠️ 实例必须经由 LaunchServices 启动(
open)。直接从 shell 里跑二进制虽然能绑定端口,但拿不到正常 GUI 会话,UI 线程不会处理请求,所有调用都会返回timed out waiting for the UI: screenshots and input need the FigCraft window on screen。
启动带控制通道的 FigCraft
两种方式,任选其一:
A. 包装 App(推荐,已随项目提供)
cd /path/to/figcraft-app-mcp
scripts/install-control-app.sh # 重新签名并设定端口(clone 后先跑一次)
open -n tools/FigCraftControl.app包装 App 会以 --control <port> 启动真正的 FigCraft,端口取自
$FIGCRAFT_CONTROL_PORT > figcraft-mcp/.control-port > 脚本内默认值 7987。
日志写在 figcraft-mcp/figcraft-control.log。
(从 zip/下载得到的包可能带 quarantine 标记:右键 ▸ 打开,或
xattr -dr com.apple.quarantine tools/FigCraftControl.app。)
B. 直接用 open 传参
open -n /Applications/FigCraft.app --args --control 7987部分 macOS 版本上 open --args 不会把参数交给应用(表现为端口没起来),此时用 A。
安装与构建
cd /Users/wangpengfei/Documents/codozero/figcraft-mcp
npm ci --cache ./.npm-cache # 或 npm install --cache ./.npm-cache
npm run build客户端配置
在项目的 .mcp.json 里:
{
"mcpServers": {
"figcraft-app": {
"command": "node",
"args": ["/Users/wangpengfei/Documents/codozero/figcraft-mcp/dist/index.js"],
"env": {
"FIGCRAFT_CONTROL_PORT": "7987"
}
}
}
}MiniMax Code 也可以用 mavis mcp create 注册同名 server。
工具
Figma 兼容面
工具 | 作用 | Figma 对应 |
| 层级树,形状为 |
|
| 几何 / 自动布局 / 填充 / 描边 / 效果 / 字体 / 样式 / 变量 / 组件链接 |
|
| 指定图层或整页 PNG; |
|
| 组件与真实代码的 Code Connect 映射 |
|
| 变量与画板样式定义 |
|
| 图层生成的代码(css/html/react/leptos/swiftui/compose) |
|
FigCraft 原生面
list_commands、run_command、batch、create_node、set_properties、inspect_document、
get_node、select、export、screenshot、open_file、save_file、undo、redo、
pointer、key、type_text、inspect_ui。
run_command 可执行全部 561 条菜单级命令(align.left、layout.add、component.create、
inspect.code、file.export …),用 list_commands 查看。
约定(与上游一致)
坐标是 page 单位(100% 缩放下 1 单位 = 1px),x 向右、y 向下。
create_node/set_properties的x/y相对父级 frame(没有父级时相对页面)。颜色
"#RRGGBB"或"#RRGGBBAA";渐变可写{"type":"linearGradient","stops":["#7048E8","#1098AD"]}。每次改动是一个 undo 步;
batch合成一步且全有或全无。batch的步骤参数里可用{"$step": n}引用前一步返回的 id。
环境变量
变量 | 默认 | 说明 |
|
| 控制通道端口 |
|
| 控制通道地址(只应在 loopback 用) |
|
| 单次请求超时(应用自身上限 60s) |
|
| 单行回复上限(对齐应用的 32 MiB) |
|
| 允许读取的目录(JSON 数组),限制 |
|
| 允许写入的目录(JSON 数组),限制 |
|
| 返回图片的体积上限 |
FIGCRAFT_READ_ROOTS / FIGCRAFT_WRITE_ROOTS 是桥接侧的兜底限制;应用侧还可以用
--automation-read-root / --automation-write-root 再限制一层。
与上游 figcraft-cli mcp 的关系
上游 Rust 项目自带 MCP Server(crates/mcp,figcraft-cli mcp / figcraft-cli mcp --attach <port>)。
本项目是同协议的独立实现,特点:
不需要编译 Rust(
cargo build --release -p figcraft-cli在本机很慢)。直接驱动已经装好的桌面应用,用户在窗口里实时看到每一次改动。
额外提供 Figma 兼容工具名,便于复用 Figma 的工作流与提示词。
两者可以并存:上游负责 headless / 批处理,本项目负责交互式编辑。
测试
npm test # 用假的控制通道做单元与集成测试(无需启动 FigCraft)
npm run typecheck已知限制
应用同一时刻只接受 8 个控制连接、队列各 8 条请求,超出会返回
control request queue is full。ui.screenshot(应用窗口截图)要求窗口在屏幕上;窗口最小化/被遮挡时ui.render仍可用。控制通道请求在 60 秒内没被 UI 线程处理就会被丢弃,不会自动重放——请先检查文档再重试。
许可
GPL-3.0。FigCraft 本身是 MIT OR Apache-2.0(上游 storytold/figcraft),本项目是独立的第三方桥接实现。
Available Tools
24 toolsbatchRun a batch of commandsADestructive
Several commands as one undo step (command.batch), all-or-nothing. A step may use what an earlier step returned: {"$step": n} anywhere in its params becomes the id of step n (zero-based).
Inputs: commands (required), label.
create_nodeCreate a layerCDestructive
Create a frame, rectangle, ellipse, polygon, star, line, arrow, text, vector, section, component or slice. Coordinates are page units relative to the parent frame (the page when there is none).
Inputs: type (required), x, y, name, +9 more.
exportExport layersBDestructive
Export layers as png, jpg, svg, webp, pdf or fig. Without path the bytes come back as image content; with path the app writes the file.
Inputs: ids, cmyk, path, size, +10 more.
get_codeGet code for a layerCRead-onlyIdempotent
The code the app generates for a layer: CSS, HTML+CSS, React, Leptos, SwiftUI or Jetpack Compose (a whole layer tree for html/react/leptos).
Inputs: unit, nodeId, language, rootFontSize.
get_code_connect_mapGet the code connect map (Figma compatible)ARead-onlyIdempotent
The code connect links of the document: every component that is connected to real code, with its language, import path, name and template.
Inputs: no named parameters.
get_design_contextGet design context (Figma compatible)BRead-onlyIdempotent
The design context of a layer: geometry, auto layout, sizing, fills, strokes, effects, typography, styles, variables, component links and interactions — the facts a code generator needs.
Inputs: depth, nodeId, language, includeCode, +1 more.
get_metadataGet metadata (Figma compatible)BRead-onlyIdempotent
The layer hierarchy in the Figma MCP shape: {id, name, type, children}. Without nodeId the current page is returned.
Inputs: depth, nodeId.
get_nodeRead one layerBRead-onlyIdempotent
One layer as JSON: id, name, type, geometry, fills, strokes, effects, auto layout, sizing, constraints, text properties, component links, overrides, interactions, exports, dev status and annotations.
Inputs: id (required), depth.
get_screenshotGet a screenshot (Figma compatible)BRead-onlyIdempotent
PNG of a layer (or of the current page) in the Figma MCP shape: nodeId for one layer, window: true for what the app window shows.
Inputs: ids, scale, nodeId, window, +1 more.
get_variable_defsGet variable definitions (Figma compatible)BRead-onlyIdempotent
The variables and paint styles of the document with their modes, code names and scopes — the Figma MCP shape.
Inputs: includeStyles.
inspect_documentInspect the documentBRead-onlyIdempotent
The document as JSON: name, path, dirty flag, current page, selection, the layer tree, styles, variables, images, colour profile, the text being edited and the undo history.
Inputs: depth, allPages.
inspect_uiInspect the app UIBRead-onlyIdempotent
The app state: panels, current tool, view, zoom, timings, frames drawn, the windows the app has, the live session and the home screen.
Inputs: no named parameters.
keyPress a keyCDestructive
A shortcut or key as if typed on the canvas: "A", "0", "Enter", "ArrowLeft", "=", or egui names like "Plus". cmd is Cmd on macOS.
Inputs: key (required), alt, cmd, ctrl, +1 more.
list_commandsList FigCraft commandsARead-onlyIdempotent
Every command the FigCraft app can run (561 of them): id, label, menu, shortcut and parameter doc. Filter with filter.
Inputs: filter.
open_fileOpen a fileCDestructive
Open a .figcraft, .json (FigCraft or REST API file JSON), .fig, .svg or image file in the app. Returns the file summary and the document outline.
Inputs: path (required), variables.
pointerPointer gestureCDestructive
A mouse gesture with the current tool: click, double, drag, down, move, up, hover. Positions are page coordinates; to is the drag target.
Inputs: x (required), y (required), to, alt, +7 more.
redoRedoCDestructive
Redo the last undone change.
Inputs: no named parameters.
run_commandRun a FigCraft commandCDestructive
Run any command of the app (the same ids as the menus, shortcuts and the Actions palette): align.left, layout.add, component.create, instance.place, inspect.code, file.export, …
Inputs: command (required), params.
save_fileSave the documentBDestructive
Save the document; path is needed the first time a document is saved programmatically.
Inputs: path.
screenshotScreenshot the canvas or the app windowCRead-onlyIdempotent
PNG of the page (with background) or of the given layers, scaled to fit maxSize (default 1600). window: true captures the app window, a window id that window.
Inputs: ids, scale, window, maxSize.
selectChange the selectionADestructive
Replace the selection with the given layer ids (an empty array deselects).
Inputs: ids (required).
set_propertiesSet layer propertiesBDestructive
Change layers: geometry, fills, strokes, effects, corner radius, auto layout, sizing, constraints, masks, handoff status, text props. Acts on ids, or on the selection when none are given.
Inputs: props (required), ids.
type_textType textBDestructive
Type into the text being edited, or replace the contents of the text layer id (the text is edited and the edit ended again).
Inputs: text (required), id.
undoUndoADestructive
Undo the last change (one command, batch or gesture).
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 24 tools
Several tools overlap: run_command can execute any app command, while create_node, set_properties, pointer, key, and type_text enable specific actions. Multiple inspection and capture tools (get_node, get_metadata, get_design_context, inspect_document, screenshot, get_screenshot, export) retrieve or output similar layer/document data, so an agent may struggle to pick the right one without careful reading.
All tool names use snake_case consistently, with predictable verb_noun or noun forms (list_commands, run_command, get_node, open_file). A few names deviate from the verb_noun pattern (batch, select, pointer, key), but they remain readable and stylistically consistent.
24 tools is on the heavy side for an MCP server and approaches the 25+ threshold where tool sets become unwieldy. The app's broad scope (561 commands, design editing, inspection, export, Figma-compatible getters) partially justifies the count, but some tools could likely be consolidated.
The surface covers core design automation: creating nodes, setting properties, inspecting documents/layers, selecting, exporting, screenshots, file open/save, undo/redo, and low-level input. Deletion, closing files, and other lifecycle operations are not explicit, though run_command and batch can likely reach them, leaving minor gaps.
Maintenance
Related MCP Connectors
Drive real devices from your AI Coding tool. Embed a client SDK (Unity, Godot, Flutter, iOS/macOS, Android, React Native, Web) in your app, then capture screenshots, traverse the UI tree, inject taps and key events, and run automated test tasks on the physical device over a secure relay.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Browz hosted MCP (free public beta): let an AI app drive your own Browz browser profiles from anywhere. Connect https://mcp.gobrowz.com/mcp and sign in with your Browz account (OAuth) or an agent token. Each call is relayed to the Browz app on your computer, which must be online with Remote control on and have a hardware security chip (Mac Secure Enclave or TPM 2.0). 17 tools: profiles, tabs, navigate, snapshot, act, wait, screenshot. Cookies, downloads and stored sign-ins stay on your computer.
Official Fibery MCP server: query and update your workspace from any AI client via OAuth.
Related MCP Servers
- AlicenseBqualityCmaintenanceLocal MCP server connecting AI clients to the Figma desktop app for inspecting and editing Figma documents via the Plugin API.1616 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP-compatible AI clients to read and modify the user's currently open Figma file by executing JavaScript in Figma's sandbox, all through a local bridge with status monitoring, node jumping, and automatic rollback on errors.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to read and modify the currently open Figma design file through a paired local Figma plugin, supporting operations like creating nodes, editing properties, and exporting PNG/SVG.94 npm2MIT
- AlicenseNot gradedqualityBmaintenanceConnects an MCP client such as Claude Code to the Figma file open in the desktop app, letting the agent create frames, write text, apply styles, import images and SVGs, take screenshots, and run arbitrary Figma Plugin API code. Commands travel through a local development plugin instead of Figma's web API, so there are no tokens, quotas, or rate limits.40 npm3MIT