figma-rust-mcp 3.2.9 → 3.2.11
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/LICENSE +21 -21
- package/README.md +409 -403
- package/bin/figma-mcp.js +591 -591
- package/package.json +62 -62
- package/plugin/code.js +52 -52
- package/plugin/manifest.json +25 -25
- package/plugin/ui.html +211 -211
- package/scripts/build-plugin.js +52 -52
- package/scripts/test-bridge-sessions.mjs +155 -155
- package/scripts/test-plugin-tokens.mjs +427 -352
- package/scripts/test-rust-mcp.sh +38 -38
package/package.json
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "figma-rust-mcp",
|
|
3
|
-
"version": "3.2.
|
|
4
|
-
"description": "Claude Code to Figma \u2014 Bidirectional MCP bridge. AI draws UI on Figma canvas, reads designs back. Works with Claude, Cursor, VS Code, Windsurf, Antigravity. No API key needed.",
|
|
5
|
-
"mcpName": "io.github.BuiHung1612/figma-mcp",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"figma-rust-mcp": "bin/figma-mcp.js",
|
|
9
|
-
"figma-mcp": "bin/figma-mcp.js"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"bin",
|
|
13
|
-
"plugin",
|
|
14
|
-
"scripts",
|
|
15
|
-
"README.md",
|
|
16
|
-
"LICENSE"
|
|
17
|
-
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "npm run build:plugin && cargo build --release",
|
|
20
|
-
"build:plugin": "node scripts/build-plugin.js",
|
|
21
|
-
"test": "./scripts/test-rust-mcp.sh",
|
|
22
|
-
"test:tokens": "node --test scripts/test-plugin-tokens.mjs && cargo test",
|
|
23
|
-
"dev": "cargo run",
|
|
24
|
-
"test:sessions": "cargo build && node --test scripts/test-bridge-sessions.mjs"
|
|
25
|
-
},
|
|
26
|
-
"engines": {
|
|
27
|
-
"node": ">=18"
|
|
28
|
-
},
|
|
29
|
-
"keywords": [
|
|
30
|
-
"figma",
|
|
31
|
-
"mcp",
|
|
32
|
-
"model-context-protocol",
|
|
33
|
-
"claude",
|
|
34
|
-
"claude-code",
|
|
35
|
-
"cursor",
|
|
36
|
-
"windsurf",
|
|
37
|
-
"vscode",
|
|
38
|
-
"antigravity",
|
|
39
|
-
"ai",
|
|
40
|
-
"design",
|
|
41
|
-
"plugin",
|
|
42
|
-
"figma-plugin",
|
|
43
|
-
"ui-generation",
|
|
44
|
-
"figma-mcp",
|
|
45
|
-
"ai-to-figma",
|
|
46
|
-
"claude-to-figma",
|
|
47
|
-
"code-to-figma",
|
|
48
|
-
"design-to-code",
|
|
49
|
-
"figma-bridge",
|
|
50
|
-
"figma-automation"
|
|
51
|
-
],
|
|
52
|
-
"license": "MIT",
|
|
53
|
-
"author": "BuiHung1612",
|
|
54
|
-
"homepage": "https://github.com/BuiHung1612/figma-mcp#readme",
|
|
55
|
-
"bugs": {
|
|
56
|
-
"url": "https://github.com/BuiHung1612/figma-mcp/issues"
|
|
57
|
-
},
|
|
58
|
-
"repository": {
|
|
59
|
-
"type": "git",
|
|
60
|
-
"url": "git+https://github.com/BuiHung1612/figma-mcp.git"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "figma-rust-mcp",
|
|
3
|
+
"version": "3.2.11",
|
|
4
|
+
"description": "Claude Code to Figma \u2014 Bidirectional MCP bridge. AI draws UI on Figma canvas, reads designs back. Works with Claude, Cursor, VS Code, Windsurf, Antigravity. No API key needed.",
|
|
5
|
+
"mcpName": "io.github.BuiHung1612/figma-mcp",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"figma-rust-mcp": "bin/figma-mcp.js",
|
|
9
|
+
"figma-mcp": "bin/figma-mcp.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"plugin",
|
|
14
|
+
"scripts",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "npm run build:plugin && cargo build --release",
|
|
20
|
+
"build:plugin": "node scripts/build-plugin.js",
|
|
21
|
+
"test": "./scripts/test-rust-mcp.sh",
|
|
22
|
+
"test:tokens": "node --test scripts/test-plugin-tokens.mjs && cargo test",
|
|
23
|
+
"dev": "cargo run",
|
|
24
|
+
"test:sessions": "cargo build && node --test scripts/test-bridge-sessions.mjs"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"figma",
|
|
31
|
+
"mcp",
|
|
32
|
+
"model-context-protocol",
|
|
33
|
+
"claude",
|
|
34
|
+
"claude-code",
|
|
35
|
+
"cursor",
|
|
36
|
+
"windsurf",
|
|
37
|
+
"vscode",
|
|
38
|
+
"antigravity",
|
|
39
|
+
"ai",
|
|
40
|
+
"design",
|
|
41
|
+
"plugin",
|
|
42
|
+
"figma-plugin",
|
|
43
|
+
"ui-generation",
|
|
44
|
+
"figma-mcp",
|
|
45
|
+
"ai-to-figma",
|
|
46
|
+
"claude-to-figma",
|
|
47
|
+
"code-to-figma",
|
|
48
|
+
"design-to-code",
|
|
49
|
+
"figma-bridge",
|
|
50
|
+
"figma-automation"
|
|
51
|
+
],
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"author": "BuiHung1612",
|
|
54
|
+
"homepage": "https://github.com/BuiHung1612/figma-mcp#readme",
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/BuiHung1612/figma-mcp/issues"
|
|
57
|
+
},
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "git+https://github.com/BuiHung1612/figma-mcp.git"
|
|
61
|
+
}
|
|
62
|
+
}
|
package/plugin/code.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
// ─── FIGMA MCP BRIDGE — DYNAMIC THIN LOADER ───────────────────────────
|
|
2
|
-
// This file is a permanent micro-stub. You never need to reinstall or edit this file.
|
|
3
|
-
// The actual runtime is loaded dynamically from the local figma-mcp Rust engine.
|
|
4
|
-
|
|
5
|
-
figma.showUI(__html__, { width: 340, height: 480, title: "Figma MCP Bridge", themeColors: true });
|
|
6
|
-
|
|
7
|
-
// Restore window size if saved
|
|
8
|
-
figma.clientStorage.getAsync("mcp_window_size").then(function(saved) {
|
|
9
|
-
if (saved && saved.width && saved.height) {
|
|
10
|
-
try {
|
|
11
|
-
figma.ui.resize(
|
|
12
|
-
Math.max(260, Math.min(1000, saved.width)),
|
|
13
|
-
Math.max(200, Math.min(1200, saved.height))
|
|
14
|
-
);
|
|
15
|
-
} catch(e) {}
|
|
16
|
-
}
|
|
17
|
-
}).catch(function() {});
|
|
18
|
-
|
|
19
|
-
// Initial stub message listener
|
|
20
|
-
figma.ui.onmessage = async function(msg) {
|
|
21
|
-
if (!msg) return;
|
|
22
|
-
|
|
23
|
-
if (msg.type === "EVAL_MAIN_CODE" && typeof msg.code === "string") {
|
|
24
|
-
try {
|
|
25
|
-
// Execute dynamic main runtime with figma context
|
|
26
|
-
var runner = new Function("figma", "__html__", msg.code);
|
|
27
|
-
runner(figma, __html__);
|
|
28
|
-
} catch (err) {
|
|
29
|
-
console.error("[figma-mcp stub] Failed to evaluate dynamic runtime:", err);
|
|
30
|
-
try {
|
|
31
|
-
figma.notify("MCP Runtime Error: " + (err && err.message ? err.message : String(err)), { error: true });
|
|
32
|
-
} catch(e) {}
|
|
33
|
-
}
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (msg.type === "resize") {
|
|
38
|
-
var newW = Math.max(260, Math.min(1000, Math.round(msg.width)));
|
|
39
|
-
var newH = Math.max(200, Math.min(1200, Math.round(msg.height)));
|
|
40
|
-
try { figma.ui.resize(newW, newH); } catch(e) {}
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (msg.type === "save-window-size") {
|
|
45
|
-
var sw = Math.max(260, Math.min(1000, Math.round(msg.width)));
|
|
46
|
-
var sh = Math.max(200, Math.min(1200, Math.round(msg.height)));
|
|
47
|
-
try {
|
|
48
|
-
figma.clientStorage.setAsync("mcp_window_size", { width: sw, height: sh }).catch(function() {});
|
|
49
|
-
} catch(e) {}
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
1
|
+
// ─── FIGMA MCP BRIDGE — DYNAMIC THIN LOADER ───────────────────────────
|
|
2
|
+
// This file is a permanent micro-stub. You never need to reinstall or edit this file.
|
|
3
|
+
// The actual runtime is loaded dynamically from the local figma-mcp Rust engine.
|
|
4
|
+
|
|
5
|
+
figma.showUI(__html__, { width: 340, height: 480, title: "Figma MCP Bridge", themeColors: true });
|
|
6
|
+
|
|
7
|
+
// Restore window size if saved
|
|
8
|
+
figma.clientStorage.getAsync("mcp_window_size").then(function(saved) {
|
|
9
|
+
if (saved && saved.width && saved.height) {
|
|
10
|
+
try {
|
|
11
|
+
figma.ui.resize(
|
|
12
|
+
Math.max(260, Math.min(1000, saved.width)),
|
|
13
|
+
Math.max(200, Math.min(1200, saved.height))
|
|
14
|
+
);
|
|
15
|
+
} catch(e) {}
|
|
16
|
+
}
|
|
17
|
+
}).catch(function() {});
|
|
18
|
+
|
|
19
|
+
// Initial stub message listener
|
|
20
|
+
figma.ui.onmessage = async function(msg) {
|
|
21
|
+
if (!msg) return;
|
|
22
|
+
|
|
23
|
+
if (msg.type === "EVAL_MAIN_CODE" && typeof msg.code === "string") {
|
|
24
|
+
try {
|
|
25
|
+
// Execute dynamic main runtime with figma context
|
|
26
|
+
var runner = new Function("figma", "__html__", msg.code);
|
|
27
|
+
runner(figma, __html__);
|
|
28
|
+
} catch (err) {
|
|
29
|
+
console.error("[figma-mcp stub] Failed to evaluate dynamic runtime:", err);
|
|
30
|
+
try {
|
|
31
|
+
figma.notify("MCP Runtime Error: " + (err && err.message ? err.message : String(err)), { error: true });
|
|
32
|
+
} catch(e) {}
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (msg.type === "resize") {
|
|
38
|
+
var newW = Math.max(260, Math.min(1000, Math.round(msg.width)));
|
|
39
|
+
var newH = Math.max(200, Math.min(1200, Math.round(msg.height)));
|
|
40
|
+
try { figma.ui.resize(newW, newH); } catch(e) {}
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (msg.type === "save-window-size") {
|
|
45
|
+
var sw = Math.max(260, Math.min(1000, Math.round(msg.width)));
|
|
46
|
+
var sh = Math.max(200, Math.min(1200, Math.round(msg.height)));
|
|
47
|
+
try {
|
|
48
|
+
figma.clientStorage.setAsync("mcp_window_size", { width: sw, height: sh }).catch(function() {});
|
|
49
|
+
} catch(e) {}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
};
|
package/plugin/manifest.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Figma MCP Bridge",
|
|
3
|
-
"id": "1614927480683426278",
|
|
4
|
-
"api": "1.0.0",
|
|
5
|
-
"main": "code.js",
|
|
6
|
-
"ui": "ui.html",
|
|
7
|
-
"documentAccess": "dynamic-page",
|
|
8
|
-
"editorType": ["figma", "dev"],
|
|
9
|
-
"networkAccess": {
|
|
10
|
-
"allowedDomains": [
|
|
11
|
-
"http://localhost:38451",
|
|
12
|
-
"http://localhost:38452",
|
|
13
|
-
"http://localhost:38453",
|
|
14
|
-
"http://localhost:38454",
|
|
15
|
-
"http://localhost:38455",
|
|
16
|
-
"ws://localhost:38451",
|
|
17
|
-
"ws://localhost:38452",
|
|
18
|
-
"ws://localhost:38453",
|
|
19
|
-
"ws://localhost:38454",
|
|
20
|
-
"ws://localhost:38455"
|
|
21
|
-
],
|
|
22
|
-
"reasoning": "Thin loader connecting dynamically to the local figma-mcp Rust engine on ports 38451-38455."
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "Figma MCP Bridge",
|
|
3
|
+
"id": "1614927480683426278",
|
|
4
|
+
"api": "1.0.0",
|
|
5
|
+
"main": "code.js",
|
|
6
|
+
"ui": "ui.html",
|
|
7
|
+
"documentAccess": "dynamic-page",
|
|
8
|
+
"editorType": ["figma", "dev"],
|
|
9
|
+
"networkAccess": {
|
|
10
|
+
"allowedDomains": [
|
|
11
|
+
"http://localhost:38451",
|
|
12
|
+
"http://localhost:38452",
|
|
13
|
+
"http://localhost:38453",
|
|
14
|
+
"http://localhost:38454",
|
|
15
|
+
"http://localhost:38455",
|
|
16
|
+
"ws://localhost:38451",
|
|
17
|
+
"ws://localhost:38452",
|
|
18
|
+
"ws://localhost:38453",
|
|
19
|
+
"ws://localhost:38454",
|
|
20
|
+
"ws://localhost:38455"
|
|
21
|
+
],
|
|
22
|
+
"reasoning": "Thin loader connecting dynamically to the local figma-mcp Rust engine on ports 38451-38455."
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|