@mp3wizard/figma-console-mcp 1.15.4 β 1.19.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 +74 -17
- package/dist/cloudflare/index.js +3 -3
- package/dist/core/annotation-tools.d.ts +14 -0
- package/dist/core/annotation-tools.d.ts.map +1 -0
- package/dist/core/annotation-tools.js +231 -0
- package/dist/core/annotation-tools.js.map +1 -0
- package/dist/core/deep-component-tools.d.ts +14 -0
- package/dist/core/deep-component-tools.d.ts.map +1 -0
- package/dist/core/deep-component-tools.js +129 -0
- package/dist/core/deep-component-tools.js.map +1 -0
- package/dist/core/design-code-tools.d.ts.map +1 -1
- package/dist/core/design-code-tools.js +65 -7
- package/dist/core/design-code-tools.js.map +1 -1
- package/dist/core/enrichment/enrichment-service.d.ts.map +1 -1
- package/dist/core/enrichment/enrichment-service.js +108 -12
- package/dist/core/enrichment/enrichment-service.js.map +1 -1
- package/dist/core/figjam-tools.d.ts +8 -0
- package/dist/core/figjam-tools.d.ts.map +1 -0
- package/dist/core/figjam-tools.js +486 -0
- package/dist/core/figjam-tools.js.map +1 -0
- package/dist/core/figma-api.d.ts +1 -1
- package/dist/core/figma-api.d.ts.map +1 -1
- package/dist/core/figma-api.js +2 -2
- package/dist/core/figma-api.js.map +1 -1
- package/dist/core/figma-connector.d.ts +102 -0
- package/dist/core/figma-connector.d.ts.map +1 -1
- package/dist/core/figma-desktop-connector.d.ts +43 -0
- package/dist/core/figma-desktop-connector.d.ts.map +1 -1
- package/dist/core/figma-desktop-connector.js +108 -0
- package/dist/core/figma-desktop-connector.js.map +1 -1
- package/dist/core/figma-tools.d.ts.map +1 -1
- package/dist/core/figma-tools.js +434 -49
- package/dist/core/figma-tools.js.map +1 -1
- package/dist/core/port-discovery.d.ts +21 -0
- package/dist/core/port-discovery.d.ts.map +1 -1
- package/dist/core/port-discovery.js +88 -0
- package/dist/core/port-discovery.js.map +1 -1
- package/dist/core/slides-tools.d.ts +8 -0
- package/dist/core/slides-tools.d.ts.map +1 -0
- package/dist/core/slides-tools.js +608 -0
- package/dist/core/slides-tools.js.map +1 -0
- package/dist/core/types/design-code.d.ts +1 -0
- package/dist/core/types/design-code.d.ts.map +1 -1
- package/dist/core/websocket-connector.d.ts +102 -0
- package/dist/core/websocket-connector.d.ts.map +1 -1
- package/dist/core/websocket-connector.js +93 -0
- package/dist/core/websocket-connector.js.map +1 -1
- package/dist/core/websocket-server.d.ts +6 -0
- package/dist/core/websocket-server.d.ts.map +1 -1
- package/dist/core/websocket-server.js +11 -0
- package/dist/core/websocket-server.js.map +1 -1
- package/dist/local.d.ts.map +1 -1
- package/dist/local.js +79 -11
- package/dist/local.js.map +1 -1
- package/figma-desktop-bridge/code.js +1945 -44
- package/figma-desktop-bridge/icon.png +0 -0
- package/figma-desktop-bridge/manifest.json +1 -1
- package/figma-desktop-bridge/ui-full.html +80 -0
- package/figma-desktop-bridge/ui.html +226 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
# Figma Console MCP Server
|
|
2
2
|
|
|
3
3
|
[](https://modelcontextprotocol.io/)
|
|
4
|
-
[](https://www.npmjs.com/package/figma-console-mcp)
|
|
4
|
+
[](https://www.npmjs.com/package/@mp3wizard/figma-console-mcp)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](Security%20review%20report/)
|
|
6
7
|
[](https://docs.figma-console-mcp.southleft.com)
|
|
7
8
|
[](https://github.com/sponsors/southleft)
|
|
8
9
|
|
|
9
10
|
> **Your design system as an API.** Model Context Protocol server that bridges design and developmentβgiving AI assistants complete access to Figma for **extraction**, **creation**, and **debugging**.
|
|
10
11
|
|
|
11
|
-
>
|
|
12
|
+
> **π Security Reviewed Fork:** This fork (`@mp3wizard/figma-console-mcp`) has passed a full security review following OWASP Top 10 and CWE standards, including automated scanning (Semgrep, Trivy, TruffleHog) and manual vulnerability analysis. Review reports are available in the [`Security review report/`](Security%20review%20report/) folder.
|
|
13
|
+
|
|
14
|
+
> **π High-Fidelity Design-to-Code:** Deep component trees (depth 4), resolved design tokens, interaction state machines with CSS mappings, and codebase-aware component scanning. AI gets everything a senior engineer needs β tokens, sizing, states, annotations, and a cross-reference of what already exists in your codebase. [See what's new β](docs/figma-mcp-vs-figma-console-mcp.md)
|
|
12
15
|
|
|
13
16
|
## What is this?
|
|
14
17
|
|
|
@@ -20,6 +23,7 @@ Figma Console MCP connects AI assistants (like Claude) to Figma, enabling:
|
|
|
20
23
|
- **βοΈ Design creation** - Create UI components, frames, and layouts directly in Figma
|
|
21
24
|
- **π§ Variable management** - Create, update, rename, and delete design tokens
|
|
22
25
|
- **β‘ Real-time monitoring** - Watch logs as plugins execute
|
|
26
|
+
- **π FigJam boards** - Create stickies, flowcharts, tables, and code blocks on collaborative boards
|
|
23
27
|
- **βοΈ Cloud Write Relay** - Web AI clients (Claude.ai, v0, Replit) can design in Figma via cloud pairing
|
|
24
28
|
- **π Four ways to connect** - Remote SSE, Cloud Mode, NPX, or Local Git
|
|
25
29
|
|
|
@@ -46,12 +50,13 @@ Figma Console MCP connects AI assistants (like Claude) to Figma, enabling:
|
|
|
46
50
|
| **Create components & frames** | β
| β
| β |
|
|
47
51
|
| **Edit existing designs** | β
| β
| β |
|
|
48
52
|
| **Manage design tokens/variables** | β
| β
| β |
|
|
53
|
+
| **FigJam boards (stickies, flowcharts)** | β
| β
| β |
|
|
49
54
|
| Real-time monitoring (console, selection) | β
| β | β |
|
|
50
55
|
| Desktop Bridge plugin | β
| β
| β |
|
|
51
56
|
| Requires Node.js | Yes | **No** | No |
|
|
52
|
-
| **Total tools available** | **
|
|
57
|
+
| **Total tools available** | **89+** | **43** | **22** |
|
|
53
58
|
|
|
54
|
-
> **Bottom line:** Remote SSE is **read-only** with ~38% of the tools. **Cloud Mode** unlocks write access from web AI clients without Node.js. NPX/Local Git gives the full
|
|
59
|
+
> **Bottom line:** Remote SSE is **read-only** with ~38% of the tools. **Cloud Mode** unlocks write access from web AI clients without Node.js. NPX/Local Git gives the full 89+ tools with real-time monitoring.
|
|
55
60
|
|
|
56
61
|
---
|
|
57
62
|
|
|
@@ -59,7 +64,7 @@ Figma Console MCP connects AI assistants (like Claude) to Figma, enabling:
|
|
|
59
64
|
|
|
60
65
|
**Best for:** Designers who want full AI-assisted design capabilities.
|
|
61
66
|
|
|
62
|
-
**What you get:** All
|
|
67
|
+
**What you get:** All 89+ tools including design creation, variable management, and component instantiation.
|
|
63
68
|
|
|
64
69
|
#### Prerequisites
|
|
65
70
|
|
|
@@ -72,13 +77,14 @@ Figma Console MCP connects AI assistants (like Claude) to Figma, enabling:
|
|
|
72
77
|
1. Go to [Manage personal access tokens](https://help.figma.com/hc/en-us/articles/8085703771159-Manage-personal-access-tokens) in Figma Help
|
|
73
78
|
2. Follow the steps to **create a new personal access token**
|
|
74
79
|
3. Enter description: `Figma Console MCP`
|
|
75
|
-
4.
|
|
80
|
+
4. Set scopes: **File content** (Read), **Variables** (Read), **Comments** (Read and write)
|
|
81
|
+
5. **Copy the token** β you won't see it again! (starts with `figd_`)
|
|
76
82
|
|
|
77
83
|
#### Step 2: Configure Your MCP Client
|
|
78
84
|
|
|
79
85
|
**Claude Code (CLI):**
|
|
80
86
|
```bash
|
|
81
|
-
claude mcp add figma-console -s user -e FIGMA_ACCESS_TOKEN=figd_YOUR_TOKEN_HERE -e ENABLE_MCP_APPS=true -- npx -y figma-console-mcp@latest
|
|
87
|
+
claude mcp add figma-console -s user -e FIGMA_ACCESS_TOKEN=figd_YOUR_TOKEN_HERE -e ENABLE_MCP_APPS=true -- npx -y @mp3wizard/figma-console-mcp@latest
|
|
82
88
|
```
|
|
83
89
|
|
|
84
90
|
**Cursor / Windsurf / Claude Desktop:**
|
|
@@ -90,7 +96,7 @@ Add to your MCP config file (see [Where to find your config file](#-where-to-fin
|
|
|
90
96
|
"mcpServers": {
|
|
91
97
|
"figma-console": {
|
|
92
98
|
"command": "npx",
|
|
93
|
-
"args": ["-y", "figma-console-mcp@latest"],
|
|
99
|
+
"args": ["-y", "@mp3wizard/figma-console-mcp@latest"],
|
|
94
100
|
"env": {
|
|
95
101
|
"FIGMA_ACCESS_TOKEN": "figd_YOUR_TOKEN_HERE",
|
|
96
102
|
"ENABLE_MCP_APPS": "true"
|
|
@@ -127,7 +133,7 @@ If you're not sure where to put the JSON configuration above, here's where each
|
|
|
127
133
|
|
|
128
134
|
> One-time setup. The plugin uses a bootloader that dynamically loads fresh code from the MCP server β no need to re-import when the server updates.
|
|
129
135
|
|
|
130
|
-
> **Upgrading from v1.14 or earlier?** Your existing plugin still works, but to get the bootloader benefits (no more re-importing), do one final re-import from `~/.figma-console-mcp/plugin/manifest.json`. The path is created automatically when the MCP server starts. Run `npx figma-console-mcp@latest --print-path` to see it. After this one-time upgrade, you're done forever.
|
|
136
|
+
> **Upgrading from v1.14 or earlier?** Your existing plugin still works, but to get the bootloader benefits (no more re-importing), do one final re-import from `~/.figma-console-mcp/plugin/manifest.json`. The path is created automatically when the MCP server starts. Run `npx @mp3wizard/figma-console-mcp@latest --print-path` to see it. After this one-time upgrade, you're done forever.
|
|
131
137
|
|
|
132
138
|
#### Step 4: Restart Your MCP Client
|
|
133
139
|
|
|
@@ -153,7 +159,7 @@ Create a simple frame with a blue background
|
|
|
153
159
|
|
|
154
160
|
**Best for:** Developers who want to modify source code or contribute to the project.
|
|
155
161
|
|
|
156
|
-
**What you get:** Same
|
|
162
|
+
**What you get:** Same 89+ tools as NPX, plus full source code access.
|
|
157
163
|
|
|
158
164
|
#### Quick Setup
|
|
159
165
|
|
|
@@ -242,7 +248,7 @@ Ready for design creation? Follow the [NPX Setup](#-npx-setup-recommended) guide
|
|
|
242
248
|
|
|
243
249
|
**Best for:** Using Claude.ai, v0, Replit, or Lovable to create and modify Figma designs β no Node.js required.
|
|
244
250
|
|
|
245
|
-
**What you get:**
|
|
251
|
+
**What you get:** 79 tools including full write access β design creation, variable management, component instantiation, and all REST API tools. Only real-time monitoring (console logs, selection tracking, document changes) requires Local Mode.
|
|
246
252
|
|
|
247
253
|
#### Prerequisites
|
|
248
254
|
|
|
@@ -299,10 +305,11 @@ AI Client β Cloud MCP Server β Durable Object Relay β Desktop Bridge Plugi
|
|
|
299
305
|
| Feature | NPX (Recommended) | Cloud Mode | Local Git | Remote SSE |
|
|
300
306
|
|---------|-------------------|------------|-----------|------------|
|
|
301
307
|
| **Setup time** | ~10 minutes | ~5 minutes | ~15 minutes | ~2 minutes |
|
|
302
|
-
| **Total tools** | **
|
|
308
|
+
| **Total tools** | **89+** | **43** | **89+** | **22** (read-only) |
|
|
303
309
|
| **Design creation** | β
| β
| β
| β |
|
|
304
310
|
| **Variable management** | β
| β
| β
| β |
|
|
305
311
|
| **Component instantiation** | β
| β
| β
| β |
|
|
312
|
+
| **FigJam boards** | β
| β
| β
| β |
|
|
306
313
|
| **Real-time monitoring** | β
| β | β
| β |
|
|
307
314
|
| **Desktop Bridge plugin** | β
| β
| β
| β |
|
|
308
315
|
| **Variables (no Enterprise)** | β
| β
| β
| β |
|
|
@@ -313,7 +320,7 @@ AI Client β Cloud MCP Server β Durable Object Relay β Desktop Bridge Plugi
|
|
|
313
320
|
| **Automatic updates** | β
(`@latest`) | β
| Manual (`git pull`) | β
|
|
|
314
321
|
| **Source code access** | β | β | β
| β |
|
|
315
322
|
|
|
316
|
-
> **Key insight:** Remote SSE is read-only. Cloud Mode adds write access for web AI clients without Node.js. NPX/Local Git give the full
|
|
323
|
+
> **Key insight:** Remote SSE is read-only. Cloud Mode adds write access for web AI clients without Node.js. NPX/Local Git give the full 89+ tools.
|
|
317
324
|
|
|
318
325
|
**π [Complete Feature Comparison](docs/mode-comparison.md)**
|
|
319
326
|
|
|
@@ -359,7 +366,7 @@ When you first use design system tools:
|
|
|
359
366
|
### Local Mode - Personal Access Token (Manual)
|
|
360
367
|
|
|
361
368
|
1. Visit https://help.figma.com/hc/en-us/articles/8085703771159-Manage-personal-access-tokens
|
|
362
|
-
2. Generate token
|
|
369
|
+
2. Generate token with scopes: **File content** (Read), **Variables** (Read), **Comments** (Read and write)
|
|
363
370
|
3. Add to MCP config as `FIGMA_ACCESS_TOKEN` environment variable
|
|
364
371
|
|
|
365
372
|
---
|
|
@@ -426,6 +433,34 @@ When you first use design system tools:
|
|
|
426
433
|
- `figma_batch_update_variables` - Update up to 100 variable values in one call
|
|
427
434
|
- `figma_setup_design_tokens` - Create complete token system (collection + modes + variables) atomically
|
|
428
435
|
|
|
436
|
+
### π FigJam Board Tools (Local Mode + Cloud Mode)
|
|
437
|
+
- `figjam_create_sticky` - Create a sticky note with color options
|
|
438
|
+
- `figjam_create_stickies` - Batch create up to 200 stickies
|
|
439
|
+
- `figjam_create_connector` - Connect nodes with labeled connector lines
|
|
440
|
+
- `figjam_create_shape_with_text` - Create flowchart shapes (diamond, ellipse, etc.)
|
|
441
|
+
- `figjam_create_table` - Create tables with cell data
|
|
442
|
+
- `figjam_create_code_block` - Add code snippets with syntax highlighting
|
|
443
|
+
- `figjam_auto_arrange` - Arrange nodes in grid, horizontal, or vertical layouts
|
|
444
|
+
- `figjam_get_board_contents` - Read all content from a FigJam board
|
|
445
|
+
- `figjam_get_connections` - Read the connection graph (flowcharts, relationships)
|
|
446
|
+
|
|
447
|
+
### ποΈ Slides Presentation Tools (Local Mode + Cloud Mode)
|
|
448
|
+
- `figma_list_slides` - List all slides with IDs, positions, and skip status
|
|
449
|
+
- `figma_get_slide_content` - Get the full content tree of a slide
|
|
450
|
+
- `figma_get_slide_grid` - Get the 2D grid layout of the presentation
|
|
451
|
+
- `figma_get_slide_transition` - Read transition settings for a slide
|
|
452
|
+
- `figma_get_focused_slide` - Get the currently focused slide
|
|
453
|
+
- `figma_create_slide` - Create a new blank slide
|
|
454
|
+
- `figma_delete_slide` - Delete a slide from the presentation
|
|
455
|
+
- `figma_duplicate_slide` - Clone an existing slide
|
|
456
|
+
- `figma_reorder_slides` - Reorder slides via new 2D grid layout
|
|
457
|
+
- `figma_set_slide_transition` - Set transition effects (22 styles, 8 curves)
|
|
458
|
+
- `figma_skip_slide` - Toggle whether a slide is skipped in presentation mode
|
|
459
|
+
- `figma_add_text_to_slide` - Add text to a specific slide
|
|
460
|
+
- `figma_add_shape_to_slide` - Add rectangle or ellipse shapes with color
|
|
461
|
+
- `figma_set_slides_view_mode` - Toggle grid vs. single-slide view
|
|
462
|
+
- `figma_focus_slide` - Navigate to a specific slide
|
|
463
|
+
|
|
429
464
|
**π [Detailed Tool Documentation](docs/TOOLS.md)**
|
|
430
465
|
|
|
431
466
|
---
|
|
@@ -479,6 +514,25 @@ Check design parity for the Card component before sign-off
|
|
|
479
514
|
Generate component documentation for the Dialog from our design system
|
|
480
515
|
```
|
|
481
516
|
|
|
517
|
+
### FigJam Boards
|
|
518
|
+
```
|
|
519
|
+
Create a retrospective board with "Went Well", "To Improve", and "Action Items" columns
|
|
520
|
+
Build a user flow diagram for the checkout process with decision points
|
|
521
|
+
Read this brainstorming board and summarize the key themes
|
|
522
|
+
Generate an affinity map from these meeting notes
|
|
523
|
+
Create a comparison table of our three platform options
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### Slides Presentations
|
|
527
|
+
```
|
|
528
|
+
List all slides and tell me which ones are skipped
|
|
529
|
+
Add a new slide with the title "Thank You" in 72px text
|
|
530
|
+
Set a DISSOLVE transition on the first slide with 0.5 second duration
|
|
531
|
+
Duplicate slide 5 for an A/B comparison
|
|
532
|
+
Skip slides 8 and 9 β they're not ready for the client presentation
|
|
533
|
+
Reorder my slides so the conclusion comes before Q&A
|
|
534
|
+
```
|
|
535
|
+
|
|
482
536
|
### Visual Debugging
|
|
483
537
|
```
|
|
484
538
|
Take a screenshot of the current Figma canvas
|
|
@@ -598,7 +652,7 @@ The **Figma Desktop Bridge** plugin is the recommended way to connect Figma to t
|
|
|
598
652
|
- The MCP server communicates via **WebSocket** through the Desktop Bridge plugin
|
|
599
653
|
- The server tries port 9223 first, then automatically falls back through ports 9224β9232 if needed
|
|
600
654
|
- The plugin scans all ports in the range and connects to every active server it finds
|
|
601
|
-
- All
|
|
655
|
+
- All 89+ tools work through the WebSocket transport
|
|
602
656
|
|
|
603
657
|
**Multiple files:** The WebSocket server supports multiple simultaneous plugin connections β one per open Figma file. Each connection is tracked by file key with independent state (selection, document changes, console logs).
|
|
604
658
|
|
|
@@ -716,11 +770,12 @@ The architecture supports adding new apps with minimal boilerplate β each app
|
|
|
716
770
|
|
|
717
771
|
## π€ vs. Figma Official MCP
|
|
718
772
|
|
|
719
|
-
**Figma Console MCP (This Project)** - Debugging
|
|
773
|
+
**Figma Console MCP (This Project)** - Debugging, data extraction, and design creation
|
|
720
774
|
- β
Real-time console logs from Figma plugins
|
|
721
775
|
- β
Screenshot capture and visual debugging
|
|
722
776
|
- β
Error stack traces and runtime monitoring
|
|
723
777
|
- β
Raw design data extraction (JSON)
|
|
778
|
+
- β
FigJam board creation and reading (stickies, flowcharts, tables)
|
|
724
779
|
- β
Works remotely or locally
|
|
725
780
|
|
|
726
781
|
**Figma Official Dev Mode MCP** - Code generation
|
|
@@ -734,9 +789,11 @@ The architecture supports adding new apps with minimal boilerplate β each app
|
|
|
734
789
|
|
|
735
790
|
## π€οΈ Roadmap
|
|
736
791
|
|
|
737
|
-
**Current Status:** v1.
|
|
792
|
+
**Current Status:** v1.17.0 (Stable) - Production-ready with FigJam + Slides support, Cloud Write Relay, Design System Kit, WebSocket-only connectivity, smart multi-file tracking, 89+ tools, Comments API, and MCP Apps
|
|
738
793
|
|
|
739
794
|
**Recent Releases:**
|
|
795
|
+
- [x] **v1.17.0** - Figma Slides Support: 15 new tools for managing presentations β slides, transitions, content, reordering, and navigation. Inspired by Toni Haidamous (PR #11).
|
|
796
|
+
- [x] **v1.16.0** - FigJam Support: 9 new tools for creating and reading FigJam boards β stickies, flowcharts, tables, code blocks, and connection graphs. Community-contributed by klgral and lukemoderwell.
|
|
740
797
|
- [x] **v1.12.0** - Cloud Write Relay: web AI clients (Claude.ai, v0, Replit, Lovable) can create and modify Figma designs via cloud relay pairing β no Node.js required
|
|
741
798
|
- [x] **v1.11.2** - Screenshot fix: `figma_take_screenshot` works without explicit `nodeId` in WebSocket mode
|
|
742
799
|
- [x] **v1.11.1** - Doc generator fixes: clean markdown tables, Storybook links, property metadata filtering
|
package/dist/cloudflare/index.js
CHANGED
|
@@ -38,7 +38,7 @@ export class FigmaConsoleMCPv3 extends McpAgent {
|
|
|
38
38
|
super(...arguments);
|
|
39
39
|
this.server = new McpServer({
|
|
40
40
|
name: "Figma Console MCP",
|
|
41
|
-
version: "1.15.
|
|
41
|
+
version: "1.15.5",
|
|
42
42
|
});
|
|
43
43
|
this.browserManager = null;
|
|
44
44
|
this.consoleMonitor = null;
|
|
@@ -950,7 +950,7 @@ export default {
|
|
|
950
950
|
});
|
|
951
951
|
const statelessServer = new McpServer({
|
|
952
952
|
name: "Figma Console MCP",
|
|
953
|
-
version: "1.15.
|
|
953
|
+
version: "1.15.5",
|
|
954
954
|
});
|
|
955
955
|
// ================================================================
|
|
956
956
|
// Cloud Write Relay β Pairing Tool (stateless /mcp path)
|
|
@@ -1579,7 +1579,7 @@ export default {
|
|
|
1579
1579
|
return new Response(JSON.stringify({
|
|
1580
1580
|
status: "healthy",
|
|
1581
1581
|
service: "Figma Console MCP",
|
|
1582
|
-
version: "1.15.
|
|
1582
|
+
version: "1.15.5",
|
|
1583
1583
|
endpoints: {
|
|
1584
1584
|
mcp: ["/sse", "/mcp"],
|
|
1585
1585
|
oauth_mcp_spec: ["/.well-known/oauth-authorization-server", "/authorize", "/token", "/oauth/register"],
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma Annotations MCP Tools
|
|
3
|
+
* Tools for reading, writing, and managing design annotations on Figma nodes.
|
|
4
|
+
* Annotations are a Plugin API feature β requires Desktop Bridge plugin connection.
|
|
5
|
+
*
|
|
6
|
+
* Annotations are distinct from comments: they are node-level design specs that
|
|
7
|
+
* can pin specific properties (fills, width, typography, etc.) and support
|
|
8
|
+
* markdown-formatted labels. Designers use them to communicate animation timings,
|
|
9
|
+
* accessibility requirements, interaction specs, and other implementation details
|
|
10
|
+
* that don't fit in the description field.
|
|
11
|
+
*/
|
|
12
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
|
+
export declare function registerAnnotationTools(server: McpServer, getDesktopConnector: () => Promise<any>): void;
|
|
14
|
+
//# sourceMappingURL=annotation-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation-tools.d.ts","sourceRoot":"","sources":["../../src/core/annotation-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4EzE,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GACrC,IAAI,CA0LN"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma Annotations MCP Tools
|
|
3
|
+
* Tools for reading, writing, and managing design annotations on Figma nodes.
|
|
4
|
+
* Annotations are a Plugin API feature β requires Desktop Bridge plugin connection.
|
|
5
|
+
*
|
|
6
|
+
* Annotations are distinct from comments: they are node-level design specs that
|
|
7
|
+
* can pin specific properties (fills, width, typography, etc.) and support
|
|
8
|
+
* markdown-formatted labels. Designers use them to communicate animation timings,
|
|
9
|
+
* accessibility requirements, interaction specs, and other implementation details
|
|
10
|
+
* that don't fit in the description field.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { createChildLogger } from "./logger.js";
|
|
14
|
+
const logger = createChildLogger({ component: "annotation-tools" });
|
|
15
|
+
// Valid AnnotationPropertyType values from the Figma Plugin API
|
|
16
|
+
// Sourced from @figma/plugin-typings β keep in sync with AnnotationPropertyType union
|
|
17
|
+
// Reference: https://developers.figma.com/docs/plugins/api/AnnotationProperty
|
|
18
|
+
const ANNOTATION_PROPERTY_TYPES = [
|
|
19
|
+
"width",
|
|
20
|
+
"height",
|
|
21
|
+
"maxWidth",
|
|
22
|
+
"minWidth",
|
|
23
|
+
"maxHeight",
|
|
24
|
+
"minHeight",
|
|
25
|
+
"fills",
|
|
26
|
+
"strokes",
|
|
27
|
+
"effects",
|
|
28
|
+
"strokeWeight",
|
|
29
|
+
"cornerRadius",
|
|
30
|
+
"textStyleId",
|
|
31
|
+
"textAlignHorizontal",
|
|
32
|
+
"fontFamily",
|
|
33
|
+
"fontStyle",
|
|
34
|
+
"fontSize",
|
|
35
|
+
"fontWeight",
|
|
36
|
+
"lineHeight",
|
|
37
|
+
"letterSpacing",
|
|
38
|
+
"itemSpacing",
|
|
39
|
+
"padding",
|
|
40
|
+
"layoutMode",
|
|
41
|
+
"alignItems",
|
|
42
|
+
"opacity",
|
|
43
|
+
"mainComponent",
|
|
44
|
+
"gridRowGap",
|
|
45
|
+
"gridColumnGap",
|
|
46
|
+
"gridRowCount",
|
|
47
|
+
"gridColumnCount",
|
|
48
|
+
"gridRowAnchorIndex",
|
|
49
|
+
"gridColumnAnchorIndex",
|
|
50
|
+
"gridRowSpan",
|
|
51
|
+
"gridColumnSpan",
|
|
52
|
+
];
|
|
53
|
+
// Zod schema for annotation property
|
|
54
|
+
const annotationPropertySchema = z.object({
|
|
55
|
+
type: z
|
|
56
|
+
.enum(ANNOTATION_PROPERTY_TYPES)
|
|
57
|
+
.describe("Design property to pin (e.g., 'fills', 'width', 'fontSize')"),
|
|
58
|
+
});
|
|
59
|
+
// Zod schema for a single annotation
|
|
60
|
+
const annotationSchema = z.object({
|
|
61
|
+
label: z
|
|
62
|
+
.string()
|
|
63
|
+
.optional()
|
|
64
|
+
.describe("Plain text annotation label"),
|
|
65
|
+
labelMarkdown: z
|
|
66
|
+
.string()
|
|
67
|
+
.optional()
|
|
68
|
+
.describe("Rich text annotation label with markdown formatting. Supports bold, italic, links, lists, code, and headers."),
|
|
69
|
+
properties: z
|
|
70
|
+
.array(annotationPropertySchema)
|
|
71
|
+
.optional()
|
|
72
|
+
.describe("Design properties to pin to this annotation (e.g., fills, width, fontSize)"),
|
|
73
|
+
categoryId: z
|
|
74
|
+
.string()
|
|
75
|
+
.optional()
|
|
76
|
+
.describe("Annotation category ID. Use figma_get_annotation_categories to list available categories."),
|
|
77
|
+
});
|
|
78
|
+
// ============================================================================
|
|
79
|
+
// Tool Registration
|
|
80
|
+
// ============================================================================
|
|
81
|
+
export function registerAnnotationTools(server, getDesktopConnector) {
|
|
82
|
+
// -----------------------------------------------------------------------
|
|
83
|
+
// Tool: figma_get_annotations
|
|
84
|
+
// -----------------------------------------------------------------------
|
|
85
|
+
server.tool("figma_get_annotations", "Read annotations from a Figma node. Annotations are designer-authored specs attached to nodes β they can include notes (plain text or markdown), pinned design properties (fills, width, fontSize, etc.), and category labels. Use this to discover animation timings, interaction specs, accessibility requirements, and other implementation details that designers annotate directly on the design. Set include_children=true to get annotations from child nodes too (useful for full component documentation). Requires Desktop Bridge plugin.", {
|
|
86
|
+
nodeId: z
|
|
87
|
+
.string()
|
|
88
|
+
.describe("Node ID to read annotations from (e.g., '695:313')"),
|
|
89
|
+
include_children: z.preprocess((v) => (typeof v === "string" ? v === "true" : v), z.boolean().optional().default(false)).describe("Also read annotations from child nodes. Useful for getting all annotations within a component tree."),
|
|
90
|
+
depth: z.preprocess((v) => (typeof v === "string" ? Number(v) : v), z.number().optional().default(1)).describe("How many levels deep to traverse when include_children is true (default: 1, max recommended: 5)"),
|
|
91
|
+
}, async ({ nodeId, include_children = false, depth = 1 }) => {
|
|
92
|
+
try {
|
|
93
|
+
logger.info({ nodeId, include_children, depth }, "Getting annotations");
|
|
94
|
+
const connector = await getDesktopConnector();
|
|
95
|
+
const result = await connector.getAnnotations(nodeId, include_children, Math.min(depth, 10));
|
|
96
|
+
if (!result || (result.success === false)) {
|
|
97
|
+
throw new Error(result?.error || "Failed to get annotations");
|
|
98
|
+
}
|
|
99
|
+
// The result may come back as { success, data } (WebSocket) or directly as data
|
|
100
|
+
const data = result.data || result;
|
|
101
|
+
return {
|
|
102
|
+
content: [
|
|
103
|
+
{
|
|
104
|
+
type: "text",
|
|
105
|
+
text: JSON.stringify(data),
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
112
|
+
logger.error({ error }, "Failed to get annotations");
|
|
113
|
+
return {
|
|
114
|
+
content: [
|
|
115
|
+
{
|
|
116
|
+
type: "text",
|
|
117
|
+
text: JSON.stringify({
|
|
118
|
+
error: "get_annotations_failed",
|
|
119
|
+
message: `Cannot get annotations. ${message}`,
|
|
120
|
+
hint: "Annotations require the Desktop Bridge plugin to be running in Figma.",
|
|
121
|
+
}),
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
isError: true,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
// -----------------------------------------------------------------------
|
|
129
|
+
// Tool: figma_set_annotations
|
|
130
|
+
// -----------------------------------------------------------------------
|
|
131
|
+
server.tool("figma_set_annotations", "Write or clear annotations on a Figma node. Annotations communicate design specs to developers β use them to document animation timings, easing curves, interaction behaviors, accessibility requirements, and implementation notes. Supports plain text labels, rich markdown labels, pinned design properties, and annotation categories. Pass an empty array to clear all annotations. Use mode='append' to add to existing annotations, or mode='replace' (default) to overwrite. Requires Desktop Bridge plugin. This operation is undoable in Figma (Cmd+Z).", {
|
|
132
|
+
nodeId: z
|
|
133
|
+
.string()
|
|
134
|
+
.describe("Node ID to write annotations to (e.g., '695:313')"),
|
|
135
|
+
annotations: z.preprocess((v) => {
|
|
136
|
+
if (typeof v === "string") {
|
|
137
|
+
try {
|
|
138
|
+
return JSON.parse(v);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return v;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return v;
|
|
145
|
+
}, z.array(annotationSchema)).describe("Array of annotations to set. Each annotation can have a label (plain or markdown), pinned properties, and a category. Pass an empty array [] to clear all annotations."),
|
|
146
|
+
mode: z
|
|
147
|
+
.enum(["replace", "append"])
|
|
148
|
+
.optional()
|
|
149
|
+
.default("replace")
|
|
150
|
+
.describe("'replace' (default) overwrites all existing annotations. 'append' adds new annotations while keeping existing ones."),
|
|
151
|
+
}, async ({ nodeId, annotations, mode = "replace" }) => {
|
|
152
|
+
try {
|
|
153
|
+
logger.info({ nodeId, count: annotations.length, mode }, "Setting annotations");
|
|
154
|
+
const connector = await getDesktopConnector();
|
|
155
|
+
const result = await connector.setAnnotations(nodeId, annotations, mode);
|
|
156
|
+
if (!result || (result.success === false)) {
|
|
157
|
+
throw new Error(result?.error || "Failed to set annotations");
|
|
158
|
+
}
|
|
159
|
+
const data = result.data || result;
|
|
160
|
+
return {
|
|
161
|
+
content: [
|
|
162
|
+
{
|
|
163
|
+
type: "text",
|
|
164
|
+
text: JSON.stringify({
|
|
165
|
+
success: true,
|
|
166
|
+
...data,
|
|
167
|
+
note: "Annotations set successfully. This operation is undoable in Figma (Cmd+Z).",
|
|
168
|
+
}),
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
175
|
+
logger.error({ error }, "Failed to set annotations");
|
|
176
|
+
return {
|
|
177
|
+
content: [
|
|
178
|
+
{
|
|
179
|
+
type: "text",
|
|
180
|
+
text: JSON.stringify({
|
|
181
|
+
error: "set_annotations_failed",
|
|
182
|
+
message: `Cannot set annotations. ${message}`,
|
|
183
|
+
hint: "Annotations require the Desktop Bridge plugin to be running in Figma.",
|
|
184
|
+
}),
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
isError: true,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
// -----------------------------------------------------------------------
|
|
192
|
+
// Tool: figma_get_annotation_categories
|
|
193
|
+
// -----------------------------------------------------------------------
|
|
194
|
+
server.tool("figma_get_annotation_categories", "List available annotation categories in the current Figma file. Categories group annotations by purpose (e.g., interactions, accessibility, development notes). Use the returned category IDs when creating annotations with figma_set_annotations. Requires Desktop Bridge plugin.", {}, async () => {
|
|
195
|
+
try {
|
|
196
|
+
logger.info("Getting annotation categories");
|
|
197
|
+
const connector = await getDesktopConnector();
|
|
198
|
+
const result = await connector.getAnnotationCategories();
|
|
199
|
+
if (!result || (result.success === false)) {
|
|
200
|
+
throw new Error(result?.error || "Failed to get annotation categories");
|
|
201
|
+
}
|
|
202
|
+
const data = result.data || result;
|
|
203
|
+
return {
|
|
204
|
+
content: [
|
|
205
|
+
{
|
|
206
|
+
type: "text",
|
|
207
|
+
text: JSON.stringify(data),
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
214
|
+
logger.error({ error }, "Failed to get annotation categories");
|
|
215
|
+
return {
|
|
216
|
+
content: [
|
|
217
|
+
{
|
|
218
|
+
type: "text",
|
|
219
|
+
text: JSON.stringify({
|
|
220
|
+
error: "get_annotation_categories_failed",
|
|
221
|
+
message: `Cannot get annotation categories. ${message}`,
|
|
222
|
+
hint: "Annotation categories require the Desktop Bridge plugin to be running in Figma.",
|
|
223
|
+
}),
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
isError: true,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=annotation-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation-tools.js","sourceRoot":"","sources":["../../src/core/annotation-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC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AC;qBAC1B;iBACD;aACD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,qCAAqC,CAAC,CAAC;YAE/D,OAAO;gBACN,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACpB,KAAK,EAAE,kCAAkC;4BACzC,OAAO,EAAE,qCAAqC,OAAO,EAAE;4BACvD,IAAI,EAAE,iFAAiF;yBACvF,CAAC;qBACF;iBACD;gBACD,OAAO,EAAE,IAAI;aACb,CAAC;QACH,CAAC;IACF,CAAC,CACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep Component Extraction MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Provides unlimited-depth component tree extraction via the Desktop Bridge
|
|
5
|
+
* Plugin API. Returns full visual properties, resolved design token names,
|
|
6
|
+
* instance references (mainComponent), prototype reactions, and annotations
|
|
7
|
+
* at every level of the tree.
|
|
8
|
+
*
|
|
9
|
+
* This complements figma_get_component_for_development (REST API, depth 4)
|
|
10
|
+
* with deeper, richer data when the Desktop Bridge plugin is connected.
|
|
11
|
+
*/
|
|
12
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
|
+
export declare function registerDeepComponentTools(server: McpServer, getDesktopConnector: () => Promise<any>): void;
|
|
14
|
+
//# sourceMappingURL=deep-component-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-component-tools.d.ts","sourceRoot":"","sources":["../../src/core/deep-component-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,wBAAgB,0BAA0B,CACzC,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GACrC,IAAI,CAyIN"}
|