MCP Figma to Code
Integrates with Figma to extract design metadata, chunks, and assets, enabling conversion into pixel-perfect React + Tailwind components with visual validation.
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., "@MCP Figma to Codeconvert the dashboard design to React + Tailwind"
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.

MCP Figma to Code
Transform Figma designs into pixel-perfect React + Tailwind components using the Model Context Protocol
Features โข Quick Start โข Documentation โข Contributing
https://github.com/user-attachments/assets/823e50c7-fb4d-4ea2-a6da-b2a8413bf1a7
๐ธ Dashboard Interface
Modern dashboard built with shadcn/ui - featuring real-time analytics, test management, and MCP status monitoring
Related MCP server: Figma MCP Server
โ ๏ธ Project Status
MVP in Active Development - This tool works great for most designs, but some edge cases are still being refined.
โ What Works
Complex Figma layouts with automatic chunking
Gradients, shadows, blend modes, stroke alignment
Design token extraction (colors, fonts, spacing)
Visual validation with Puppeteer
Interactive dashboard with shadcn/ui components
Real-time MCP connection monitoring
๐ง Roadmap
Component variants support
Animation & interaction states
Advanced component library mapping
Better handling of deeply nested components
Contributions welcome! โญ Star the repo โข ๐ Report bugs โข ๐ก Suggest features โข ๐จ Submit PRs
๐ Features
๐ฏ Pixel-Perfect Conversion
Visual Fidelity - Automated validation ensures code matches Figma design exactly
Smart Chunking - Handles designs of any size by splitting into manageable pieces
11 AST Transforms - Specialized Babel transforms optimize generated code
Advanced Graphics - Full support for gradients, shadows, blend modes, custom shapes
Design Tokens - Automatic CSS variables for colors, spacing, typography
๐ Dual Output Modes
Mode | Files | Purpose |
Fixed |
| Tailwind-based (requires safelist config) |
Clean |
| Pure CSS, zero dependencies, copy/paste ready |
Both versions generated automatically via CLI --clean flag or dashboard.
๐ Modern Dashboard (shadcn/ui)
New Architecture:
Built with shadcn/ui + Radix UI primitives
Dark/Light mode with system preference detection
i18n support (EN/FR) with language switcher
Sidebar navigation with collapsible menu
Charts & Analytics - Timeline, KPIs, test statistics
Pages:
Dashboard - KPIs, charts, recent activity
Analyze - Launch new Figma analyses with real-time logs
Export Figma - Grid/List view with pagination, sorting, filtering
Export Figma Detail - 4-tab interface (Preview, Code, Report, Technical)
Features:
Responsive preview with slider (320px โ 1920px)
Syntax-highlighted code viewer
Visual fidelity report (Figma vs Web)
Real-time API usage tracking
MCP connection status indicator
๐ง Developer Experience
MCP Protocol - Direct Figma Desktop integration (no API keys)
Docker Support - One-command setup with hot reload
TypeScript - Full type safety across codebase
Modular Architecture - Features organized by domain
๐ฑ Responsive Merge (Multi-Screen Fusion)
Combine 3 Figma screens (Desktop, Tablet, Mobile) into a single responsive component:
Intelligent Merging - Detects common components across breakpoints
Pure CSS Media Queries - No framework dependencies, works everywhere
Conflict Detection - Identifies and resolves className conflicts
Modular Output - Generates
Page.tsx+Subcomponents/structurePuck Integration - Visual editor-ready components
Visual Reports - Side-by-side comparison across breakpoints
Process:
Export 3 Figma screens (Desktop 1440px, Tablet 960px, Mobile 420px)
Use dashboard to create a responsive merge
Get a single responsive component with media queries
Visual editor (Puck) for easy customization
For details: See Responsive Merge Guide
Simple Form With Visible Comamand Line
Grid list of all exported Code
View list of all exported Code
Detailled exported page with responsive merge preview
๐ Quick Start
Prerequisites
Tool | Version | Purpose |
Docker + Docker Compose | Latest | Container runtime (recommended) |
MCP Figma Desktop | Latest | Figma integration server (port 3845) |
Node.js (optional) | 20+ | For local development |
Installation (Docker)
# 1. Clone repository
git clone https://github.com/vincegx/Figma-to-Code.git
cd Figma-to-Code
# 2. Start Docker (dependencies install automatically inside container)
docker-compose up --build
# 3. Open dashboard
# http://localhost:5173That's it! ๐ The dashboard is now running.
For Developers (Optional)
If you want IDE support (IntelliSense, linting):
# Install dependencies locally (optional - for IDE only)
npm install
# Note: Chromium is NOT downloaded (configured in .npmrc)
# The app MUST run in Docker for full functionality (MCP + Puppeteer)Verify MCP Connection
# Check MCP server is accessible
curl http://localhost:3845/mcp
# Dashboard should show: ๐ข MCP ConnectedYour First Analysis
Ensure Figma Desktop is running
Open dashboard at http://localhost:5173
Navigate to Analyze page
Paste your Figma URL:
https://www.figma.com/design/FILE_ID?node-id=X-YClick "Launch Export"
Watch real-time logs in the modal
View results in the Export Figma page
Reprocessing Exports (No MCP Calls)
Already have an export but need to regenerate files? Use the reprocess command:
# Find your export ID
ls src/generated/export_figma/
# Example: node-8132-3793-1763118767
# Reprocess with Tailwind version only
./cli/figma-reprocess node-8132-3793-1763118767
# Reprocess with both Tailwind + Clean versions
./cli/figma-reprocess node-8132-3793-1763118767 --cleanWhat it does:
Re-runs AST transformations (Phase 2)
Recaptures web screenshot (Phase 3)
Regenerates reports and dist package (Phase 4)
Uses existing
Component.tsx(no MCP calls = faster)
Use cases:
Modified transform configuration and want to re-apply
Need clean version but forgot
--cleanflag initiallyScreenshot failed and want to retry
Testing transform changes during development
๐ Documentation
Comprehensive guides available in the /docs folder:
Guide | Description |
Detailed system architecture, tech stack, pipeline flow | |
Developer guide, adding transforms, contributing | |
Complete AST transform reference | |
Multi-screen fusion, responsive pipeline, Puck integration | |
Common issues and solutions | |
REST API & SSE endpoints documentation | |
AI assistant guidance (for Claude Code) |
Quick Links
Architecture:
Development:
Usage:
Reprocessing Exports - Regenerate files without MCP calls
๐ก How It Works
4-Phase Pipeline
Phase 1: EXTRACTION (MCP)
โโ Connect to Figma Desktop (port 3845)
โโ Extract metadata.xml (hierarchy)
โโ Extract parent-wrapper.tsx
โโ Extract chunks (1s delay between calls)
โโ Save design tokens, screenshot
Phase 2: PROCESSING (AST)
โโ Organize images (Figma names)
โโ Process each chunk:
โ โโ Parse to AST
โ โโ Apply 11 transforms (priority 10-100)
โ โโ Extract CSS
โโ Consolidate chunks โ Component-fixed.tsx
โโ Merge CSS โ Component-fixed.css
โโ Generate clean version โ Component-clean.tsx/css
โโ Optimize CSS/TSX โ Component-optimized.tsx/css (sync-optimizer.js)
โโ Split components โ components/*.tsx/css (if --split-components)
Phase 3: VALIDATION (Visual)
โโ Launch Puppeteer
โโ Render at exact dimensions
โโ Capture web-render.png
Phase 4: OUTPUT (Reports)
โโ metadata.json (dashboard)
โโ analysis.md (technical)
โโ report.html (visual comparison)Responsive Merge Pipeline
Multi-Screen Fusion - Combines 3 Figma exports into one responsive component:
Phase 1: DETECTION & VALIDATION
โโ Validate 3 exports have modular/ directory
โโ Detect common components across breakpoints
โโ Extract component order from Desktop metadata.xml
โโ Extract helper functions from Desktop
Phase 2: COMPONENT MERGING (Responsive AST)
โโ Parse Desktop, Tablet, Mobile TSX โ AST
โโ Run 7 responsive transforms (priority 10-70):
โ โโ Detect missing elements
โ โโ Normalize className formatting
โ โโ Detect className conflicts
โ โโ Merge Desktop-first (base + overrides)
โ โโ Add horizontal scroll
โ โโ Reset conflicting properties
โ โโ Inject visibility classes
โโ Inject helper functions if needed
โโ Fix image paths (./img/ โ ../img/)
Phase 3: CSS MERGING
โโ Desktop styles (baseline, no media query)
โโ Tablet overrides (@media max-width: 960px)
โโ Mobile overrides (@media max-width: 420px)
โโ Compile responsive classes to pure CSS
Phase 4: PAGE GENERATION
โโ Merge Page structure from 3 Component-clean.tsx
โโ Replace <div data-name> with <ComponentName />
โโ Generate Page.tsx + Page.css
โโ Generate Puck components (visual editor)
โโ Create visual report + technical analysisOutput: responsive-merger-{timestamp}/ with Page.tsx, Subcomponents/, puck/, and reports.
For details: See Responsive Merge Guide
Key Concepts
Adaptive Processing: Two modes automatically selected based on design complexity:
Simple Mode - Direct processing for small, valid designs (4 MCP calls)
Chunk Mode - Split processing for large/complex designs (5+N MCP calls)
Single-Pass AST: Transforms sorted by priority (10โ100), all execute in one traversal for performance.
Dual Output:
-fixed uses Tailwind utilities, -clean uses pure CSS classes.
Visual Validation: Puppeteer captures web render at exact Figma dimensions for pixel-perfect comparison.
Responsive Merge (Multi-Screen):
Three key strategies power the responsive merge system:
Desktop-First Approach - Desktop layout serves as baseline, Tablet/Mobile become progressive overrides via media queries
Component Matching - Automatically detects common components across breakpoints by name (e.g., "Header" present in Desktop, Tablet, Mobile)
Conflict Resolution - Uses
data-nameattributes and positional matching to identify corresponding elements, then merges classNames intelligentlyMedia Query Generation - Calculates CSS differences between breakpoints, generates optimized
@mediarules (Desktop โ Tablet @960px โ Mobile @420px)Helper Injection - Extracts shared utilities (like
formatCurrency(), icon components) from Desktop and auto-injects where neededPure CSS Output - Compiles responsive classes (
max-md:w-80) to pure CSS, zero dependenciesPuck Integration - Visual editor for drag-and-drop customization post-merge
Example workflow:
Desktop (1440px) โ Export with --split-components
Tablet (960px) โ Export with --split-components } โ Responsive Merge
Mobile (420px) โ Export with --split-components
Result: Page.tsx + Subcomponents/ with media queriesFor more details: See Architecture Guide and Responsive Merge Guide
๐ฆ Output Structure
Single-Screen Export
Each analysis creates a folder in src/generated/export_figma/:
node-{id}-{timestamp}/
โโโ Component-fixed.tsx # Tailwind version
โโโ Component-fixed.css # Consolidated CSS
โโโ Component-clean.tsx # Pure CSS version (if --clean)
โโโ Component-clean.css # Production CSS (if --clean)
โโโ chunks-fixed/ # Processed chunks
โ โโโ Header.tsx
โ โโโ Header.css
โโโ img/ # Organized images
โโโ metadata.json # Dashboard metadata
โโโ analysis.md # Technical report
โโโ report.html # Visual comparison
โโโ figma-render.png # Reference screenshot
โโโ web-render.png # Validation screenshotResponsive Merge (Multi-Screen)
Each responsive merge creates a folder in src/generated/responsive-screens/:
responsive-merger-{timestamp}/
โโโ Page.tsx # Main page component
โโโ Page.css # Consolidated CSS with media queries
โโโ Subcomponents/ # Modular responsive components
โ โโโ Header.tsx # Desktop-first with responsive classes
โ โโโ Header.css # Media queries: tablet/mobile
โ โโโ Hero.tsx
โ โโโ Hero.css
โ โโโ Footer.tsx
โ โโโ Footer.css
โโโ img/ # Images (from Desktop export)
โ โโโ logo.png
โ โโโ hero-bg.jpg
โโโ puck/ # Puck visual editor
โ โโโ components/ # Puck-wrapped components
โ โ โโโ Header.tsx
โ โ โโโ Hero.tsx
โ โ โโโ Footer.tsx
โ โโโ config.tsx # Puck configuration
โ โโโ data.json # Initial Puck data
โโโ responsive-metadata.json # Merge stats + transformation details
โโโ responsive-analysis.md # Technical analysis report
โโโ responsive-report.html # Visual comparison (Desktop/Tablet/Mobile)Key files:
Page.tsx- Main page importing all subcomponentsSubcomponents/*.tsx- Modular components with responsive classNames*.css- Pure CSS with media queries (no Tailwind dependencies)puck/- Visual editor for drag-and-drop customization
๐ง Configuration
Environment Variables
# Puppeteer
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
# MCP Server (default values)
MCP_SERVER_HOST=host.docker.internal
MCP_SERVER_PORT=3845
# API Server
PORT=3000Transform Configuration
Enable/disable transforms in scripts/config.js:
export const defaultConfig = {
'font-detection': { enabled: true },
'auto-layout': { enabled: true },
'ast-cleaning': { enabled: true },
// ... 8 more transforms
}Docker Ports
# docker-compose.yml
ports:
- "5173:5173" # Dashboard + API๐ Troubleshooting
MCP Not Connected?
# 1. Verify Figma Desktop is running
# 2. Check MCP server
curl http://localhost:3845/mcp
# 3. Check from Docker
docker exec mcp-figma-v1 curl http://host.docker.internal:3845/mcpImages Not Appearing?
# Re-organize images
docker exec mcp-figma-v1 node scripts/post-processing/organize-images.js \
src/generated/export_figma/node-{id}Need to Regenerate Files?
# Reprocess existing export (no MCP calls)
./cli/figma-reprocess node-{id}-{timestamp}
# With clean version
./cli/figma-reprocess node-{id}-{timestamp} --cleanComponent Won't Load?
# Check for syntax errors
docker exec mcp-figma-v1 npm run lint
# Check browser console (F12)For comprehensive troubleshooting: See Troubleshooting Guide
๐ค Contributing
We welcome contributions! Here's how to get started:
Quick Contribution Workflow
# 1. Fork & clone
git clone https://github.com/YOUR_USERNAME/Figma-to-Code.git
# 2. Create feature branch
git checkout -b feature/amazing-feature
# 3. Make changes & test
npm run lint
npm run build
docker-compose up --build
# 4. Test with real Figma designs
./cli/figma-analyze "https://www.figma.com/design/..."
# 5. Commit & push
git commit -m "feat: add amazing feature"
git push origin feature/amazing-feature
# 6. Open Pull RequestContribution Areas
๐ Bug Fixes - Fix edge cases, improve stability
โจ Features - Add new transforms, improve pipeline
๐ Documentation - Improve guides, add examples
๐จ UI/UX - Enhance dashboard components
๐งช Testing - Add tests, validate edge cases
For detailed guidelines: See Development Guide
๐ Resources
Project Links
External Documentation
Model Context Protocol - MCP specification
Figma MCP Server - Figma Desktop integration
shadcn/ui - UI component library
Babel AST - AST parsing docs
Tailwind CSS - Utility classes reference
๐ License
This project is licensed under the MIT License - see LICENSE file for details.
MIT License - Copyright (c) 2025 MCP Figma to Code Contributors๐ Acknowledgments
Anthropic - Model Context Protocol & Claude
Figma - Design tool & MCP server implementation
shadcn - Beautiful UI component library
React Team - React 19
Tailwind Labs - Tailwind CSS
All Contributors - Thank you! ๐
Made with โค๏ธ by Vince
โญ Star this repo if you find it useful!
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/vincegx/Figma-to-Code_MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server