Figma MCP Complete
Exports Figma designs as ready-to-use HTML/CSS with design tokens and screenshots.
Provides a GitHub Actions workflow for automatic pixel-perfect validation on push.
Integrates with Percy.io for visual regression testing and pixel-perfect validation.
Click on "Deploy 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 MCP CompleteExport the login button frame as HTML/CSS"
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.
šØ Figma MCP Complete
By Nour Shamrok
Figma to Code MCP + Pixel Perfect Validation
Export Figma designs as ready-to-use HTML/CSS + Validate pixel-perfect accuracy āØ
š Table of Contents
Related MCP server: Sunnyside Figma MCP
šÆ Overview
Figma MCP Complete solves the biggest problem in design-to-code workflows:
The Problem ā
Figma MCP (existing):
ā Returns only JSON metadata
ā Claude guesses colors, fonts, spacing
ā Needs manual fixes
ā 30 minutes per component ā±ļø
Result: Frustration, mistakes, wasted time š«The Solution ā
Figma MCP Better (this project):
ā Returns Screenshot + CSS + HTML + JSON
ā Claude knows exactly what to build
ā Ready-to-use code
ā 30 seconds per component ā”
Result: Perfect accuracy, zero iterations šāØ Features
šØ Figma MCP Better
ā Screenshot Export - Visual reference for accuracy
ā CSS Generation - Production-ready styles
ā HTML Code - Copy-paste ready components
ā Design Tokens - Automated design system extraction
ā High DPI Support - 2x resolution for Retina displays
ā Pixel Perfect Validator
ā Image Comparison - Pixel-by-pixel accuracy checking
ā Visual Regression Testing - Percy.io integration
ā Heatmap Generation - See exact differences
ā Responsive Testing - Mobile, Tablet, Desktop
ā CI/CD Integration - GitHub Actions workflow
š Color & Typography Verification
ā RGB to Hex conversion
ā Font accuracy checking
ā Spacing validation (padding, margin, gap)
ā Shadow & effects verification
ā Border radius matching
š Installation
Prerequisites
Step 1: Download & Extract
# Download figma-mcp-complete.zip
# Extract to your desired location
cd figma-mcp-completeStep 2: Install Dependencies
# Install Node packages
npm install --save-dev playwright
# Install Python packages
pip install opencv-python numpy pillow
# Optional: For Percy.io validation
npm install --save-dev @percy/cliStep 3: Setup Environment
Create .env file:
cat > .env << 'EOF'
FIGMA_TOKEN=figd_xxxxxxxxxxxxx
SIMULATOR_PORT=3000
PERCY_TOKEN=percy_xxxxxxxxxxxxx # Optional
EOFGet your Figma Token: https://www.figma.com/developers/api#access-tokens
Step 4: Verify Installation
# Test the setup
node figma-mcp-comparison.js
# Output should show comparison of old vs new MCP ā
ā” Quick Start
Export Figma Design to HTML/CSS
# Set your Figma token
export FIGMA_TOKEN="figd_xxxxxxxxxxxxx"
# Export frame from Figma
node figma-mcp-better.js FILE_ID NODE_ID "Component Name"
# Results saved to:
# figma-export/
# āāā index.html ā Copy-paste this!
# āāā style.css ā Or this!
# āāā data.json ā Or everything here
# āāā tokens.json ā Design systemGet Figma IDs
Open your Figma file:
https://www.figma.com/file/YOUR_FILE_ID/...Copy the
FILE_IDfrom URLRight-click on a frame ā Copy link ā Extract
NODE_ID
Example:
URL: https://www.figma.com/file/abc123def456/MyDesign?node-id=789:123
FILE_ID: abc123def456
NODE_ID: 789:123Validate Design Accuracy
# Start your simulator/app
npm run start:simulator &
# Capture simulator screenshots
npm run capture:simulator
# Compare with Figma
npm run pixel-perfect
# Results:
# ā
Similarity: 99.8%
# ā
All colors match
# ā
Typography verified
# ā
Pixel Perfect!š Usage
Basic Workflow
# 1. Export from Figma
export FIGMA_TOKEN="..."
node figma-mcp-better.js FILE NODE "Button"
# 2. Get HTML/CSS
cat figma-export/index.html
# <button style="background-color: #FF5722; ...">
# 3. Copy to your project
# Done! āØAdvanced: Export Multiple Frames
// export-all.js
const BetterFigmaMCP = require('./figma-mcp-better');
const mcp = new BetterFigmaMCP(process.env.FIGMA_TOKEN);
const frames = [
{ id: '123:45', name: 'Login Button' },
{ id: '123:46', name: 'Signup Form' },
{ id: '123:47', name: 'Dashboard Header' }
];
(async () => {
for (const frame of frames) {
const result = await mcp.exportFrame(FILE_ID, frame.id, frame.name);
await mcp.saveExport(result, `./exports/${frame.name}`);
console.log(`ā
Exported: ${frame.name}`);
}
})();Run:
node export-all.jsIntegration with Claude AI
// Use with Claude API
const BetterFigmaMCP = require('./figma-mcp-better');
const figmaData = await mcp.exportFrame(fileId, nodeId);
// Claude now gets:
// - figmaData.screenshot ā Visual reference
// - figmaData.css ā Styling
// - figmaData.html ā Code
// - figmaData.designTokens ā System
// Result: Claude writes perfect code! šÆš Examples
Example 1: Button Component
export FIGMA_TOKEN="figd_xxx"
node figma-mcp-better.js abc123 "456:789" "Primary Button"Output: figma-export/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Primary Button</title>
<style>
.container {
background-color: #FF5722;
color: #FFFFFF;
font-size: 16px;
font-family: Inter;
font-weight: 700;
padding: 12px 24px;
border-radius: 8px;
box-shadow: 4px 4px 8px rgba(0,0,0,0.3);
}
</style>
</head>
<body>
<button class="container">Click me</button>
</body>
</html>Example 2: Design System Extraction
node figma-mcp-better.js abc123 "def:456" "Design System"Output: figma-export/tokens.json
{
"colors": {
"primary": "#FF5722",
"secondary": "#2196F3",
"text": "#212121"
},
"typography": {
"heading": {
"fontFamily": "Montserrat",
"fontSize": 32,
"fontWeight": 700,
"lineHeight": 1.2
},
"body": {
"fontFamily": "Open Sans",
"fontSize": 16,
"fontWeight": 400,
"lineHeight": 1.5
}
},
"spacing": {
"xs": "4px",
"sm": "8px",
"md": "16px",
"lg": "24px"
}
}Example 3: Pixel Perfect Validation
npm run pixel-perfectOutput:
šØ Comparing 5 screens...
1. login-mobile: 99.8% ā
2. dashboard-mobile: 99.5% ā
3. profile-mobile: 99.9% ā
4. settings-mobile: 99.2% ā
5. onboarding-mobile: 99.7% ā
============================================================
PIXEL PERFECT VALIDATION RESULTS
============================================================
Average Similarity: 99.62%
Threshold: 99.0%
Screens Checked: 5
ā
ALL SCREENS PASSED PIXEL PERFECT VALIDATION!š API Reference
BetterFigmaMCP Class
Constructor
const mcp = new BetterFigmaMCP(figmaToken);Methods
exportFrame(fileId, nodeId, frameName)
Export a single frame.
const result = await mcp.exportFrame(
'abc123def456',
'789:123',
'Login Button'
);
// Returns:
{
name: 'Login Button',
screenshot: 'https://...',
css: { ... },
html: '<button>...</button>',
designTokens: { ... },
json: { ... }
}saveExport(data, outputDir)
Save export to files.
await mcp.saveExport(result, './exports');
// Creates:
// ./exports/index.html
// ./exports/style.css
// ./exports/data.json
// ./exports/tokens.jsonextractCSS(node)
Extract CSS from Figma node.
const css = mcp.extractCSS(figmaNode);
// Returns: { backgroundColor, fontSize, ... }extractDesignTokens(file)
Extract design system tokens.
const tokens = mcp.extractDesignTokens(figmaFile);
// Returns: { colors, typography, spacing, shadows }ā Pixel Perfect Validation
How It Works
1. Export Figma screenshot ā figma-baseline/
2. Capture simulator screenshot ā simulator-screenshots/
3. Compare pixel-by-pixel ā reports/
4. Generate heatmap of differencesRun Validation
# Capture simulator
npm run capture:simulator
# Compare with Figma
npm run pixel-check
# Or full validation
npm run pixel-perfectThresholds
Similarity | Status | Action |
99%+ | ā PASS | Merge! |
95-99% | ā ļø REVIEW | Check heatmap |
<95% | ā FAIL | Fix design |
View Heatmap
Differences appear in reports/heatmap_*.png:
š“ Red = Large differences
š” Yellow = Small differences
šµ Blue/Green = Identical
š GitHub Actions CI/CD
Automatic Validation on Push
The project includes GitHub Actions workflow that:
ā Validates on every push
ā Checks pixel-perfect accuracy
ā Blocks merge if validation fails
ā Comments on PRs with results
Setup GitHub Actions
# Copy workflow file
.github/workflows/pixel-perfect.yml
# Commit to GitHub
git add .github/
git commit -m "Add pixel perfect CI/CD"
git push
# Set branch protection
GitHub ā Settings ā Branches
ā Require status checks to pass
ā Select "Pixel Perfect Validation"Require Pixel Perfect
Now you cannot merge without passing validation! š
PR created
ā
GitHub Actions runs
ā
Pixel Perfect test passes?
ā
ā No ā PR blocked š«
ā
ā
Yes ā Can merge ā
š Troubleshooting
Installation Issues
"npm: command not found"
# Install Node.js
https://nodejs.org/
# Verify:
node --version
npm --version"python3: command not found"
# Install Python
https://python.org/downloads
# Verify:
python3 --version"ModuleNotFoundError: No module named 'cv2'"
# Reinstall Python packages
pip install --upgrade opencv-python numpy pillowRuntime Issues
"FIGMA_TOKEN not set"
# Set token
export FIGMA_TOKEN="figd_xxxxxxxxxxxxx"
# Or create .env file
echo "FIGMA_TOKEN=figd_xxxxxxxxxxxxx" > .env"Node FILE_ID NODE_ID not found"
# Get correct IDs from Figma URL
# https://www.figma.com/file/YOUR_FILE_ID/...?node-id=YOUR_NODE_ID
# Verify they're correct
echo $FIGMA_TOKEN"Screenshots don't match"
# Check DPI consistency
# Ensure both screenshots are 2x scale (Retina)
# Manually verify
open figma-export/index.html
open reports/heatmap_*.pngPerformance
Slow export?
# Reduce resolution
node figma-mcp-better.js FILE NODE --scale=1Memory issues?
# Process one frame at a time
# Or increase Node memory
node --max-old-space-size=4096 figma-mcp-better.jsš Comparison: Old vs New
Feature | Old Figma MCP | Figma MCP Complete |
Screenshot | ā | ā |
CSS | ā | ā |
HTML | ā | ā |
Design Tokens | ā | ā |
Color Format | RGB(0-1) š© | #HEX š |
Font Size | Just number | px (web standard) |
Ready to Use | ā 30 min | ā 30 sec |
Claude Accuracy | 60% | 99%+ |
Iterations Needed | Many | Zero |
š¤ Contributing
Contributions welcome!
# Fork & clone
git clone https://github.com/YOUR_FORK/figma-mcp-complete.git
cd figma-mcp-complete
# Create branch
git checkout -b feature/amazing-feature
# Make changes
# Test thoroughly
npm test
# Push & create PR
git push origin feature/amazing-featureDevelopment
# Run tests
npm test
# Lint code
npm run lint
# Build docs
npm run docsš License
MIT License - See LICENSE file
š Acknowledgments
Built with ā¤ļø for designers and developers
Inspired by real design-to-code workflow problems
Thanks to Figma & Anthropic communities
š Support
Documentation
š Full Guide
š Pixel Perfect Guide
ā” Quick Start
Issues & Questions
š GitHub Issues
š¬ Discussions
š§ Email: shamroknour057@gmail.com
Community
š¤ Claude Community
šØ Figma Community
š» GitHub Discussions
ā If you find this useful, please star! ā
Star this repo to show support āØ
Share with your team š„
Contribute improvements ššÆ Roadmap
Web UI for exports
Figma plugin integration
Multiple design system formats
Real-time validation
Browser extension
Cloud storage integration
š Stats
ā
Lines of code: 5000+
ā
Supported Figma nodes: 15+
ā
Export formats: 5+ (HTML, CSS, JSON, etc)
ā
Validation accuracy: 99%+
ā
Performance: <30s per componentMade with ā¤ļø for better design-to-code workflows
Created by Nour Shamrok š
This server cannot be deployed
Maintenance
Related MCP Connectors
- miromiroOAuthapp.miromiro
Turn any live website into brand colors, fonts, design tokens, SVGs, Lottie and paste-ready code.
Build responsive HTML email campaigns from any brand website: design, QA, export.
Capture screenshots, detect visual regressions between page versions, and analyze with AI.
Build and manage your design system with AI: tokens, themes, components, icons, Figma and code.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceConnects AI applications to Figma API for extracting design data, generating production-ready HTML/CSS from designs, and capturing screenshots in multiple formats.1,642 npm-
- AlicenseNot gradedqualityDmaintenanceConnects Figma designs to AI agents, enabling extraction of production-ready code, assets, and design tokens through natural language descriptions. Supports React, Vue, CSS, and Tailwind with real-time design system analysis.60,612 npm40MIT
- AlicenseAqualityDmaintenanceConverts Figma designs into production-ready React components with design token extraction, widget registry integration, and micro-frontend module generation.356 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables seamless integration with Figma API for extracting design tokens, generating production-ready code in multiple frameworks, capturing screenshots, and managing design assets directly from Figma.5MIT