@clovis500c/figma-bridge 0.0.0-stage → 1.5.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 +164 -2
- package/dist/server.js +27270 -0
- package/package.json +58 -4
- package/plugin/code.js +3310 -0
- package/plugin/manifest.json +15 -0
- package/plugin/ui.html +1204 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Clovis500c
|
|
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
CHANGED
|
@@ -1,3 +1,165 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Figma Bridge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/Clovis500c/figma-bridge/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
**Let any AI agent design in the Figma desktop app, with no rate limits.**
|
|
6
|
+
|
|
7
|
+
Figma Bridge is a local [MCP](https://modelcontextprotocol.io) server plus a Figma plugin. Your agent gets full read and
|
|
8
|
+
write access to the open file through the Plugin API, not the web API: no tokens, no quotas.
|
|
9
|
+
|
|
10
|
+
Works with **Claude Code**, **Claude Desktop**, **Codex**, **Antigravity**, **Gemini CLI**, **Cursor**, **Windsurf**
|
|
11
|
+
and any other MCP client.
|
|
12
|
+
|
|
13
|
+
<p align="center"><img src="docs/plugin.jpg" alt="Figma Bridge plugin" width="620"></p>
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **Build whole layouts in one call** from a JSON spec: auto-layout and grid, rich text, icons, images, component sets with variants and properties, prototype links.
|
|
18
|
+
- **Write the design system**: variables with Light/Dark modes and styles, from simple JSON, W3C design tokens or a Tailwind theme.
|
|
19
|
+
- **Read existing designs** compactly, search every page, and reuse the file's design system.
|
|
20
|
+
- **Check its own work** with screenshots, a design audit, and a pixel diff against a mockup.
|
|
21
|
+
- **Hand off**: Dev Mode annotations and export to HTML or React (CSS or Tailwind).
|
|
22
|
+
- **200 000+ icons** through Iconify, checkpoints to roll back, and a library of reusable scripts.
|
|
23
|
+
- **Zero-friction connection**: the plugin connects and reconnects on its own. Each AI command is one Ctrl+Z step, and you can cancel it from the plugin.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
Requires [Node.js](https://nodejs.org) 20+ and the Figma **desktop** app.
|
|
28
|
+
|
|
29
|
+
1. Run:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx @clovis500c/figma-bridge setup
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
It adds Figma Bridge to every AI client installed on your machine (originals are backed up), copies the Figma
|
|
36
|
+
plugin to `~/.figma-bridge/plugin` and prints the path of its manifest.
|
|
37
|
+
|
|
38
|
+
2. In Figma: **Plugins → Development → Import plugin from manifest…** and select that `manifest.json`.
|
|
39
|
+
|
|
40
|
+
3. Restart your AI client, open a Figma file and run **Plugins → Development → Figma Bridge**. A green **Live** badge means it's connected.
|
|
41
|
+
|
|
42
|
+
To update the plugin later, run `npx @clovis500c/figma-bridge plugin` and reopen it in Figma.
|
|
43
|
+
|
|
44
|
+
<details>
|
|
45
|
+
<summary>With Bun instead of npm</summary>
|
|
46
|
+
|
|
47
|
+
Download the [latest release](https://github.com/Clovis500c/figma-bridge/releases/latest), unzip it, and run in that folder:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bun install
|
|
51
|
+
bun run setup
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Then import `plugin/manifest.json` in Figma as in step 2.
|
|
55
|
+
|
|
56
|
+
</details>
|
|
57
|
+
|
|
58
|
+
<details>
|
|
59
|
+
<summary>Manual configuration</summary>
|
|
60
|
+
|
|
61
|
+
`npx @clovis500c/figma-bridge setup --print` prints these snippets. To target one client: `setup --client codex`.
|
|
62
|
+
|
|
63
|
+
Most clients (`mcpServers` in their JSON config):
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"FigmaBridge": {
|
|
69
|
+
"command": "npx",
|
|
70
|
+
"args": ["-y", "@clovis500c/figma-bridge"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
On Windows, use `"command": "cmd"` and `"args": ["/c", "npx", "-y", "@clovis500c/figma-bridge"]`.
|
|
77
|
+
|
|
78
|
+
Codex (`~/.codex/config.toml`):
|
|
79
|
+
|
|
80
|
+
```toml
|
|
81
|
+
[mcp_servers.FigmaBridge]
|
|
82
|
+
command = 'npx'
|
|
83
|
+
args = ['-y', '@clovis500c/figma-bridge']
|
|
84
|
+
startup_timeout_sec = 60
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
| Client | Config file |
|
|
88
|
+
|---|---|
|
|
89
|
+
| Claude Code | `~/.claude.json` |
|
|
90
|
+
| Claude Desktop | `%APPDATA%\Claude\claude_desktop_config.json` |
|
|
91
|
+
| Codex | `~/.codex/config.toml` |
|
|
92
|
+
| Antigravity | `~/.gemini/antigravity/mcp_config.json` (or **Manage MCP Servers → View raw config**) |
|
|
93
|
+
| Gemini CLI | `~/.gemini/settings.json` |
|
|
94
|
+
| Cursor | `~/.cursor/mcp.json` |
|
|
95
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |
|
|
96
|
+
|
|
97
|
+
</details>
|
|
98
|
+
|
|
99
|
+
## Usage
|
|
100
|
+
|
|
101
|
+
Keep the plugin open (the **—** button collapses it to a thin bar) and ask your agent, for example:
|
|
102
|
+
|
|
103
|
+
> Design a mobile sign-in screen from scratch on a new page: logo, email and password fields, a primary button and a "Forgot password?" link.
|
|
104
|
+
|
|
105
|
+
> Create our design system from `tokens.json` (Light and Dark modes), then rebuild the selected screen with those variables and show it in Dark mode.
|
|
106
|
+
|
|
107
|
+
> Reproduce `C:\mockups\dashboard.png` as an editable frame with auto-layout, compare it with the screenshot and fix the differences.
|
|
108
|
+
|
|
109
|
+
When your agent needs you to point at something, the plugin shows **Your agent is waiting** until you select it.
|
|
110
|
+
A running command has a **Cancel** button: `build` stops at the next layer, but a script cannot be interrupted and
|
|
111
|
+
finishes in the background.
|
|
112
|
+
|
|
113
|
+
To reopen the plugin later, use **Ctrl+Alt+P** or the **Figma Bridge** button in the right panel.
|
|
114
|
+
|
|
115
|
+
## Tools
|
|
116
|
+
|
|
117
|
+
| Tool | Purpose |
|
|
118
|
+
|---|---|
|
|
119
|
+
| `build` | Create a layout from a JSON spec in one call: grid, rich text, variants, reactions |
|
|
120
|
+
| `run_script` | Run any Figma Plugin API code |
|
|
121
|
+
| `describe` | Compact outline of existing layers |
|
|
122
|
+
| `find` | Search layers on every page by name, text, type, style or component |
|
|
123
|
+
| `get_design_system` | Local styles, variables and components |
|
|
124
|
+
| `design_tokens` | Create or update variables (with modes) and styles from JSON, W3C tokens or Tailwind |
|
|
125
|
+
| `audit` | Lint for contrast, overflow, fonts, spacing and naming |
|
|
126
|
+
| `screenshot` | Export a layer to an image (optionally shown to the agent) |
|
|
127
|
+
| `compare` | Pixel-diff a layer against a reference image, with a heatmap |
|
|
128
|
+
| `wait_for_selection` | Ask the user to select layers and wait for it |
|
|
129
|
+
| `prototype` | Link frames (click, hover, transitions) and set flow starting points |
|
|
130
|
+
| `annotate` | Add, list or clear Dev Mode annotations |
|
|
131
|
+
| `export_code` | Export a frame to HTML or React, with CSS or Tailwind |
|
|
132
|
+
| `insert_icon` · `search_icons` | Iconify icons as editable vectors |
|
|
133
|
+
| `place_image` · `import_svg` | Images from disk or URL, SVG as vectors |
|
|
134
|
+
| `checkpoint` | Save layers and restore them later |
|
|
135
|
+
| `snippets` | Reusable script functions (`lib.name()` in scripts) |
|
|
136
|
+
| `get_context` · `get_css` · `list_fonts` | File info, generated CSS, installed fonts |
|
|
137
|
+
| `list_sessions` · `select_session` | Choose a file when several are open |
|
|
138
|
+
|
|
139
|
+
Each tool describes its parameters to the agent, which needs no extra instructions.
|
|
140
|
+
|
|
141
|
+
## Troubleshooting
|
|
142
|
+
|
|
143
|
+
| Plugin status | Fix |
|
|
144
|
+
|---|---|
|
|
145
|
+
| **Offline** | The MCP server isn't running: start or restart your AI client and check that `FigmaBridge` is enabled. |
|
|
146
|
+
| **Port busy** | Another program uses port 3055. Close it; the plugin reconnects. |
|
|
147
|
+
| **Version mismatch** | The plugin and the server come from different releases: reopen the plugin, or update both. |
|
|
148
|
+
|
|
149
|
+
Logs, screenshots, comparison heatmaps and exported code are written to `%TEMP%\figma-bridge`.
|
|
150
|
+
|
|
151
|
+
## Development
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
bun install # also builds the plugin and dist/server.js
|
|
155
|
+
bun run build # plugin/code.ts → plugin/code.js, src/cli.ts → dist/server.js (Node)
|
|
156
|
+
bun run check # type-check server and plugin, reject syntax Figma cannot run
|
|
157
|
+
bun test # unit tests (bridge, setup, schemas, tokens, code generation)
|
|
158
|
+
bun run test # end-to-end test against an open Figma file
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
To release, change `version` in `package.json`, then run **Actions → Release → Run workflow** on `main`: it publishes to
|
|
162
|
+
npm and creates the GitHub release.
|
|
163
|
+
|
|
164
|
+
Options: `FIGMA_BRIDGE_PORT` (default `3055`), `FIGMA_BRIDGE_CHANNEL`, `FIGMA_BRIDGE_OUT`, `FIGMA_BRIDGE_SNIPPETS`.
|
|
165
|
+
The server listens on `127.0.0.1` only, and browsers can't send it commands.
|