sloth-d2c-mcp
v1.0.4-beta77
Published
这是一个MCP (Model Context Protocol) 服务器,提供Figma设计转代码的功能。
Downloads
685
Readme
D2C MCP Server
这是一个MCP (Model Context Protocol) 服务器,提供Figma设计转代码的功能。
可用工具
1. d2c_figma_intercept
使用Tauri桌面应用获取用户输入的工具。
特点:
- 打开原生桌面应用
- 更好的用户体验
- 窗口始终保持在最前面
- 支持快捷键操作
参数:
fileKey: Figma文件的key (必需)nodeId: 节点ID (可选)depth: 遍历深度 (可选)
2. d2c_figma_intercept_web
使用网页浏览器获取用户输入的工具。
特点:
- 在默认浏览器中打开网页
- 兼容性更好
- 无需额外的桌面应用
参数:
fileKey: Figma文件的key (必需)nodeId: 节点ID (可选)depth: 遍历深度 (可选)
使用方法
启动MCP服务器:
通过MCP客户端调用工具:
或者使用网页版本:
{
"method": "tools/call",
"params": {
"name": "d2c_figma_intercept_web",
"arguments": {
"fileKey": "your-figma-file-key",
"nodeId": "optional-node-id"
}
}
}端口配置
- MCP服务器: 端口3001 (如果被占用会自动尝试下一个端口)
- 网页服务器: 端口3002
- Tauri回调服务器: 动态端口 (从3001开始)
开发
# 安装依赖
npm install
# 开发模式
npm run dev
# 构建
npm run build
# 测试
node test-both-tools.js{
"method": "tools/call",
"params": {
"name": "d2c_figma_intercept",
"arguments": {
"fileKey": "your-figma-file-key",
"nodeId": "optional-node-id"
}
}
}npm run devnpx @modelcontextprotocol/inspector
