Skip to main content
Glama
figma-forge-mcp

figma-forge-mcp

by TBlopT
README.md
<p align="center">
  <img src="assets/banner.png" alt="Figma Forge — design-grade Figma from your AI agent" width="100%">
</p>

<p align="center">
  <a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-FFB38A?style=flat-square&labelColor=211824"></a>
  <img alt="MCP" src="https://img.shields.io/badge/MCP-server-29C5F6?style=flat-square&labelColor=211824">
  <img alt="Figma plugin" src="https://img.shields.io/badge/Figma-plugin-F59E0B?style=flat-square&labelColor=211824">
  <img alt="Bun" src="https://img.shields.io/badge/runtime-Bun-FFF1E6?style=flat-square&labelColor=211824">
  <img alt="No telemetry" src="https://img.shields.io/badge/telemetry-none-C8AFA8?style=flat-square&labelColor=211824">
</p>

**Figma Forge** lets Claude Code, Cursor or any MCP client design in Figma like a senior product designer, not like a script drawing rectangles one at a time.

It builds entire auto-layout screens in a single call, writes real styles and variables, assembles component sets, and wires **Smart Animate prototypes with your own easing curves**. Whatever it can't do with a dedicated tool, it does through `run_code`, a direct line to the full Figma Plugin API.

> Built on top of [cursor-talk-to-figma-mcp](https://github.com/sonnylazuardi/cursor-talk-to-figma-mcp) by Sonny Lazuardi (MIT). All 44 original tools are still here.

---

## Why it exists

Agents driving Figma through one-node-per-call tools produce designs that look generated: default fonts, flat fills, no system behind them. Figma Forge closes that gap.

| | One node per call | **Figma Forge** |
|---|---|---|
| A full landing page | Hundreds of round trips, minutes | **One `build_tree` call, seconds** |
| Typography | Inter only | **Any installed font**, line height, tracking, text ranges |
| Paint | Solid colours | **Linear and radial gradients**, image fills with caching |
| Depth | None | **Layered drop / inner shadows**, layer and background blur |
| Design system | Ad-hoc values | **Paint, text and effect styles + Figma variables with modes** |
| Components | Instances of existing ones | **Create components, variants and instances** |
| Motion | Static frames | **Prototype interactions: Smart Animate, hover, press, timers, scroll-to, flows** |
| Anything else | Not possible | **`run_code`: the whole Plugin API** |
| Privacy | Analytics in the plugin | **No telemetry; relay bound to 127.0.0.1** |

## How it works

```mermaid
flowchart LR
  A["Claude Code / Cursor<br/>(MCP client)"] -- stdio --> B["figma-forge-mcp<br/>MCP server"]
  B -- WebSocket --> C["Relay<br/>127.0.0.1:3055"]
  C -- WebSocket --> D["Figma Forge plugin<br/>(Figma Desktop)"]
  E["client/forge.ts<br/>scripts"] -- WebSocket --> C
```

The plugin joins a channel on the local relay; the MCP server (or your own scripts) send commands to that channel.

## Quick start

**1. Install and build** ([Bun](https://bun.sh) required)

```bash
git clone https://github.com/TBlopT/figma-forge-mcp.git
cd figma-forge-mcp
bun install
bun run build
```

**2. Start the relay** (keep it running)

```bash
bun run socket
```

**3. Install the plugin in Figma Desktop**

*Plugins → Development → Import plugin from manifest…* → `src/cursor_mcp_plugin/manifest.json`.
Run **Figma Forge**, press **Connect** and copy the channel code.

**4. Register the MCP server**

Claude Code:

```bash
claude mcp add --scope user figma-forge -- bun /absolute/path/to/figma-forge-mcp/dist/server.js
```

Cursor (`~/.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "figma-forge": { "command": "bun", "args": ["/absolute/path/to/figma-forge-mcp/dist/server.js"] }
  }
}
```

**5. Talk to it**

> *Join channel `abc123` and design a pricing page with a 12-column grid, a dark and light theme as variables, and a toggle that animates between monthly and yearly.*

## Tools

New in Figma Forge:

| Tool | What it does |
|---|---|
| `build_tree` | Builds a whole node tree in one call: frames, text, shapes, components, instances and SVG, with auto-layout, sizing, gradients, shadows, blur, any font, styles, variables, grids, constraints, min/max sizes, masks and export settings. The root is built hidden and revealed when done. |
| `create_styles` | Creates or updates paint, text and effect styles. |
| `create_variables` | Creates variable collections with modes (`COLOR`, `FLOAT`, `STRING`): real design tokens that Dev Mode exposes as CSS variables. |
| `combine_variants` | Turns components into a component set. |
| `set_reactions` | Prototype interactions: click / hover / press / timeout / mouse enter-leave → change-to, navigate, scroll-to, overlay or back, with Smart Animate and custom `cubic-bezier` easing. |
| `set_flows` | Sets presentation flows on a page. |
| `set_image_fill_cached` | Image fills from local files; each image is sent only once per session. |
| `create_page`, `ping` | Utilities. |
| `run_code` | Runs any Figma Plugin API code inside the plugin and returns the result. |

Plus the original toolkit: reading documents and selections, annotations, text replacement, instance overrides, auto-layout setters, connectors, exports and more.

## Examples

Run any example against an open Figma file:

```bash
bun client/forge.ts examples/01-product-card.ts --channel <code>
```

| Example | Shows |
|---|---|
| [`01-product-card.ts`](examples/01-product-card.ts) | A polished card in one `build_tree` call |
| [`02-animated-toggle.ts`](examples/02-animated-toggle.ts) | A component set wired with Smart Animate; press *Present* and click it |
| [`03-tokens.ts`](examples/03-tokens.ts) | Variables with Dark/Light modes bound to a frame |
| [`04-run-code.ts`](examples/04-run-code.ts) | The escape hatch: anything the Plugin API can do |

A taste of `build_tree`:

```ts
await send("build_tree", { tree: {
  type: "FRAME", name: "Card", w: 360, sizeV: "HUG", radius: 28,
  fills: [{ type: "GRADIENT_LINEAR", angle: 90, stops: [{ pos: 0, color: "#2F2333" }, { pos: 1, color: "#211824" }] }],
  effects: [{ type: "DROP_SHADOW", color: "#000", opacity: 0.35, y: 40, blur: 90, spread: -20 }],
  layout: { mode: "VERTICAL", gap: 16, pad: 24 },
  children: [
    { type: "TEXT", sizeH: "FILL", text: { chars: "Hello", font: "Inter", weight: "SemiBold", size: 24, letterSpacing: -2, color: "#FFF1E6" } },
    { type: "INSTANCE", componentId: "12:34" },
  ],
} });
```

And a micro-interaction:

```ts
await send("set_reactions", { items: [{
  nodeId: offVariant,
  reactions: [{ on: "click", to: onVariant, nav: "CHANGE_TO", anim: "SMART_ANIMATE", duration: 0.35, easing: [0.22, 1, 0.36, 1] }],
}] });
```

## Tips for professional results

- **Build in one call.** `build_tree` sets sizing before children are added and keeps the root hidden until it's finished, so Figma doesn't relayout the canvas on every node. That's the difference between seconds and minutes on large frames.
- **Name layers consistently across variants.** Smart Animate matches layers by name; keep `Eye/L`, `Label`, `Icon` and so on identical between states.
- **Use styles and variables, not raw hex.** Agents produce far more coherent work when every value comes from a token.
- **Install the fonts you design with.** The plugin can use any font Figma Desktop can see.

## Security and privacy

- The relay listens on **127.0.0.1** only.
- The plugin sends **no analytics** and talks only to the local relay.
- `run_code` executes inside *your* Figma session with the plugin's permissions. Only connect agents you trust.

## Credits

Figma Forge is a fork of [sonnylazuardi/cursor-talk-to-figma-mcp](https://github.com/sonnylazuardi/cursor-talk-to-figma-mcp), released under the MIT license. Thanks to Sonny Lazuardi and its contributors for the original bridge.

## License

[MIT](LICENSE)

TDQS

C2.9/5.0

Scored across 54 tools

Disambiguation2/5

Several tools have unclear boundaries or near-duplicate purposes: read_my_design duplicates get_selection, get_node_info/get_nodes_info/get_document_info overlap, and set_annotation/set_multiple_annotations plus delete_node/delete_multiple_nodes differ mainly by cardinality. The broad build_tree and run_code escape hatches also overlap nearly every individual creation/editing tool, making tool selection less predictable.

Naming Consistency4/5

Most tool names follow a clear snake_case verb_noun convention such as create_frame, set_fill_color, get_styles, and delete_node. There are minor deviations like ping, read_my_design, run_code, and join_channel, but the overall pattern remains highly readable.

Tool Count1/5

With 54 tools, the surface is far beyond a well-scoped 3-15 tool set and exceeds the rubric's 50+ extreme-mismatch threshold. Many cardinality variants and convenience wrappers could be consolidated without losing core Figma capabilities.

Completeness4/5

The surface covers a wide Figma lifecycle: node creation/read/update/delete, layout, styles, variables, components, annotations, prototyping, export, and a run_code escape hatch. Minor gaps exist around variable/style inspection or deletion and page management, but run_code prevents hard dead ends.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues