FigmaMCP

How FigmaMCP is built: architecture, design choices and fixes

This page describes the FigmaMCP architecture for people who build or run AI agents. It names the parts, says why each write is checked the way it is, and lists real problems we hit while building it, with the fix for each.

If you only want to know what happens when you ask your agent for a change, read how Figma MCP works instead. That page is the short user view. This one is the build story.

The FigmaMCP architecture in five parts

A request goes down a chain of five parts. Each hop has one job. The agent never touches the Figma file directly.

FigmaMCP architecture diagram Five boxes in a column. The AI agent calls a tool on the local MCP server over stdio. The server sends the command over a WebSocket to a relay on localhost. The FigmaMCP plugin in the Figma desktop app connects out to the same relay, receives the command, checks scope, names and batches, and then reads or edits the open Figma file through the Figma Plugin API. AI agent (MCP client) Claude Code or Codex MCP server (figmamcp) started by your AI app, on your Mac Relay routes commands by channel, localhost FigmaMCP plugin checks scope, names and batches Your open Figma file in the Figma desktop app tool call over stdio WebSocket plugin connects out (WebSocket) Figma Plugin API
The five parts of the FigmaMCP architecture
Part Where it runs Its job
AI agentClaude Code or CodexReads your request, picks tools, reads before it writes.
MCP serverA process your AI app starts, talking stdioLists the tools, checks the shape of each input, and forwards the call.
RelayA small local service that the Mac app keeps runningHolds a channel per open file and routes each command and its answer between one plugin and its AI sessions.
PluginInside the Figma desktop appRuns every safety check, then reads or edits the file.
Your fileFigma desktop appThe live document. You and teammates can change it at any time.

Why a relay sits in the middle

A Figma plugin cannot listen on a port. It can only connect out. The MCP server cannot connect to the plugin, so both connect to a third process, the relay, on localhost. Each channel is named after the file key. The relay keeps one plugin per channel and lets up to four AI sessions share it when the plugin allows that (FigmaMCP allows it by default). The relay checks that the server and plugin are from the same release line before it routes anything.

The relay is a separate process that the Mac app keeps running with launchd. Each AI app starts its own MCP server process, and all of them reach the one plugin for a file through the relay.

Design choices and why we made them

FigmaMCP is a fork of figma-edit-mcp by Neo Product LLC. The plugin-side safety model, scope lock, name checks and batch checks, comes from that project, and we kept all of it. FigmaMCP added the installer and Mac app, a new way to connect to the plugin, and different defaults. The table shows which is which.

Which design choices FigmaMCP kept and which it added
Choice Origin Why
Checks run in the pluginKept from upstreamThe plugin is the only layer every call must pass.
Scope locked at connect timeKept; FigmaMCP changed the default to the whole fileThe agent cannot widen what it may edit.
Name check on every writeKept from upstreamCatches stale or invented layer IDs.
Batches checked before any changeKept from upstreamOne bad item stops the batch before it starts.
Bind to the open plugin, no code to copyAdded in FigmaMCPThe only step left for a person is to open the plugin.
Patch versions work togetherAdded in FigmaMCPAn update must not break a running AI session.

The plugin is the trust boundary

The agent is not trusted to judge whether an edit is safe. It may hold an old node ID or guess a name. So the plugin checks mechanical facts it can prove: where the target is, which layer it is, what type it is and whether it is locked. The MCP server also validates input shapes, but that is only for clear early errors. A client that skips the server still meets every check in the plugin.

Scope lock

Scope is fixed when the plugin connects and stays fixed for the session. In FigmaMCP a blank link means the whole file is editable. Pages and the document root still cannot be deleted, moved or copied, and locked layers are protected. When you turn off the plugin’s AI can edit this file switch, the session is read-only and any write returns READ_ONLY_MODE. A write to a node outside a narrower scope returns OUTSIDE_SCOPE. Variables and styles have their own permission switches.

Name verification

Every write against an existing object carries that object’s current name, read from node_info, page_info, variable_list or style_list. The plugin looks up the object by ID and refuses the write if the name differs, with NAME_MISMATCH. Creation checks the parent’s name in the same way. It works like a text editor tool that refuses an edit when the old text no longer matches: the agent reads again and retries with fresh data. In a shared file someone can rename a layer between two calls, and this catches it.

Batch validation

Batch tools such as text_set_content and annotation_set check every item first: does it exist, is it in scope, does its name match, is it the right type. If one item fails, nothing changes. After the batch starts, items run in order and each gets its own result row. (node_delete gets the same first check, then deletes in parallel chunks.) We do not claim rollback: a failure in the middle returns partial_success with one row per item, and any change the plugin could not undo is reported as a partial mutation.

Structured error codes

An agent cannot recover from a vague message. So each refusal carries a code that says what to do next. Every error result is also marked as an error in the MCP response, so a client does not read it as success.

Examples of FigmaMCP error codes and the next step for the agent
Code Meaning What the agent should do
NAME_MISMATCHThe name sent does not match the layer.Read the layer again, then retry with its real name.
OUTSIDE_SCOPEThe target is outside the editable scope.Pick another target, or ask the user to reconnect.
READ_ONLY_MODEThe edit switch in the plugin is off.Tell the user. Only reads work.
CHANNEL_NOT_BOUNDThe session has no file yet, for example because several files have the plugin open.Call channel_join with a link to the right file.
CONNECTION_NOT_READYThe relay connection did not open in time.Ask the user to open the Mac app and the plugin, then retry once.
VERSION_MISMATCHServer and plugin are from different release lines.Tell the user which side is older: reconnect the AI session, or reopen the plugin.

Binding to the open plugin

Upstream paired the agent and the plugin with a short channel code that the user copied from the plugin. FigmaMCP drops that step. The plugin names its channel after the file key, and any tool call binds to the open plugin when only one file has it open. If several files are open, the call returns CHANNEL_NOT_BOUND with the list of open files, and the agent calls channel_join with a link. After a plugin reload, the next call rejoins the same file with the same scope. It never moves a session to another file.

What went wrong on the way

These are real problems from FigmaMCP’s own commits and release notes, each with the fix that shipped.

  1. An early channel_join failed with no code

    A fresh MCP server opens its relay socket in the background. A channel_join sent before the socket was open came back as UNKNOWN_ERROR “Not connected to Figma.” A tester reported it on 0.1.11.

    Fix (2026-11-17): channel_join now waits up to 5 seconds for the socket, the same wait page_info already used. If it still is not open, it fails with the coded error CONNECTION_NOT_READY. The same change marks every error result as an error.

  2. A patch update broke running AI sessions

    After an update, the plugin reloads the new version, but an AI session keeps the server process it started with. The relay refused any pair of unequal versions, so every call failed with VERSION_MISMATCH. The message told users to reinstall the plugin, which could not help.

    Fix (2026-11-11): patch releases share one wire contract, so the relay now admits the same major and minor version. A refusal names the older side and the step that fixes it.

  3. Upgrading over a running relay failed

    Setup stops the old relay with launchd and starts the new one. launchctl bootout returns before the old service is gone, so starting the new one failed with “Bootstrap error 5” until the user ran setup again.

    Fix (2026-11-09): setup retries the start while launchd removes the old relay.

  4. The plugin said “Connected” when no agent was there

    In 0.1.20 the plugin showed its first-run hint as soon as the plugin reached the relay. It said “Connected” even when no AI app had FigmaMCP loaded, so a new user could wait for an agent that was not there.

    Fix (0.1.21, 2026-11-21): the plugin waits 4 seconds for the relay’s notice that an AI session is present. Without it, the plugin tells the user to quit Claude Code or Codex and open it again.

What this means if you build agents

Download for Mac Version 0.1.25 macOS 14+ · Intel & Apple Silicon · ~155 MB

Questions

Is the FigmaMCP code public?
No. FigmaMCP’s code is private. The built Mac app and its release notes are public. The project it forks from, figma-edit-mcp, is public.
Does FigmaMCP use the Figma REST API or a Figma access token?
No. Every read and edit goes through the Figma Plugin API inside the desktop app. There is no Figma token to create.
Can an agent switch to another file in the middle of a session?
Not by itself. After a plugin reload, the next call rejoins the same file. To work on another file, the agent calls channel_join with a link to it.
Why not do the safety checks in the MCP server?
Because a client can talk to the plugin without the server’s schemas. The plugin is the only layer every call must pass, so the checks live there.
Does FigmaMCP call Figma’s own MCP server?
No. It does not call Figma’s hosted or desktop MCP server. It works only through the plugin in your open file.

Related: How Figma MCP works · Is Figma MCP safe · Changelog · Tools

Last updated: