figma-react
v1.0.3An MCP server that converts Figma designs into React code.
An MCP (Model Context Protocol) server that converts Figma design nodes (frames, text, shapes, auto-layout) directly into production-ready React / CSS-in-JS components. This isn't just a basic REST API wrapper—it handles complex design token logic and CSS extraction: - Auto Layout to Flexbox: Converts Figma's layout modes, alignments, padding, and UI gaps seamlessly into perfectly structured CSS Flexbox code. - Typography: Maps weights, absolute font sizes, exact colors, and text alignments. - Tokens: Processes shape fills, borders (strokes), opacity layers, and corner radiuses.
Summary extracted from the README.
Figma to React MCP Server (@manansiingh/figma-react-mcp-server)
An MCP (Model Context Protocol) server that converts Figma design nodes (frames, text, shapes, auto-layout) directly into production-ready React / CSS-in-JS components.
This isn't just a basic REST API wrapper—it handles complex design token logic and CSS extraction:
- Auto Layout to Flexbox: Converts Figma's layout modes, alignments, padding, and UI gaps seamlessly into perfectly structured CSS Flexbox code.
- Typography: Maps weights, absolute font sizes, exact colors, and text alignments.
- Tokens: Processes shape fills, borders (strokes), opacity layers, and corner radiuses.
Setup & Usage with MCP Clients (Cursor, Windsurf, Claude)
Because this package is published globally on the MCP Registry and npm, you don't even need to install it. Standard MCP-compatible clients can run it automatically via npx.
1. Requirements from Figma
Whenever you prompt your AI to generate code, you simply provide it:
- Figma Token (
figmaToken): Generate a Personal Access Token from Figma (Settings → Personal Access Tokens). - File Key (
fileKey): The unique string identifier found in your Figma URL (e.g.figma.com/file/your_file_key_here/...). - Node ID (
nodeId): Found in the URL when you select a specific component/frame (e.g.,?node-id=1:2).
2. General Configuration
Add this to your MCP configuration file (like claude_desktop_config.json or your IDE's agent settings):
{
"mcpServers": {
"figma-to-react": {
"command": "npx",
"args": [
"-y",
"@manansiingh/figma-react-mcp-server"
]
}
}
}
3. Using it
Once integrated, simply ask your agent!
"Use the figma-to-react tool to convert the Node '123:4' in my file 'abcxyz' to a React component. My Figma API token is 'figd_XXXXXXXXX'."
How it Works
The server exposes one very powerful MCP tool:
generate_react_component: Takes your API key, hits the official Figma REST API, parses the geometry and absolute bounding boxes of the internal nodes, and recursively returns pure React JSX Code.