Skip to main content
Glama
figma-mcp
by ivn4k

figma-mcp

Локальный MCP-сервер, через который AI-агент (OpenCode, Claude Code, Cursor, Claude Desktop) читает и редактирует открытый файл в Figma. Сервер связывается с плагином Figma по WebSocket на вашем компьютере. Токен Figma API для подключения не требуется.

AI-клиент ──stdio──► figma-mcp (Node) ──WebSocket :3055──► плагин «Figma MCP Bridge» (ui.html ⇄ code.js) ──► Figma Plugin API
  • Читать можно: страницы, выделение, дерево слоёв, поиск, стили, переменные, компоненты, скриншоты (PNG/JPG/SVG/PDF).

  • Менять можно: создание целых деревьев (auto layout, текст, картинки, SVG, инстансы), изменение свойств, удаление, клонирование, группировка, компоненты/варианты, булевы операции, переключение страниц и выделения, а для всего остального есть произвольный JavaScript Plugin API.

  • Изменения слоёв за один вызов инструмента можно отменить одним шагом в Figma (Ctrl+Z или ⌘Z).

Требования

  • Node.js 20+

  • Figma Desktop: импорт плагина из manifest.json работает только в приложении.

Related MCP server: Talk to Figma MCP

Установка

Клонируйте репозиторий или распакуйте архив исходников. В каталоге с package.json выполните

npm ci

Команда установит зависимости из package-lock.json и соберёт сервер (dist/server/index.js) и плагин (plugin/code.js). Оставьте каталог на месте после настройки клиента и плагина.

Плагин в Figma (один раз)

  1. Откройте любой файл в Figma Desktop.

  2. Меню → Plugins → Development → Import plugin from manifest…

  3. Выберите файл plugin/manifest.json из каталога проекта.

Подключение к AI-клиентам

Выберите свой клиент. В примерах замените /path/to/figma-mcp/dist/server/index.js абсолютным путём к собранному серверу. Следующая команда выводит путь из каталога проекта. В примерах JSON для Windows используйте прямые слеши, например C:/projects/figma-mcp/dist/server/index.js.

node -p "require('node:path').resolve('dist/server/index.js')"

OpenCode 2. Зарегистрируйте сервер и проверьте соединение. Документация OpenCode

opencode mcp add figma --global -- node "/path/to/figma-mcp/dist/server/index.js"
opencode mcp list

Для ручной настройки добавьте сервер в mcp.servers файла opencode.json.

{
  "mcp": {
    "servers": {
      "figma": { "type": "local", "command": ["node", "/path/to/figma-mcp/dist/server/index.js"] }
    }
  }
}

Claude Code. Зарегистрируйте сервер для своего пользователя. Документация Claude Code

claude mcp add --scope user --transport stdio figma -- node "/path/to/figma-mcp/dist/server/index.js"

Cursor (~/.cursor/mcp.json) и Claude Desktop (claude_desktop_config.json). Добавьте запись figma в раздел mcpServers и перезапустите клиент.

{
  "mcpServers": {
    "figma": { "command": "node", "args": ["/path/to/figma-mcp/dist/server/index.js"] }
  }
}

Проверка подключения

  1. В нужном файле Figma откройте Plugins → Development → Figma MCP Bridge.

  2. Запустите настроенный AI-клиент. Он запустит сервер, а в окне плагина появится зелёный индикатор «Подключено к MCP-серверу».

  3. Выделите слой и попросите агента описать выделение. Оставьте окно плагина открытым на время работы.

Инструменты

Инструмент

Что делает

get_status

Подключён ли плагин, какие файлы открыты, какой активный

select_file

Выбрать активный файл, если плагин запущен в нескольких

get_document

Файл, страницы, текущая страница, выделение, верхние фреймы

get_selection

Выделенные слои с деталями (depth, detail: outline/full)

get_nodes

Слои по id с поддеревом

find_nodes

Поиск по имени, regex, типу, тексту (на странице или во всём файле)

get_styles

Локальные стили: цвет, текст, эффекты, сетки

get_variables

Коллекции и переменные со значениями по режимам

get_components

Компоненты и наборы вариантов со свойствами

export_image

PNG/JPG как картинка для агента, SVG-разметка, PDF в файл (savePath)

create_nodes

Создать деревья узлов одним вызовом (FRAME, TEXT, IMAGE, SVG, INSTANCE, COMPONENT, PAGE…)

update_nodes

Изменить свойства, перенести в другого родителя

delete_nodes

Удалить

clone_nodes

Дублировать

restructure_nodes

group / ungroup / wrap_in_frame / to_component / combine_as_variants / create_instance / flatten / union / subtract / intersect / exclude / detach_instance

set_selection

Выделить, переключить страницу, приблизить

execute_code

Произвольный JS внутри плагина (figma.* + помощники getNode, setProps, serialize, parseColor, loadFonts, log)

Удобства в свойствах: цвета строкой ("#RRGGBB", "#RRGGBBAA", rgba()), градиенты с angle, картинки по локальному пути (imagePath) или URL (сервер сам скачает и передаст), шрифты подгружаются автоматически (fontFamily + fontWeight/fontStyle), padding сокращённо, стили и переменные по имени, свойства инстансов без суффикса #id. Ошибка в одном свойстве не ломает весь вызов: такие ошибки приходят в warnings.

Примеры запросов агенту

  • «Опиши, что выделено в Figma, и сделай скриншот».

  • «Создай карточку товара 360×480 с auto layout: фото из C:\pics\shoe.jpg, заголовок Inter Bold 24, цена, кнопка».

  • «Перекрась все кнопки на странице в переменную brand/primary».

  • «Найди все тексты со словом "Lorem" и замени на нормальный текст».

Несколько файлов и клиентов

  • Плагин можно запустить в нескольких файлах. Команды уходят в активный: по умолчанию это последний подключившийся. Сменить его можно кнопкой «Сделать активным» в окне плагина или попросить агента (select_file).

  • Если сервер запущен несколькими клиентами (или OpenCode открыт в нескольких проектах), первый процесс держит порт (хаб), остальные подключаются к нему как пиры. Если хаб закрылся, его место занимает следующий процесс, а плагин переподключается сам.

Порт

По умолчанию 3055. Другой порт задаётся переменной FIGMA_MCP_PORT (или аргументом --port) у сервера и полем «Порт» в настройках плагина. В manifest.json разрешены 3055–3059; для другого порта добавьте его в devAllowedDomains.

Безопасность

  • Сервер слушает только 127.0.0.1/::1 и проверяет заголовок Host. Мост доверяет локальным процессам. Запускайте его на компьютере, где вы доверяете другим пользователям и программам.

  • Подключение «плагином» разрешено только без Origin, с Origin: null (так подключается iframe плагина) или с *.figma.com; обычные сайты получат 403. Роль mcp разрешена только клиентам без Origin (не браузерам).

  • Ограничение: страница в песочнице с null-origin теоретически может выдать себя за плагин. Не держите плагин и сервер запущенными без надобности на чужих машинах.

  • Через execute_code агент может выполнить JavaScript с правами плагина в открытом файле. Сервер также читает файлы по указанным путям, скачивает изображения по URL и записывает экспорт в savePath. Существующий файл по этому пути будет перезаписан.

  • Текст слоёв и скриншоты возвращаются в AI-клиент. Обработка этих данных у поставщика модели зависит от настроек клиента.

Разработка

npm run build   # server/*.ts → dist/server, plugin/src/code.ts → plugin/code.js
npm run check   # проверка типов сервера и плагина
npm test        # plugin-test (code.js в фейковом figma) + smoke-test (MCP + мост + фейковый плагин)

После изменения исходников выполните npm run build. Если изменился плагин, закройте и снова запустите его в Figma. Если изменился сервер, перезапустите его в MCP-клиенте.

Если не работает

Симптом

Что сделать

Плагин: «MCP-сервер не найден»

Сервер запускает AI-клиент: откройте чат с агентом. Проверьте opencode mcp list / http://127.0.0.1:3055/status

Агент: «Figma plugin is not connected»

Запустите плагин в файле: Plugins → Development → Figma MCP Bridge

Команды уходят не в тот файл

«Сделать активным» в окне нужного файла

Порт занят чужой программой

Другой порт: FIGMA_MCP_PORT + поле «Порт» в плагине

Текст не меняется / ошибка шрифта

Шрифт не установлен или стиль называется иначе: ошибка подскажет доступные начертания

Лицензия

Проект распространяется по лицензии MIT.

Available Tools

17 tools
clone_nodesDuplicate nodesC

Duplicate nodes. Without parentId the copy stays next to the original; top-level copies on a page are shifted right by default.

Inputs: ids (required), offsetX, offsetY, parentId.

create_nodesCreate nodesA

Create one or more node trees in one call (one undo step). Returns the new ids. NODE SPEC: {type, ...PROPS, children?: [NODE SPEC]}. type: FRAME (default) | RECTANGLE | ELLIPSE | LINE | POLYGON | STAR | TEXT | COMPONENT | SECTION | GROUP (needs children) | SVG (svg: "<svg…>" or svgPath) | IMAGE (rectangle with an image fill: imagePath | imageUrl | imageBase64, scaleMode; natural size when width/height omitted) | INSTANCE (componentId of a COMPONENT/COMPONENT_SET, or componentKey of a library component) | PAGE (top level only). Nested frames get no fill unless fills are given (top-level frames: white). Auto-layout frames hug their content on axes without width/height; plain frames without size grow to fit their children. TEXT: width without height → fixed width, wrapping. Top-level nodes without x/y are placed to the right of existing content. Example: {"type":"FRAME","name":"Card","layoutMode":"VERTICAL","padding":24,"itemSpacing":12,"cornerRadius":16,"fills":["#FFFFFF"],"effects":[{"type":"DROP_SHADOW","color":"#0000001A","offset":{"x":0,"y":4},"radius":16}],"children":[{"type":"TEXT","characters":"Title","fontFamily":"Inter","fontWeight":700,"fontSize":24},{"type":"TEXT","characters":"Body","fontSize":14,"fills":["#666666"],"layoutSizingHorizontal":"FILL"}]}

PROPS (all optional):

  • Geometry: name, x, y, width, height, rotation, opacity, visible, locked, constraints, blendMode.

  • fills / strokes: array of "#RRGGBB" | "#RRGGBBAA" | "rgba(r,g,b,a)" | {type:"SOLID", color, opacity?, variable?} | {type:"GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", stops:[{color, position}] or ["#hex", ...], angle? (linear only, degrees: 0 = left→right, 90 = top→bottom)} | {type:"IMAGE", imagePath (local file) | imageUrl | imageBase64, scaleMode?: "FILL"|"FIT"|"CROP"|"TILE"}. [] removes all. Shorthand: fill / stroke = single paint.

  • strokeWeight, strokeAlign ("INSIDE"|"OUTSIDE"|"CENTER"), dashPattern, cornerRadius (number or [tl,tr,br,bl]).

  • effects: [{type:"DROP_SHADOW"|"INNER_SHADOW", color, offset:{x,y}, radius, spread?} | {type:"LAYER_BLUR"|"BACKGROUND_BLUR", radius}].

  • Auto layout (FRAME/COMPONENT): layoutMode ("HORIZONTAL"|"VERTICAL"|"GRID"|"NONE"), itemSpacing, padding (number | [vertical, horizontal] | [top,right,bottom,left] | {top,right,bottom,left}), primaryAxisAlignItems ("MIN"|"CENTER"|"MAX"|"SPACE_BETWEEN"), counterAxisAlignItems ("MIN"|"CENTER"|"MAX"|"BASELINE"), layoutWrap ("WRAP"|"NO_WRAP"), counterAxisSpacing, clipsContent.

  • Inside an auto-layout parent: layoutSizingHorizontal / layoutSizingVertical ("FIXED"|"HUG"|"FILL"), layoutPositioning ("ABSOLUTE"), layoutGrow.

  • TEXT: characters, fontFamily, fontStyle ("Bold", "Medium Italic"…), fontWeight (100-900), fontSize, lineHeight (px | "150%" | "auto"), letterSpacing (px | "2%"), textAlignHorizontal ("LEFT"|"CENTER"|"RIGHT"|"JUSTIFIED"), textAlignVertical, textAutoResize ("WIDTH_AND_HEIGHT"|"HEIGHT"|"NONE"|"TRUNCATE"), textCase, textDecoration, paragraphSpacing, hyperlink (url). Fonts are loaded automatically. Partial styling: rangeStyles [{text: "substring" | start, end, fontFamily?, fontStyle?, fontWeight?, fontSize?, fills?, textDecoration?, textCase?, letterSpacing?, lineHeight?, hyperlink?, textStyleId?, fillStyleId?}] (applied after characters).

  • Styles: fillStyleId / strokeStyleId / effectStyleId / textStyleId / gridStyleId — style id or exact local style name.

  • Variables: boundVariables {field: variableId | variable name | null}, fields e.g. fills, strokes, width, height, itemSpacing, paddingLeft, cornerRadius, opacity, characters.

  • INSTANCE: componentProperties {propName: value} (names without the #id suffix are fine), swapComponentId.

  • Any other writable Plugin API property is assigned as-is; problems are reported in "warnings" instead of failing the whole call.

Inputs: nodes (required), select, parentId.

delete_nodesDelete nodesA
Destructive

Delete nodes by id (one undo step; the user can press Ctrl+Z in Figma).

Inputs: ids (required).

execute_codeRun Plugin API codeA
Destructive

Run JavaScript inside the Figma plugin (body of an async function; use await and return a value). Full Figma Plugin API via figma (document uses dynamic page loading: use figma.getNodeByIdAsync, await page.loadAsync() before reading other pages, await figma.loadFontAsync(font) before editing text). Helpers in scope: getNode(id) (throws if missing), setProps(node, props) (same PROPS as update_nodes), serialize(node, depth=1, "full"|"outline"), parseColor("#hex") → {r,g,b,a}, loadFonts(textNode), log(...args). The returned value is JSON-serialized (nodes become {id,name,type}); log() output is returned too. One undo step. Use it for anything the other tools do not cover: styles, variables, components, prototyping, plugin data, bulk edits.

Inputs: code (required), timeoutMs.

export_imageExport / screenshotA
Read-only

Render a node (frame, layer, component; default: first selected node) to PNG/JPG and return it as an image, or export SVG markup / PDF. Use it to look at designs and verify edits.

Inputs: scale, format, nodeId, maxSize, +2 more.

find_nodesFind nodesA
Read-only

Search layers by name, type and/or text content. Returns id, name, type, parent, bounds (and text for TEXT nodes).

Inputs: name, text, limit, types, +2 more.

get_componentsLocal componentsA
Read-only

Components and component sets (with variants and property definitions) defined in this file. Use their id with create_nodes type INSTANCE.

Inputs: name, limit, allPages.

get_documentDocument overviewA
Read-only

File name, pages, current page, current selection and the top-level nodes of the current page. Good first call.

Inputs: no named parameters.

get_nodesRead nodesA
Read-only

Read nodes (frames, layers, pages; "0:0" = document) by id with their subtree up to depth. Output is capped by maxNodes (see "truncated").

Inputs: ids (required), depth, detail, maxNodes.

get_selectionRead selectionB
Read-only

Nodes currently selected by the user in Figma, with their subtree up to depth.

Inputs: depth, detail, maxNodes.

get_statusBridge statusA
Read-only

Shows whether the Figma plugin is connected, which Figma files are connected and which one is active (receives commands).

Inputs: no named parameters.

get_stylesLocal stylesA
Read-only

Local paint, text, effect and grid styles of the file (id, name, key and values).

Inputs: no named parameters.

get_variablesLocal variablesB
Read-only

Local variable collections (modes) and variables with values per mode. Colors are hex; aliases are {alias: id, name}.

Inputs: name, type, limit, collection.

restructure_nodesGroup / component / boolean opsA

Structural operations on nodes: group, ungroup, wrap_in_frame (frame around nodes, keeps positions; pass props such as layoutMode/padding), to_component (each node becomes a component), combine_as_variants (components → component set), create_instance (instance of a component placed next to it), flatten, union, subtract, intersect, exclude, detach_instance. Optional name/props are applied to the resulting node.

Inputs: ids (required), action (required), name, props, +1 more.

select_fileChoose active Figma fileA

When the plugin runs in several Figma files, choose which file receives commands (by connectionId from get_status or by file name substring).

Inputs: fileName, connectionId.

set_selectionSelect / show nodesB

Select nodes in Figma (switches page when needed) and zoom the viewport to them. A page id just switches to that page. Empty ids clears the selection.

Inputs: ids (required), zoom.

update_nodesUpdate nodesA

Change properties of existing nodes (one undo step). Also move nodes: props.parentId (+ optional props.index) re-parents. PROPS (all optional):

  • Geometry: name, x, y, width, height, rotation, opacity, visible, locked, constraints, blendMode.

  • fills / strokes: array of "#RRGGBB" | "#RRGGBBAA" | "rgba(r,g,b,a)" | {type:"SOLID", color, opacity?, variable?} | {type:"GRADIENT_LINEAR"|"GRADIENT_RADIAL"|"GRADIENT_ANGULAR"|"GRADIENT_DIAMOND", stops:[{color, position}] or ["#hex", ...], angle? (linear only, degrees: 0 = left→right, 90 = top→bottom)} | {type:"IMAGE", imagePath (local file) | imageUrl | imageBase64, scaleMode?: "FILL"|"FIT"|"CROP"|"TILE"}. [] removes all. Shorthand: fill / stroke = single paint.

  • strokeWeight, strokeAlign ("INSIDE"|"OUTSIDE"|"CENTER"), dashPattern, cornerRadius (number or [tl,tr,br,bl]).

  • effects: [{type:"DROP_SHADOW"|"INNER_SHADOW", color, offset:{x,y}, radius, spread?} | {type:"LAYER_BLUR"|"BACKGROUND_BLUR", radius}].

  • Auto layout (FRAME/COMPONENT): layoutMode ("HORIZONTAL"|"VERTICAL"|"GRID"|"NONE"), itemSpacing, padding (number | [vertical, horizontal] | [top,right,bottom,left] | {top,right,bottom,left}), primaryAxisAlignItems ("MIN"|"CENTER"|"MAX"|"SPACE_BETWEEN"), counterAxisAlignItems ("MIN"|"CENTER"|"MAX"|"BASELINE"), layoutWrap ("WRAP"|"NO_WRAP"), counterAxisSpacing, clipsContent.

  • Inside an auto-layout parent: layoutSizingHorizontal / layoutSizingVertical ("FIXED"|"HUG"|"FILL"), layoutPositioning ("ABSOLUTE"), layoutGrow.

  • TEXT: characters, fontFamily, fontStyle ("Bold", "Medium Italic"…), fontWeight (100-900), fontSize, lineHeight (px | "150%" | "auto"), letterSpacing (px | "2%"), textAlignHorizontal ("LEFT"|"CENTER"|"RIGHT"|"JUSTIFIED"), textAlignVertical, textAutoResize ("WIDTH_AND_HEIGHT"|"HEIGHT"|"NONE"|"TRUNCATE"), textCase, textDecoration, paragraphSpacing, hyperlink (url). Fonts are loaded automatically. Partial styling: rangeStyles [{text: "substring" | start, end, fontFamily?, fontStyle?, fontWeight?, fontSize?, fills?, textDecoration?, textCase?, letterSpacing?, lineHeight?, hyperlink?, textStyleId?, fillStyleId?}] (applied after characters).

  • Styles: fillStyleId / strokeStyleId / effectStyleId / textStyleId / gridStyleId — style id or exact local style name.

  • Variables: boundVariables {field: variableId | variable name | null}, fields e.g. fills, strokes, width, height, itemSpacing, paddingLeft, cornerRadius, opacity, characters.

  • INSTANCE: componentProperties {propName: value} (names without the #id suffix are fine), swapComponentId.

  • Any other writable Plugin API property is assigned as-is; problems are reported in "warnings" instead of failing the whole call.

Inputs: updates (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 17 tools

    Disambiguation4/5

    Most tools have distinct resource/action boundaries: dedicated getters for nodes, styles, variables, components, selection, and document state, plus separate mutation tools. The main overlap is execute_code acting as a universal fallback, and some creation/transform overlap between create_nodes and restructure_nodes, but descriptions clarify intended use.

    Naming Consistency5/5

    All tools use snake_case with a verb_noun pattern (get_nodes, create_nodes, update_nodes, delete_nodes, export_image, etc.). Variations such as get/find and set/select are semantically motivated rather than inconsistent.

    Tool Count4/5

    17 tools is slightly above the ideal range but reasonable for a broad Figma plugin surface covering selection, reading, creation, editing, structure, export, and file connection. Each tool maps to a meaningful operation and there is little pure duplication.

    Completeness4/5

    The surface covers core design-file lifecycle operations: inspect, create, update, clone, restructure, delete, export, and manage connections. Dedicated style/variable/component authoring is missing, but execute_code provides a documented escape hatch for those cases.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      Enables AI agents to read and modify Figma designs programmatically through WebSocket communication, supporting document manipulation, styling, text replacement, and component management.
      42
      5
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables an agent to read, edit, and build Figma designs from scratch — including style guides, variables, components, and screens — through a local plugin bridge to the open file's Plugin API, with no Figma token or REST API calls.
      21
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to read, create, edit, and organize Figma documents directly through a local plugin bridge, without needing a Figma AI subscription.
      3
      Apache 2.0