figma-mcp-console 0.4.0 → 0.5.0

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 CHANGED
@@ -14,8 +14,6 @@
14
14
  - 🔁 **Token sync** — pull design tokens into your theme config, or build a design system in Figma from your code
15
15
  - ✏️ **Bulk editing** — rename layers, replace text across a page, reorganize frames
16
16
 
17
- > 💡 **Why no token?** Most Figma MCP servers call the REST API — access token required, and free plans get only a handful of calls. This one drives a plugin **inside Figma Desktop** instead: the same unlimited API every Figma plugin uses. Everything stays on your machine.
18
-
19
17
  ---
20
18
 
21
19
  ## ⚡ Quick start
@@ -165,12 +163,22 @@ Standard MCP stdio transport — any client works. Set the command to `npx` with
165
163
 
166
164
  </details>
167
165
 
168
- > 💡 **Tip:** exported assets are written relative to the directory the server runs in. CLI tools (Claude CLI, Codex, Cursor, …) start it in your project directory, so global registration is fine. In clients without a working directory (e.g. Claude Desktop), pass explicit export paths or prefer a project-level config where available.
169
-
170
166
  ### Step 2 — Install the Figma plugin
171
167
 
172
- 1. Run **`npx figma-mcp-console install-plugin`** — it writes the plugin files locally and prints the path to `manifest.json`
173
- 2. In **Figma Desktop**: **Plugins → Development → Import plugin from manifest…** → select that `manifest.json` *(one-time step)*
168
+ First, get the plugin folder onto your machine — **pick either option:**
169
+
170
+ **📦 Option A — Download from GitHub (recommended)**
171
+
172
+ > 1. Download **[plugin.zip](https://github.com/hoangann2000/figma-mcp-console/releases/latest)** → **unzip it**
173
+
174
+ **⌨️ Option B — Get it via command** *(if the download doesn't work)*
175
+
176
+ > 1. Run **`npx figma-mcp-console install-plugin`**
177
+ > 2. It saves the plugin to a folder and **opens it automatically** so you can see `manifest.json`
178
+
179
+ Then, in both cases:
180
+
181
+ 2. In **Figma Desktop**: **Plugins → Development → Import plugin from manifest…** → select `manifest.json` *(one-time step)*
174
182
  3. Run it: **Plugins → Development → Figma MCP Console** — and **keep the plugin window open** while you work. 🟢 Green dot = connected
175
183
  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
176
184
 
@@ -233,7 +241,7 @@ Exports follow the file extension the AI picks (`.svg` for vector, `.png`/`.jpg`
233
241
  | 🕐 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 |
234
242
  | 🗂 "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) |
235
243
  | 🚫 The MCP server doesn't appear in your AI tool | Check Node.js 18+ is installed (`node -v`) |
236
- | 📁 Exported files end up in the wrong folder | Register the server in the project-level config, not the global one (see the tip in Step 1) |
244
+ | 📁 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 |
237
245
  | 🔤 Font errors when creating text | The Figma file uses a font not installed on your machine — the error message names it |
238
246
 
239
247
  ## 📄 License
Binary file
Binary file
Binary file
Binary file
@@ -97,10 +97,12 @@
97
97
  // background tabs throttle timers, so a visibility change and a click on
98
98
  // the status line also trigger an immediate attempt.
99
99
  const PORT = 2000,
100
- RETRY = 1000;
100
+ RETRY = 1000,
101
+ PROTOCOL = 1; // must match bridge.ProtocolVersion in the Go server
101
102
  let ws = null; // open connection, null while disconnected
102
103
  let attempt = null; // socket currently trying to connect
103
104
  let reg = null; // {key, name} of this file, sent by the main thread
105
+ let protoWarning = null; // set when the server reports a newer protocol
104
106
 
105
107
  function setStatus(connected, text) {
106
108
  document.getElementById("dot").className = connected ? "on" : "";
@@ -108,6 +110,7 @@
108
110
  }
109
111
 
110
112
  function label() {
113
+ if (protoWarning) return protoWarning;
111
114
  return reg ? "Connected · " + reg.name : "Connected (port " + PORT + ")";
112
115
  }
113
116
 
@@ -136,6 +139,10 @@
136
139
  sock.onmessage = (e) => {
137
140
  const msg = JSON.parse(e.data);
138
141
  if (msg.hello) {
142
+ protoWarning =
143
+ msg.hello.protocol && msg.hello.protocol !== PROTOCOL
144
+ ? "⚠ Plugin outdated — re-import from the latest release"
145
+ : null;
139
146
  setStatus(true, label());
140
147
  return;
141
148
  }
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figma-mcp-console",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "scripts": {
5
5
  "prepublishOnly": "cp ../README.md ./README.md"
6
6
  },
package/run.js CHANGED
@@ -24,20 +24,30 @@ const binPath = path.join(
24
24
  `figma-mcp${exe}`,
25
25
  );
26
26
 
27
- // Lệnh con: install-plugin
27
+ // Lệnh con: install-plugin — trích plugin ra thư mục HIỆN RÕ (không có dấu chấm)
28
+ // và tự mở folder đó lên để user thấy ngay manifest.json.
28
29
  if (process.argv[2] === "install-plugin") {
29
30
  const srcDir = path.join(__dirname, "bin", "plugin");
30
- const destDir = path.join(os.homedir(), ".figma-mcp-console", "plugin");
31
+ const destDir = path.join(os.homedir(), "figma-mcp-console-plugin");
31
32
  fs.mkdirSync(destDir, { recursive: true });
32
33
  for (const f of ["code.js", "ui.html", "manifest.json"])
33
34
  fs.copyFileSync(path.join(srcDir, f), path.join(destDir, f));
35
+
34
36
  process.stdout.write(
35
- "Plugin đã cài. Trong Figma Desktop:\n" +
36
- " Plugins → Development → Import plugin from manifest…\n" +
37
- " Chọn file:\n " +
37
+ "\n✅ Figma plugin ready.\n\n" +
38
+ "In Figma Desktop → Plugins → Development → Import plugin from manifest…\n" +
39
+ "and select this file:\n\n" +
40
+ " " +
38
41
  path.join(destDir, "manifest.json") +
39
- "\n",
42
+ "\n\n",
40
43
  );
44
+
45
+ // Tự mở folder trong trình quản lý file (best-effort; lỗi thì bỏ qua).
46
+ const opener =
47
+ plat === "darwin" ? "open" : plat === "windows" ? "explorer" : "xdg-open";
48
+ try {
49
+ spawnSync(opener, [destDir], { stdio: "ignore", detached: true });
50
+ } catch (_) {}
41
51
  process.exit(0);
42
52
  }
43
53