figma-mcp

figma-mcp

Read-only Figma MCP server that enables design-to-code workflows by talking to the Figma REST API with a personal access token, for use with Claude Code and GitHub Copilot.

Category
访问服务器

README

figma-mcp

Read-only Figma MCP server for design→code. Talks to the Figma REST API with a personal access token (PAT) over stdio, for use with Claude Code and GitHub Copilot.

Unofficial. This is a community project and is not affiliated with, endorsed by, or sponsored by Figma, Inc. "Figma" is a trademark of Figma, Inc., used here only to describe what this tool talks to. You provide your own Figma personal access token; none is bundled. Use is subject to Figma's Developer / API Terms.

Tools

  • get_file_metadata — pages + top-level child nodes (navigate first)
  • get_node — node(s) by id; component instances are collapsed with variant props, slots, and a codeConnect block when mapped
  • get_components / get_component_sets — components and variant-axis catalog
  • get_design_tokens — color/typography/effect tokens from styles (all plans)
  • get_variables — variables from an imported plugin JSON (DTCG or raw Figma)
  • get_code_connect_map / set_code_connect_map / delete_code_connect_map — Figma↔code component mappings
  • export_image — render node(s) to PNG/SVG/PDF, saved to disk
  • get_comments, parse_figma_url

Setup

  1. npm install && npm run build — compiles src/ → build/index.js (the server entrypoint).
  2. Create a Figma personal access token (Figma → Settings → Security → Personal access tokens) with at least File content: read and Comments: read scopes. It looks like figd_….
  3. Connect it to your MCP client (below).

The token goes in the X-Figma-Token HTTP header, so it must be plain ASCII. Pasting a placeholder (e.g. Thai text) fails fast with a clear error instead of an opaque ByteString crash.

Connecting

Claude Code — CLI (recommended)

Register once. Point the path at this repo's build/index.js (the entry file, not the repo folder):

claude mcp add figma -s user --env FIGMA_ACCESS_TOKEN=figd_your_token_here -- node "/absolute/path/to/figma-mcp/build/index.js"

One line, so it pastes cleanly into any shell (bash, zsh, PowerShell, cmd). Swap the path for this repo's build/index.js — on Windows use forward slashes, e.g. D:/Personal Projects/figma-mcp/build/index.js.

  • -s user → available in every project. Use -s local to scope it to the current project only.
  • Everything after -- is the command Claude Code runs to launch the server.
  • Add more env vars with extra --env KEY=value flags — -e is the short alias (see the table below).
  • Restart Claude Code afterward so the tool registry reloads.

Verify:

claude mcp list

Expected: figma · ✔ connected · 12 tools.

Claude Code / Copilot / Cursor — manual JSON

Edit the client's MCP config — Claude Code .mcp.json, GitHub Copilot .vscode/mcp.json, Cursor .cursor/mcp.json:

{
  "mcpServers": {
    "figma": {
      "command": "node",
      "args": ["<abs-path>/build/index.js"],
      "env": {
        "FIGMA_ACCESS_TOKEN": "figd_...",
        "FIGMA_CODE_CONNECT_PATH": "./figma.code-connect.json",
        "FIGMA_VARIABLES_PATH": "./figma.variables.json"
      }
    }
  }
}

On Windows, use forward slashes (D:/...) or escaped backslashes (D:\\...) in JSON. Restart the client to pick it up.

Environment variables

Variable Required Default Purpose
FIGMA_ACCESS_TOKEN yes — Figma personal access token (figd_…, ASCII)
FIGMA_BASE_URL no https://api.figma.com Override the API base URL
FIGMA_CODE_CONNECT_PATH no ./figma.code-connect.json Where the local Code Connect map lives
FIGMA_VARIABLES_PATH no — Local variables JSON (DTCG or raw Figma export)
FIGMA_OUTPUT_DIR no ./figma-exports Output directory for export_image

Quick check

Give the client a Figma URL and ask it to parse, e.g.:

Parse this Figma URL: https://www.figma.com/design/<fileKey>/<name>?node-id=1-2

It should call parse_figma_url and return { fileKey, nodeId }.

Troubleshooting

  • FIGMA_ACCESS_TOKEN is not set — the env var didn't reach the server. Re-check the -e flag / env block, then restart the client.
  • ...contains non-ASCII or whitespace — you pasted a placeholder, not a real token. Replace with a figd_… value.
  • 0 tools / not connected — confirm npm run build succeeded and args points at build/index.js.
  • 401 / 403 from Figma — token expired or missing scope; regenerate it.

Code Connect mapping

figma.code-connect.json, keyed by Figma component key:

{
  "<figmaComponentKey>": {
    "component": "FormValidated",
    "source": "@/forms/form-validated",
    "props": { "DocType": "docType", "PartnerType": "partnerType" },
    "valueMap": { "DocType": { "Z100": "z100", "Z200": "z200" } },
    "slots": { "Icon": "icon", "Content": "children" }
  }
}

Variables (non-Enterprise)

Figma's Variables REST API is Enterprise-only. On Free/Pro/Org, export variables with a community plugin to JSON (W3C DTCG or raw Figma) and point FIGMA_VARIABLES_PATH at it; get_variables normalizes it (modes + alias refs). Styles always work via get_design_tokens.

Tests

  • npm test — unit tests (no network).
  • Integration tests run only when FIGMA_ACCESS_TOKEN and FIGMA_TEST_FILE are set: FIGMA_ACCESS_TOKEN=figd_... FIGMA_TEST_FILE=<fileKey> npm test

Known v1 limitations

  • get_design_tokens color tokens are RGB hex; the alpha channel is dropped.
  • Component variant axes are derived by parsing variant names (Axis=Value); confirmed against real files via the integration test.
  • Code Connect slots are stored but not yet applied by get_node's codeConnect block — content slots are surfaced separately as slotContent, and INSTANCE_SWAP props flow through props.
  • Some Figma REST response shapes (component-set linkage, style node values, instance overrides) are best-effort and validated by the integration test against a real file.

License

MIT © chisanucha_s

Disclaimer

Not affiliated with, endorsed by, or sponsored by Figma, Inc. Provided "as is" without warranty. You are responsible for keeping your Figma access token secret and for complying with Figma's API terms and rate limits. Never commit your token or local Figma exports — .env, figma.code-connect.json, figma.variables.json, and figma-exports/ are git-ignored by default.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选