Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| STORAGE_PROVIDER | No | The storage provider to use (e.g., 'custom') | |
| CUSTOM_UPLOAD_KEY | No | Your upload key for the custom upload server | |
| CUSTOM_UPLOAD_URL | No | The URL of your custom upload server | |
| FIGMA_ACCESS_TOKEN | Yes | Your Figma access token (required by Figma API) |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| get_figma_images | 从Figma导出、压缩并上传指定节点的图像,返回可公开访问的图像URL。
此工具自动化处理从Figma提取设计素材的整个流程:
1. 根据提供的 `file_key` 和 `node_ids` 从Figma API获取图像。
2. 可选择导出节点本身或其所有子节点(默认)。
3. 对导出的图像(JPG/PNG)进行压缩以优化文件大小。
4. 将处理后的图像上传到云存储。
5. 返回一个包含成功上传图像的URL列表和失败详情的字典。
**如何从Figma链接中提取参数:**
当用户提供一个Figma链接时,需要从中提取 `file_key` 和 `node_ids`。
例如,对于链接: `https://www.figma.com/design/d5VnH9TP69zb3EyDejwvKs/My-Design?node-id=1348-2218`
- `file_key` 是 `d5VnH9TP69zb3EyDejwvKs` (位于 `design/` 或 `file/` 之后的部分)
- `node_ids` 是 `1348-2218` (位于 `?node-id=` 之后的部分)
Args:
file_key (str): Figma文件的唯一标识符。从文件URL中 'file/' 或 'design/' 之后的部分提取。
node_ids (str): 一个或多个逗号分隔的Figma节点ID。从URL的 `?node-id=` 参数中提取。
format (str): 导出图像的格式。支持 "jpg", "png", "svg", "pdf"。默认为 "png"。
scale (float): 图像的缩放比例,取值范围在 0.01 到 4 之间。默认为 1.0 (原始尺寸)。
compression_quality (float): 图像压缩质量,仅对'jpg'和'png'格式有效。取值范围 0.0 (低质量,高压缩) 到 1.0 (高质量,低压缩)。默认为 0.85。
export_children (bool): 控制导出行为。
- `True` (默认): 导出指定`node_ids`下所有直接子节点作为独立的图像。这是最常见的用法,适用于需要节点内多个图层(如图标、图片素材)的场景。
- `False`: 仅导出`node_ids`指定的节点本身,将其作为一个整体图像。当用户明确指定将节点本身导出时使用。
Returns:
Dict[str, Any]: 一个字典,包含两个键:
- "successful_uploads": 一个列表,其中每个元素都是一个字典,包含 `node_id`, `file_name`, 和 `url`。
例如: `[{"node_id": "1:2", "file_name": "icon.png", "url": "https://cdn.example.com/icon.png"}]`
- "failed_uploads": 一个包含上传失败详情的列表。 |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |