@liner-fe/figma-mcp 1.0.4 → 1.0.5
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/dist/server/server.cjs +64 -0
- package/package.json +1 -1
package/dist/server/server.cjs
CHANGED
|
@@ -24,6 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
// src/server.ts
|
|
25
25
|
var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
26
26
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
27
|
+
var import_zod = require("zod");
|
|
27
28
|
|
|
28
29
|
// src/figmaClient.ts
|
|
29
30
|
var import_crypto = require("crypto");
|
|
@@ -184,6 +185,69 @@ server.tool(
|
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
);
|
|
188
|
+
server.tool(
|
|
189
|
+
"get_node_info",
|
|
190
|
+
"Get detailed information about a specific node in Figma",
|
|
191
|
+
{
|
|
192
|
+
nodeId: import_zod.z.string().describe("The ID of the node to get information about")
|
|
193
|
+
},
|
|
194
|
+
async ({ nodeId }) => {
|
|
195
|
+
try {
|
|
196
|
+
const result = await sendCommandToFigma("get_node_info", { nodeId });
|
|
197
|
+
return {
|
|
198
|
+
content: [
|
|
199
|
+
{
|
|
200
|
+
type: "text",
|
|
201
|
+
text: JSON.stringify(result)
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
};
|
|
205
|
+
} catch (error) {
|
|
206
|
+
return {
|
|
207
|
+
content: [
|
|
208
|
+
{
|
|
209
|
+
type: "text",
|
|
210
|
+
text: `Error getting node info: ${error instanceof Error ? error.message : String(error)}`
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
server.tool(
|
|
218
|
+
"get_nodes_info",
|
|
219
|
+
"Get detailed information about multiple nodes in Figma",
|
|
220
|
+
{
|
|
221
|
+
nodeIds: import_zod.z.array(import_zod.z.string()).describe("Array of node IDs to get information about")
|
|
222
|
+
},
|
|
223
|
+
async ({ nodeIds }) => {
|
|
224
|
+
try {
|
|
225
|
+
const results = await Promise.all(
|
|
226
|
+
nodeIds.map(async (nodeId) => {
|
|
227
|
+
const result = await sendCommandToFigma("get_node_info", { nodeId });
|
|
228
|
+
return { nodeId, info: result };
|
|
229
|
+
})
|
|
230
|
+
);
|
|
231
|
+
return {
|
|
232
|
+
content: [
|
|
233
|
+
{
|
|
234
|
+
type: "text",
|
|
235
|
+
text: JSON.stringify(results)
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
};
|
|
239
|
+
} catch (error) {
|
|
240
|
+
return {
|
|
241
|
+
content: [
|
|
242
|
+
{
|
|
243
|
+
type: "text",
|
|
244
|
+
text: `Error getting nodes info: ${error instanceof Error ? error.message : String(error)}`
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
);
|
|
187
251
|
server.registerTool(
|
|
188
252
|
"get_selection",
|
|
189
253
|
{
|