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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。