Back to projects

Open source (Apr – Jun 2026)

Figma MCP Bridge

A developer tool for people who have AI implement screens: it hands over the Figma design itself, so nobody has to describe colors and spacing in words.

I built an MCP server and Figma plugin that let AI code editors such as Claude Code and Codex read the design open in Figma Desktop. Because it goes through the plugin API, the layout, colors, and text settings of whatever is selected right now can be handed over without looking up node IDs.

Period
2026.04 - 2026.06
Format
Team project (3 people), open source
Team
Blueberry Team · 3 people
Role
Implemented the MCP server that links AI editors to the Figma plugin over WebSocket, and added a tool that writes a whole page out as a map file plus Codex CLI setup.
Tech stack
TypeScript, MCP SDK, ws (WebSocket), Figma Plugin API

Reading from the open file, not the REST API

The Figma REST API can also return specific nodes if you pass their IDs. But that means picking the file key and node IDs out of URLs and setting up a personal token. And the REST API cannot tell what is selected on screen right now.

This tool reads from a Figma Desktop plugin instead. The AI editor launches the MCP server over stdio, and the server opens a WebSocket on port 3055. The plugin UI connects to it, forwards each request to the main thread with postMessage, and reads nodes through the plugin API.

That lets it answer "implement the element I have selected" without any node ID. Local color, text, and effect styles can be listed straight from the plugin API too. Reading the design needs no token.

The cost is that Figma Desktop must be open with the plugin running. Comments cannot be read or answered through the plugin API, so that part alone still uses the REST API and a token.

stdioWebSocket :3055replies matched by UUIDpostMessageAI editorClaude Code etc.MCP serverTypeScriptPlugin UIFigmaMain threadPlugin API
The path from an AI editor to the Figma nodes it reads (illustrates the section above).

Matching replies to requests over one WebSocket

An AI editor may call several tools in a row, and the plugin's replies do not always come back in order. The MCP server gives each request a UUID and stores it in a pending table before sending it. The plugin replies with the same ID, and the server resolves the waiting call by that ID.

Timeouts differ by operation: 30 seconds for normal reads, 60 seconds for image exports, and 120 seconds for a full-page export. If the plugin disconnects, every pending request ends with an error, so the AI editor does not keep waiting after Figma is closed.

The amount of data has three levels: minimal returns only names and sizes, standard adds the fills, spacing, and text settings needed to implement, and full includes design-token bindings. Default values such as visible: true are dropped from the output.

Handing over a whole page at a size AI can read

While implementing a Flutter sample app from its design, I needed the structure of a whole page, not one screen. But the server automatically lowers detail in deep or crowded parts of the tree to keep responses small, so a full page could not be fetched without gaps.

I bypassed the automatic downgrade, read every node at full detail, and wrote the result to a file instead of the MCP response. The response carries only the file path and a summary: node count, counts by type, and maximum depth.

Exporting one real design page (13,269 nodes) produced a 21MB full JSON and a 3MB map. The exported SVGs and PNGs were used as assets in the Flutter app. On some image nodes the plugin's export call still hangs; I split that off as a separate issue.

Implementation details
  • Alongside the full JSON, it writes a "map" JSON for the AI to open first. The map keeps only containers such as frames and components, plus text. Shapes such as vectors and rectangles are folded into per-type counts on their parent.
  • The AI uses the map to understand the structure, then fetches only the nodes it needs at full detail. The full JSON is consulted only when a detail needs checking.
  • Assets such as icons can be saved straight into a chosen folder. SVG comes back as text rather than base64, because the Claude API cannot handle SVG as an image.
Figma MCP Bridge running screen

Recommending the global config for Codex

I added a config skeleton for Codex CLI and wrote the steps into the Japanese, English, and Korean READMEs. The Codex Desktop app does not load a project's own config file, so the guide recommends the global config. The config holds a Figma token, so the project config file is in .gitignore.