
Figma To Code Mcp
io.github.felixAnhalt由 GitHub 账号 felixAnhalt 发布v0.29.0更新于 Oct 24, 2026
LLM-optimized Figma MCP server.
发布方自己的服务:Figma MCP Server
概览
以紧凑、对齐 CSS 的格式获取 Figma 设计数据,让助手能根据 Figma 链接生成界面代码。
- 可以做什么
- 将 Figma 文件、画板或分组数据转换为便于大模型使用的结构,采用 CSS 属性名、内联样式和 flexbox 布局原语,并去除 Figma 内部元数据。工具包括 get_figma_design(获取优化后的设计数据)、get_image_fills(获取图片填充 URL)、render_node_images(将节点渲染为 PNG)和 read_vector_svg(以 SVG 读取矢量节点数据)。还支持将 SVG 导出到指定目录,并把 Figma 变量解析为实际值。
- 适用场景
- 当你希望 AI 编程助手根据 Figma 设计实现界面,并需要把设计数据精简到代码生成所需的内容时使用。适合在 Cursor 等编辑器中把 Figma 链接粘贴到对话里的前端工作流。
- 运行要求
- 通过 npm 包 @tmegit/figma-to-code-mcp 以 stdio 在本地运行,需要 Node.js 18 或更高版本。需要 Figma 个人访问令牌,通过 FIGMA_API_KEY 或 --figma-api-key 参数提供,权限范围包括 file_content:read 和 library_content:read;file_variables:read 为可选,变量解析需要 Enterprise 套餐。需要访问 Figma API 的网络连接。
安装
在 SourceWeft 中
- 打开 控制台中的 Figma To Code Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Figma To Code MCP
Transform Figma design data into a compact, LLM-friendly format for code generation and UI building.
[weekly downloads] [MIT License]Why This Project?
Figma To Code MCP specializes in extracting only the information LLMs need to build UIs while removing Figma-specific metadata that isn't relevant for code generation. The result:
- ✅ 99.5% size reduction on real Figma files (65 MB → 128 KB)
- ✅ Compact, CSS-mappable fields (
style.background,layout.direction,style.fontSize) - ✅ Complete UI-building data preserved (layout, styling, text, components)
- ✅ Node-local layout and styles with reusable values in a shared token registry
- ✅ Omits Figma internals - no bounding boxes or constraint metadata
- ✅ Variable resolution - resolves Figma variables to actual values
- ✅ SVG support - exports vector graphics to disk
- ✅ Pattern collapsing - deduplicates repeating UI patterns
Give Cursor and other AI-powered coding tools access to your Figma files with this Model Context Protocol server.
Available Tools
get_figma_design exports SVG assets automatically. Its response contains svgAssetsFolder and relative svgPathInAssetFolder filenames; combine them to locate each file. Use svgOutputDir to export directly to a chosen assets directory. It also renders the requested node as a 1x PNG: its response contains renderedDesignNodeAssetsFolder and the file name renderedDesignNodePathInAssetFolder, which you can use to compare the built result with the design. There is no separate registered read_vector_svg tool.
By default get_figma_design returns the components the design uses in componentSets, each with propKeys and propValues (the values each prop takes across the set's members). Every set is written to its own file in componentSetsFolder, as YAML or JSON to match the output format, and componentSets lists each set's file, propKeys and propValues. A set larger than 228 KB becomes a folder named after the set: its file is <set>/index.yaml (index.json in JSON output), which lists the variants, and each variant is its own <nodeId>.yaml beside it, with : replaced by - (for example 7-770.yaml). These examples assume the default YAML output; with JSON output every file ends in .json. A COMPONENT_SET root gets the same treatment: when its variants exceed 228 KB, its children move out, root.file points at <name>/index.yaml, and each variant is a <variant name>.yaml beside it, since root variants carry no node id. Every file value is relative to componentSetsFolder, so a variant's file is <set>/<nodeId>.yaml, not relative to its set folder. A large SECTION root keeps each frame as a stub in root.children, and each frame's design is in its file in framesFolder (see Resolving frame files). For building components from a component library, pass includeComponentVariants: true to also get every other variant of those components (all sizes, colors, and states), with their props and any visuals that can be fetched. That fetches more from Figma and returns a larger response.
With --skip-image-downloads, only get_figma_design is registered; SVG export remains available, and no node PNG is rendered.
Required Scopes
Create a Figma personal access token with these scopes:
Note: Variable resolution requires Enterprise plan. Set
resolveVariables: falseif not on Enterprise.
If comment access is unavailable, extraction continues without comments and logs a warning.
How it works
- Open your IDE's chat (e.g. agent mode in Cursor).
- Paste a link to a Figma file, frame, or group.
- Ask Cursor to implement the design.
- Cursor fetches CSS-aligned, LLM-optimized design data and generates accurate code.
Agents that build a page from a design should follow For LLMs.
This MCP server transforms Figma API data into an LLM-friendly format:
- Compact layout/style fields (
layout.direction,style.background,style.fontSize) instead of verbose Figma internals - Node-local styles with every distinct design value referenced from the
tokensregistry - Flexbox primitives for auto-layout, with parent-local positioning for overlays and freeform graphics
- Complete UI data (colors, typography, spacing, effects)
- 99.5% size reduction while preserving all UI-critical information
The current response uses schema v3. V3_CSS_PROPERTY_MAPPING.md describes the older v2 mapping, not the current response contract.
Interpreting visual details in v3
The response includes optional fields for details that cannot be represented by one text style or a simple flex layout:
The existing full text field and node-level style remain present. When textRuns exists, render its runs in order rather than rendering text a second time. Resolve the node's base typography token first, then apply each run's scalar overrides. Run text concatenates to the original full text; plain runs inherit the base style. Explicit normal, none, and zero values reset inherited styling.
For positioned children, keep the emitted containing block, local dimensions, and offsets. Real auto-layout siblings stay in flex flow; overlay notifications, chart curves, and guides can share an absolute coordinate space. A Figma layout mode of NONE is not converted into a flex column.
borderWidths replaces the uniform borderWidth for asymmetric strokes. Apply the shared border color only to the indicated edges; do not invent a surrounding box border. Uniform borders continue using borderWidth.
Gradient handles may lie outside the unit square; do not clamp them or discard them in favor of a default direction.
SVG exports keep original node-local coordinates and include the union of the local canvas and visible geometry. Each exported node's svgViewport matches the file's viewBox. Keep the node's original layout footprint as a wrapper, then place the SVG or image at svgViewport.x / y (a missing one means 0), with the viewport's width / height. Do not stretch this expanded asset to the original node dimensions: chart series can have different ink bounds but must share the same local coordinate system. Preserve ancestor clipping. Solid paint colors are baked into design-exported assets so external images retain their colors too.
For LLMs
Follow this section when you build a page or component from a Figma node with get_figma_design.
Response overview
Responses are large. Full pages in testing were 200–360 KB, so read root in parts rather than all at once.
The reference picture
renderedDesignNodePathInAssetFolder is a 1x PNG of the requested node. It shows the design as Figma renders it, and it is the reference for both building and checking.
- Open the PNG before you write code. For a component set it shows every variant in a grid; for a frame it shows the frame.
- Use it to split the page into sections, then match each section to a part of
root.children. - Render your build at the same width and compare it with the PNG section by section. Keep fixing until the differences are gone or you can explain them.
- For a frame, the PNG's pixel width equals the frame's layout width (for example 410 px for a 410 px frame).
- The PNG is missing when the server runs with
--skip-image-downloads, when Figma returns no image, or when the download fails. Without it, say that the visual check was skipped instead of guessing.
Process: from design to page
- Fetch one node per breakpoint. A frame named like
Startseite (XS)is one breakpoint. Fetch each breakpoint you need separately. - Use a fresh export folder per design. Pass
svgOutputDir. The folder receives the SVGs, the PNG andcomponent-sets/. Files from earlier runs stay there, so don't reuse a folder for a different design. - Read the reference picture and list the page's sections.
- Plan components. Make one component per repeated section or per
componentname. UsecomponentSets[name].propValuesto see each component's variant options. - Map tokens once. Create one theme file that maps each token key the page uses to a CSS variable or theme value. Don't copy hex values into each element.
- Build section by section. Map
layoutto flex:direction,gap,padding,width,height,grow,alignandjustify. Use absolute positioning only wherelayout.positionisabsolute, withleftandtoprelative to the parent. - Render text from
text. WhentextRunsexists, render its runs in order over the base typography token and don't rendertextagain (see Interpreting visual details). - Place vectors by viewport. For each vector, load the file named by
svgPathInAssetFolderfromsvgAssetsFolder. Position it atsvgViewport.xandy(a missing value means 0) and size it tosvgViewport.widthandheight. Don't stretch it to the node size. - Handle image fills. If a node uses an image fill, such as a photo or screenshot, call
get_image_fillsto get its download URL. - Verify the build against the reference picture, as described above.
- Ask when the target stack, the breakpoints or the expected output are unclear, instead of guessing.
Resolving component files
root.file,componentSets[name].fileand thefileentries in an index file are relative tocomponentSetsFolder. Join them to that folder instead of guessing a location.- Names become file names by replacing each run of characters other than
A–Z,a–z,0–9and_with one-. For example,Variant=Start 1, Color=DefaultbecomesVariant-Start-1-Color-Default.json, and node7:770becomes7-770.json. These examples use JSON output; with the default YAML output the extension is.yaml. - Use the key from
componentSetsas written. Keys can include a library reference in brackets, such asheadline-combo [zd1Yd…/3574:6]. Read thefilevalue rather than building the path from the key.
Resolving frame files
- A
SECTIONroot whose frame children together exceed 228 KB keeps each frame as a stub inroot.children, with itsname, itstypeand afile. The full frames are written toframesFolder. fileis relative toframesFolder. Join them to read a frame. The frame file holds the full frame node and only the tokens it uses.- Frame file names follow the naming rule above, with the output extension. Frames that share a name get
-2,-3and so on, such asCronjobs-2.yaml. - A section whose frames stay under 228 KB, or that holds anything other than frames, stays inline with no
framesFolder.
Pitfalls
Root node … not found: the node ID is wrong or the file can't be read. Convert the URL'snode-id=519-8870to519:8870, and check that the node exists in that file.- Repeated calls: the server caches a design for 5 minutes for the same inputs. Keep the first response instead of fetching again. Changing
includeComponentVariants,resolveVariablesor the credentials fetches again. interactionsdescribe prototype hover and click targets. Ignore them unless the build needs that behavior.
Getting Started
Many code editors and other AI clients use a configuration file to manage MCP servers.
This server requires Node.js 18 or later.
The tmegit-figma-to-code-mcp server can be configured by adding the following to your configuration file.
MacOS / Linux
Windows
Or you can set FIGMA_API_KEY and PORT in the env field.
HTTP mode
Omit --stdio to serve Streamable HTTP at /mcp and legacy SSE at /sse with messages posted to /messages. Concurrent clients have independent MCP sessions; closing one does not close the others. Library-variable prefetch is shared across sessions using the same configured credentials.
For embedded use, startHttpServer(host, port, server) still accepts a server returned by this package's createServer. For a custom McpServer, pass a per-session factory as the third argument to support concurrent clients; a single external instance remains single-session.
createServerFactory(auth, options) prepares shared configuration once. If you add custom tools, register them on every server returned by your factory: registrations added to a single supplied instance are not copied to its generated siblings. Custom asynchronous factories must settle so shutdown can finish cleaning up pending connections.
The default host is 127.0.0.1. These endpoints do not add client authentication; do not expose them to an untrusted network without an authenticated proxy.
Configuration
The server reads configuration from CLI flags and environment variables. If both are set, the CLI flag wins.
Notes:
--library-file-keysandFIGMA_LIBRARY_VARIABLE_PREFETCH_FILE_KEYSare comma-separated Figma library file keys.FIGMA_MCP_CACHE_PATHmay point to either a JSON file or a directory. The server adds a credential fingerprint before.jsonto isolate cached library variables, for examplefigma-mcp-library-cache.<fingerprint>.jsoninside a directory. Existing unscoped cache files are not reused by server startup.- The library cache is used only when library file keys are configured.
FIGMA_MCP_REFRESH_CACHEforces a re-fetch on startup even if a cache file exists.
Example .env:
API Calls & Rate Limits
On a design-cache miss, get_figma_design can make these API calls:
Request counts vary with the number of unique component keys, libraries, node batches, and retries. Components from multiple libraries are supported; unavailable library metadata falls back to usable instance data.
Requests are paced per Figma tier so no tier exceeds its per-minute budget (10, 25, and 50 requests for tiers 1, 2, and 3 on Professional Dev/Full seats). If Figma still answers with a 429, only that tier pauses for the Retry-After time, and the request is retried up to three times. A GET that fails at the network level is retried once through curl, which helps behind corporate proxies. The retry runs in the same request slot, so it still counts once against the tier budget.
Compatible design-cache hits avoid these Figma calls but still export assets, including the node PNG, into the requested directory. The PNG is downloaded from Figma's image URL, which is not a Figma API call. Changing credentials or result-affecting options does not reuse an incompatible design response.
Effective styles are read from node properties, including node-specific overrides. The tool does not make a separate /styles request. The library's existing fetchStyles export and styleMap parameter remain available for compatibility; shared-style names are not currently emitted in the design response.
For Professional plan with Dev/Full seat: 10 req/min (Tier 1), 25 req/min (Tier 2), 50 req/min (Tier 3).
Star History
Acknowledgment
This project was initially inspired by the ideas explored in the original Figma Context MCP by GLips: https://github.com/glips/figma-context-mcp
While the original project provides a Model Context Protocol (MCP) server that simplifies Figma data for use with AI coding agents, this implementation has been substantially redesigned with a different data model, API, and processing approach, and should be considered an independent system.
来源:README.md,提交 abf851d
工具
0版本历史
1- v0.29.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
其他 Figma 集成

Figma MCP Server
com.figma.mcp官方发布者
Figma 官方远程 MCP 服务器,为 AI 编程助手提供 Figma 设计上下文,用于生成和更新代码。

Figma Vector MCP
由 GitHub 账号 workingmodel 发布
本地 MCP 服务器加 Figma 插件,让助手在 Figma 画布上创建和编辑可完全编辑的矢量节点、形状、文本与组件。

Figma CodeKit MCP
由 GitHub 账号 Mehmoodqureshi 发布
把 Figma 画板转换为 HTML、React 或 Next.js 代码,并将渲染结果与设计稿做像素比对,反复迭代直至收敛。

figma-mcp
由 GitHub 账号 Mehmoodqureshi 发布
把 Figma 画板确定性地转换为 HTML、React 或 Next.js 代码,在 Chromium 中渲染并与设计稿做像素比对,直到一致。

figma-vault
由 GitHub 账号 NBhey 发布
本地 MCP 服务器,让助手读取一次性拉取到本地库中的 Figma 设计,离线可用,无需 Figma 令牌,也不受速率限制。