@biolab/talk-to-figma 0.5.0 → 0.7.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 +0 -125
- package/dist/cli.cjs +104 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +104 -0
- package/dist/cli.js.map +1 -1
- package/dist/talk_to_figma_mcp/server.cjs +104 -0
- package/dist/talk_to_figma_mcp/server.cjs.map +1 -1
- package/dist/talk_to_figma_mcp/server.js +104 -0
- package/dist/talk_to_figma_mcp/server.js.map +1 -1
- package/figma-plugin/code.js +118 -1
- package/figma-plugin/figma-plugin.zip +0 -0
- package/figma-plugin/ui.html +869 -832
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,128 +55,3 @@ https://cdn.jsdelivr.net/npm/@biolab/talk-to-figma@latest/figma-plugin/figma-plu
|
|
|
55
55
|
1. Open the plugin in Figma and join a channel
|
|
56
56
|
2. In your AI agent, call `join_channel` with the same channel name
|
|
57
57
|
3. Start using the MCP tools
|
|
58
|
-
|
|
59
|
-
## MCP Tools
|
|
60
|
-
|
|
61
|
-
### Document & Selection
|
|
62
|
-
|
|
63
|
-
- `get_document_info` - Get document info
|
|
64
|
-
- `get_selection` - Get current selection
|
|
65
|
-
- `read_my_design` - Get detailed selection info with all node details
|
|
66
|
-
- `get_node_info` - Get info about a specific node
|
|
67
|
-
- `get_nodes_info` - Get info about multiple nodes
|
|
68
|
-
- `set_focus` - Focus and scroll to a node
|
|
69
|
-
- `set_selections` - Select multiple nodes
|
|
70
|
-
|
|
71
|
-
### Creating Elements
|
|
72
|
-
|
|
73
|
-
- `create_rectangle` - Create a rectangle
|
|
74
|
-
- `create_frame` - Create a frame with auto-layout support
|
|
75
|
-
- `create_text` - Create a text node
|
|
76
|
-
|
|
77
|
-
### Modifying Elements
|
|
78
|
-
|
|
79
|
-
- `set_fill_color` - Set fill color (RGBA 0-1)
|
|
80
|
-
- `set_stroke_color` - Set stroke color and weight
|
|
81
|
-
- `set_corner_radius` - Set corner radius (per-corner support)
|
|
82
|
-
- `set_text_content` - Set text content
|
|
83
|
-
- `set_multiple_text_contents` - Batch update text nodes
|
|
84
|
-
- `move_node` - Move a node
|
|
85
|
-
- `resize_node` - Resize a node
|
|
86
|
-
- `clone_node` - Clone a node
|
|
87
|
-
- `delete_node` / `delete_multiple_nodes` - Delete nodes
|
|
88
|
-
|
|
89
|
-
### Auto Layout
|
|
90
|
-
|
|
91
|
-
- `set_layout_mode` - Set layout mode (NONE, HORIZONTAL, VERTICAL)
|
|
92
|
-
- `set_padding` - Set frame padding
|
|
93
|
-
- `set_axis_align` - Set axis alignment
|
|
94
|
-
- `set_layout_sizing` - Set sizing mode (FIXED, HUG, FILL)
|
|
95
|
-
- `set_item_spacing` - Set spacing between children
|
|
96
|
-
|
|
97
|
-
### Variables
|
|
98
|
-
|
|
99
|
-
- `get_local_variables` - Get all local variables with values per mode
|
|
100
|
-
- `get_local_variable_collections` - Get variable collections with modes
|
|
101
|
-
- `get_variable_by_id` - Get a specific variable
|
|
102
|
-
- `create_variable_collection` - Create a variable collection
|
|
103
|
-
- `create_variable` - Create a variable
|
|
104
|
-
- `set_variable_value` - Set variable value for a mode
|
|
105
|
-
- `set_variable_mode_name` - Rename a mode
|
|
106
|
-
- `set_variable_binding` - Bind a variable to a node property
|
|
107
|
-
|
|
108
|
-
### Components & Styles
|
|
109
|
-
|
|
110
|
-
- `get_styles` - Get local styles
|
|
111
|
-
- `get_local_components` - Get local components
|
|
112
|
-
- `create_component_instance` - Instantiate a component
|
|
113
|
-
- `get_instance_overrides` / `set_instance_overrides` - Copy/apply instance overrides
|
|
114
|
-
- `get_team_library_components` - Get team library components
|
|
115
|
-
- `get_team_library_variables` - Get team library variables
|
|
116
|
-
- `import_variable_by_key` - Import a variable from team library
|
|
117
|
-
|
|
118
|
-
### Scanning
|
|
119
|
-
|
|
120
|
-
- `scan_text_nodes` - Scan text nodes (chunked for large designs)
|
|
121
|
-
- `scan_nodes_by_types` - Scan nodes by type
|
|
122
|
-
|
|
123
|
-
### Annotations
|
|
124
|
-
|
|
125
|
-
- `get_annotations` - Get annotations
|
|
126
|
-
- `set_annotation` / `set_multiple_annotations` - Create/update annotations
|
|
127
|
-
|
|
128
|
-
### Prototyping & Connections
|
|
129
|
-
|
|
130
|
-
- `get_reactions` - Get prototype reactions
|
|
131
|
-
- `set_default_connector` - Set default connector style
|
|
132
|
-
- `create_connections` - Create connector lines between nodes
|
|
133
|
-
|
|
134
|
-
### Export
|
|
135
|
-
|
|
136
|
-
- `export_node_as_image` - Export as PNG, JPG, SVG, or PDF
|
|
137
|
-
|
|
138
|
-
### Connection
|
|
139
|
-
|
|
140
|
-
- `join_channel` - Join a channel to communicate with Figma
|
|
141
|
-
|
|
142
|
-
## Local Development
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
bun install # Install dependencies
|
|
146
|
-
bun run build # Build MCP server + relay (tsup → dist/)
|
|
147
|
-
bun run dev # Build in watch mode
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Start the relay (pick one)
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
bun socket # Bun-native relay (dev only, uses src/socket.ts)
|
|
154
|
-
node dist/cli.js --relay # Node-compatible relay (same as npm package)
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Both run on port 3055 by default (`PORT` env to override).
|
|
158
|
-
|
|
159
|
-
### Point MCP config to local build
|
|
160
|
-
|
|
161
|
-
```json
|
|
162
|
-
{
|
|
163
|
-
"mcpServers": {
|
|
164
|
-
"TalkToFigma": {
|
|
165
|
-
"command": "node",
|
|
166
|
-
"args": ["/path-to-repo/dist/cli.js"]
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Project Structure
|
|
173
|
-
|
|
174
|
-
- `src/cli.ts` - CLI entry point (routes `--relay` flag)
|
|
175
|
-
- `src/talk_to_figma_mcp/server.ts` - MCP server
|
|
176
|
-
- `src/relay.ts` - WebSocket relay (Node-compatible, bundled in npm package)
|
|
177
|
-
- `src/socket.ts` - WebSocket relay (Bun-native, local dev only)
|
|
178
|
-
- `src/cursor_mcp_plugin/` - Figma plugin (`code.js`, `ui.html`, `manifest.json`)
|
|
179
|
-
|
|
180
|
-
## License
|
|
181
|
-
|
|
182
|
-
MIT
|
package/dist/cli.cjs
CHANGED
|
@@ -1058,6 +1058,110 @@ var init_server = __esm({
|
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
1060
|
);
|
|
1061
|
+
server.tool(
|
|
1062
|
+
"set_font_family",
|
|
1063
|
+
"Set the font family of an existing text node in Figma",
|
|
1064
|
+
{
|
|
1065
|
+
nodeId: import_zod.z.string().describe("The ID of the text node to modify"),
|
|
1066
|
+
fontFamily: import_zod.z.string().describe("Font family name (e.g. 'Inter', 'Roboto', 'Arial')"),
|
|
1067
|
+
fontStyle: import_zod.z.string().optional().describe("Font style (e.g. 'Regular', 'Bold', 'Italic'). Defaults to 'Regular'")
|
|
1068
|
+
},
|
|
1069
|
+
async ({ nodeId, fontFamily, fontStyle }) => {
|
|
1070
|
+
try {
|
|
1071
|
+
const result = await sendCommandToFigma("set_font_family", {
|
|
1072
|
+
nodeId,
|
|
1073
|
+
fontFamily,
|
|
1074
|
+
fontStyle: fontStyle || "Regular"
|
|
1075
|
+
});
|
|
1076
|
+
const typedResult = result;
|
|
1077
|
+
return {
|
|
1078
|
+
content: [
|
|
1079
|
+
{
|
|
1080
|
+
type: "text",
|
|
1081
|
+
text: `Updated font family of node "${typedResult.name}" to "${typedResult.fontName.family} ${typedResult.fontName.style}"`
|
|
1082
|
+
}
|
|
1083
|
+
]
|
|
1084
|
+
};
|
|
1085
|
+
} catch (error) {
|
|
1086
|
+
return {
|
|
1087
|
+
content: [
|
|
1088
|
+
{
|
|
1089
|
+
type: "text",
|
|
1090
|
+
text: `Error setting font family: ${error instanceof Error ? error.message : String(error)}`
|
|
1091
|
+
}
|
|
1092
|
+
]
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
);
|
|
1097
|
+
server.tool(
|
|
1098
|
+
"set_font_size",
|
|
1099
|
+
"Set the font size of an existing text node in Figma",
|
|
1100
|
+
{
|
|
1101
|
+
nodeId: import_zod.z.string().describe("The ID of the text node to modify"),
|
|
1102
|
+
fontSize: import_zod.z.number().min(1).describe("Font size in pixels")
|
|
1103
|
+
},
|
|
1104
|
+
async ({ nodeId, fontSize }) => {
|
|
1105
|
+
try {
|
|
1106
|
+
const result = await sendCommandToFigma("set_font_size", {
|
|
1107
|
+
nodeId,
|
|
1108
|
+
fontSize
|
|
1109
|
+
});
|
|
1110
|
+
const typedResult = result;
|
|
1111
|
+
return {
|
|
1112
|
+
content: [
|
|
1113
|
+
{
|
|
1114
|
+
type: "text",
|
|
1115
|
+
text: `Updated font size of node "${typedResult.name}" to ${typedResult.fontSize}px`
|
|
1116
|
+
}
|
|
1117
|
+
]
|
|
1118
|
+
};
|
|
1119
|
+
} catch (error) {
|
|
1120
|
+
return {
|
|
1121
|
+
content: [
|
|
1122
|
+
{
|
|
1123
|
+
type: "text",
|
|
1124
|
+
text: `Error setting font size: ${error instanceof Error ? error.message : String(error)}`
|
|
1125
|
+
}
|
|
1126
|
+
]
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
);
|
|
1131
|
+
server.tool(
|
|
1132
|
+
"set_font_weight",
|
|
1133
|
+
"Set the font weight of an existing text node in Figma. Maps numeric weight to font style (100=Thin, 300=Light, 400=Regular, 500=Medium, 600=Semi Bold, 700=Bold, 800=Extra Bold, 900=Black)",
|
|
1134
|
+
{
|
|
1135
|
+
nodeId: import_zod.z.string().describe("The ID of the text node to modify"),
|
|
1136
|
+
fontWeight: import_zod.z.number().min(100).max(900).describe("Font weight (100-900)")
|
|
1137
|
+
},
|
|
1138
|
+
async ({ nodeId, fontWeight }) => {
|
|
1139
|
+
try {
|
|
1140
|
+
const result = await sendCommandToFigma("set_font_weight", {
|
|
1141
|
+
nodeId,
|
|
1142
|
+
fontWeight
|
|
1143
|
+
});
|
|
1144
|
+
const typedResult = result;
|
|
1145
|
+
return {
|
|
1146
|
+
content: [
|
|
1147
|
+
{
|
|
1148
|
+
type: "text",
|
|
1149
|
+
text: `Updated font weight of node "${typedResult.name}" to ${fontWeight} (${typedResult.fontName.style})`
|
|
1150
|
+
}
|
|
1151
|
+
]
|
|
1152
|
+
};
|
|
1153
|
+
} catch (error) {
|
|
1154
|
+
return {
|
|
1155
|
+
content: [
|
|
1156
|
+
{
|
|
1157
|
+
type: "text",
|
|
1158
|
+
text: `Error setting font weight: ${error instanceof Error ? error.message : String(error)}`
|
|
1159
|
+
}
|
|
1160
|
+
]
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
);
|
|
1061
1165
|
server.tool(
|
|
1062
1166
|
"get_styles",
|
|
1063
1167
|
"Get all styles from the current Figma document",
|