Figma MCP Server
A self-hosted MCP server that enables AI agents to retrieve Figma design data for generating code, templates, or custom prompts.
README
Figma Model Context Protocol (MCP) Server
A self-hosted Model Context Protocol (MCP) server that enables Large Language Models (LLMs) and AI agents to interact with Figma designs programmatically. This server acts as a bridge between MCP-compatible clients and the Figma API, allowing AI tools to retrieve design data for generating templates and custom prompts.
Overview
This project implements the Model Context Protocol (MCP) to provide standardized access to Figma resources. It allows AI agents and LLMs to fetch Figma design structures, enabling them to understand and work with design components when generating code, templates, or other creative outputs.
Features
- MCP v1 Protocol Compliance: Implements core MCP methods including
listToolsandcallTool - Figma API Integration: Secure proxy to Figma's REST API with authentication handling
- Smart Caching: Local caching mechanism to reduce API calls and improve response times
- Rate Limit Handling: Built-in retry logic with exponential backoff for API rate limits
- Node-Specific Access: Supports fetching specific nodes within Figma files
- Depth Control: Configurable depth for retrieving nested design structures
Prerequisites
- Node.js >= 18.0
- Figma Personal Access Token with appropriate permissions
Installation
-
Clone this repository:
git clone <repository-url> cd figma-mcp -
Install dependencies:
npm install -
Set up your Figma access token as an environment variable:
export FIGMA_ACCESS_TOKEN="your-personal-access-token-here"
Configuration
The server requires a Figma Personal Access Token with appropriate permissions. You can create one in your Figma account settings.
Required permissions typically include:
- Read files (
file_read) - Access to teams/files you want to access
Usage
Start the MCP server:
node index.js
The server will start and listen for MCP requests via stdio. It exposes the following tool:
Available Tool
get_figma_from_url
Retrieves the JSON structure of a Figma file or specific node.
Parameters:
url(required): The Figma file URL containing the designdepth(optional): Controls the level of detail (2 or 3 for plans, omit for full structure)
Example:
{
"name": "get_figma_from_url",
"arguments": {
"url": "https://www.figma.com/file/FILE_KEY/...",
"depth": 2
}
}
How It Works
- The server registers an MCP-compatible tool called
get_figma_from_url - When called, it extracts the file key and node ID (if specified) from the provided URL
- It makes authenticated requests to the Figma API using the provided access token
- Results are cached locally for 1 hour to optimize performance
- Responses are formatted according to MCP specifications
Integration with AI Tools
This server is designed to work with MCP-compatible AI tools such as:
- Cursor
- Claude Desktop
- Other MCP-enabled IDEs and AI assistants
Once running, these tools can discover and communicate with the server to access Figma design data.
Customization for LLM Prompts
The server is particularly useful for:
- Retrieving design specifications to inform code generation
- Extracting component structures for template creation
- Providing design context to LLMs for frontend development
- Converting Figma designs to various code formats
Security Considerations
- Store your Figma access token securely as an environment variable
- The server relies on the MCP host for authentication and authorization
- Run the server in a secure environment with appropriate network isolation
- Tokens should have the minimum required permissions
Caching
The server implements a local caching mechanism:
- Cache directory:
.figma_cachein the project root - Cache TTL: 1 hour (3,600,000 milliseconds)
- Cache keys are generated using MD5 hashes of API endpoints
Rate Limiting
The server includes built-in rate limiting support:
- Automatic retry with exponential backoff for 429 responses
- Maximum of 3 retry attempts
- Starting backoff of 2 seconds, doubling each attempt
Error Handling
Common error responses include:
- Invalid URL format
- Rate limit exceeded (429) with guidance to wait
- General API errors with descriptive messages
- System errors with detailed error messages
Development
To extend the server with additional tools:
- Register new tools in the
ListToolsRequestSchemahandler - Implement the corresponding logic in the
CallToolRequestSchemahandler - Ensure responses conform to MCP content standards
License
ISC License
Support
If you encounter issues or have questions:
- Verify your Figma access token is valid and has appropriate permissions
- Check that your Figma file URLs are accessible
- Review the server logs for error details
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.