@vkhanhqui/figma-mcp-go 0.0.1-alpha
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/bin/run.js +19 -0
- package/package.json +35 -0
- package/scripts/install.js +96 -0
package/bin/run.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require('node:child_process');
|
|
5
|
+
const { existsSync } = require('node:fs');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
|
|
8
|
+
const binaryName = process.platform === 'win32' ? 'figma-mcp-go.exe' : 'figma-mcp-go';
|
|
9
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
10
|
+
|
|
11
|
+
if (!existsSync(binaryPath)) {
|
|
12
|
+
process.stderr.write(
|
|
13
|
+
'[figma-mcp-go] Binary not found. Try reinstalling: npm install @vkhanhqui/figma-mcp-go\n'
|
|
14
|
+
);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
19
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vkhanhqui/figma-mcp-go",
|
|
3
|
+
"version": "0.0.1-alpha",
|
|
4
|
+
"description": "A zero-cost, unlimited Figma MCP server — no API key, no rate limits",
|
|
5
|
+
"mcpName": "io.github.vkhanhqui/figma-mcp-go",
|
|
6
|
+
"bin": {
|
|
7
|
+
"figma-mcp-go": "bin/run.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node scripts/install.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/run.js",
|
|
14
|
+
"scripts"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"figma",
|
|
18
|
+
"mcp",
|
|
19
|
+
"model-context-protocol",
|
|
20
|
+
"ai",
|
|
21
|
+
"design"
|
|
22
|
+
],
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/vkhanhqui/figma-mcp-go.git"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/vkhanhqui/figma-mcp-go#readme",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/vkhanhqui/figma-mcp-go/issues"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.0.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const https = require('node:https');
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
const { execFileSync } = require('node:child_process');
|
|
8
|
+
const os = require('node:os');
|
|
9
|
+
|
|
10
|
+
const pkg = require('../package.json');
|
|
11
|
+
const version = pkg.version;
|
|
12
|
+
|
|
13
|
+
const PLATFORM_MAP = {
|
|
14
|
+
darwin: 'darwin',
|
|
15
|
+
linux: 'linux',
|
|
16
|
+
win32: 'windows',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const ARCH_MAP = {
|
|
20
|
+
x64: 'amd64',
|
|
21
|
+
arm64: 'arm64',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const goos = PLATFORM_MAP[process.platform];
|
|
25
|
+
const goarch = ARCH_MAP[process.arch];
|
|
26
|
+
|
|
27
|
+
if (!goos || !goarch) {
|
|
28
|
+
console.error(`[figma-mcp-go] Unsupported platform: ${process.platform}/${process.arch}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const isWindows = goos === 'windows';
|
|
33
|
+
const binaryName = isWindows ? 'figma-mcp-go.exe' : 'figma-mcp-go';
|
|
34
|
+
const ext = isWindows ? '.zip' : '.tar.gz';
|
|
35
|
+
const archiveName = `figma-mcp-go_${goos}_${goarch}${ext}`;
|
|
36
|
+
const downloadUrl = `https://github.com/vkhanhqui/figma-mcp-go/releases/download/v${version}/${archiveName}`;
|
|
37
|
+
const binDir = path.join(__dirname, '..', 'bin');
|
|
38
|
+
const tmpFile = path.join(os.tmpdir(), archiveName);
|
|
39
|
+
|
|
40
|
+
function download(url, dest) {
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
const file = fs.createWriteStream(dest);
|
|
43
|
+
function get(u) {
|
|
44
|
+
https.get(u, (res) => {
|
|
45
|
+
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
46
|
+
return get(res.headers.location);
|
|
47
|
+
}
|
|
48
|
+
if (res.statusCode !== 200) {
|
|
49
|
+
file.close();
|
|
50
|
+
fs.rmSync(dest, { force: true });
|
|
51
|
+
reject(new Error(`HTTP ${res.statusCode} downloading ${u}`));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
res.pipe(file);
|
|
55
|
+
file.on('finish', () => file.close(resolve));
|
|
56
|
+
file.on('error', reject);
|
|
57
|
+
}).on('error', reject);
|
|
58
|
+
}
|
|
59
|
+
get(url);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function main() {
|
|
64
|
+
console.log(`[figma-mcp-go] Downloading ${archiveName}...`);
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
await download(downloadUrl, tmpFile);
|
|
68
|
+
} catch (err) {
|
|
69
|
+
console.error(`[figma-mcp-go] Failed to download: ${err.message}`);
|
|
70
|
+
console.error(`[figma-mcp-go] URL: ${downloadUrl}`);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
if (isWindows) {
|
|
78
|
+
execFileSync('powershell', [
|
|
79
|
+
'-NoProfile', '-Command',
|
|
80
|
+
`Expand-Archive -Force -Path "${tmpFile}" -DestinationPath "${binDir}"`,
|
|
81
|
+
]);
|
|
82
|
+
} else {
|
|
83
|
+
execFileSync('tar', ['xzf', tmpFile, '-C', binDir, binaryName]);
|
|
84
|
+
fs.chmodSync(path.join(binDir, binaryName), 0o755);
|
|
85
|
+
}
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.error(`[figma-mcp-go] Failed to extract: ${err.message}`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
} finally {
|
|
90
|
+
fs.rmSync(tmpFile, { force: true });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
console.log('[figma-mcp-go] Installed successfully.');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
main();
|