
Figma MCP Server

2025.03.30
20
TypeScriptFigma API设计协作设计系统开发效率
mcp-figma 是一个基于 Model Context Protocol (MCP) 的 Figma API 交互服务器,提供了一套完整的 Figma API 方法。该服务器允许开发者通过 MCP 协议与 Figma 平台进行交互,包括获取用户信息、文件操作、评论管理、团队项目管理、组件和样式管理、Webhook 设置以及库分析等功能。
View on GitHub
Overview
基本能力
产品定位
mcp-figma 是一个专门为 Figma 设计的 MCP 服务器,旨在通过 MCP 协议提供完整的 Figma API 功能,方便开发者集成 Figma 功能到自己的应用中。
核心功能
- 用户方法:获取当前用户信息。
- 文件方法:获取 Figma 文件、节点、图像、图像填充和文件版本历史。
- 评论方法:管理 Figma 文件中的评论和评论反应。
- 团队和项目管理:获取团队项目和项目中的文件。
- 组件方法:管理团队和文件中的组件和组件集。
- 样式方法:管理团队和文件中的样式。
- Webhook 方法:创建、获取、更新和删除 Webhook。
- 库分析方法:获取组件、样式和变量的使用分析数据。
适用场景
- 设计协作:在团队中管理 Figma 文件和评论。
- 设计系统集成:将 Figma 组件和样式集成到开发流程中。
- 自动化工作流:通过 Webhook 实现 Figma 文件更新的自动化通知和处理。
- 设计分析:分析 Figma 库中组件和样式的使用情况。
工具列表
figma_get_me
- 获取当前用户信息figma_get_file
- 获取 Figma 文件figma_get_file_nodes
- 获取文件中的特定节点figma_get_images
- 渲染文件中的图像figma_get_image_fills
- 获取文件中的图像填充figma_get_file_versions
- 获取文件的版本历史figma_get_comments
- 获取文件中的评论figma_post_comment
- 添加评论figma_delete_comment
- 删除评论figma_get_comment_reactions
- 获取评论反应figma_post_comment_reaction
- 添加评论反应figma_delete_comment_reaction
- 删除评论反应figma_get_team_projects
- 获取团队项目figma_get_project_files
- 获取项目文件figma_get_team_components
- 获取团队组件figma_get_file_components
- 获取文件组件figma_get_component
- 获取组件figma_get_team_component_sets
- 获取团队组件集figma_get_file_component_sets
- 获取文件组件集figma_get_component_set
- 获取组件集figma_get_team_styles
- 获取团队样式figma_get_file_styles
- 获取文件样式figma_get_style
- 获取样式figma_post_webhook
- 创建 Webhookfigma_get_webhook
- 获取 Webhookfigma_update_webhook
- 更新 Webhookfigma_delete_webhook
- 删除 Webhookfigma_get_team_webhooks
- 获取团队 Webhookfigma_get_library_analytics_component_usages
- 获取组件使用分析figma_get_library_analytics_style_usages
- 获取样式使用分析figma_get_library_analytics_variable_usages
- 获取变量使用分析
常见问题解答
- 如何处理大型 Figma 文件?
对于大型 Figma 文件,建议先使用
depth = 1
获取文件,然后在需要时增加深度。
使用教程
使用依赖
- Node.js (v16 或更高版本)
- npm 或 yarn
安装教程
通过 Smithery 安装
npx @smithery/cli@latest install @thirdstrandstudio/mcp-figma --client claude
手动安装
# 克隆仓库
git clone https://github.com/thirdstrandstudio/mcp-figma.git
cd mcp-figma
# 安装依赖
npm install
# 构建包
npm run build
调试方式
设置 Figma API 密钥
-
环境变量 创建
.env
文件或在环境中设置:FIGMA_API_KEY=your_figma_api_key
-
命令行参数 ```bash # 使用长格式 node dist/index.js --figma-token YOUR_FIGMA_TOKEN
# 或使用短格式 node dist/index.js -ft YOUR_FIGMA_TOKEN ```
与 Claude Desktop 一起使用
在 claude_desktop_config.json
中添加配置:
{
"mcpServers": {
"figma": {
"command": "node",
"args": ["/path/to/mcp-figma/dist/index.js", "--figma-token", "your_figma_api_key"]
}
}
}
开发模式
# 启动开发服务器
npm start
# 使用 Figma API 令牌运行
npm start -- --figma-token YOUR_FIGMA_TOKEN