figrelay 0.0.0-stage → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +279 -2
- package/bin/darwin-amd64/figma-mcp +0 -0
- package/bin/darwin-arm64/figma-mcp +0 -0
- package/bin/linux-amd64/figma-mcp +0 -0
- package/bin/linux-arm64/figma-mcp +0 -0
- package/bin/plugin/code.js +1356 -0
- package/bin/plugin/manifest.json +14 -0
- package/bin/plugin/ui.html +559 -0
- package/bin/windows-amd64/figma-mcp.exe +0 -0
- package/bin/windows-arm64/figma-mcp.exe +0 -0
- package/package.json +34 -4
- package/run.js +60 -0
package/README.md
CHANGED
|
@@ -1,3 +1,280 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Figma Relay
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/figrelay)
|
|
4
|
+
[](https://modelcontextprotocol.io/)
|
|
5
|
+
[](https://github.com/quannh287/figma-relay/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
> **Let your AI assistant design in Figma — no API token, no rate limits.**
|
|
8
|
+
> Works with Claude CLI · Claude Desktop · Codex · VS Code · Cursor · Antigravity · any MCP client.
|
|
9
|
+
|
|
10
|
+
> **Fork of [figma-mcp-console](https://github.com/hoangann2000/figma-mcp-console)** by [@hoangann2000](https://github.com/hoangann2000), forked at v0.5.4. Same setup, published on npm as [`figrelay`](https://www.npmjs.com/package/figrelay); the plugin now shows as **Figma Relay**.
|
|
11
|
+
|
|
12
|
+
## 🆕 What's new since the fork
|
|
13
|
+
|
|
14
|
+
- **Prototype tools** — `set_prototype_links`, `get_prototype_links` and `set_flow_starting_point` wire and check prototype flows.
|
|
15
|
+
- **Safer `run_script`** — resending the same `token` returns the original run instead of running the script twice; timeout and disconnect errors say the script may still be writing.
|
|
16
|
+
- **Batch edits, variants, text restyling, page targeting** — fewer calls for common edits, plus a scripting escape hatch.
|
|
17
|
+
- **Many sessions, one plugin** — a timeout reports how many commands are queued, screenshots get 150s, and a busy plugin is no longer dropped as dead.
|
|
18
|
+
- **Smaller tool list** — `create_frame`/`create_rectangle`/`create_ellipse` merged into `create_shape`; hide whole groups with `FIGMA_MCP_DISABLE`.
|
|
19
|
+
- **Server version in the plugin panel**, so a stale binary is easy to spot.
|
|
20
|
+
|
|
21
|
+
**Coming from `figma-mcp-console`?** Swap the package name to `figrelay@latest`, re-import the plugin from this release, and replace calls to `create_frame`/`create_rectangle`/`create_ellipse` with `create_shape`.
|
|
22
|
+
|
|
23
|
+
## ✨ What can it do?
|
|
24
|
+
|
|
25
|
+
- 🖥️ **Figma → Code** — paste a link to a Figma frame, and the AI implements that exact screen in your codebase, exporting the design's icons and images into your project instead of inventing its own
|
|
26
|
+
- 🎨 **Requirement → Figma** — paste a requirement, and the AI draws the screen in Figma, then screenshots its own work and fixes what's off
|
|
27
|
+
- 🔁 **Token sync** — pull design tokens into your theme config, or build a design system in Figma from your code
|
|
28
|
+
- ✏️ **Bulk editing** — rename layers, replace text across a page, reorganize frames
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## ⚡ Quick start
|
|
33
|
+
|
|
34
|
+
**Prerequisites**
|
|
35
|
+
|
|
36
|
+
- [ ] [Node.js](https://nodejs.org) 18+ — check with `node --version`
|
|
37
|
+
- [ ] **Figma Desktop** app (the web app can't run development plugins)
|
|
38
|
+
|
|
39
|
+
### Step 1 — Add the server to your AI tool
|
|
40
|
+
|
|
41
|
+
No install needed — `npx` downloads and runs everything automatically.
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary><b>Claude CLI</b></summary>
|
|
45
|
+
|
|
46
|
+
For one project — run inside that project (registers it there only):
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
claude mcp add figma-console -- npx -y figrelay@latest
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For all your projects at once — add it globally instead:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
claude mcp add --scope user figma-console -- npx -y figrelay@latest
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Both work the same at runtime: each Claude session starts its own server instance in that project's directory (so exported assets land in the right project), and all instances share one local bridge to Figma automatically.
|
|
59
|
+
|
|
60
|
+
Or add to the project's `.mcp.json`:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"figma-console": {
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "figrelay@latest"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
</details>
|
|
74
|
+
|
|
75
|
+
<details>
|
|
76
|
+
<summary><b>Claude Desktop</b></summary>
|
|
77
|
+
|
|
78
|
+
**Settings → Developer → Edit Config** (`claude_desktop_config.json`):
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"figma-console": {
|
|
84
|
+
"command": "npx",
|
|
85
|
+
"args": ["-y", "figrelay@latest"]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Restart Claude Desktop. On Windows use `"command": "cmd"`, `"args": ["/c", "npx", "-y", "figrelay@latest"]`.
|
|
92
|
+
|
|
93
|
+
</details>
|
|
94
|
+
|
|
95
|
+
<details>
|
|
96
|
+
<summary><b>Codex CLI</b></summary>
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
codex mcp add figma-console -- npx -y figrelay@latest
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or in `~/.codex/config.toml`:
|
|
103
|
+
|
|
104
|
+
```toml
|
|
105
|
+
[mcp_servers.figma-console]
|
|
106
|
+
command = "npx"
|
|
107
|
+
args = ["-y", "figrelay@latest"]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
</details>
|
|
111
|
+
|
|
112
|
+
<details>
|
|
113
|
+
<summary><b>VS Code (GitHub Copilot)</b></summary>
|
|
114
|
+
|
|
115
|
+
Create `.vscode/mcp.json` (or **Command Palette → "MCP: Add Server"**):
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"servers": {
|
|
120
|
+
"figma-console": {
|
|
121
|
+
"type": "stdio",
|
|
122
|
+
"command": "npx",
|
|
123
|
+
"args": ["-y", "figrelay@latest"],
|
|
124
|
+
"cwd": "${workspaceFolder}"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Use it from Copilot Chat in **Agent** mode.
|
|
131
|
+
|
|
132
|
+
</details>
|
|
133
|
+
|
|
134
|
+
<details>
|
|
135
|
+
<summary><b>Cursor</b></summary>
|
|
136
|
+
|
|
137
|
+
Create `.cursor/mcp.json` (or **Settings → MCP → Add new MCP server**):
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"mcpServers": {
|
|
142
|
+
"figma-console": {
|
|
143
|
+
"command": "npx",
|
|
144
|
+
"args": ["-y", "figrelay@latest"]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
<details>
|
|
153
|
+
<summary><b>Antigravity</b></summary>
|
|
154
|
+
|
|
155
|
+
Agent panel → **MCP Servers → Manage MCP servers → View raw config** (`mcp_config.json`):
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"mcpServers": {
|
|
160
|
+
"figma-console": {
|
|
161
|
+
"command": "npx",
|
|
162
|
+
"args": ["-y", "figrelay@latest"]
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Click **Refresh** after saving.
|
|
169
|
+
|
|
170
|
+
</details>
|
|
171
|
+
|
|
172
|
+
<details>
|
|
173
|
+
<summary><b>Other MCP clients (opencode, Windsurf, Cline, Gemini CLI, Zed, …)</b></summary>
|
|
174
|
+
|
|
175
|
+
Standard MCP stdio transport — any client works. Set the command to `npx` with args `["-y", "figrelay@latest"]`.
|
|
176
|
+
|
|
177
|
+
</details>
|
|
178
|
+
|
|
179
|
+
### Step 2 — Install the Figma plugin
|
|
180
|
+
|
|
181
|
+
First, get the plugin folder onto your machine — **pick either option:**
|
|
182
|
+
|
|
183
|
+
**📦 Option A — Download from GitHub (recommended)**
|
|
184
|
+
|
|
185
|
+
> 1. Download **[plugin.zip](https://github.com/quannh287/figma-relay/releases/latest)** → **unzip it**
|
|
186
|
+
|
|
187
|
+
**⌨️ Option B — Get it via command** *(if the download doesn't work)*
|
|
188
|
+
|
|
189
|
+
> 1. Run **`npx figrelay install-plugin`**
|
|
190
|
+
> 2. It saves the plugin to a folder and **opens it automatically** so you can see `manifest.json`
|
|
191
|
+
|
|
192
|
+
Then, in both cases:
|
|
193
|
+
|
|
194
|
+
2. In **Figma Desktop**: **Plugins → Development → Import plugin from manifest…** → select `manifest.json` *(one-time step)*
|
|
195
|
+
3. Run it: **Plugins → Development → Figma Relay** — and **keep the plugin window open** while you work. 🟢 Green dot = connected
|
|
196
|
+
4. Working with several Figma files at once? Run the plugin in **each** file — every window connects to the same local bridge, and the AI picks the right file per call
|
|
197
|
+
|
|
198
|
+
### Step 3 — Try it
|
|
199
|
+
|
|
200
|
+
**Figma → code** — right-click a frame → **Copy link to selection**, then:
|
|
201
|
+
|
|
202
|
+
```text
|
|
203
|
+
Implement this Figma page in our project: <paste link>. Match layout, spacing,
|
|
204
|
+
type and colors; export its icons/images into the project; screenshot the frame
|
|
205
|
+
and compare when done.
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Requirement → Figma:**
|
|
209
|
+
|
|
210
|
+
```text
|
|
211
|
+
Design a SaaS landing page in Figma (desktop, 1440px): hero + CTA, three feature
|
|
212
|
+
cards, pricing with three plans, footer. Light theme, use auto-layout, then
|
|
213
|
+
screenshot and fix anything off.
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
> 🎯 Asking the AI to **screenshot and compare** at the end makes it check its own work instead of guessing.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 🗂 Multiple files, multiple projects
|
|
221
|
+
|
|
222
|
+
All AI sessions and all Figma files share **one local bridge** on port 2000 — the first MCP server to start owns it, later ones join it automatically, and if the owner exits another session takes over within a second. Nothing to configure.
|
|
223
|
+
|
|
224
|
+
- **Several Figma files**: run the plugin in each file (its window shows *Connected · \<file name\>*). With more than one file connected, every tool accepts a `file` parameter (file name, case-insensitive), and `list_files` shows what's connected — so you can say things like *"copy the primary color from **Design System** into the CTA button in **Landing Page**"* in a single session. With one file connected, nothing changes.
|
|
225
|
+
- **Several code projects**: each AI session (one per project) reaches every connected file through the shared bridge. State which file you mean in the prompt and each session works with the right one.
|
|
226
|
+
|
|
227
|
+
## ✂️ Hide tools you don't use
|
|
228
|
+
|
|
229
|
+
Every listed tool takes up room in the AI's context, even in sessions that never touch Figma. Hide whole groups with `FIGMA_MCP_DISABLE` (or `-disable`): `components`, `styles`, `variables`, `prototype`. Hiding all four cuts the tool list by about a third.
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
"figma-console": {
|
|
233
|
+
"command": "npx",
|
|
234
|
+
"args": ["-y", "figrelay@latest"],
|
|
235
|
+
"env": { "FIGMA_MCP_DISABLE": "variables,prototype" }
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## 🧠 Teach your AI what to export, and where
|
|
240
|
+
|
|
241
|
+
Exports follow the file extension the AI picks (`.svg` for vector, `.png`/`.jpg` for bitmap, with an optional 0.5–4x scale). It decides based on what you ask — so put your preferences in the project rules file once, and stop repeating yourself:
|
|
242
|
+
|
|
243
|
+
| AI tool | Rules file |
|
|
244
|
+
|---|---|
|
|
245
|
+
| Claude CLI / Claude Desktop | `CLAUDE.md` |
|
|
246
|
+
| Codex / opencode | `AGENTS.md` |
|
|
247
|
+
| Cursor | `.cursorrules` |
|
|
248
|
+
| VS Code Copilot | `.github/copilot-instructions.md` |
|
|
249
|
+
| Windsurf | `.windsurfrules` |
|
|
250
|
+
|
|
251
|
+
> **📋 Copy-paste rules** (adjust paths — this fits Next.js):
|
|
252
|
+
|
|
253
|
+
```markdown
|
|
254
|
+
## Figma asset rules
|
|
255
|
+
- Icons: SVG into public/icons/. Images: PNG into public/images/.
|
|
256
|
+
- File names: kebab-case English (arrow-left.svg, hero-banner.png).
|
|
257
|
+
- Read design tokens with get_variable_defs; map them to our theme config.
|
|
258
|
+
- After building a screen, screenshot and fix issues before finishing.
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## 🔧 Troubleshooting
|
|
262
|
+
|
|
263
|
+
| Problem | Fix |
|
|
264
|
+
|---|---|
|
|
265
|
+
| ❌ "no Figma plugin is connected" | Open the plugin in Figma Desktop (**Plugins → Development → Figma Relay**) and keep its window open — in every file you want the AI to touch |
|
|
266
|
+
| 🕐 Plugin says "Searching for MCP server…" | Normal before your AI client connects — the server starts automatically with it. If it never connects, click the status line to retry, or restart your AI client |
|
|
267
|
+
| 🗂 "N Figma files are connected; pass the file parameter" | More than one plugin window is open — tell the AI which file you mean (or close the extra plugin windows) |
|
|
268
|
+
| 🚫 The MCP server doesn't appear in your AI tool | Check Node.js 18+ is installed (`node -v`) |
|
|
269
|
+
| 📁 Exported files end up in the wrong folder | Exports are written relative to where the server runs. Register it in the project-level config, or tell the AI an explicit export path |
|
|
270
|
+
| 🔤 Font errors when creating text | The Figma file uses a font not installed on your machine — the error message names it |
|
|
271
|
+
|
|
272
|
+
## 🛠 Contributing
|
|
273
|
+
|
|
274
|
+
Setup, how to add a tool, and the gotchas that cost time: **[CONTRIBUTING.md](CONTRIBUTING.md)**. Why the non-obvious parts work the way they do: **[docs/design-notes.md](docs/design-notes.md)**.
|
|
275
|
+
|
|
276
|
+
## 📄 License
|
|
277
|
+
|
|
278
|
+
[MIT](https://github.com/quannh287/figma-relay/blob/main/LICENSE) — © [Hoang Le Thien An](https://github.com/hoangann2000) (original project), fork maintained by [@quannh287](https://github.com/quannh287)
|
|
279
|
+
|
|
280
|
+
> This is an independent community project, not affiliated with or endorsed by Figma, Inc. "Figma" is a trademark of Figma, Inc.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|