Figma To Code MCP
Fetches Figma design data (nodes, styles, variables) and transforms it into a compact, CSS-aligned format for AI-powered code generation. Supports SVG export, image fill retrieval, node rendering as PNG, and vector SVG reading.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Figma To Code MCPConvert this Figma design to a React component"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
✅ 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.
Related MCP server: Framelink Figma MCP Server
Available Tools
Tool | Description |
| Fetches CSS-aligned, LLM-optimized design data. Supports SVG export to custom dir. |
| Retrieves image fill URLs from a Figma file |
| Renders Figma nodes as PNG images |
| Reads vector node data as SVG |
Required Scopes
Create a Figma personal access token with these scopes:
Scope | Purpose |
| Read file nodes, layout, styles |
| Read published components/styles |
| Read variables (Enterprise only, optional) |
Note: Variable resolution requires Enterprise plan. Set
resolveVariables: falseif not on Enterprise.
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 internalsInline 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.
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.
Configuration
The server reads configuration from CLI flags and environment variables. If both are set, the CLI flag wins.
Option | CLI | Env | Default |
Figma API key |
|
| required |
Figma OAuth token |
|
| unset |
Port |
|
|
|
Host |
|
|
|
Output format |
|
|
|
Skip image tools |
|
|
|
SVG output dir |
|
| temp dir |
Prefetch library variables |
|
| unset |
Cache path |
|
| temp cache file |
Cache TTL |
|
|
|
Force cache refresh |
|
| off |
Notes:
--library-file-keysandFIGMA_LIBRARY_VARIABLE_PREFETCH_FILE_KEYSare comma-separated Figma library file keys.FIGMA_MCP_CACHE_PATHmay point to either a file or a directory. If it is a directory, the cache file is stored asfigma-mcp-library-cache.jsoninside it.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:
FIGMA_API_KEY=your_figma_pat
# prefetch variables (tokens etc) from specific library files on startup to avoid T2 calls during design fetch
FIGMA_LIBRARY_VARIABLE_PREFETCH_FILE_KEYS=abc123,def456
FIGMA_MCP_CACHE_PATH=./cache
FIGMA_MCP_CACHE_TTL_MS=604800000
# Uncomment to force cache refresh on next startup
# FIGMA_MCP_REFRESH_CACHE=1API Calls & Rate Limits
One execution of get_figma_design makes the following API calls:
Call | Endpoint | Tier | Description |
1 |
| T1 | Fetch requested nodes (geometry=paths) |
2 |
| T3 | Fetch all styles |
3 |
| T2 | Fetch local variables (if resolveVariables=true) |
4 |
| T3 | Resolve component key → library file (up to 3 tries) |
5 |
| T3 | Fetch all components from library |
6+ |
| T1 | Fetch component definitions from each library |
Amount of T1 calls: 1 + N (N=number of unique library files) Amount of T2 calls: 1 (if resolveVariables=true) Amount of T3 calls: 2 + N (styles + component key resolution + N library components)
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.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/felixAnhalt/figma-to-code-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server