figma-coder-mcp 0.1.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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/bin.js +2154 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GoldynLabs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# figma-coder-mcp
|
|
2
|
+
|
|
3
|
+
MCP server **and** CLI that exposes the Figma → HTML/Tailwind converter to AI
|
|
4
|
+
coding agents (Claude Code, Cursor, …).
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm i -g figma-coder-mcp # or: npx figma-coder-mcp
|
|
8
|
+
figma-coder-mcp set-token figd_xxx
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
It runs in two modes and picks automatically:
|
|
12
|
+
|
|
13
|
+
- **local** (default when a PAT is present): converts using the bundled
|
|
14
|
+
[`@figma-to-code/core`](../packages/figma-core) directly. **No backend needed** —
|
|
15
|
+
works even if the API server is down. Just provide a Figma PAT.
|
|
16
|
+
- **remote**: delegates to a running `figma-to-html-api` over HTTP (`FIGMA_MCP_API`).
|
|
17
|
+
|
|
18
|
+
Both modes share the **exact same conversion code** (the core package), so output
|
|
19
|
+
is identical.
|
|
20
|
+
|
|
21
|
+
## Tools
|
|
22
|
+
|
|
23
|
+
| Tool | What it does |
|
|
24
|
+
|------|--------------|
|
|
25
|
+
| `get_figma_data` | Returns the deterministic **Style IR** (exact CSS per node) so the agent can generate code itself. Large trees are written to a JSON file and summarised. |
|
|
26
|
+
| `convert_figma_to_html` | Produces finished, self-contained **HTML + Tailwind** (assets inlined, optional LLM restructure). The HTML is written to a file; a compact summary + path is returned to keep the agent's context small. |
|
|
27
|
+
|
|
28
|
+
## Setup
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Build the workspace from the repo root
|
|
32
|
+
npm install
|
|
33
|
+
npm run build
|
|
34
|
+
|
|
35
|
+
# Store a Figma personal access token (local mode, no backend)
|
|
36
|
+
node figma-mcp/dist/bin.js set-token figd_xxx
|
|
37
|
+
# …or set it per-process: FIGMA_PAT=figd_xxx
|
|
38
|
+
|
|
39
|
+
# (optional) Point at a backend instead / as fallback
|
|
40
|
+
node figma-mcp/dist/bin.js set-api http://localhost:3000
|
|
41
|
+
|
|
42
|
+
# Check how requests will be served (no secrets printed)
|
|
43
|
+
node figma-mcp/dist/bin.js status
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Register with an agent
|
|
47
|
+
|
|
48
|
+
`.mcp.json` (Claude Code) / Cursor MCP config — once installed (`npm i -g`) or via npx:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"figma": {
|
|
54
|
+
"command": "npx",
|
|
55
|
+
"args": ["-y", "figma-coder-mcp"],
|
|
56
|
+
"env": { "FIGMA_PAT": "figd_xxx" }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
(From a local clone instead, point `command: "node"`, `args: [".../figma-mcp/dist/bin.js"]`.)
|
|
63
|
+
|
|
64
|
+
## One-off CLI (no agent)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
figma-coder-mcp convert "https://www.figma.com/design/<key>/Title?node-id=1-23"
|
|
68
|
+
figma-coder-mcp convert <fileKey> --node 1:23 --no-assets --out page.html
|
|
69
|
+
figma-coder-mcp data <fileKey> --node 1:23
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
| Var | Meaning |
|
|
75
|
+
|-----|---------|
|
|
76
|
+
| `FIGMA_PAT` / `FIGMA_TOKEN` | Figma personal access token (local mode). |
|
|
77
|
+
| `FIGMA_MCP_API` | Backend converter base URL (remote mode). |
|
|
78
|
+
| `FIGMA_MCP_TOKEN` | Bearer token for the backend (remote mode, optional). |
|
|
79
|
+
| `FIGMA_MCP_MODE` | `auto` (default) · `local` · `remote`. Auto prefers local. |
|
|
80
|
+
| `FIGMA_MCP_OUT_DIR` | Where HTML/JSON outputs are written. Default `<cwd>/figma-output`. |
|
|
81
|
+
| `OLLAMA_CLOUD_URL` / `OLLAMA_API_KEY` / `OLLAMA_CLOUD_MODELS` | Enable the `--llm` restructure pass. |
|
|
82
|
+
|
|
83
|
+
Priority for every setting: **flags > env > stored credentials** (`~/.figma-mcp/credentials.json`).
|