Figma MCP Server
Figma MCP servers enable AI models to access Figma design files, extract components, retrieve design tokens, and automate design-to-code workflows for seamless developer handoff.
Overview
The Figma MCP Server enables AI models to interact directly with Figma design files through the Model Context Protocol. This server bridges the gap between design and code by providing structured access to layouts, components, design tokens, and visual specifications.
Official & Community Servers:
Official: Figma MCP Server by Figma (desktop & remote)
Community: Framelink (figma-developer-mcp) with 24K+ weekly npm downloads
Key Features
Design Context Extraction
Extract layout, styling, and component information from Figma designs
Design Tokens
Access colors, spacing, typography, and other design system variables
Multi-Framework Support
Generate code for React, Vue, HTML+CSS, iOS, and custom frameworks
Component Mapping
Link Figma components to codebase implementations via Code Connect
Available Tools
Quick Reference
| Tool | Purpose | Category |
|---|---|---|
get_design_context | Extract design info for code gen | Design-to-Code |
get_variable_defs | Retrieve design tokens | Design Tokens |
get_code_connect_map | Map components to code | Code Connect |
get_screenshot | Capture visual snapshots | Visual Fidelity |
get_metadata | Get sparse layer info | Metadata |
create_design_system_rules | Generate design system rules | Design Systems |
get_figjam | Convert FigJam to XML | Diagrams |
whoami | Get user identity (remote) | Authentication |
Detailed Usage
get_design_context▶
Extract design information for code generation. Supports React, Vue, HTML+CSS, iOS, and custom frameworks.
// Get React + Tailwind code (default)
use_mcp_tool({
server_name: "figma",
tool_name: "get_design_context",
arguments: {
node_id: "123:456",
file_key: "abc123def"
}
});
// Get Vue code
use_mcp_tool({
server_name: "figma",
tool_name: "get_design_context",
arguments: {
node_id: "123:456",
file_key: "abc123def",
framework: "vue"
}
});
// Get HTML + CSS
use_mcp_tool({
server_name: "figma",
tool_name: "get_design_context",
arguments: {
node_id: "123:456",
file_key: "abc123def",
framework: "html"
}
});
// Selection-based (desktop server only)
// Select a frame in Figma, then prompt:
// "Generate code for the selected frame"
Returns structured design data optimized for code generation.
get_variable_defs▶
Retrieve design tokens including colors, spacing, typography, and other variables.
// Get all variables
use_mcp_tool({
server_name: "figma",
tool_name: "get_variable_defs",
arguments: {
node_id: "123:456",
file_key: "abc123def"
}
});
// Get specific variable types
use_mcp_tool({
server_name: "figma",
tool_name: "get_variable_defs",
arguments: {
node_id: "123:456",
file_key: "abc123def",
types: ["color", "spacing"]
}
});
// Get typography tokens
use_mcp_tool({
server_name: "figma",
tool_name: "get_variable_defs",
arguments: {
node_id: "123:456",
file_key: "abc123def",
types: ["typography"]
}
});
Returns design system tokens for consistent styling.
get_code_connect_map▶
Map Figma components to their codebase implementations using Code Connect.
use_mcp_tool({
server_name: "figma",
tool_name: "get_code_connect_map",
arguments: {
node_id: "123:456",
file_key: "abc123def"
}
});
Returns object mapping Figma node IDs to component file locations.
Example response:
{
"123:456": {
"componentName": "Button",
"codeConnectSrc": "src/components/Button.tsx"
},
"123:789": {
"componentName": "Card",
"codeConnectSrc": "src/components/Card.tsx"
}
}
get_screenshot▶
Capture visual snapshots to preserve layout accuracy in generated code.
// Get screenshot of a frame
use_mcp_tool({
server_name: "figma",
tool_name: "get_screenshot",
arguments: {
node_id: "123:456",
file_key: "abc123def"
}
});
// Get screenshot with specific scale
use_mcp_tool({
server_name: "figma",
tool_name: "get_screenshot",
arguments: {
node_id: "123:456",
file_key: "abc123def",
scale: 2 // 2x resolution
}
});
Returns PNG image data for visual reference during code generation.
get_metadata▶
Get sparse XML representation with basic layer properties for efficient large design handling.
use_mcp_tool({
server_name: "figma",
tool_name: "get_metadata",
arguments: {
node_id: "123:456",
file_key: "abc123def"
}
});
Returns layer IDs, names, types, positions, and sizes without full styling details.
create_design_system_rules▶
Generate rule files to help AI translate designs into framework-aligned code while respecting design system constraints.
use_mcp_tool({
server_name: "figma",
tool_name: "create_design_system_rules",
arguments: {
file_key: "abc123def",
framework: "react",
design_system: "material-ui"
}
});
Returns rules for consistent design-to-code translation.
get_figjam▶
Convert FigJam diagrams (workflows, architecture maps) to structured XML format.
use_mcp_tool({
server_name: "figma",
tool_name: "get_figjam",
arguments: {
file_key: "abc123def"
}
});
Returns XML representation with metadata and node screenshots.
whoami▶
Remote Server Only:
This tool is only available when using the remote Figma MCP server.
Get authenticated user identity including email, plan memberships, and seat types.
use_mcp_tool({
server_name: "figma",
tool_name: "whoami",
arguments: {}
});
Returns user account information for the authenticated session.
Installation
Official Figma Desktop MCP Server
The desktop server runs locally through the Figma desktop app.
Prerequisites:
- Latest Figma desktop app installed
- Figma Design or Make file open
Setup Steps:
- Open Figma desktop app
- Create or open a Design file
- Toggle to Dev Mode (Shift+D)
- Click "Enable desktop MCP server" in the inspect panel's MCP section
- Confirm when prompted
Configuration (VS Code/Cursor/Claude Code):
{
"mcpServers": {
"figma": {
"command": "node",
"args": [
"/path/to/figma-mcp-client.js"
],
"env": {
"FIGMA_SERVER_URL": "http://127.0.0.1:3845/mcp"
}
}
}
}
Selection-Based Prompting:
The desktop server supports selection-based prompting—select a frame in Figma and prompt your AI client to implement it directly.
Common Use Cases
1. Design-to-Code Translation
Convert Figma designs to production-ready code:
// Approach 1: Using Figma link
// Paste Figma link in chat: https://www.figma.com/file/abc123/Design?node-id=123:456
// Prompt: "Implement this design in React with Tailwind"
// Approach 2: Using get_design_context directly
use_mcp_tool({
server_name: "figma",
tool_name: "get_design_context",
arguments: {
node_id: "123:456",
file_key: "abc123def",
framework: "react"
}
});
// Get visual reference for accuracy
use_mcp_tool({
server_name: "figma",
tool_name: "get_screenshot",
arguments: {
node_id: "123:456",
file_key: "abc123def",
scale: 2
}
});
2. Design Token Extraction
Extract and implement design system tokens:
// Get all design tokens
use_mcp_tool({
server_name: "figma",
tool_name: "get_variable_defs",
arguments: {
file_key: "abc123def"
}
});
// Prompt: "Generate a theme configuration file from these design tokens"
// Get specific token types
use_mcp_tool({
server_name: "figma",
tool_name: "get_variable_defs",
arguments: {
file_key: "abc123def",
types: ["color", "spacing", "typography"]
}
});
// Prompt: "Create CSS variables for these design tokens"
3. Component Library Sync
Map Figma components to codebase implementations:
// Get component mappings
use_mcp_tool({
server_name: "figma",
tool_name: "get_code_connect_map",
arguments: {
file_key: "abc123def"
}
});
// Use mapping to ensure correct components
// Prompt: "Implement this design using the mapped component library"
// Get design context for specific component
use_mcp_tool({
server_name: "figma",
tool_name: "get_design_context",
arguments: {
node_id: "123:456",
file_key: "abc123def"
}
});
4. Responsive Design Implementation
Generate responsive layouts from Figma designs:
// Get design context for desktop
use_mcp_tool({
server_name: "figma",
tool_name: "get_design_context",
arguments: {
node_id: "123:456", // Desktop variant
file_key: "abc123def",
framework: "react"
}
});
// Get design context for mobile
use_mcp_tool({
server_name: "figma",
tool_name: "get_design_context",
arguments: {
node_id: "123:789", // Mobile variant
file_key: "abc123def",
framework: "react"
}
});
// Prompt: "Create a responsive component that adapts between these layouts"
5. Design System Documentation
Generate design system rules and documentation:
// Create design system rules
use_mcp_tool({
server_name: "figma",
tool_name: "create_design_system_rules",
arguments: {
file_key: "abc123def",
framework: "react",
design_system: "custom"
}
});
// Get all variables for documentation
use_mcp_tool({
server_name: "figma",
tool_name: "get_variable_defs",
arguments: {
file_key: "abc123def"
}
});
// Prompt: "Generate design system documentation with usage examples"
6. FigJam Workflow Visualization
Convert FigJam diagrams to structured data:
// Get FigJam diagram data
use_mcp_tool({
server_name: "figma",
tool_name: "get_figjam",
arguments: {
file_key: "figjam-file-key"
}
});
// Prompt: "Create a technical specification document from this FigJam workflow"
// Prompt: "Generate a state machine based on this user flow diagram"
Workflow Patterns
Desktop Server Workflow (Selection-Based)
- Select a frame or component in Figma
- Prompt your AI client: "Implement the selected design"
- Review generated code and iterate
- Refine with specific framework or styling requests
Remote Server Workflow (Link-Based)
- Copy Figma link for frame or component
- Paste link in AI client chat
- Request implementation: "Convert this to React component"
- Iterate with design token integration
Code Connect Integration
- Set up Code Connect for your component library
- Map Figma components to code files
- Use
get_code_connect_mapto retrieve mappings - Generate code that references existing components
Best Practices
- Use Selection-Based Prompting: Desktop server's selection feature is faster than copying links
- Include Screenshots: Use
get_screenshotfor visual accuracy verification - Extract Design Tokens First: Get variables before implementing components for consistency
- Leverage Code Connect: Map components to avoid regenerating existing UI elements
- Specify Frameworks: Always indicate target framework (React, Vue, etc.) for better results
- Iterate Incrementally: Start with basic structure, then add styling and interactivity
- Use Design System Rules: Create rules files for consistent multi-component generation
Supported Frameworks
The Figma MCP server supports code generation for:
- React (default with Tailwind CSS)
- Vue.js
- HTML + CSS
- iOS (Swift/SwiftUI)
- Custom frameworks (via prompts)
Design Token Types
Supported design token categories:
- Colors: Fill colors, stroke colors, gradients
- Spacing: Padding, margins, gaps
- Typography: Font families, sizes, weights, line heights
- Border Radius: Corner radius values
- Shadows: Drop shadows, inner shadows
- Effects: Blur, opacity
- Grid: Layout grids, columns
Troubleshooting
Common Issues
Issue: Desktop server not starting
- Ensure you're in Dev Mode (Shift+D)
- Verify latest Figma desktop app is installed
- Check firewall settings for port 3845
Issue: Selection-based prompting not working
- Confirm desktop server is running (not remote)
- Select frame or component in Figma before prompting
- Ensure MCP client is properly configured
Issue: API token authentication failing
- Regenerate personal access token in Figma settings
- Verify token has correct permissions
- Check token is properly set in environment variable
Issue: Generated code doesn't match design
- Include screenshot for visual reference
- Specify exact framework and styling library
- Extract design tokens first for accuracy
- Use Code Connect for component consistency
Security Considerations
API Token Security:
Never commit Figma API tokens to version control. Use environment variables or secure credential management.
Security Best Practices
- Rotate Tokens Regularly: Generate new personal access tokens periodically
- Limit Token Scope: Create separate tokens for different projects
- Use Desktop Server: For sensitive designs, use local desktop server instead of remote
- Review Permissions: Ensure tokens only have necessary file access
- Monitor Usage: Check Figma API usage logs for unexpected activity
Performance Tips
- Use Metadata for Large Files: Call
get_metadatainstead of full context for large designs - Cache Design Tokens: Extract variables once and reuse across components
- Batch Component Extraction: Get all component mappings in one call
- Optimize Screenshot Requests: Use appropriate scale (1x-2x) based on needs
- Filter Variable Types: Request only needed token types to reduce payload
Limitations
- Desktop Server: Selection-based prompting only works with desktop server, not remote
- File Access: Remote server requires appropriate file permissions
- Rate Limits: Figma API has rate limits for remote server usage
- Framework Support: Some frameworks may have limited code generation quality
- Complex Interactions: Animation and complex interaction logic may require manual implementation
Resources
- Official Figma MCP Documentation
- Figma MCP Tools & Prompts Guide
- Figma Developer Docs
- Code Connect Documentation
- Framelink Community Server
Sources
Related Articles
MCP Implementation Guide
A comprehensive guide to implementing and configuring Model Context Protocol (MCP) servers
Neon MCP Server
Neon MCP servers enable AI models to interact with serverless PostgreSQL databases, providing capabilities for structured data operations, SQL queries, database branching, and automatic scaling in a fully managed environment.
Setting up MCP Servers in Visual Studio Code
Model Context Protocol (MCP) enables AI models to interact with external tools and services through a unified interface. This guide will walk you through setting up MCP servers in Visual Studio Code to enhance your GitHub Copilot experience.