这是一个模型上下文协议(MCP)服务器,通过标准化接口提供对Figma文件和设计资源的访问。
cargo install figma-mcp
git clone https://github.com/paulvandermeijs/figma-mcp.git
cd figma-mcp
cargo build --release
从开发者设置获取您的Figma令牌
设置环境变量:
export FIGMA_TOKEN="your_token_here"
运行服务器:
# 如果通过cargo install安装
figma-mcp
# 如果从源码构建
cargo run --release
parse_figma_url从任何Figma URL中提取文件键parse_figma_url - 从Figma URL中提取文件键get_file - 获取文件结构(带深度控制)get_file_nodes - 获取特定节点(带深度控制)export_images - 从节点导出图像get_me - 测试认证help - 使用说明导出的图像是自动作为MCP资源可用的:
figma://file/{file_key}/node/{node_id}.{format}https://www.figma.com/file/FILE_ID/filenamehttps://www.figma.com/design/FILE_ID/filename?node-id=1%3A2cargo test # 运行测试
RUST_LOG=info cargo run # 启用日志运行
MIT许可证 - 详情见LICENSE文件。 </中文翻译>