figma-console-mcp 1.15.5 β 1.16.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 +28 -3
- 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-connector.d.ts +43 -0
- package/dist/core/figma-connector.d.ts.map +1 -1
- package/dist/core/figma-desktop-connector.d.ts +8 -0
- package/dist/core/figma-desktop-connector.d.ts.map +1 -1
- package/dist/core/figma-desktop-connector.js +9 -0
- package/dist/core/figma-desktop-connector.js.map +1 -1
- package/dist/core/websocket-connector.d.ts +43 -0
- package/dist/core/websocket-connector.d.ts.map +1 -1
- package/dist/core/websocket-connector.js +27 -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 +5 -0
- package/dist/local.js.map +1 -1
- package/figma-desktop-bridge/code.js +502 -2
- package/figma-desktop-bridge/icon.png +0 -0
- package/figma-desktop-bridge/manifest.json +1 -1
- package/figma-desktop-bridge/ui.html +51 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **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
10
|
|
|
11
|
-
> **π
|
|
11
|
+
> **π FigJam Support β AI Meets Collaborative Whiteboarding:** 9 new tools let AI assistants create and read FigJam boards β sticky notes, flowcharts, tables, code blocks, and more. Build affinity maps from meeting notes, generate user flow diagrams, or summarize brainstorming sessions. [See what's possible β](docs/figjam.md)
|
|
12
12
|
|
|
13
13
|
## What is this?
|
|
14
14
|
|
|
@@ -20,6 +20,7 @@ Figma Console MCP connects AI assistants (like Claude) to Figma, enabling:
|
|
|
20
20
|
- **βοΈ Design creation** - Create UI components, frames, and layouts directly in Figma
|
|
21
21
|
- **π§ Variable management** - Create, update, rename, and delete design tokens
|
|
22
22
|
- **β‘ Real-time monitoring** - Watch logs as plugins execute
|
|
23
|
+
- **π FigJam boards** - Create stickies, flowcharts, tables, and code blocks on collaborative boards
|
|
23
24
|
- **βοΈ Cloud Write Relay** - Web AI clients (Claude.ai, v0, Replit) can design in Figma via cloud pairing
|
|
24
25
|
- **π Four ways to connect** - Remote SSE, Cloud Mode, NPX, or Local Git
|
|
25
26
|
|
|
@@ -46,6 +47,7 @@ Figma Console MCP connects AI assistants (like Claude) to Figma, enabling:
|
|
|
46
47
|
| **Create components & frames** | β
| β
| β |
|
|
47
48
|
| **Edit existing designs** | β
| β
| β |
|
|
48
49
|
| **Manage design tokens/variables** | β
| β
| β |
|
|
50
|
+
| **FigJam boards (stickies, flowcharts)** | β
| β
| β |
|
|
49
51
|
| Real-time monitoring (console, selection) | β
| β | β |
|
|
50
52
|
| Desktop Bridge plugin | β
| β
| β |
|
|
51
53
|
| Requires Node.js | Yes | **No** | No |
|
|
@@ -303,6 +305,7 @@ AI Client β Cloud MCP Server β Durable Object Relay β Desktop Bridge Plugi
|
|
|
303
305
|
| **Design creation** | β
| β
| β
| β |
|
|
304
306
|
| **Variable management** | β
| β
| β
| β |
|
|
305
307
|
| **Component instantiation** | β
| β
| β
| β |
|
|
308
|
+
| **FigJam boards** | β
| β
| β
| β |
|
|
306
309
|
| **Real-time monitoring** | β
| β | β
| β |
|
|
307
310
|
| **Desktop Bridge plugin** | β
| β
| β
| β |
|
|
308
311
|
| **Variables (no Enterprise)** | β
| β
| β
| β |
|
|
@@ -426,6 +429,17 @@ When you first use design system tools:
|
|
|
426
429
|
- `figma_batch_update_variables` - Update up to 100 variable values in one call
|
|
427
430
|
- `figma_setup_design_tokens` - Create complete token system (collection + modes + variables) atomically
|
|
428
431
|
|
|
432
|
+
### π FigJam Board Tools (Local Mode + Cloud Mode)
|
|
433
|
+
- `figjam_create_sticky` - Create a sticky note with color options
|
|
434
|
+
- `figjam_create_stickies` - Batch create up to 200 stickies
|
|
435
|
+
- `figjam_create_connector` - Connect nodes with labeled connector lines
|
|
436
|
+
- `figjam_create_shape_with_text` - Create flowchart shapes (diamond, ellipse, etc.)
|
|
437
|
+
- `figjam_create_table` - Create tables with cell data
|
|
438
|
+
- `figjam_create_code_block` - Add code snippets with syntax highlighting
|
|
439
|
+
- `figjam_auto_arrange` - Arrange nodes in grid, horizontal, or vertical layouts
|
|
440
|
+
- `figjam_get_board_contents` - Read all content from a FigJam board
|
|
441
|
+
- `figjam_get_connections` - Read the connection graph (flowcharts, relationships)
|
|
442
|
+
|
|
429
443
|
**π [Detailed Tool Documentation](docs/TOOLS.md)**
|
|
430
444
|
|
|
431
445
|
---
|
|
@@ -479,6 +493,15 @@ Check design parity for the Card component before sign-off
|
|
|
479
493
|
Generate component documentation for the Dialog from our design system
|
|
480
494
|
```
|
|
481
495
|
|
|
496
|
+
### FigJam Boards
|
|
497
|
+
```
|
|
498
|
+
Create a retrospective board with "Went Well", "To Improve", and "Action Items" columns
|
|
499
|
+
Build a user flow diagram for the checkout process with decision points
|
|
500
|
+
Read this brainstorming board and summarize the key themes
|
|
501
|
+
Generate an affinity map from these meeting notes
|
|
502
|
+
Create a comparison table of our three platform options
|
|
503
|
+
```
|
|
504
|
+
|
|
482
505
|
### Visual Debugging
|
|
483
506
|
```
|
|
484
507
|
Take a screenshot of the current Figma canvas
|
|
@@ -716,11 +739,12 @@ The architecture supports adding new apps with minimal boilerplate β each app
|
|
|
716
739
|
|
|
717
740
|
## π€ vs. Figma Official MCP
|
|
718
741
|
|
|
719
|
-
**Figma Console MCP (This Project)** - Debugging
|
|
742
|
+
**Figma Console MCP (This Project)** - Debugging, data extraction, and design creation
|
|
720
743
|
- β
Real-time console logs from Figma plugins
|
|
721
744
|
- β
Screenshot capture and visual debugging
|
|
722
745
|
- β
Error stack traces and runtime monitoring
|
|
723
746
|
- β
Raw design data extraction (JSON)
|
|
747
|
+
- β
FigJam board creation and reading (stickies, flowcharts, tables)
|
|
724
748
|
- β
Works remotely or locally
|
|
725
749
|
|
|
726
750
|
**Figma Official Dev Mode MCP** - Code generation
|
|
@@ -734,9 +758,10 @@ The architecture supports adding new apps with minimal boilerplate β each app
|
|
|
734
758
|
|
|
735
759
|
## π€οΈ Roadmap
|
|
736
760
|
|
|
737
|
-
**Current Status:** v1.
|
|
761
|
+
**Current Status:** v1.16.0 (Stable) - Production-ready with FigJam support, Cloud Write Relay, Design System Kit, WebSocket-only connectivity, smart multi-file tracking, 63+ tools, Comments API, and MCP Apps
|
|
738
762
|
|
|
739
763
|
**Recent Releases:**
|
|
764
|
+
- [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
765
|
- [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
766
|
- [x] **v1.11.2** - Screenshot fix: `figma_take_screenshot` works without explicit `nodeId` in WebSocket mode
|
|
742
767
|
- [x] **v1.11.1** - Doc generator fixes: clean markdown tables, Storybook links, property metadata filtering
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
/**
|
|
3
|
+
* Register FigJam-specific tools.
|
|
4
|
+
* These tools only work when the connected file is a FigJam board (editorType === 'figjam').
|
|
5
|
+
* Used by both local mode (src/local.ts) and cloud mode (src/index.ts).
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerFigJamTools(server: McpServer, getDesktopConnector: () => Promise<any>): void;
|
|
8
|
+
//# sourceMappingURL=figjam-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figjam-tools.d.ts","sourceRoot":"","sources":["../../src/core/figjam-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4DzE;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GACrC,IAAI,CA2eN"}
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createChildLogger } from "./logger.js";
|
|
3
|
+
const logger = createChildLogger({ component: "figjam-tools" });
|
|
4
|
+
/** Valid sticky note colors */
|
|
5
|
+
const STICKY_COLORS = [
|
|
6
|
+
"YELLOW",
|
|
7
|
+
"BLUE",
|
|
8
|
+
"GREEN",
|
|
9
|
+
"PINK",
|
|
10
|
+
"ORANGE",
|
|
11
|
+
"PURPLE",
|
|
12
|
+
"RED",
|
|
13
|
+
"LIGHT_GRAY",
|
|
14
|
+
"GRAY",
|
|
15
|
+
];
|
|
16
|
+
/** Valid FigJam shape types */
|
|
17
|
+
const SHAPE_TYPES = [
|
|
18
|
+
"ROUNDED_RECTANGLE",
|
|
19
|
+
"DIAMOND",
|
|
20
|
+
"ELLIPSE",
|
|
21
|
+
"TRIANGLE_UP",
|
|
22
|
+
"TRIANGLE_DOWN",
|
|
23
|
+
"PARALLELOGRAM_RIGHT",
|
|
24
|
+
"PARALLELOGRAM_LEFT",
|
|
25
|
+
"ENG_DATABASE",
|
|
26
|
+
"ENG_QUEUE",
|
|
27
|
+
"ENG_FILE",
|
|
28
|
+
"ENG_FOLDER",
|
|
29
|
+
];
|
|
30
|
+
/** Valid FigJam node types for board content filtering */
|
|
31
|
+
const FIGJAM_NODE_TYPES = [
|
|
32
|
+
"STICKY",
|
|
33
|
+
"SHAPE_WITH_TEXT",
|
|
34
|
+
"CONNECTOR",
|
|
35
|
+
"TABLE",
|
|
36
|
+
"CODE_BLOCK",
|
|
37
|
+
"SECTION",
|
|
38
|
+
"FRAME",
|
|
39
|
+
"TEXT",
|
|
40
|
+
];
|
|
41
|
+
/** Maximum items for batch operations to prevent DoS / plugin timeouts */
|
|
42
|
+
const MAX_BATCH_SIZE = 200;
|
|
43
|
+
/** Maximum table dimensions */
|
|
44
|
+
const MAX_TABLE_ROWS = 100;
|
|
45
|
+
const MAX_TABLE_COLUMNS = 50;
|
|
46
|
+
/** Maximum text length per field */
|
|
47
|
+
const MAX_TEXT_LENGTH = 5000;
|
|
48
|
+
/** Maximum code block length */
|
|
49
|
+
const MAX_CODE_LENGTH = 50000;
|
|
50
|
+
/** Maximum node IDs for arrangement */
|
|
51
|
+
const MAX_ARRANGE_NODES = 500;
|
|
52
|
+
/** Maximum nodes to return from board content reads */
|
|
53
|
+
const MAX_READ_NODES = 1000;
|
|
54
|
+
/**
|
|
55
|
+
* Register FigJam-specific tools.
|
|
56
|
+
* These tools only work when the connected file is a FigJam board (editorType === 'figjam').
|
|
57
|
+
* Used by both local mode (src/local.ts) and cloud mode (src/index.ts).
|
|
58
|
+
*/
|
|
59
|
+
export function registerFigJamTools(server, getDesktopConnector) {
|
|
60
|
+
// ============================================================================
|
|
61
|
+
// STICKY NOTE TOOLS
|
|
62
|
+
// ============================================================================
|
|
63
|
+
server.tool("figjam_create_sticky", `Create a sticky note on a FigJam board. Only works in FigJam files.
|
|
64
|
+
|
|
65
|
+
**Colors:** YELLOW, BLUE, GREEN, PINK, ORANGE, PURPLE, RED, LIGHT_GRAY, GRAY (default: YELLOW)`, {
|
|
66
|
+
text: z
|
|
67
|
+
.string()
|
|
68
|
+
.max(MAX_TEXT_LENGTH)
|
|
69
|
+
.describe("Text content for the sticky note"),
|
|
70
|
+
color: z
|
|
71
|
+
.enum(STICKY_COLORS)
|
|
72
|
+
.optional()
|
|
73
|
+
.describe("Sticky color"),
|
|
74
|
+
x: z.number().optional().describe("X position on canvas"),
|
|
75
|
+
y: z.number().optional().describe("Y position on canvas"),
|
|
76
|
+
}, async ({ text, color, x, y }) => {
|
|
77
|
+
try {
|
|
78
|
+
const connector = await getDesktopConnector();
|
|
79
|
+
const result = await connector.createSticky({ text, color, x, y });
|
|
80
|
+
return {
|
|
81
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
logger.error({ error }, "figjam_create_sticky failed");
|
|
86
|
+
return {
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: JSON.stringify({
|
|
91
|
+
error: error instanceof Error ? error.message : String(error),
|
|
92
|
+
hint: "This tool only works in FigJam files. Make sure the Desktop Bridge plugin is running in a FigJam board.",
|
|
93
|
+
}),
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
isError: true,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
server.tool("figjam_create_stickies", `Batch create multiple sticky notes on a FigJam board (max ${MAX_BATCH_SIZE}). Use this to populate boards from structured data (meeting notes, brainstorm ideas, etc.).
|
|
101
|
+
|
|
102
|
+
**Colors:** YELLOW, BLUE, GREEN, PINK, ORANGE, PURPLE, RED, LIGHT_GRAY, GRAY`, {
|
|
103
|
+
stickies: z
|
|
104
|
+
.array(z.object({
|
|
105
|
+
text: z.string().max(MAX_TEXT_LENGTH).describe("Text content"),
|
|
106
|
+
color: z.enum(STICKY_COLORS).optional().describe("Sticky color"),
|
|
107
|
+
x: z.number().optional().describe("X position"),
|
|
108
|
+
y: z.number().optional().describe("Y position"),
|
|
109
|
+
}))
|
|
110
|
+
.max(MAX_BATCH_SIZE)
|
|
111
|
+
.describe(`Array of sticky note specifications (max ${MAX_BATCH_SIZE})`),
|
|
112
|
+
}, async ({ stickies }) => {
|
|
113
|
+
try {
|
|
114
|
+
const connector = await getDesktopConnector();
|
|
115
|
+
const result = await connector.createStickies({ stickies });
|
|
116
|
+
return {
|
|
117
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
logger.error({ error }, "figjam_create_stickies failed");
|
|
122
|
+
return {
|
|
123
|
+
content: [
|
|
124
|
+
{
|
|
125
|
+
type: "text",
|
|
126
|
+
text: JSON.stringify({
|
|
127
|
+
error: error instanceof Error ? error.message : String(error),
|
|
128
|
+
hint: "This tool only works in FigJam files.",
|
|
129
|
+
}),
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
isError: true,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
// ============================================================================
|
|
137
|
+
// CONNECTOR TOOL
|
|
138
|
+
// ============================================================================
|
|
139
|
+
server.tool("figjam_create_connector", `Connect two nodes with a connector line in FigJam. Use to create flowcharts, diagrams, and relationship maps.
|
|
140
|
+
|
|
141
|
+
Nodes must exist on the board (stickies, shapes, etc.). Use their node IDs from creation results.`, {
|
|
142
|
+
startNodeId: z.string().describe("Node ID of the start element"),
|
|
143
|
+
endNodeId: z.string().describe("Node ID of the end element"),
|
|
144
|
+
label: z
|
|
145
|
+
.string()
|
|
146
|
+
.max(MAX_TEXT_LENGTH)
|
|
147
|
+
.optional()
|
|
148
|
+
.describe("Optional text label on the connector"),
|
|
149
|
+
}, async ({ startNodeId, endNodeId, label }) => {
|
|
150
|
+
try {
|
|
151
|
+
const connector = await getDesktopConnector();
|
|
152
|
+
const result = await connector.createConnector({
|
|
153
|
+
startNodeId,
|
|
154
|
+
endNodeId,
|
|
155
|
+
label,
|
|
156
|
+
});
|
|
157
|
+
return {
|
|
158
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
logger.error({ error }, "figjam_create_connector failed");
|
|
163
|
+
return {
|
|
164
|
+
content: [
|
|
165
|
+
{
|
|
166
|
+
type: "text",
|
|
167
|
+
text: JSON.stringify({
|
|
168
|
+
error: error instanceof Error ? error.message : String(error),
|
|
169
|
+
hint: "This tool only works in FigJam files. Both start and end nodes must exist.",
|
|
170
|
+
}),
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
isError: true,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
// ============================================================================
|
|
178
|
+
// SHAPE WITH TEXT TOOL
|
|
179
|
+
// ============================================================================
|
|
180
|
+
server.tool("figjam_create_shape_with_text", `Create a labeled shape on a FigJam board. Use for flowchart nodes, process diagrams, and visual organization.
|
|
181
|
+
|
|
182
|
+
**Shape types:** ROUNDED_RECTANGLE (default), DIAMOND, ELLIPSE, TRIANGLE_UP, TRIANGLE_DOWN, PARALLELOGRAM_RIGHT, PARALLELOGRAM_LEFT, ENG_DATABASE, ENG_QUEUE, ENG_FILE, ENG_FOLDER`, {
|
|
183
|
+
text: z
|
|
184
|
+
.string()
|
|
185
|
+
.max(MAX_TEXT_LENGTH)
|
|
186
|
+
.optional()
|
|
187
|
+
.describe("Text label for the shape"),
|
|
188
|
+
shapeType: z
|
|
189
|
+
.enum(SHAPE_TYPES)
|
|
190
|
+
.optional()
|
|
191
|
+
.describe("Shape type"),
|
|
192
|
+
x: z.number().optional().describe("X position on canvas"),
|
|
193
|
+
y: z.number().optional().describe("Y position on canvas"),
|
|
194
|
+
}, async ({ text, shapeType, x, y }) => {
|
|
195
|
+
try {
|
|
196
|
+
const connector = await getDesktopConnector();
|
|
197
|
+
const result = await connector.createShapeWithText({
|
|
198
|
+
text,
|
|
199
|
+
shapeType,
|
|
200
|
+
x,
|
|
201
|
+
y,
|
|
202
|
+
});
|
|
203
|
+
return {
|
|
204
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
logger.error({ error }, "figjam_create_shape_with_text failed");
|
|
209
|
+
return {
|
|
210
|
+
content: [
|
|
211
|
+
{
|
|
212
|
+
type: "text",
|
|
213
|
+
text: JSON.stringify({
|
|
214
|
+
error: error instanceof Error ? error.message : String(error),
|
|
215
|
+
hint: "This tool only works in FigJam files.",
|
|
216
|
+
}),
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
isError: true,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
// ============================================================================
|
|
224
|
+
// TABLE TOOL
|
|
225
|
+
// ============================================================================
|
|
226
|
+
server.tool("figjam_create_table", `Create a table on a FigJam board with optional cell data. Use for structured data display, comparison matrices, and organized information.
|
|
227
|
+
|
|
228
|
+
**Data format:** 2D array of strings, e.g. [["Header1", "Header2"], ["Row1Col1", "Row1Col2"]]`, {
|
|
229
|
+
rows: z
|
|
230
|
+
.number()
|
|
231
|
+
.min(1)
|
|
232
|
+
.max(MAX_TABLE_ROWS)
|
|
233
|
+
.describe(`Number of rows (1-${MAX_TABLE_ROWS})`),
|
|
234
|
+
columns: z
|
|
235
|
+
.number()
|
|
236
|
+
.min(1)
|
|
237
|
+
.max(MAX_TABLE_COLUMNS)
|
|
238
|
+
.describe(`Number of columns (1-${MAX_TABLE_COLUMNS})`),
|
|
239
|
+
data: z
|
|
240
|
+
.array(z.array(z.string().max(MAX_TEXT_LENGTH)))
|
|
241
|
+
.optional()
|
|
242
|
+
.describe("2D array of cell text content (row-major order)"),
|
|
243
|
+
x: z.number().optional().describe("X position on canvas"),
|
|
244
|
+
y: z.number().optional().describe("Y position on canvas"),
|
|
245
|
+
}, async ({ rows, columns, data, x, y }) => {
|
|
246
|
+
try {
|
|
247
|
+
const connector = await getDesktopConnector();
|
|
248
|
+
const result = await connector.createTable({
|
|
249
|
+
rows,
|
|
250
|
+
columns,
|
|
251
|
+
data,
|
|
252
|
+
x,
|
|
253
|
+
y,
|
|
254
|
+
});
|
|
255
|
+
return {
|
|
256
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
logger.error({ error }, "figjam_create_table failed");
|
|
261
|
+
return {
|
|
262
|
+
content: [
|
|
263
|
+
{
|
|
264
|
+
type: "text",
|
|
265
|
+
text: JSON.stringify({
|
|
266
|
+
error: error instanceof Error ? error.message : String(error),
|
|
267
|
+
hint: "This tool only works in FigJam files.",
|
|
268
|
+
}),
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
isError: true,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
// ============================================================================
|
|
276
|
+
// CODE BLOCK TOOL
|
|
277
|
+
// ============================================================================
|
|
278
|
+
server.tool("figjam_create_code_block", `Create a code block on a FigJam board. Use for sharing code snippets, config examples, or technical documentation in collaborative boards.`, {
|
|
279
|
+
code: z.string().max(MAX_CODE_LENGTH).describe("The code content"),
|
|
280
|
+
language: z
|
|
281
|
+
.string()
|
|
282
|
+
.optional()
|
|
283
|
+
.describe("Programming language (e.g., 'JAVASCRIPT', 'PYTHON', 'TYPESCRIPT', 'JSON', 'HTML', 'CSS')"),
|
|
284
|
+
x: z.number().optional().describe("X position on canvas"),
|
|
285
|
+
y: z.number().optional().describe("Y position on canvas"),
|
|
286
|
+
}, async ({ code, language, x, y }) => {
|
|
287
|
+
try {
|
|
288
|
+
const connector = await getDesktopConnector();
|
|
289
|
+
const result = await connector.createCodeBlock({
|
|
290
|
+
code,
|
|
291
|
+
language,
|
|
292
|
+
x,
|
|
293
|
+
y,
|
|
294
|
+
});
|
|
295
|
+
return {
|
|
296
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
logger.error({ error }, "figjam_create_code_block failed");
|
|
301
|
+
return {
|
|
302
|
+
content: [
|
|
303
|
+
{
|
|
304
|
+
type: "text",
|
|
305
|
+
text: JSON.stringify({
|
|
306
|
+
error: error instanceof Error ? error.message : String(error),
|
|
307
|
+
hint: "This tool only works in FigJam files.",
|
|
308
|
+
}),
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
isError: true,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
// ============================================================================
|
|
316
|
+
// LAYOUT HELPER TOOL
|
|
317
|
+
// ============================================================================
|
|
318
|
+
server.tool("figjam_auto_arrange", `Arrange nodes on a FigJam board in a grid, horizontal row, or vertical column layout. Use after batch-creating elements to organize them neatly.`, {
|
|
319
|
+
nodeIds: z
|
|
320
|
+
.array(z.string())
|
|
321
|
+
.max(MAX_ARRANGE_NODES)
|
|
322
|
+
.describe(`Array of node IDs to arrange (max ${MAX_ARRANGE_NODES})`),
|
|
323
|
+
layout: z
|
|
324
|
+
.enum(["grid", "horizontal", "vertical"])
|
|
325
|
+
.optional()
|
|
326
|
+
.default("grid")
|
|
327
|
+
.describe("Layout type: grid, horizontal, or vertical"),
|
|
328
|
+
spacing: z
|
|
329
|
+
.number()
|
|
330
|
+
.optional()
|
|
331
|
+
.default(40)
|
|
332
|
+
.describe("Spacing between nodes in pixels"),
|
|
333
|
+
columns: z
|
|
334
|
+
.number()
|
|
335
|
+
.optional()
|
|
336
|
+
.describe("Number of columns for grid layout (defaults to sqrt of node count)"),
|
|
337
|
+
}, async ({ nodeIds, layout, spacing, columns }) => {
|
|
338
|
+
try {
|
|
339
|
+
const connector = await getDesktopConnector();
|
|
340
|
+
// Compute grid columns safely on the server side β no string interpolation
|
|
341
|
+
const gridCols = columns || Math.ceil(Math.sqrt(nodeIds.length));
|
|
342
|
+
// Pass all parameters as a JSON object to avoid code injection.
|
|
343
|
+
// The plugin code reads from the params object, not interpolated strings.
|
|
344
|
+
const paramsJson = JSON.stringify({
|
|
345
|
+
nodeIds,
|
|
346
|
+
layout,
|
|
347
|
+
spacing,
|
|
348
|
+
gridCols,
|
|
349
|
+
});
|
|
350
|
+
// Use JSON.stringify to produce a properly-escaped double-quoted JS string literal.
|
|
351
|
+
// This handles all control characters including \u2028/\u2029 that manual
|
|
352
|
+
// single-quote escaping would miss.
|
|
353
|
+
const code = `
|
|
354
|
+
const params = JSON.parse(${JSON.stringify(paramsJson)});
|
|
355
|
+
const nodes = [];
|
|
356
|
+
for (const id of params.nodeIds) {
|
|
357
|
+
const node = await figma.getNodeByIdAsync(id);
|
|
358
|
+
if (node) nodes.push(node);
|
|
359
|
+
}
|
|
360
|
+
if (nodes.length === 0) throw new Error('No valid nodes found');
|
|
361
|
+
|
|
362
|
+
let x = nodes[0].x;
|
|
363
|
+
let y = nodes[0].y;
|
|
364
|
+
const startX = x;
|
|
365
|
+
let maxRowHeight = 0;
|
|
366
|
+
|
|
367
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
368
|
+
const node = nodes[i];
|
|
369
|
+
if (params.layout === 'horizontal') {
|
|
370
|
+
node.x = x;
|
|
371
|
+
node.y = y;
|
|
372
|
+
x += node.width + params.spacing;
|
|
373
|
+
} else if (params.layout === 'vertical') {
|
|
374
|
+
node.x = x;
|
|
375
|
+
node.y = y;
|
|
376
|
+
y += node.height + params.spacing;
|
|
377
|
+
} else {
|
|
378
|
+
const col = i % params.gridCols;
|
|
379
|
+
if (col === 0 && i > 0) {
|
|
380
|
+
y += maxRowHeight + params.spacing;
|
|
381
|
+
maxRowHeight = 0;
|
|
382
|
+
x = startX;
|
|
383
|
+
}
|
|
384
|
+
node.x = x;
|
|
385
|
+
node.y = y;
|
|
386
|
+
maxRowHeight = Math.max(maxRowHeight, node.height);
|
|
387
|
+
x += node.width + params.spacing;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return { arranged: nodes.length, layout: params.layout };
|
|
391
|
+
`;
|
|
392
|
+
const result = await connector.executeCodeViaUI(code, 10000);
|
|
393
|
+
return {
|
|
394
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
catch (error) {
|
|
398
|
+
logger.error({ error }, "figjam_auto_arrange failed");
|
|
399
|
+
return {
|
|
400
|
+
content: [
|
|
401
|
+
{
|
|
402
|
+
type: "text",
|
|
403
|
+
text: JSON.stringify({
|
|
404
|
+
error: error instanceof Error ? error.message : String(error),
|
|
405
|
+
hint: "Make sure all node IDs are valid and the Desktop Bridge plugin is running.",
|
|
406
|
+
}),
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
isError: true,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
// ============================================================================
|
|
414
|
+
// READ TOOLS β Query existing FigJam board content
|
|
415
|
+
// ============================================================================
|
|
416
|
+
server.tool("figjam_get_board_contents", `Read all content from a FigJam board. Returns stickies, shapes, connectors, tables, code blocks, and sections with their text content and positions.
|
|
417
|
+
|
|
418
|
+
Use this to understand what's on a board before modifying it, or to extract structured data from collaborative sessions.
|
|
419
|
+
|
|
420
|
+
**Filters:** Pass nodeTypes to limit results (e.g., ["STICKY"] for only stickies). Omit for everything.`, {
|
|
421
|
+
nodeTypes: z
|
|
422
|
+
.array(z.enum(FIGJAM_NODE_TYPES))
|
|
423
|
+
.optional()
|
|
424
|
+
.describe("Filter by node types. Omit for all."),
|
|
425
|
+
maxNodes: z
|
|
426
|
+
.number()
|
|
427
|
+
.min(1)
|
|
428
|
+
.max(MAX_READ_NODES)
|
|
429
|
+
.optional()
|
|
430
|
+
.default(500)
|
|
431
|
+
.describe(`Maximum nodes to return (1-${MAX_READ_NODES}, default: 500)`),
|
|
432
|
+
}, async ({ nodeTypes, maxNodes }) => {
|
|
433
|
+
try {
|
|
434
|
+
const connector = await getDesktopConnector();
|
|
435
|
+
const result = await connector.getBoardContents({
|
|
436
|
+
nodeTypes,
|
|
437
|
+
maxNodes,
|
|
438
|
+
});
|
|
439
|
+
return {
|
|
440
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
logger.error({ error }, "figjam_get_board_contents failed");
|
|
445
|
+
return {
|
|
446
|
+
content: [
|
|
447
|
+
{
|
|
448
|
+
type: "text",
|
|
449
|
+
text: JSON.stringify({
|
|
450
|
+
error: error instanceof Error ? error.message : String(error),
|
|
451
|
+
hint: "This tool only works in FigJam files. Make sure the Desktop Bridge plugin is running in a FigJam board.",
|
|
452
|
+
}),
|
|
453
|
+
},
|
|
454
|
+
],
|
|
455
|
+
isError: true,
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
server.tool("figjam_get_connections", `Read the connection graph from a FigJam board. Returns all connectors with their start/end node references and labels.
|
|
460
|
+
|
|
461
|
+
Use this to understand relationships, flowcharts, and diagrams. Returns edges as {startNodeId, endNodeId, label} plus a summary of connected nodes.`, {}, async () => {
|
|
462
|
+
try {
|
|
463
|
+
const connector = await getDesktopConnector();
|
|
464
|
+
const result = await connector.getConnections();
|
|
465
|
+
return {
|
|
466
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
catch (error) {
|
|
470
|
+
logger.error({ error }, "figjam_get_connections failed");
|
|
471
|
+
return {
|
|
472
|
+
content: [
|
|
473
|
+
{
|
|
474
|
+
type: "text",
|
|
475
|
+
text: JSON.stringify({
|
|
476
|
+
error: error instanceof Error ? error.message : String(error),
|
|
477
|
+
hint: "This tool only works in FigJam files. Make sure the Desktop Bridge plugin is running in a FigJam board.",
|
|
478
|
+
}),
|
|
479
|
+
},
|
|
480
|
+
],
|
|
481
|
+
isError: true,
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
//# sourceMappingURL=figjam-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figjam-tools.js","sourceRoot":"","sources":["../../src/core/figjam-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,SA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C,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACpB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;4BAC7D,IAAI,EAAE,yGAAyG;yBAC/G,CAAC;qBACF;iBACD;gBACD,OAAO,EAAE,IAAI;aACb,CAAC;QACH,CAAC;IACF,CAAC,CACD,CAAC;IAEF,MAAM,CAAC,IAAI,CACV,wBAAwB,EACxB;;oJAEkJ,EAClJ,EAAE,EACF,KAAK,IAAI,EAAE;QACV,IAAI,CAAC;YACJ,MAAM,SAAS,GAAG,MAAM,mBAAmB,EAAE,CAAC;YAC9C,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,CAAC;YAChD,OAAO;gBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;aAClE,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,+BAA+B,CAAC,CAAC;YACzD,OAAO;gBACN,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACpB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;4BAC7D,IAAI,EAAE,yGAAyG;yBAC/G,CAAC;qBACF;iBACD;gBACD,OAAO,EAAE,IAAI;aACb,CAAC;QACH,CAAC;IACF,CAAC,CACD,CAAC;AACH,CAAC"}
|
|
@@ -43,6 +43,49 @@ export interface IFigmaConnector {
|
|
|
43
43
|
setInstanceProperties(nodeId: string, properties: any): Promise<any>;
|
|
44
44
|
setImageFill(nodeIds: string[], imageData: string, scaleMode?: string): Promise<any>;
|
|
45
45
|
lintDesign(nodeId?: string, rules?: string[], maxDepth?: number, maxFindings?: number): Promise<any>;
|
|
46
|
+
createSticky(params: {
|
|
47
|
+
text: string;
|
|
48
|
+
color?: string;
|
|
49
|
+
x?: number;
|
|
50
|
+
y?: number;
|
|
51
|
+
}): Promise<any>;
|
|
52
|
+
createStickies(params: {
|
|
53
|
+
stickies: Array<{
|
|
54
|
+
text: string;
|
|
55
|
+
color?: string;
|
|
56
|
+
x?: number;
|
|
57
|
+
y?: number;
|
|
58
|
+
}>;
|
|
59
|
+
}): Promise<any>;
|
|
60
|
+
createConnector(params: {
|
|
61
|
+
startNodeId: string;
|
|
62
|
+
endNodeId: string;
|
|
63
|
+
label?: string;
|
|
64
|
+
}): Promise<any>;
|
|
65
|
+
createShapeWithText(params: {
|
|
66
|
+
text?: string;
|
|
67
|
+
shapeType?: string;
|
|
68
|
+
x?: number;
|
|
69
|
+
y?: number;
|
|
70
|
+
}): Promise<any>;
|
|
71
|
+
createTable(params: {
|
|
72
|
+
rows: number;
|
|
73
|
+
columns: number;
|
|
74
|
+
data?: string[][];
|
|
75
|
+
x?: number;
|
|
76
|
+
y?: number;
|
|
77
|
+
}): Promise<any>;
|
|
78
|
+
createCodeBlock(params: {
|
|
79
|
+
code: string;
|
|
80
|
+
language?: string;
|
|
81
|
+
x?: number;
|
|
82
|
+
y?: number;
|
|
83
|
+
}): Promise<any>;
|
|
84
|
+
getBoardContents(params: {
|
|
85
|
+
nodeTypes?: string[];
|
|
86
|
+
maxNodes?: number;
|
|
87
|
+
}): Promise<any>;
|
|
88
|
+
getConnections(): Promise<any>;
|
|
46
89
|
clearFrameCache(): void;
|
|
47
90
|
}
|
|
48
91
|
//# sourceMappingURL=figma-connector.d.ts.map
|