| name | sunnyside-figma-context-mcp |
| description | Extract pixel-perfect code, design tokens, and component structures from Figma designs via MCP tools for AI-driven development workflows |
| triggers | ["extract code from this Figma design","generate React component from Figma selection","get design tokens from Figma file","convert Figma frame to Tailwind component","analyze design system health in Figma","extract CSS from Figma layers","simulate design token changes","download assets from Figma design"] |
Sunnyside Figma Context MCP
Skill by ara.so — Design Skills collection
A Model Context Protocol (MCP) server providing 27 specialized tools to bridge Figma designs with AI development workflows. Supports two data paths: Figma Plugin (highest fidelity, works on any plan including Drafts) and Figma REST API (headless, requires team/project files).
Installation
Prerequisites:
git clone https://github.com/tercumantanumut/sunnysideFigma-Context-MCP
cd sunnysideFigma-Context-MCP
npm install
npm run build
Environment configuration (.env):
FIGMA_API_KEY=figd_your_token_here
PORT=3333
OUTPUT_FORMAT=json
Start the server:
npm start
MCP Client Configuration
SSE Transport (Recommended for Plugin Use)
Use when you need the Figma plugin and MCP tools to share extraction state:
{
"mcpServers": {
"sunnyside-figma": {
"type": "sse",
"url": "http://localhost:3333/sse"
}
}
}
stdio Transport
For headless use without plugin integration:
{
"mcpServers": {
"sunnyside-figma": {
"type": "stdio",
"command": "node",
"args": [
"/absolute/path/to/sunnysideFigma-Context-MCP/dist/cli.js",
"--stdio"
],
"env": {
"FIGMA_API_KEY": "figd_your_token_here"
}
}
}
}
HTTP Transport
{
"mcpServers": {
"sunnyside-figma": {
"type": "http",
"url": "http://localhost:3333/mcp"
}
}
}
Figma Plugin Setup
- Open Figma Desktop → Plugins → Development → Import plugin from manifest…
- Navigate to
figma-dev-plugin/manifest.json in the cloned repo
- Run the plugin on any file
- Select a frame → click Extract Dev Code
The plugin sends extraction data to http://localhost:3333/plugin/* endpoints.
Core Tool Categories
Plugin-Bridge Tools (Highest Fidelity)
These tools read data extracted by the Figma plugin. No API limits, works on Drafts.
get_JSON — Primary extraction tool, returns comprehensive structured data:
{
id: string,
name: string,
type: string,
layoutMode?: string,
primaryAxisAlignItems?: string,
counterAxisAlignItems?: string,
paddingLeft?: number,
fills: Array<{type: string, color: {r, g, b, a}, opacity?: number}>,
strokes: Array<any>,
effects: Array<any>,
variables: {[key: string]: {resolvedType: string, value: any}},
designTokens: {[category: string]: {[token: string]: any}},
allLayersCSS: {[layerId: string]: string}
}
get_figma_dev_history — List all past extractions:
{
id: string,
name: string,
timestamp: string,
type?: string,
layoutMode?: string
}
get_Basic_CSS — Root-level CSS only:
get_All_Layers_CSS — CSS for every layer in selection:
Code Generation Tools
get_react_component — TypeScript React + CSS module:
{
component: string,
styles: string
}
get_tailwind_component — React with Tailwind classes:
get_styled_component — React + styled-components:
Design Token Lifecycle
extract_design_tokens — Build token catalog from selection:
{
colors: {[name: string]: {value: string, type: string}},
spacing: {[name: string]: {value: string, type: string}},
typography: {[name: string]: {value: string, type: string}},
}
simulate_token_change — Dry-run a token modification:
{
tokenPath: string,
newValue: any,
reason?: string
}
analyze_token_change_impact — Blast-radius analysis:
{
affectedNodes: Array<{id, name, currentValue, newValue}>,
breakingChanges: Array<{issue, severity}>,
recommendations: string[]
}
apply_token_change — Commit a simulated change:
rollback_token_change — Revert an applied change:
generate_migration_code — Produce codemod output:
track_design_system_health — Coverage & conflict report:
{
tokenCoverage: number,
conflicts: Array<{token, instances, values}>,
orphanedTokens: string[],
recommendations: string[]
}
Figma REST API Tools
Require FIGMA_API_KEY and file access (team/project). Do not work on Drafts.
get_figma_data — Raw file or node JSON:
{
fileKey: string,
nodeId?: string
}
get_figma_page_structure — Page-level tree:
{
pages: Array<{
id: string,
name: string,
children: Array<{id, name, type}>
}>
}
download_figma_images — Batch export assets:
{
fileKey: string,
nodeIds: string[],
format: 'svg' | 'png' | 'jpg',
scale?: number,
outputDir?: string
}
analyze_figma_components — Component detection:
{
components: Array<{
id: string,
name: string,
description?: string,
instances: number
}>
}
Figma Dev Mode Tools (Professional Plan Only)
Bridge to Figma's official Dev Mode MCP Server (localhost:3845).
check_figma_dev_connection — Test Dev Mode server:
get_figma_dev_mode_code — Official React + Tailwind generator:
Common Usage Patterns
Pattern 1: Extract and Generate Component
const history = await use_mcp_tool("sunnyside-figma", "get_figma_dev_history", {});
const latestExtraction = history[0];
const data = await use_mcp_tool("sunnyside-figma", "get_JSON", {
extractionId: latestExtraction.id
});
const component = await use_mcp_tool("sunnyside-figma", "get_tailwind_component", {
extractionId: latestExtraction.id
});
await writeFile("./components/HeroSection.tsx", component);
Pattern 2: Design System Audit
const overview = await use_mcp_tool("sunnyside-figma", "get_plugin_project_overview", {});
const tokens = await use_mcp_tool("sunnyside-figma", "extract_design_tokens", {});
const health = await use_mcp_tool("sunnyside-figma", "track_design_system_health", {});
if (health.conflicts.length > 0) {
console.log("Token conflicts detected:");
health.conflicts.forEach(conflict => {
console.log(`- ${conflict.token}: ${conflict.instances} instances with different values`);
});
}
Pattern 3: Safe Token Migration
const simulation = await use_mcp_tool("sunnyside-figma", "simulate_token_change", {
tokenPath: "colors.primary.500",
newValue: "brand-primary",
reason: "Align with new brand guidelines"
});
const impact = await use_mcp_tool("sunnyside-figma", "analyze_token_change_impact", {
simulationId: simulation.simulationId
});
console.log(`Affects ${impact.affectedNodes.length} nodes`);
console.log(`Breaking changes: ${impact.breakingChanges.length}`);
const migration = await use_mcp_tool("sunnyside-figma", "generate_migration_code", {
simulationId: simulation.simulationId,
format: "ts"
});
await writeFile("./migrations/rename-primary-token.ts", migration.code);
if (impact.breakingChanges.length === ) {
(, , {
: simulation.
});
}
Pattern 4: Headless Asset Export from URL
const fileKey = "ABC123";
const nodeId = "10:52";
const nodeData = await use_mcp_tool("sunnyside-figma", "get_figma_data", {
fileKey,
nodeId
});
const exports = await use_mcp_tool("sunnyside-figma", "download_figma_images", {
fileKey,
nodeIds: [nodeId],
format: "svg",
outputDir: "./assets"
});
console.log(`Exported to: ${exports.downloads[0].path}`);
Pattern 5: Multi-Layer CSS Extraction
const history = await use_mcp_tool("sunnyside-figma", "get_figma_dev_history", {});
const extractionId = history[0].id;
const allCSS = await use_mcp_tool("sunnyside-figma", "get_All_Layers_CSS", {
extractionId
});
const data = await use_mcp_tool("sunnyside-figma", "get_JSON", {
extractionId
});
let cssModule = "";
Object.entries(allCSS).forEach(([layerId, css]) => {
const layerName = findLayerName(data, layerId);
cssModule += `.${toClassName(layerName)} {\n${css}\n}\n\n`;
});
await writeFile("./styles/component.module.css", cssModule);
Troubleshooting
"No extracted data available"
Cause: Plugin hasn't sent data or client is using stdio (separate process).
Solution:
- Re-open Figma plugin and click Extract Dev Code
- If using stdio transport, switch to SSE to share state with the HTTP server:
{
"mcpServers": {
"sunnyside-figma": {
"type": "sse",
"url": "http://localhost:3333/sse"
}
}
}
Figma REST API 404 / Timeout
Cause: File is in Drafts or token lacks access.
Solution:
- Move file from Drafts to a team/project
- Verify
FIGMA_API_KEY has correct permissions
- Fallback to plugin-bridge tools (work on Drafts)
check_figma_dev_connection Fails
Cause: Figma Dev Mode MCP Server not enabled or Free plan.
Solution:
- Requires Figma Professional plan
- Enable in Figma Desktop: Preferences → Enable local MCP Server
- Dev Mode server must be running on
localhost:3845
- Free plan users: use plugin-bridge tools instead
Server Won't Start on Port 3333
Cause: Port already in use.
Solution:
# Change in .env
PORT=3334
Update MCP client URL: http://localhost:3334/sse
Token Simulation Not Showing Changes
Cause: Simulation not applied or extraction is stale.
Solution:
- Check simulation list:
await use_mcp_tool("sunnyside-figma", "list_token_simulations", {});
- Apply simulation:
await use_mcp_tool("sunnyside-figma", "apply_token_change", {
simulationId: "sim-123"
});
- Re-extract from Figma plugin to see changes
Plugin Shows "Failed to Send Data"
Cause: MCP server not running or wrong port.
Solution:
- Verify server is running:
npm start
- Check console for
Server running on port 3333
- Plugin sends to hardcoded
localhost:3333 — if using different port, update plugin code:
const response = await fetch('http://localhost:YOUR_PORT/plugin/extract', {
method: 'POST',
});
Key Configuration Options
Environment Variables:
# Required
FIGMA_API_KEY=figd_your_token_here
# Optional
PORT=3333 # HTTP server port
OUTPUT_FORMAT=json # Response format (json | text)
FIGMA_DEV_MODE_URL=http://localhost:3845 # Official Dev Mode server
Plugin Configuration:
Edit figma-dev-plugin/manifest.json to adjust plugin metadata:
{
"name": "Sunnyside Dev Extractor",
"id": "your-plugin-id",
"api": "1.0.0",
"main": "code.js",
"ui": "ui.html",
"editorType": ["figma"]
}
Development Commands
npm run dev
npm run dev:cli
npm run type-check
npm run lint
npm test
npm run inspect
npm run build
Tool Selection Guide
| Goal | Use Tool | Why |
|---|
| Get comprehensive layer data | get_JSON | Single call returns layout, fills, variables, tokens, and CSS for all layers |
| Generate production component | get_tailwind_component or get_react_component | Ready-to-use code with styling |
| Audit design system | get_plugin_project_overview + track_design_system_health | Full project scan with token coverage |
| Plan token refactor | simulate_token_change → analyze_token_change_impact | Safe what-if analysis |
| Export assets headlessly | download_figma_images | Batch SVG/PNG export from file key |
| Use official Figma codegen | get_figma_dev_mode_code | Requires Pro plan, uses Figma's generator |
Plugin vs. REST API decision tree:
- Need Drafts support? → Plugin tools
- Headless automation? → REST API tools
- Highest CSS fidelity? → Plugin (uses native
getCSSAsync())
- Batch export many files? → REST API tools
Advanced: Token Registry Architecture
The token lifecycle tools maintain an in-memory registry:
interface TokenRegistry {
tokens: Map<string, {
value: any,
type: string,
path: string[]
}>,
dependencies: Map<string, Set<string>>,
simulations: Map<string, {
changes: Array<{tokenPath, oldValue, newValue}>,
applied: boolean
}>
}
Query registry state:
const registry = await use_mcp_tool("sunnyside-figma", "debug_token_registry", {});
Build dependency graph:
const graph = await use_mcp_tool("sunnyside-figma", "build_dependency_graph", {
extractionId: "latest"
});
This enables surgical updates: when a token changes, only affected components need regeneration.