README
🚀 Figma MCP 服务器
一个提供与 Figma API 集成的模型上下文协议 (MCP) 服务器,允许您交互 Figma 文件、评论、组件等,极大提升与 Figma 相关资源的操作便利性。
🚀 快速开始
此服务器提供与 Figma API 集成的 MCP 服务,让你能方便地对 Figma 文件、评论、组件等进行操作。
✨ 主要特性
-
文件操作
- 获取文件信息
- 获取文件版本历史
- 获取文件组件
-
评论管理
- 列出文件中的评论
- 添加新评论
- 删除评论
-
项目与团队特性
- 列出团队的项目
- 获取项目的文件
- 获取已发布的样式
-
网钩管理
- 创建网钩
- 列出现有的网钩
- 删除网钩
📦 安装指南
通过 Smithery 安装
要通过 Smithery 自动安装 Figma MCP Server for Claude Desktop:
npx -y @smithery/cli install @deepsuthar496/figma-mcp-server --client claude
手动安装
- 克隆仓库
- 安装依赖:
npm install
- 构建服务器:
npm run build
📚 详细文档
配置
在您的 MCP 设置文件中使用 Figma 访问令牌配置服务器:
{
"mcpServers": {
"figma": {
"command": "node",
"args": ["path/to/figma-server/build/index.js"],
"env": {
"FIGMA_ACCESS_TOKEN": "your-access-token-here"
},
"disabled": false,
"alwaysAllow": []
}
}
}
可用工具
文件操作
get_file
获取文件信息
{
"file_key": "string"
}
get_file_versions
获取文件版本历史
{
"file_key": "string"
}
get_file_components
获取文件组件
{
"file_key": "string"
}
评论管理
get_file_comments
列出文件中的评论
{
"file_key": "string"
}
post_comment
添加文件的评论
{
"file_key": "string",
"message": "string"
}
delete_comment
删除文件中的评论
{
"file_key": "string",
"comment_id": "string"
}
项目与团队特性
get_team_projects
获取团队的项目
{
"team_id": "string"
}
get_project_files
获取项目的文件
{
"project_id": "string"
}
get_component_styles
获取已发布的样式
{
"team_id": "string"
}
网钩管理
create_webhook
创建网钩
{
"team_id": "string",
"event_type": "string",
"callback_url": "string"
}
list_webhooks
列出网钩
{
"team_id": "string"
}
delete_webhook
删除网钩
{
"webhook_id": "string"
}
💻 使用示例
基础用法
```figma
Figma 客户端 ID: your_client_id_here
Figma 客户端Secret: your_client_secret_here
要获取文件信息:
curl -X GET 'https://api.figma.com/v1/files/[file_key]'
-H 'Authorization: Bearer [access_token]'
要获取文件版本历史:
curl -X GET 'https://api.figma.com/v1/files/[file_key]/versions'
-H 'Authorization: Bearer [access_token]'
要添加评论:
curl -X POST 'https://api.figma.com/v1/comments'
-H 'Content-Type: application/json'
-d '{"file_key": "your_file_key", "message": "your_message"}'
📄 许可证
[许可证内容]
贡献指南
欢迎为这个项目做出贡献!请参考以下步骤进行贡献:
- 克隆仓库
- 创建功能分支
- 提交您的更改
- 推送到远程仓库
- 提交拉取请求
请确保在提交代码前检查代码格式,并为您的更改添加适当的文档。
Scan to contact