figma-mcp-console 0.7.0 β†’ 0.8.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
@@ -11,8 +11,12 @@
11
11
 
12
12
  - πŸ–₯️ **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
13
13
  - 🎨 **Requirement β†’ Figma** β€” paste a requirement, and the AI draws the screen in Figma, then screenshots its own work and fixes what's off
14
- - πŸ” **Token sync** β€” pull design tokens into your theme config, or build a design system in Figma from your code
15
- - ✏️ **Bulk editing** β€” rename layers, replace text across a page, reorganize frames
14
+ - πŸ” **Token sync** β€” export Figma variables to CSS or design-tokens JSON (`export_tokens`), and import them back from your code (`import_tokens`), updating what changed instead of duplicating
15
+ - βœ… **Design checks** β€” `audit_design` lists layers that are cut off or overflow, text that spills or is truncated, text below WCAG contrast, and tap targets that are too small
16
+ - πŸ” **What changed in the design** β€” `diff_design` compares a frame with a checkpoint you save from the plugin window; `get_component_states` lists every state a screen's components define
17
+ - ✏️ **Bulk editing** β€” rename layers, replace text across a page, reorganize frames; `batch` runs many steps in one call
18
+ - 🎯 **Icons** β€” import SVG icons as editable vectors, resized and recolored, from your file's own components or an icon library
19
+ - πŸ”’ **Read-only by default** β€” the AI can read a file but not change it until you untick **Read-only** in the plugin window
16
20
 
17
21
  ---
18
22
 
@@ -180,7 +184,8 @@ Then, in both cases:
180
184
 
181
185
  2. In **Figma Desktop**: **Plugins β†’ Development β†’ Import plugin from manifest…** β†’ select `manifest.json` *(one-time step)*
182
186
  3. Run it: **Plugins β†’ Development β†’ Figma MCP Console** β€” and **keep the plugin window open** while you work. 🟒 Green dot = connected
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
187
+ 4. **Untick Read-only** in the plugin window when you want the AI to change the design. It is ticked every time the plugin opens, so a file you only want read stays safe; reading, screenshots, exports and checks work either way
188
+ 5. 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
184
189
 
185
190
  ### Step 3 β€” Try it
186
191
 
@@ -200,7 +205,11 @@ cards, pricing with three plans, footer. Light theme, use auto-layout, then
200
205
  screenshot and fix anything off.
201
206
  ```
202
207
 
203
- > 🎯 Asking the AI to **screenshot and compare** at the end makes it check its own work instead of guessing.
208
+ > 🎯 Asking the AI to **run `audit_design`, then screenshot and compare** at the end makes it check its own work instead of guessing.
209
+
210
+ ### Updating
211
+
212
+ When you update the server (`figma-mcp-console@<version>`), **re-import the plugin** from that release's `plugin.zip`: a hand-installed plugin cannot update itself. The plugin window says *Plugin outdated* or *Server outdated* when the two do not match. Release notes: [CHANGELOG.md](CHANGELOG.md).
204
213
 
205
214
  ---
206
215
 
@@ -243,6 +252,10 @@ Exports follow the file extension the AI picks (`.svg` for vector, `.png`/`.jpg`
243
252
  | 🚫 The MCP server doesn't appear in your AI tool | Check Node.js 18+ is installed (`node -v`) |
244
253
  | πŸ“ 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 |
245
254
  | πŸ”€ Font errors when creating text | The Figma file uses a font not installed on your machine β€” the error message names it |
255
+ | πŸ”’ "… was blocked: read-only mode is on" | **Read-only** is ticked in that file's plugin window (it is, every time the plugin opens). Untick it if the edit is intended |
256
+ | ⚠ "Plugin outdated" / "the plugin … is outdated" | Re-import the plugin from the latest release's `plugin.zip` and run it again |
257
+ | ⚠ "Server outdated" | Restart your AI client, or update the version in its MCP config |
258
+ | πŸ‘ The plugin will not run in a file | Figma runs plugins only for people who can edit the file. Duplicate it to your drafts, or copy the frames into a file you can edit |
246
259
 
247
260
  ## πŸ›  Contributing
248
261
 
Binary file
Binary file
Binary file
Binary file
@@ -593,6 +593,18 @@ async function importSvg(params) {
593
593
  return summarize(n);
594
594
  }
595
595
 
596
+ // Figma's own wording for "could not load that data" blames the network,
597
+ // which sends people checking their connection. It shows up when a page that
598
+ // was never opened in this session is loaded, and for some ids that do not exist.
599
+ function explainError(message) {
600
+ if (/Unable to establish connection to Figma/i.test(message)) {
601
+ return message + " β€” Figma could not load the data for this request; the network is usually fine. " +
602
+ "If it reads another page, open that page once in Figma (or reopen the file) and retry; " +
603
+ "if it names a node id, check the id with find_nodes.";
604
+ }
605
+ return message;
606
+ }
607
+
596
608
  // ---------- command handlers (names match MCP tool names) ----------
597
609
 
598
610
  const handlers = {
@@ -615,6 +627,36 @@ const handlers = {
615
627
  };
616
628
  },
617
629
 
630
+ async create_page(params) {
631
+ if (!params.name) throw new Error("name is required");
632
+ const p = figma.createPage();
633
+ p.name = params.name;
634
+ if (params.index !== undefined && params.index !== null) figma.root.insertChild(params.index, p);
635
+ return { id: p.id, name: p.name, index: figma.root.children.indexOf(p) };
636
+ },
637
+
638
+ async rename_page(params) {
639
+ if (!params.name) throw new Error("name is required");
640
+ const p = await resolvePage(params.page);
641
+ const from = p.name;
642
+ p.name = params.name;
643
+ return { id: p.id, from, name: p.name };
644
+ },
645
+
646
+ // Figma cannot remove the open page or the last one: open a neighbour first.
647
+ async remove_page(params) {
648
+ const p = await resolvePage(params.page);
649
+ const pages = figma.root.children;
650
+ if (pages.length === 1) throw new Error("page " + p.name + " is the file's only page and cannot be removed");
651
+ if (p.id === figma.currentPage.id) {
652
+ const i = pages.indexOf(p);
653
+ await figma.setCurrentPageAsync(pages[i === 0 ? 1 : i - 1]);
654
+ }
655
+ const out = { removed: { id: p.id, name: p.name, layers: p.children.length }, currentPage: figma.currentPage.name };
656
+ p.remove();
657
+ return out;
658
+ },
659
+
618
660
  async set_current_page(params) {
619
661
  const p = await resolvePage(params.page);
620
662
  await figma.setCurrentPageAsync(p);
@@ -1752,7 +1794,7 @@ figma.ui.onmessage = async (msg) => {
1752
1794
  const result = await h(p);
1753
1795
  figma.ui.postMessage({ id: msg.id, result: result === undefined ? null : result });
1754
1796
  } catch (e) {
1755
- act.error = String((e && e.message) || e);
1797
+ act.error = explainError(String((e && e.message) || e));
1756
1798
  figma.ui.postMessage({ id: msg.id, error: act.error });
1757
1799
  }
1758
1800
  figma.ui.postMessage({ activity: act });
@@ -289,7 +289,7 @@
289
289
  // the status line also trigger an immediate attempt.
290
290
  const PORT = 2000,
291
291
  RETRY = 1000,
292
- PROTOCOL = 4; // must match bridge.ProtocolVersion in the Go server
292
+ PROTOCOL = 5; // must match bridge.ProtocolVersion in the Go server
293
293
  let ws = null; // open connection, null while disconnected
294
294
  let attempt = null; // socket currently trying to connect
295
295
  let reg = null; // {key, name} of this file, sent by the main thread
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figma-mcp-console",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "scripts": {
5
5
  "prepublishOnly": "test -d bin/plugin && cd .. && go vet ./... && go test ./... && node --check plugin/code.js && cp README.md npm/README.md"
6
6
  },