OpenFigma MCP

v0.5.0
io.github.mishafyi/openfigma-mcp Checked 2 days ago Published 3 days ago

Read and edit Figma files from any MCP agent through a Figma plugin, a session per file, no relay

Quick Start · What's New · Installation · Usage · Tools · Architecture · Development An MCP server and a Figma plugin that let AI agents read and edit Figma and FigJam files: pages, layers and what they're made of, components and their properties, styles and variables, text, auto layout, annotations, prototype reactions, and exports as images. The plugin runs in the Figma desktop app. OpenFigma MCP is a fork of Talk to Figma MCP by sonnylazuardi, with no relay to run, a session per file, 22 more tools and design-system guides.

Summary extracted from the README.

English · 日本語 · 한국어 · 简体中文

OpenFigma MCP

Read and edit Figma files from Claude Code, Cursor or any MCP agent.

Building an app from a Figma design? Let your agent read the file itself, and edit it with you.

npm version MCP tools Node.js MCP Registry skills.sh Figma plugin MIT license

Quick Start · What's New · Installation · Usage · Tools · Architecture · Development

npx -y @mishafyi/openfigma-mcp


An MCP server and a Figma plugin that let AI agents read and edit Figma and FigJam files: pages, layers and what they're made of, components and their properties, styles and variables, text, auto layout, annotations, prototype reactions, and exports as images. The plugin runs in the Figma desktop app.

OpenFigma MCP is a fork of Talk to Figma MCP by sonnylazuardi, with no relay to run, a session per file, 22 more tools and design-system guides.

🚀 Quick Start

Claude Code

claude mcp add OpenFigma-MCP -- npx -y @mishafyi/openfigma-mcp

Other clients: Installation.

Figma

The plugin comes from this repository: clone it (git clone https://github.com/mishafyi/OpenFigma-MCP.git) or download it with GitHub's Code → Download ZIP.

  1. In the Figma desktop app, Plugins → Development → Import plugin from manifest…, then pick src/plugin/manifest.json in it.
  2. Open a file and run Plugins → Development → OpenFigma MCP. Its window lists the sessions it's connected to.

Figma starts a plugin only when someone runs it: run it again after reopening the file.

Ask your agent

Join Figma file <file key> and list the components on its Buttons page.

The file key is the ID after /design/ in the file's URL.

🆕 What's New

OpenFigma MCP keeps all 44 tools of Talk to Figma MCP, changes how sessions reach Figma, adds 22 tools and design-system guides, and fixes commands that timed out, failed without saying so or left layers behind.

🔌 No relay, a session per file

Talk to Figma MCP needs a WebSocket relay started by hand (bun socket) and a channel name copied from the plugin into the session. In OpenFigma each MCP server listens for the plugin itself, on the first free port from 3155 to 3164, and the plugin connects to every session on its own. A session picks its file with join_channel and the file key: its commands go only to that file and the answers come back only to that session, so several sessions can work in several files at once.

A session that starts later is found through one already connected, which lists the ports that have servers, so the plugin doesn't keep trying empty ports and Figma's console stays free of failed connections.

🎨 Design-system aware

  • Node info says what a layer is made of: an instance's main component, component set, property values, description and documentation link; style names; text styles per range; bound variables by name; auto layout without Figma's defaults, and Figma's inferred auto layout for frames without it.
  • get_components_by_page lists each page's component sets and loose components with their descriptions and documentation links; set_documentation_links sets or clears links in one batch.
  • kits/ holds a guide per design-system kit, and the server's instructions point every session to it. kits/ios-ipados-27.md says how Apple's iOS and iPadOS 27 kit becomes SwiftUI; each kit element links to its page in Apple's Human Interface Guidelines, which Apple Docs 2.0 MCP reads.

🧰 22 more tools

Area Tools
Pages create_page, set_current_page
Shapes and vectors create_ellipse, create_svg, create_slice, boolean_operation, group_nodes, ungroup_node
Styling set_gradient_fill, set_effects (Liquid Glass included), set_node_properties, set_text_style, apply_style, bind_color_variable, get_variables
Components get_components_by_page, set_documentation_links, get_instance_properties, set_instance_properties, detach_instance, create_component_from_node
Export export_node_to_file

🛠️ Fixes

  • Long commands finish while Figma is hidden: the plugin pauses with a message round trip instead of timers, which Chromium runs once a minute in a hidden window. A 47-page component listing that timed out takes 214 ms.
  • Progress from get_reactions, scan_nodes_by_types, delete_multiple_nodes and create_connections reaches the session, so long runs don't time out at 30 seconds.
  • Errors come back as Figma's own messages, such as a font it can't load, and as tool errors, so the agent sees what failed.
  • A create tool that fails leaves nothing behind, such as an empty text layer when its font can't load.
  • A colour with alpha 0 stays transparent.

✨ Features

  • 📄 Read designs: the document, its pages, the selection and any node with what it's made of
  • 🧩 Components: instances, variants and properties, overrides copied between instances, documentation links
  • ✏️ Create: frames, sections, shapes, text in any installed font, SVG as vectors, slices and pages
  • 🎨 Style: solid and gradient fills, images, strokes, corner radii, effects with Liquid Glass, local styles and colour variables
  • 📐 Auto layout: direction and wrap, padding, alignment, sizing and spacing
  • 🔤 Text: list a frame's text, replace it in bulk and restyle it, inside instances too
  • 📝 Annotations: Figma's native annotations, read and written in bulk
  • 🔀 Prototypes: read reactions and draw them as connector lines
  • 🖼️ Export: PNG, JPG, SVG or PDF, into the conversation or to a file
  • 📚 Design-system guides: one per kit, named in every session's instructions

📦 Installation

Each client runs the server from npm with npx, on Node.js 18 or later.

claude mcp add OpenFigma-MCP -- npx -y @mishafyi/openfigma-mcp

Claude Code's server names allow only letters, numbers, hyphens and underscores, hence OpenFigma-MCP.

📖 Claude Code MCP docs

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "OpenFigma-MCP": {
      "command": "npx",
      "args": ["-y", "@mishafyi/openfigma-mcp"]
    }
  }
}

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "OpenFigma-MCP": {
      "command": "npx",
      "args": ["-y", "@mishafyi/openfigma-mcp"]
    }
  }
}

📖 Cursor MCP docs

Add to .mcp.json at the root of your workspace, VS Code's portable format:

{
  "mcpServers": {
    "OpenFigma-MCP": {
      "command": "npx",
      "args": ["-y", "@mishafyi/openfigma-mcp"]
    }
  }
}

📖 VS Code MCP docs

Add to your Zed settings.json:

{
  "context_servers": {
    "OpenFigma-MCP": {
      "command": "npx",
      "args": ["-y", "@mishafyi/openfigma-mcp"],
      "env": {}
    }
  }
}

📖 Zed MCP docs

💬 Usage Examples

📄 Reading

"Describe the selected frame: its layout, styles and components"
"List the components on each page with their documentation links"
"Which colour variables does this file define, in light and dark?"

✏️ Creating and editing

"Create a 390×844 frame named Home with vertical auto layout and 16 px padding"
"Draw this SVG icon inside the selected frame"
"Give the card a drop shadow and a 12 px corner radius"

🧩 Components

"Switch every button on this page to its Secondary variant"
"Copy the overrides of the selected card onto the other cards"
"Link each component on the Toggles page to its guideline page"

🔤 Text and annotations

"Replace the placeholder text on this screen with real copy"
"Turn the numbered notes beside this screen into Figma annotations"

🔀 Prototypes and export

"Draw this page's prototype flows as connector lines"
"Export the selected frame as a PNG at 2x"

🛠️ Available Tools

📄 Document and selection

Tool What it does
get_document_info Every page of the document, and the current page's top-level nodes
set_current_page Switches Figma to a page, by its ID or name, and gets its top-level nodes
get_selection The selected nodes: ID, name, type and visibility
read_my_design Each selected node's details, as get_node_info gives them
get_node_info A node and its subtree as Figma's REST JSON, trimmed, with what it's made of: component (an instance's main component, component set, property values, description and documentation link), styles, textStyles per range, variables by name, layout and inferredLayout without Figma's defaults; a hidden layer has visible: false
get_nodes_info get_node_info for several nodes; IDs that aren't found are left out
set_focus Selects a node and scrolls the viewport to it
set_selections Selects nodes and scrolls the viewport to them

✏️ Creating elements

Tool What it does
create_frame A frame, optionally with a fill, a stroke and auto layout
create_rectangle A rectangle
create_ellipse An ellipse, circle, ring (stroke without fill) or arc
create_text A text node in any installed font (fontFamily, fontStyle; Inter when unset), with alignment, fixed width, line height and letter spacing
create_svg Vector layers from SVG markup, like Figma's SVG import: lines, arrows, paths, icons
create_section A section to group related content on the canvas
create_slice An export region over whatever lies under it, for export_node_to_file
create_page A page (a Starter-plan file is limited to 3)

🔤 Text

Tool What it does
scan_text_nodes The text nodes inside a node: text, font, position, size and layer path
set_text_content Replaces a text node's text
set_multiple_text_contents Sets the text of several text nodes, five at a time
set_text_style Changes a text node's font, size, alignment, line height, letter spacing or sizing, inside an instance too

📐 Auto layout and spacing

Tool What it does
set_layout_mode A frame's auto layout direction (NONE, HORIZONTAL, VERTICAL) and wrap
set_padding An auto-layout frame's padding
set_axis_align An auto-layout frame's primary and counter axis alignment
set_layout_sizing An auto-layout frame's horizontal and vertical sizing (FIXED, HUG, FILL)
set_item_spacing The spacing between an auto-layout frame's children, and between wrapped rows

🎨 Styling

Tool What it does
set_fill_color Replaces a node's fills with one solid colour (RGBA, 0–1)
set_stroke_color Replaces a node's strokes with one solid colour, and sets the weight (1 when unset)
set_gradient_fill Replaces a node's fills with a linear, radial, angular or diamond gradient
set_image_fill Fills a node with an image from a file path, a URL or base64 data (FILL, FIT, CROP or TILE)
set_corner_radius A node's corner radius, on all corners or the chosen ones
set_effects Replaces a node's effects with drop or inner shadows, layer or background blur, or Liquid Glass
set_node_properties A node's opacity, visibility, rotation, blend mode, clipping, lock, stroke alignment, dashes or corner smoothing

🗂️ Layout and organization

Tool What it does
move_node Sets a node's position, relative to its parent
resize_node Resizes a node
set_parent Moves a node into another parent (a section, frame or group), keeping its position on the canvas unless x and y are given
clone_node Duplicates a node into the same parent, on top of its siblings
rename_node Renames a node
group_nodes / ungroup_node Groups nodes, or ungroups a group or frame keeping its children
boolean_operation Combines shapes with union, subtract, intersect or exclude
delete_node / delete_multiple_nodes Deletes one node, or several

🧩 Components, styles and variables

Tool What it does
get_components_by_page Each page's component sets and the components outside sets, with their descriptions and documentation links; variants only when they have a description or link of their own
get_local_components Every local component: ID, name and key
set_documentation_links Sets or clears the documentation links of components, component sets, variants and styles, in one batch, with a result per item
create_component_instance An instance of a local component, by ID, or a published one, by key
get_instance_properties / set_instance_properties An instance's variants and its boolean, text and instance-swap properties, with every allowed value
get_instance_overrides An instance's overrides
set_instance_overrides Copies a source instance's overrides onto target instances, switching each to the source's main component
detach_instance Detaches an instance into a plain frame, and any instances it sits in
create_component_from_node Turns a node into a component
get_styles The document's local colour, text, effect and grid styles
apply_style Applies a local fill, stroke, text or effect style
get_variables The local variables by collection, with each one's value in every mode
bind_color_variable Binds a fill or stroke colour to a local colour variable, by ID or name

📝 Annotations

Tool What it does
get_annotations The annotations on a node and its descendants
set_annotation Sets a node's annotation, in Markdown, replacing any it has
set_multiple_annotations Annotates several nodes; each annotation replaces those on its node
scan_nodes_by_types A node's descendants of the given types, with their bounding boxes

🔀 Prototyping and connections

Tool What it does
get_reactions The prototype reactions (interactions) of nodes
set_default_connector Chooses the connector create_connections copies
create_connections Connects pairs of nodes with copies of the default connector, each with optional text

🖼️ Export

Tool What it does
export_node_as_image Exports a node (PNG, JPG, SVG or PDF) and returns the image in the conversation
export_node_to_file Exports a node or slice to a file on disk, keeping the image out of the conversation

🔌 Connection

Tool What it does
join_channel Chooses the file to work on, by its file key, and waits up to 10 seconds for its plugin to connect

💡 Prompts

Prompt Guides the agent through
design_strategy Working with Figma designs
read_design_strategy Reading Figma designs
text_replacement_strategy Replacing text across a design
annotation_conversion_strategy Turning annotations drawn as layers into Figma's native ones
swap_overrides_instances Copying overrides between instances
reaction_to_connector_strategy Drawing prototype reactions as connector lines with get_reactions and create_connections

🏗️ Architecture

Agent session ←(stdio)→ MCP server, first free port from 3155–3164 ←(WebSocket)→ Figma plugin, one per open file
OpenFigma-MCP/
├── src/
│   ├── server/server.ts            # MCP server: tools, prompts and the plugin connections
│   └── plugin/                     # Figma plugin, run as is (not bundled)
│       ├── manifest.json           # The ports it may reach, one by one
│       ├── code.js                 # Runs the commands in the file
│       └── ui.html                 # Connects to the sessions and passes commands and answers
├── kits/                           # A guide per design-system kit
└── scripts/
    ├── check-sessions.ts           # Two servers side by side against a fake plugin
    └── check-design-system.ts      # The design-system tools against a copy of Apple's iOS and iPadOS 27 kit

🔌 How sessions reach Figma

  • Each MCP server, one per agent session, listens on the first free port from 3155 to 3164.
  • The plugin connects to every server that answers and tells it the file's key, the ID after /design/ in the file's URL. To find sessions that start later, it asks a connected server every 2 seconds which ports have servers.
  • join_channel picks the file. A session's commands go only to that file's plugin, and the answers come back only to that session.
  • A command waits 30 seconds for its answer, and 60 seconds after each progress update. Long commands work in chunks and report progress, so Figma's window keeps responding.

📊 Usage analytics

The plugin sends anonymous usage events to the project's Google Analytics 4 property over the Measurement Protocol: plugin_open, channel_join when it connects to a session, and command_executed per command with its name, success, duration and error message. No file content is sent. The Measurement ID and API secret are at the top of the analytics block in src/plugin/ui.html; the secret only lets its holder send events, not read or change the property.

🧪 Development

git clone https://github.com/mishafyi/OpenFigma-MCP.git
cd OpenFigma-MCP
bun install
bunx tsc --noEmit                                         # types
bun run build                                             # tsup into dist/, what npm ships

# Run your clone in Claude Code in place of the npm package
claude mcp add OpenFigma-MCP -- bun "$PWD/src/server/server.ts"

bun scripts/check-sessions.ts                             # two sessions against a fake plugin
bun scripts/check-design-system.ts <file key> [check …]   # the design-system tools in a real file

check-design-system.ts needs the plugin running in a copy of Apple's iOS and iPadOS 27 kit; it works in a scratch frame and puts back every link it changes.

Figma runs src/plugin/code.js and ui.html as they are, and reloads the plugin when either is saved while it runs. After changing the server, reconnect it in your MCP client (/mcp in Claude Code).

🙏 Credits

OpenFigma MCP builds on Talk to Figma MCP by sonnylazuardi, published by Grab, whose plugin, tools and prompts it started from. dusskapark contributed its bulk text replacement (demo) and instance override propagation (demo).

🤝 Contributing

Contributions are welcome:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

📄 License

MIT License, as the original project: see LICENSE.

⚠️ Disclaimer

This project is not affiliated with or endorsed by Figma, Inc.