Skip to main content
Glama

comfyui-mcp

为 ComfyUI 设计的模型上下文协议(Model Context Protocol, MCP)服务器。将本地(或托管的 Comfy Cloud)工作流暴露为工具接口,使聊天代理、日志和仪表盘能够生成图像、视频、音频和 3D 内容。

功能

  • 运行任意 API 格式的工作流,支持参数注入

  • 将输出以文件形式流式返回(图像 / 视频 / 音频)

  • 管理队列、中断任务、释放 VRAM

  • 列出已安装的自定义节点和模型

  • 上传图像用于 img2img / inpaint

  • 通过 comfy-cli 安装自定义节点和模型

Related MCP server: comfy-mcp

架构

┌─────────────────────────┐    stdio / Streamable HTTP / REST    ┌──────────────────┐
│  Chat agent / dashboard │  ────────────────────────────────▶  │  comfyui-mcp     │
│  (Hermes, Claude, etc.) │  ◀────────────────────────────────  │  (Python)        │
└─────────────────────────┘                                     └──────────────────┘
                                                                            │
                                                                            ▼
                                                                  ┌──────────────────┐
                                                                  │  ComfyUI server  │
                                                                  │  127.0.0.1:8188  │
                                                                  │  (or Cloud)      │
                                                                  └──────────────────┘

提供三种传输方式:

传输方式

URL

使用场景

stdio

无

Claude Desktop、Hermes、任何 MCP-stdio 客户端

HTTP REST

http://localhost:9300/...

curl、webhook、仪表盘

Streamable HTTP MCP

http://localhost:9300/mcp

浏览器端 MCP 客户端

隐私

本仓库完全公开。代码库中不包含任何密钥信息。 所有后端凭据在运行时通过环境变量配置(参见 .env.example):

  • COMFYUI_HOST — 本地 ComfyUI 服务器的主机:端口

  • COMFY_CLOUD_API_KEY — 若设置,则目标地址为 platform.comfy.org

  • COMFYUI_AUTH_TOKEN — 自托管服务器的可选 Bearer 令牌

发布的代码不会接触到您的 API 密钥。

暴露的工具

工具

用途

comfy_health

Ping /system_stats

comfy_run_workflow

提交带参数的工作流 JSON

comfy_get_output

通过 prompt_id 获取生成的图像/视频

comfy_queue_status

查看队列

comfy_interrupt

取消正在运行的任务

comfy_free_memory

卸载模型

comfy_list_nodes

列出已安装的自定义节点

comfy_list_models

列出已安装的 checkpoint、lora、vae 等

comfy_upload_image

上传图像用于 img2img / inpaint

comfy_install_node

安装自定义节点

comfy_install_model

下载模型

快速开始

git clone https://github.com/Franzferdinan51/comfyui-mcp
cd comfyui-mcp
cp .env.example .env
# edit .env to point at your ComfyUI server
pip install -r requirements.txt
./scripts/comfyui-mcp.bat     # or python scripts/comfyui_mcp_server.py

ComfyUI 必须在配置的主机:端口上运行(默认为 127.0.0.1:8188)。

为 curl/仪表盘使用启动 HTTP 桥接:

python scripts/comfyui_http_bridge.py
# → http://localhost:9300

启动 Streamable HTTP MCP 传输:

python scripts/comfyui_streamable_http.py
# → http://localhost:9300/mcp

许可证

MIT — 可自由分叉,署名回 Franzferdinan51 / Duckets。

Related MCP Connectors

Related MCP Servers