Figma To Code MCP
Transform Figma design data into a compact, LLM-friendly format for code generation and UI building.
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)
- ✅ CSS-aligned property names (backgroundColor, flexDirection, etc.) matching LLM training data
- ✅ Complete UI-building data preserved (layout, styling, text, components)
- ✅ Inline styles - no separate dictionaries to parse
- ✅ Omits Figma internals - no bounding boxes, constraints, or prototype data
Example transformation:
- This project: Returns CSS-aligned nodes with
display: "flex",backgroundColor: "rgba(...)", etc.
Give Cursor and other AI-powered coding tools access to your Figma files with this Model Context Protocol server.
Figma To Code MCP optimizes the Figma data specifically for LLM UI building by converting Figma's internal format to CSS-aligned properties while reducing response size by up to 99.5%.
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.
This MCP server transforms Figma API data into an LLM-friendly format:
- CSS property names (
backgroundColor,flexDirection,fontSize) instead of Figma internals - Inline styles directly in nodes (no separate dictionaries)
- Flexbox primitives for layout (no absolute positioning)
- Complete UI data (colors, typography, spacing, effects)
- 99.5% size reduction while preserving all UI-critical information
See V2_CSS_PROPERTY_MAPPING.md for complete property mapping details.
Getting Started
Many code editors and other AI clients use a configuration file to manage MCP servers.
The tmegit-figma-to-code-mcp server can be configured by adding the following to your configuration file.
NOTE: You will need to create a Figma access token to use this server. Instructions on how to create a Figma API access token can be found here.
MacOS / Linux
{
"mcpServers": {
"Figma To Code MCP": {
"command": "npx",
"args": ["-y", "@tmegit/figma-to-code-mcp", "--figma-api-key=YOUR-KEY", "--stdio"]
}
}
}
Windows
{
"mcpServers": {
"Figma To Code MCP": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@tmegit/figma-to-code-mcp",
"--figma-api-key=YOUR-KEY",
"--stdio"
]
}
}
}
Or you can set FIGMA_API_KEY and PORT in the env field.
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.