localfig
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**The Figma desktop app as an MCP server.** localfig gives an AI agent the **full Figma Plugin API** on the file you have open — through a tiny dev plugin and a loopback HTTP bridge, entirely on your machine.
- **Reads and writes.** Frames, text, auto-layout, variables, components, image fills, exports, undo — anything the Plugin API can do, the agent can do.
- **No Figma cloud API, no personal access token, no per-account quota.**
- **Zero dependencies.** Node built-ins only. Nothing leaves your machine.
- Works with any MCP client that can launch a stdio server: Claude Code, Cursor, Windsurf, Cline, Claude Desktop and more.
Why localfig
| | localfig | Official Figma MCP | REST-API servers | Fixed-command plugin bridges |
|---|---|---|---|---|
| Writes to the file | anything the Plugin API can | limited | no — the REST API cannot write nodes | a fixed menu of commands |
| Arbitrary Plugin API JavaScript | **yes** (figma_eval) | no | no | no |
| Quota / login | none | plan-dependent | token + rate limits | none |
| Tokens, styles, components read back | figma_tokens, figma_metadata | yes, incl. Code Connect | partial | rarely |
| Agent can see the design as an image | yes, inline in the response | yes | files or links, not inline | varies |
| Undo per agent step, change tracking | yes | no | no | no |
Requirements
- Node.js 18 or newer
- The **Figma desktop app** — dev plugins cannot be imported in the browser
- An MCP client: Claude Code, Cursor, Windsurf, Cline, Claude Desktop, …
Install (once)
That generates your local secret, writes the plugin to ~/.localfig/plugin/, **registers localfig with every MCP client it finds on your machine**, and prints the manifest path for the next step. --dry-run shows what it would do without touching anything, and --clients=cursor,vscode limits it to the clients you name. Prefer a clone? git clone https://github.com/LucasGorgal/localfig.git && cd localfig && node server.mjs --setup does the same.
| Client | Where setup registers localfig |
|---|---|
| Claude Code | claude mcp add --scope user |
| Claude Desktop | claude_desktop_config.json |
| Cursor | ~/.cursor/mcp.json |
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
| VS Code (Copilot agent mode) | user mcp.json |
| Cline (extension and CLI) | ~/.cline/data/settings/cline_mcp_settings.json, or VS Code's extension storage on older versions |
| Gemini CLI | ~/.gemini/settings.json |
| Codex | ~/.codex/config.toml |
| opencode | ~/.config/opencode/opencode.json |
| Zed | settings.json, under context_servers |
| LM Studio | ~/.lmstudio/mcp.json |
A client counts as installed when its config folder exists. Setup merges into existing files instead of replacing them: other servers and settings stay, an existing localfig entry keeps its env, and a .localfig.bak copy is written before any change. Files it cannot safely rewrite, such as a settings.json with comments, are left untouched and reported with the entry to paste. Restart any client that was already open.
For a client that is not in the list, add this to its MCP configuration:
On Windows, use "command": "cmd", "args": ["/c", "npx", "-y", "localfig"] instead: most clients start servers without a shell, and npx is a .cmd script there.
Then import the plugin into Figma (once):
1. Open any **design file** in the desktop app. The Plugins menu only exists inside a file, not on the home screen.
2. Figma menu (the logo, top-left) → **Plugins → Development → Import plugin from manifest…** — or press Ctrl / (Cmd /) and type *import plugin from manifest*.
3. Pick ~/.localfig/plugin/manifest.json (the setup output prints the full path).
The manifest asks for two permissions — teamlibrary (library components and tokens) and currentuser (who is driving) — and registers a relaunch button.
Use (every session)
1. Open the file you want to work on.
2. Run the plugin: Ctrl / → *localfig* — or Ctrl Alt P (Cmd Opt P) to re-run the last plugin, or the **Reconnect localfig** button in the properties panel of a file it has run in. A small panel appears and says **Connected to localfig** once the MCP server is up. Leave it open.