](https://mseep.ai/app/archimedescrypto-figma-mcp-chunked)
Figma带分块的MCP服务器
](https://smithery.ai/server/@ArchimedesCrypto/figma-mcp-chunked)
用于与Figma API交互的模型上下文协议(MCP)服务器,具有处理大型Figma文件的高效内存分块和分页功能。
概述
此MCP服务器为Figma API提供了一个强大的接口,具有内置的内存管理功能。它旨在通过将操作分解为可管理的块并在必要时实现分页来有效地处理大型Figma文件。
主要特点
- 具有可配置限制的内存感知处理
- 大文件的分块数据检索
- 对所有列表操作的分页支持
- 节点类型过滤
- 进度跟踪
- 可配置的块大小
- 恢复中断操作的能力
- 调试记录
- 配置文件支持
安装
通过Smithery安装
通过以下方式自动安装带有分块功能的Figma MCP Server for Claude Desktop 史密瑟里:
npx -y @smithery/cli install @ArchimedesCrypto/figma-mcp-chunked --client claude手动安装
# Clone the repository
git clone [repository-url]
cd figma-mcp-chunked
# Install dependencies
npm install
# Build the project
npm run build配置
环境变量
FIGMA_ACCESS_TOKEN:您的Figma API访问令牌
配置文件
您可以使用以下命令通过JSON文件提供配置 --config 标志:
{
"mcpServers": {
"figma": {
"env": {
"FIGMA_ACCESS_TOKEN": "your-access-token"
}
}
}
}用途:
node build/index.js --config=path/to/config.json工具
get_file_data(新建)
通过内存高效的分块和分页来检索Figma文件数据。
{
"name": "get_file_data",
"arguments": {
"fileKey": "your-file-key",
"accessToken": "your-access-token",
"pageSize": 100, // Optional: nodes per chunk
"maxMemoryMB": 512, // Optional: memory limit
"nodeTypes": ["FRAME", "COMPONENT"], // Optional: filter by type
"cursor": "next-page-token", // Optional: resume from last position
"depth": 2 // Optional: traversal depth
}
}答复:
{
"nodes": [...],
"memoryUsage": 256.5,
"nextCursor": "next-page-token",
"hasMore": true
}列表文件
列出支持分页的文件。
{
"name": "list_files",
"arguments": {
"project_id": "optional-project-id",
"team_id": "optional-team-id"
}
}获取_版本
以块为单位检索版本历史记录。
{
"name": "get_file_versions",
"arguments": {
"file_key": "your-file-key"
}
}获取_文件_注释
使用分页检索注释。
{
"name": "get_file_comments",
"arguments": {
"file_key": "your-file-key"
}
}获取_文件_信息
使用分块节点遍历检索文件信息。
{
"name": "get_file_info",
"arguments": {
"file_key": "your-file-key",
"depth": 2, // Optional: traversal depth
"node_id": "specific-node-id" // Optional: start from specific node
}
}get_组件
检索支持分块的组件。
{
"name": "get_components",
"arguments": {
"file_key": "your-file-key"
}
}get_styles
检索支持分块的样式。
{
"name": "get_styles",
"arguments": {
"file_key": "your-file-key"
}
}获取_文件_节点
使用分块支持检索特定节点。
{
"name": "get_file_nodes",
"arguments": {
"file_key": "your-file-key",
"ids": ["node-id-1", "node-id-2"]
}
}内存管理
服务器实施了几种策略来有效地管理内存:
分块策略
- 可通过以下方式配置块大小
pageSize - 内存使用监控
- 基于内存压力的自动块大小调整
- 每个块的进度跟踪
- 使用光标恢复功能
最佳实践
- 从较小的块大小(50-100个节点)开始,并根据性能进行调整
- 通过响应元数据监控内存使用情况
- 尽可能使用节点类型过滤来减少数据负载
- 为大型数据集实现分页
- 使用恢复功能处理非常大的文件
配置选项
pageSize:每个块的节点数(默认值:100)maxMemoryMB:最大内存使用量(MB)(默认值:512)nodeTypes:筛选特定节点类型depth:控制嵌套结构的遍历深度
调试日志记录
服务器包括全面的调试日志记录:
// Debug log examples
[MCP Debug] Loading config from config.json
[MCP Debug] Access token found xxxxxxxx...
[MCP Debug] Request { tool: 'get_file_data', arguments: {...} }
[MCP Debug] Response size 2.5 MB错误处理
服务器提供详细的错误消息和建议:
// Memory limit error
"Response size too large. Try using a smaller depth value or specifying a node_id.""
// Invalid parameters
"Missing required parameters: fileKey and accessToken"
// API errors
"Figma API error: [detailed message]"故障排除
常见问题
- 内存错误
- 减小块大小 - 使用节点类型筛选 - 实现分页 - 指定较小的深度值
- 性能问题
- 监控内存使用情况 - 调整块大小 - 使用适当的节点类型筛选器 - 对频繁访问的数据实施缓存
- API限值
- 实施速率限制 - 使用分页 - 尽可能缓存响应
调试模式
启用调试日志记录以获取详细信息:
# Set debug environment variable
export DEBUG=true贡献
欢迎投稿!请阅读我们的贡献指南,并将拉取请求提交到我们的存储库。
许可证
此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。
