figma-mcp
Integrates with the Figma API to retrieve and analyze files, pages, nodes, comments, components, and design tokens, and to generate CSS, HTML, and image assets for website prototyping.
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 Extract the colors and typography from my Figma design and generate 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 (Model Context Protocol)
A comprehensive MCP (Model Context Protocol) integration for Figma that enables AI coding tools like Cursor to access, analyze, and prototype websites from Figma designs.
π Features
π§ Smart File Handling - Automatic size detection and recommendations
π¨ Website Prototyping - Generate CSS, HTML, and assets from Figma designs
π Page Navigation - Comprehensive page indexing and navigation
πΎ File Management - Save large files to JSON and manage downloads
π Component Analysis - Analyze components, variants, and instances
π― Design Tokens - Extract colors, typography, spacing, and styles
Related MCP server: Framelink Figma MCP Server
What is MCP?
Model Context Protocol (MCP) is a standard for connecting AI models to external data sources and tools. It allows AI assistants to interact with various services, including Figma, through a standardized interface.
Prerequisites
Node.js (v18 or higher)
npm or yarn
A Figma account with API access
Figma Personal Access Token
Quick Start
# Clone the repository
git clone <your-repo-url>
cd figma-mcp-experiment
# Install dependencies
npm install
# Run setup wizard (creates .env and mcp-config.json)
npm run setup
# Start the MCP server
npm start
# Test the setup
npm run test:allSetup Instructions
1. Install Dependencies
npm install2. Quick Setup (Recommended)
Run the interactive setup wizard:
npm run setupThis will guide you through:
Creating your
.envfile with Figma API credentialsSetting up
mcp-config.jsonfor MCP client configurationConfiguring environment variables
3. Manual Configuration
If you prefer manual setup:
Get Figma Access Token:
Go to Figma Account Settings
Navigate to "Personal access tokens"
Create a new token with appropriate permissions
Create Environment File:
cp env.example .envEdit
.env:FIGMA_ACCESS_TOKEN=your_figma_personal_access_token_here FIGMA_FILE_KEY=your_figma_file_key_hereCreate MCP Configuration:
cp mcp-config.example.json mcp-config.jsonEdit
mcp-config.json:{ "mcpServers": { "figma-mcp": { "command": "node", "args": ["src/server.js"], "cwd": ".", "env": { "FIGMA_ACCESS_TOKEN": "your_figma_access_token_here", "FIGMA_FILE_KEY": "your_figma_file_key_here" } } } }
Usage
Starting the MCP Server
npm startAvailable Commands
npm run setup- Interactive setup wizardnpm start- Start the MCP servernpm run dev- Start in development mode with hot reloadnpm test- Run all testsnpm run test:unit- Run unit tests onlynpm run test:integration- Run integration tests onlynpm run clean- Remove generated filesnpm run cleanup- Full cleanup scriptnpm run debug- Run debug script
Available MCP Tools
π§ Smart Tools (Start Here)
get_smart_figma_overview - RECOMMENDED FIRST STEP - Automatic file analysis and recommendations
π Core Tools
get_figma_file - Retrieve complete Figma file data (β οΈ LIMITED: Only works for files under 200KB)
get_figma_file_nodes - Get specific nodes from a Figma file
get_figma_comments - Retrieve comments from a Figma file
create_figma_comment - Add comments to Figma files
β‘ Lightweight Tools (For Large Files)
get_figma_file_metadata - Get lightweight metadata and structure
get_figma_file_info - CONSOLIDATED - Get file information (structure, stats, or specific page)
πΎ File Management Tools
save_figma_file_to_json - Save complete Figma file data to a JSON file (handles large files)
save_figma_nodes_to_json - Save specific nodes from a Figma file to a JSON file
list_saved_figma_files - List all saved JSON files in the downloads directory
π¨ Website Prototyping Tools
extract_figma_design_tokens - Extract design tokens (colors, typography, spacing, etc.)
get_figma_layout_data - Get layout and positioning data for nodes
analyze_figma_components - Analyze component instances and variants
generate_figma_css - Generate CSS from Figma design tokens
generate_figma_html - Generate HTML structure from Figma layout data
get_figma_images - CONSOLIDATED - Get image URLs or download images locally
π§ Page Navigation Tools
get_figma_pages - CONSOLIDATED - Get page information (list, index, detailed, or specific page)
Smart File Handling (Recommended Approach)
Always start with get_smart_figma_overview - this tool automatically analyzes your file and recommends the best approach based on size and complexity.
File Size Guidelines:
< 100KB: Use
get_figma_filedirectly100-200KB: Use lightweight tools with warnings
> 200KB: Use
save_figma_file_to_jsonto download, then work locally
Recommended Workflows:
For Large Files (>200KB):
Use
save_figma_file_to_jsonto download complete fileUse
get_figma_file_metadatafor overviewUse
get_figma_page_listfor navigationUse
get_figma_file_pagefor specific pagesUse
get_figma_file_nodesfor specific elements
For Multi-Page Files (>10 pages):
Use
get_figma_page_listfor page overviewUse
generate_figma_page_indexfor detailed navigationUse
get_figma_file_pagefor specific pages
For Component-Rich Files (>50 components):
Use
analyze_figma_componentsfor component analysisUse
get_figma_file_metadatafor overviewUse
get_figma_file_structurefor structure
Handling Large Files (Legacy)
1. Start with Smart Overview (RECOMMENDED)
// Always start here - gets automatic recommendations
const overview = await mcpClient.getSmartFileOverview({
fileKey: 'your_file_key'
});
// Follow the recommended approach
console.log(overview.recommendation.approach);
console.log(overview.recommendation.alternatives);2. Use Lightweight Tools First
// Get file overview without full content
const metadata = await mcpClient.getFileMetadata({
fileKey: 'your_file_key'
});
// Get file structure to understand organization
const structure = await mcpClient.getFileStructure({
fileKey: 'your_file_key'
});
// Get statistics to understand file complexity
const stats = await mcpClient.getFileStats({
fileKey: 'your_file_key'
});2. Save Large Files to JSON
// Save complete file to JSON (handles any size)
const saveResult = await mcpClient.saveFileToJson({
fileKey: 'your_file_key'
});
// Save specific nodes to JSON
const nodesResult = await mcpClient.saveNodesToJson({
fileKey: 'your_file_key',
ids: ['node_id_1', 'node_id_2']
});3. Work with Specific Pages or Nodes
// Get specific page content
const page = await mcpClient.getFilePage({
fileKey: 'your_file_key',
pageId: 'page_id'
});
// Get specific nodes
const nodes = await mcpClient.getFileNodes({
fileKey: 'your_file_key',
ids: ['node_id_1', 'node_id_2']
});4. Create Website Prototypes
// Extract design tokens for styling
const tokens = await mcpClient.extractDesignTokens({
fileKey: 'your_file_key'
});
// Get layout data for positioning
const layout = await mcpClient.getLayoutData({
fileKey: 'your_file_key',
ids: ['node_id_1', 'node_id_2']
});
// Generate CSS from design tokens
const css = await mcpClient.generateCSS({
fileKey: 'your_file_key',
outputPath: './styles.css'
});
// Generate HTML structure
const html = await mcpClient.generateHTML({
fileKey: 'your_file_key',
ids: ['node_id_1', 'node_id_2'],
outputPath: './index.html'
});
// Export images for assets
const images = await mcpClient.exportImages({
fileKey: 'your_file_key',
ids: ['node_id_1', 'node_id_2'],
format: 'png',
scale: 2
});5. Navigate File Pages
// Get page list for navigation
const pageList = await mcpClient.getPageList({
fileKey: 'your_file_key'
});
// Generate comprehensive page index
const pageIndex = await mcpClient.generatePageIndex({
fileKey: 'your_file_key',
includeDetails: true
});
// Get detailed page information
const pageInfo = await mcpClient.getPageInfo({
fileKey: 'your_file_key',
pageId: 'page_id'
});Example Usage
π§ Smart File Handling (Recommended)
// Always start with smart overview
const overview = await mcpClient.getSmartFileOverview({
fileKey: 'your_file_key'
});
// Follow the recommended approach
console.log(overview.recommendation.approach);
console.log(overview.recommendation.alternatives);π Basic File Operations
// Get file metadata (lightweight)
const metadata = await mcpClient.getFileMetadata({
fileKey: 'your_file_key'
});
// Get specific nodes
const nodes = await mcpClient.getFileNodes({
fileKey: 'your_file_key',
ids: ['node_id_1', 'node_id_2']
});
// Get file structure
const structure = await mcpClient.getFileStructure({
fileKey: 'your_file_key'
});π¨ Website Prototyping
// Extract design tokens
const tokens = await mcpClient.extractDesignTokens({
fileKey: 'your_file_key'
});
// Generate CSS
const css = await mcpClient.generateCSS({
fileKey: 'your_file_key',
outputPath: './styles.css'
});
// Generate HTML
const html = await mcpClient.generateHTML({
fileKey: 'your_file_key',
ids: ['node_id_1', 'node_id_2'],
outputPath: './index.html'
});
// Get image URLs
const imageUrls = await mcpClient.getFigmaImages({
fileKey: 'your_file_key',
ids: ['node_id_1', 'node_id_2'],
format: 'png',
scale: 2,
download: false
});
// Download images locally
const downloadedImages = await mcpClient.getFigmaImages({
fileKey: 'your_file_key',
ids: ['node_id_1', 'node_id_2'],
format: 'png',
scale: 2,
download: true,
outputDir: './images'
});π§ Page Navigation
// Get simple page list (lightweight)
const pageList = await mcpClient.getFigmaPages({
fileKey: 'your_file_key',
detailLevel: 'list'
});
// Get detailed page index
const pageIndex = await mcpClient.getFigmaPages({
fileKey: 'your_file_key',
detailLevel: 'index',
includeDetails: true
});
// Get specific page info
const pageInfo = await mcpClient.getFigmaPages({
fileKey: 'your_file_key',
pageId: 'page_id'
});πΎ File Management
// Save large file to JSON
const saveResult = await mcpClient.saveFileToJson({
fileKey: 'your_file_key',
outputPath: './my-figma-file.json',
prettyPrint: true
});
// List saved files
const savedFiles = await mcpClient.listSavedFiles();Project Structure
βββ README.md # Project documentation
βββ CONTRIBUTING.md # Contributing guidelines
βββ CHANGELOG.md # Version history
βββ package.json # Project configuration
βββ mcp-config.json # MCP server configuration
βββ .env.example # Environment variables template
βββ .gitignore # Git ignore rules
βββ src/ # Source code
β βββ server.js # MCP server implementation
β βββ figma-client.js # Figma API client
β βββ mcp-handlers.js # MCP tool handlers
βββ tests/ # Test files
β βββ figma-client.test.js
β βββ test-smart-file-handling.js
β βββ test-new-tools.js
β βββ test-file-saving.js
β βββ test-prototyping-tools.js
β βββ test-page-index.js
β βββ examples/
β βββ basic-usage.js
βββ scripts/ # Utility scripts
β βββ debug-mcp.js
β βββ start-server.sh
βββ downloads/ # Downloaded files (gitignored)
βββ exports/ # Exported files (gitignored)Testing
Run the test scripts to verify functionality:
# Run all tests
npm run test:all
# Run unit tests only
npm run test:unit
# Run integration tests only
npm run test:integration
# Run individual test files
node tests/test-smart-file-handling.js
node tests/test-new-tools.js
node tests/test-file-saving.js
node tests/test-prototyping-tools.js
node tests/test-page-index.jsDevelopment
Project Structure
βββ src/ # Source code
β βββ server.js # MCP server implementation
β βββ figma-client.js # Figma API client
β βββ mcp-handlers.js # MCP tool handlers
βββ tests/ # Test files
β βββ figma-client.test.js
β βββ test-*.js # Integration tests
β βββ examples/ # Example usage
βββ scripts/ # Utility scripts
β βββ debug-mcp.js
β βββ start-server.sh
β βββ cleanup.sh
βββ downloads/ # Downloaded files (gitignored)
βββ exports/ # Exported files (gitignored)Adding New Tools
Add the method to
src/figma-client.jsAdd the handler to
src/mcp-handlers.jsRegister the tool in
src/server.jsAdd tests in
tests/Update documentation
See CONTRIBUTING.md for detailed guidelines.
Troubleshooting
Common Issues
Authentication Error:
Ensure your Figma access token is valid and has the correct permissions
Check that the token is properly set in
.envandmcp-config.json
File Not Found:
Verify the file key is correct and you have access to the file
Check that the file key is properly formatted
Rate Limiting:
Figma API has rate limits; implement appropriate delays between requests
Consider caching responses for frequently accessed data
Large File Context Issues:
Use
get_smart_figma_overviewfirst to get recommendationsUse lightweight tools or save files to JSON instead of getting full file data
Follow the size-aware recommendations provided by the smart overview
Configuration Issues:
Ensure both
.envandmcp-config.jsonare properly configuredRun
npm run setupto recreate configuration filesCheck that file paths in
mcp-config.jsonare correct
Debug Mode
Enable debug logging by setting the DEBUG environment variable:
DEBUG=* npm startGetting Help
Check the PROJECT_SUMMARY.md for quick reference
Review CONTRIBUTING.md for development guidelines
See CHANGELOG.md for version history
Run tests with
npm run test:allto verify functionality
Contributing
We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines.
Quick Contribution Steps
Fork the repository
Create a feature branch
Make your changes
Add tests for new functionality
Update documentation
Submit a pull request
Development Setup
# Clone and setup
git clone <your-fork-url>
cd figma-mcp-experiment
npm install
npm run setup
# Run tests
npm run test:all
# Start development
npm run devLicense
This project is licensed under the MIT License - see the LICENSE file for details.
Resources
Acknowledgments
Figma for providing the excellent API
The MCP community for the protocol specification
Contributors and users of this project
Available Tools
17 toolsanalyze_figma_componentsC
Analyze component instances and variants
Inputs: fileKey (required), ids.
create_figma_commentC
Create a comment on a Figma file
Inputs: fileKey (required), message (required), position.
extract_figma_design_tokensC
Extract design tokens from Figma file (colors, typography, spacing, etc.)
Inputs: fileKey (required).
generate_figma_cssC
Generate CSS from Figma design tokens
Inputs: fileKey (required), outputPath.
generate_figma_htmlC
Generate HTML structure from Figma layout data
Inputs: ids (required), fileKey (required), outputPath.
get_figma_commentsC
Get comments from a Figma file
Inputs: fileKey (required).
get_figma_fileA
Get a Figma file by its key (β οΈ LIMITED: Only works for files under 200KB. For larger files, use get_figma_file_metadata, get_figma_file_structure, or save_figma_file_to_json)
Inputs: fileKey (required).
get_figma_file_infoC
Get comprehensive file information with configurable detail level (structure, stats, or specific page)
Inputs: fileKey (required), pageId, detailLevel.
get_figma_file_metadataA
Get lightweight metadata and structure of a Figma file (recommended for large files)
Inputs: fileKey (required).
get_figma_file_nodesC
Get specific nodes from a Figma file
Inputs: ids (required), fileKey (required).
get_figma_imagesC
Get comprehensive image handling with configurable options (URLs or download)
Inputs: ids (required), fileKey (required), scale, format, +2 more.
get_figma_layout_dataB
Get layout and positioning data for nodes (for website prototyping)
Inputs: ids (required), fileKey (required).
get_figma_pagesC
Get comprehensive page information with configurable detail level (list, index, detailed, or specific page)
Inputs: fileKey (required), pageId, detailLevel, includeDetails.
get_smart_figma_overviewB
Get smart file overview with automatic recommendations for the best approach based on file size and complexity (RECOMMENDED FIRST STEP)
Inputs: fileKey (required).
list_saved_figma_filesA
List all saved JSON files in the downloads directory
Inputs: downloadsDir.
save_figma_file_to_jsonC
Save complete Figma file data to a JSON file (handles large files)
Inputs: fileKey (required), outputPath, prettyPrint.
save_figma_nodes_to_jsonC
Save specific nodes from a Figma file to a JSON file
Inputs: ids (required), fileKey (required), outputPath, prettyPrint.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 17 tools
There is a dense cluster of file-retrieval tools (get_figma_file, get_figma_file_metadata, get_figma_file_info, get_figma_file_nodes, get_figma_pages, get_smart_figma_overview) whose boundaries rely entirely on prose hints like 'lightweight' or 'configurable detail level'. The descriptions do warn about size limits and recommend an entry point, which helps, but an agent can easily misselect between metadata/info/overview/pages for the same file.
Nearly all tools follow a verb_figma_noun snake_case pattern (get_figma_comments, create_figma_comment, save_figma_file_to_json, generate_figma_css). A few deviations exist, notably get_smart_figma_overview inserting an adjective and inconsistent pluralization (get_figma_comments vs create_figma_comment).
17 tools is at the heavy end of the acceptable range, and several of them (file/info/metadata/overview/pages) appear to be variations on the same read operation rather than distinct capabilities. The set feels padded by redundant access routes rather than cleanly scoped.
The extraction/inspection side is well covered (files, nodes, pages, tokens, images, layout, CSS/HTML generation), but the write surface is thin: only comment creation with no update/delete, and no way to list or search available Figma files. Descriptions also reference a get_figma_file_structure tool that does not exist in the set, which leaves a documented dead end.
Maintenance
Related MCP Connectors
Deterministic Figma to Elementor, Gutenberg, Oxygen, Etch and HTML layouts for AI assistants.
The Figma MCP server brings Figma design context directly into your AI workflow.
UI design from prompts, screenshots, and URLs for AI coding agents and theme tokens.
Connect AI coding agents to Anima Playground, Figma, and your design system.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceGives AI-powered coding tools like Cursor, Windsurf, and Cline access to Figma design files, enabling more accurate code generation directly from Figma designs.MIT
- AlicenseNot gradedqualityDmaintenanceProvides AI coding agents with access to Figma design data through the Figma API. Enables accurate one-shot implementation of designs in any framework by translating Figma files into simplified layout and styling information.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI coding tools like Cursor to access Figma design files and metadata, allowing accurate one-shot implementation of designs in any framework by providing simplified layout and styling information from the Figma API.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to read Figma design files and automatically map responsive relationships between mobile and desktop screens to generate accurate frontend code. Eliminates manual copy-pasting by providing direct access to design tokens, dimensions, and screen layouts within AI-powered IDEs.ISC