关于 Figma MCP Server
Figma MCP Server 是一个面向 Figma API 的 MCP 服务,将 Figma 的主要 API 方法以 MCP 工具形式提供。适合需要通过 AI 访问 Figma 文件、评论、组件和样式的开发者与设计团队。README 提到大型文件可通过调整 depth 参数分步读取。
主要功能
- 01覆盖用户、文件、评论、团队与项目等 API 方法
- 02提供组件、组件集与样式的查询工具
- 03支持评论及评论回应的增删查
- 04支持 Webhook 的创建、查询、更新与删除
- 05提供库分析的组件、样式与变量使用数据
适用场景
- 01让 AI 读取 Figma 文件结构并导出节点图像
- 02查询团队组件与样式用于设计系统审查
- 03通过 Webhook 监听文件更新事件
MCP 相关
该项目是一个 MCP 服务,将 Figma API 方法封装为 MCP 工具,供 MCP 客户端调用。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
31收录的工具列表 · 更新于 3 周前
此工具无需参数。
详细介绍
Figma MCP 服务
用于与 Figma API 交互的 MCP 服务。此服务通过 Model Context Protocol 提供一套完整的 Figma API 方法。有时,对于较大的 Figma 文件,你可能需要让它在调用 figma_get_file 时使用 depth = 1,然后在需要更多内容时再逐步增加。
工具
此服务将所有 Figma API 方法实现为 MCP 工具:
用户方法
figma_get_me- 获取当前用户
文件方法
figma_get_file- 按键获取 Figma 文件figma_get_file_nodes- 获取 Figma 文件中的指定节点figma_get_images- 渲染 Figma 文件中的图像figma_get_image_fills- 获取 Figma 文件中的图像填充figma_get_file_versions- 获取 Figma 文件的版本历史记录
评论方法
figma_get_comments- 获取 Figma 文件中的评论figma_post_comment- 向 Figma 文件添加评论figma_delete_comment- 删除 Figma 文件中的评论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- 按键获取样式
Webhook 方法(V2 API)
figma_post_webhook- 创建 webhookfigma_get_webhook- 按 ID 获取 webhookfigma_update_webhook- 更新 webhookfigma_delete_webhook- 删除 webhookfigma_get_team_webhooks- 获取团队的 webhook
库分析方法
figma_get_library_analytics_component_usages- 获取库分析中的组件使用数据figma_get_library_analytics_style_usages- 获取库分析中的样式使用数据figma_get_library_analytics_variable_usages- 获取库分析中的变量使用数据
安装
通过 Smithery 安装
通过 Smithery 自动为 Claude Desktop 安装 mcp-figma:
npx @smithery/cli@latest install @thirdstrandstudio/mcp-figma --client claude
先决条件
- Node.js(v16 或更高版本)
- npm 或 yarn
安装软件包
# Clone the repository
git clone https://github.com/thirdstrandstudio/mcp-figma.git
cd mcp-figma
# Install dependencies
npm install
# Build the package
npm run build
设置
要使用此 MCP 服务,你需要设置 Figma API 令牌。可以通过以下三种方式之一进行设置:
1. 环境变量
在项目根目录中创建 .env 文件,或直接设置环境变量:
FIGMA_API_KEY=your_figma_api_key
2. 命令行参数
启动服务时,可以将 Figma API 令牌作为命令行参数传入:
# Using the long form
node dist/index.js --figma-token YOUR_FIGMA_TOKEN
# Or using the short form
node dist/index.js -ft YOUR_FIGMA_TOKEN
在 Claude Desktop 中使用
将以下内容添加到 claude_desktop_config.json:
使用 npx
{
"mcpServers": {
"figma": {
"command": "npx",
"args": ["@thirdstrandstudio/mcp-figma", "--figma-token", "your_figma_api_key"]
}
}
}
直接使用 Node.js(通过环境变量)
{
"mcpServers": {
"figma": {
"command": "node",
"args": ["/path/to/mcp-figma/dist/index.js"],
"env": {
"FIGMA_API_KEY": "your_figma_api_key"
}
}
}
}
直接使用 Node.js(通过命令行参数)
{
"mcpServers": {
"figma": {
"command": "node",
"args": ["/path/to/mcp-figma/dist/index.js", "--figma-token", "your_figma_api_key"]
}
}
}
将 /path/to/mcp-figma 替换为你的仓库实际路径。
示例
获取 Figma 文件
// Get a Figma file
const result = await callTool("figma_get_file", {
fileKey: "abcXYZ123"
});
获取文件中的评论
// Get comments from a file
const comments = await callTool("figma_get_comments", {
fileKey: "abcXYZ123",
as_md: true
});
创建 Webhook
// Create a webhook
const webhook = await callTool("figma_post_webhook", {
event_type: "FILE_UPDATE",
team_id: "12345",
endpoint: "https://example.com/webhook",
passcode: "your_passcode_here",
description: "File update webhook"
});
开发
# Install dependencies
npm install
# Start the server in development mode
npm start
# Build the server
npm run build
# Run with a Figma API token
npm start -- --figma-token YOUR_FIGMA_TOKEN
许可证
此 MCP 服务采用 MIT 许可证授权。这意味着你可以自由使用、修改和分发此软件,但须遵守 MIT 许可证的条款和条件。详情请参阅项目仓库中的 LICENSE 文件。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。