ComfyUI MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ComfyUI MCPgenerate an image of a cat using txt2img template"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
comfyui-mcp
MCP Server that connects local ComfyUI to AI Agents (e.g. Trae). Control ComfyUI entirely via natural language — create workflows, configure models, generate images, manage the queue — without touching the ComfyUI UI.
功能
20 个 MCP 工具:模型列表、节点类型、工作流构建/执行、图片上传下载、队列管理、原子节点操作
7 个 MCP Resources:checkpoints、loras、vaes、upscalers、controlnet、节点类型定义、系统信息
模板驱动 + 动态构建:内置 txt2img / img2img 模板,也支持自定义工作流
中间表示层:用简洁的 IR dict 描述工作流,由 MCP Server 翻译为 ComfyUI 原生 JSON
统一错误格式:所有工具返回
{success: true/false, error: "...", error_code: "..."}自动检测 ComfyUI:启动时检测可用性,不可达不阻塞
Related MCP server: fm-mcp-comfyui-bridge
环境要求
Python 3.10+
ComfyUI 本地运行(默认
http://127.0.0.1:8188)
安装依赖
pip install -r requirements.txt部署到 Trae
打开 Trae → 设置 → MCP → 添加 MCP Servers
选择手动配置,粘贴以下 JSON(将路径改为你的实际路径):
{
"mcpServers": {
"comfyui": {
"command": "python",
"args": ["C:\\path\\to\\comfyui_mcp_project\\src\\server.py"]
}
}
}保存。Trae 会自动启动 MCP Server,Agent 即可调用工具。
直接运行
cd comfyui_mcp_project
python src/server.py环境变量(可选)
变量 | 默认值 | 说明 |
|
| ComfyUI 地址 |
|
| 日志级别(DEBUG/INFO/WARNING/ERROR) |
|
| 日志文件目录 |
|
| 日志保留天数 |
|
| 缩略图最大边长(px) |
核心工具速查
工具 | 说明 |
| 列出可用模型(checkpoints/loras/vaes/upscalers/controlnet) |
| 获取所有节点类型定义 |
| 加载内置或用户模板 |
| 从 IR dict 构建工作流并设为当前工作流 |
| 提交当前工作流到 ComfyUI 执行 |
| 查询执行状态 |
| 下载生成的图片(含缩略图 base64 + 原图路径) |
| 原子操作:增/改/删工作流节点 |
| 原子操作:连接/断开节点 |
中间表示(IR)示例
{
"type": "txt2img",
"checkpoint": "sdXL_v10VAEFix.safetensors",
"positive_prompt": "cyberpunk city at night, neon lights",
"negative_prompt": "blurry, cartoon",
"width": 1024,
"height": 1024,
"steps": 25,
"cfg": 7.0,
"seed": -1,
}项目结构
comfyui_mcp_project/
├── src/
│ ├── server.py # MCP Server 入口
│ ├── comfyui_client.py # ComfyUI REST API 客户端
│ ├── workflow_builder.py # IR → ComfyUI JSON 翻译
│ ├── context.py # 共享上下文
│ ├── templates/ # 内置模板
│ │ ├── txt2img.json
│ │ └── img2img.json
│ └── tools/ # MCP 工具实现
├── design_doc/ # 设计文档
├── user_templates/ # 用户自定义模板
├── requirements.txt
└── pyproject.toml详细设计文档见 design_doc/。
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote MCP for RunComfy: ComfyUI deployments, hosted models, LoRA training. 31 tools.
MCP server for Qwen Image 3 AI image generation
MCP server for Flux AI image generation
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- AlicenseBqualityBmaintenanceAn MCP server that bridges AI agents with ComfyUI for automated workflow building, execution, monitoring, and output routing.961MIT
- AlicenseAqualityDmaintenanceMCP server that provides image generation, captioning, and tagging via ComfyUI API, configurable for agent tools.43MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that enables AI agents to control a local ComfyUI instance for image generation, allowing workflow understanding, parameter modification, execution, and model discovery.23 npm3Apache 2.0
- AlicenseNot gradedqualityBmaintenanceA lightweight MCP server that bridges AI agents with a local ComfyUI instance, enabling them to generate and iteratively refine images, audio, and video through conversational tool calls.15 npmMIT