comfyui-mcp
MCP server for ComfyUI — text-to-image, variations, img2img refine, upscale, image proxy, and workflow runner.
README
comfyui-mcp
MCP server for ComfyUI. Generate images from natural language prompts using any MCP-compatible client.
Part of the MCP Server Series.
Status
v0.2 — core tools plus upscale, image proxy, and public-URL support. Tools: generate_image, generate_variations, generate_with_workflow, refine_image, upscale_image, list_models, list_workflows, upload_image. See Roadmap for what's next.
Install
npx (no install required)
npx @miller-joe/comfyui-mcp --comfyui-url http://your-comfyui-host:8188
npm
npm install -g @miller-joe/comfyui-mcp
comfyui-mcp --comfyui-url http://your-comfyui-host:8188
Docker
docker run -p 9100:9100 \
-e COMFYUI_URL=http://your-comfyui-host:8188 \
ghcr.io/miller-joe/comfyui-mcp:latest
Connect an MCP client
Example — Claude Code:
claude mcp add --transport http comfyui http://localhost:9100/mcp
Or register the streamable HTTP endpoint with an MCP gateway (e.g. MetaMCP) to aggregate with other servers.
Configuration
All options can be set via CLI flag or environment variable:
| CLI flag | Env var | Default | Description |
|---|---|---|---|
--host |
MCP_HOST |
0.0.0.0 |
Bind host |
--port |
MCP_PORT |
9100 |
Bind port |
--comfyui-url |
COMFYUI_URL |
http://127.0.0.1:8188 |
ComfyUI HTTP URL (used internally by this server to call ComfyUI) |
--comfyui-public-url |
COMFYUI_PUBLIC_URL |
(same as --comfyui-url) |
Externally-reachable URL used in image URLs returned to MCP clients. Set this when the internal URL is not reachable from clients (common with Docker networks). |
| — | COMFYUI_DEFAULT_CKPT |
sd_xl_base_1.0.safetensors |
Default checkpoint filename |
Image URLs returned to clients
Generation tools return image URLs like <comfyui-public-url>/view?filename=…. If --comfyui-public-url is not set, URLs use the internal --comfyui-url value.
The server also exposes a proxy endpoint: GET /images/<filename>?subfolder=&type=output streams the image bytes through the MCP server — useful when clients can reach the MCP server but not ComfyUI directly.
The default checkpoint must match a file installed in your ComfyUI models/checkpoints/ directory. Override via COMFYUI_DEFAULT_CKPT or pass checkpoint as a tool argument.
Tools
generate_image
Generate an image from a text prompt using ComfyUI's default txt2img workflow.
Parameters: prompt (required), negative_prompt, width, height, steps, cfg, seed, checkpoint.
generate_variations
Generate multiple variations of the same prompt by varying the seed. Returns all images at once.
Parameters: prompt (required), count (2–16, default 4), plus the same generation params as generate_image, with base_seed instead of seed.
generate_with_workflow
Submit an arbitrary ComfyUI workflow JSON (full node graph) and return the resulting image URLs. Use this for custom workflows — ControlNet, upscaling, or anything exported from ComfyUI's Save (API Format).
Parameter: workflow (object) — the complete node graph.
refine_image
Run img2img on a source image: fetches a source URL, uploads it to ComfyUI, and runs a denoising pass guided by a new prompt. Lower denoise preserves more of the original; higher gives the prompt more freedom.
Parameters: prompt, source_image_url (required), denoise (0–1, default 0.5), plus standard generation params.
list_models
List available checkpoints, LoRAs, samplers, or schedulers on the ComfyUI instance.
Parameter: kind — one of checkpoints (default), loras, samplers, schedulers.
list_workflows
List built-in workflow templates shipped with this server (currently txt2img, img2img).
upload_image
Upload a reference image to ComfyUI for use in img2img, ControlNet, or IP-Adapter workflows.
Parameters: source_url or image_base64 (one required), filename (optional), overwrite (default false).
Returns: the stored filename, which can be used as the image input in workflow nodes like LoadImage.
generate_with_controlnet
Generate an image conditioned by a ControlNet preprocessed image (pose skeleton, depth map, canny edges, normal map, etc.) plus a text prompt.
Parameters: prompt, control_image_url (the preprocessed conditioning image — this tool doesn't run preprocessors), controlnet_model (filename from models/controlnet/), strength (0–2, default 1), start_percent / end_percent (0–1, when CN is active during sampling), plus standard generation params.
Requires a ControlNet model installed in your ComfyUI models/controlnet/ directory.
generate_with_ip_adapter
Generate an image using a reference image as a visual/style/subject guide via IP-Adapter.
Parameters: prompt, reference_image_url, preset (e.g. "STANDARD (medium strength)", "PLUS FACE (portraits)", "VIT-G (medium strength)"), weight (0–3, default 1), start_at / end_at (0–1), plus standard generation params.
Requires the ComfyUI-IPAdapter-plus custom node pack plus the preset's matching IPAdapter weights and CLIP Vision models.
Workflow template registry
Save complex workflow JSON once, run them by name later. Templates are stored on disk under --templates-dir (defaults to ~/.config/comfyui-mcp/templates/<name>.json) so they survive restarts and are portable across MCP clients.
| Tool | Description |
|---|---|
save_workflow_template |
Save a workflow JSON under a named slot. overwrite=true to replace. |
list_workflow_templates |
List saved templates with descriptions and last-updated timestamp. |
get_workflow_template |
Fetch a stored template's JSON + metadata. |
delete_workflow_template |
Delete a stored template. |
run_workflow_template |
Run a saved template against ComfyUI and return image URLs. |
Template names must start alphanumeric; a-z, A-Z, 0-9, -, _; max 64 chars.
Return format
All generation tools return image URLs served directly by the ComfyUI instance (http://<comfyui>/view?filename=…). These URLs can be passed straight to any client that accepts image URLs.
Architecture
┌────────────────┐ ┌──────────────────┐ ┌──────────────┐
│ MCP client │────▶│ comfyui-mcp │────▶│ ComfyUI │
│ (Claude, etc.)│◀────│ (this server) │◀────│ instance │
└────────────────┘ └──────────────────┘ └──────────────┘
streamable HTTP HTTP REST + poll
The server is stateless. A single MCP request → submit workflow to ComfyUI → poll /history/{id} until complete → return image URLs.
Development
git clone https://github.com/miller-joe/comfyui-mcp
cd comfyui-mcp
npm install
npm run dev # hot-reload via tsx watch
npm run build # compile TS to dist/
npm run typecheck # strict type checking
Requires Node 20+.
Roadmap
- [x]
generate_image— text-to-image with default workflow - [x]
generate_with_workflow— submit arbitrary workflows - [x]
list_models/list_workflows - [x]
upload_image— reference images for img2img / ControlNet / IP-Adapter - [x]
generate_variations— batch variations of a prompt - [x]
refine_image— img2img refinement from a source URL - [x]
upscale_image— ESRGAN/SwinIR-style model upscale - [x] Image proxy endpoint (
/images/<filename>) for clients that can't reach ComfyUI - [x] Configurable public URL for externally-correct image URLs
- [x] Workflow template registry:
save_workflow_template,list_workflow_templates,get_workflow_template,delete_workflow_template,run_workflow_template - [x] ControlNet workflow helper:
generate_with_controlnet(requires ControlNet models on the ComfyUI side) - [x] IP-Adapter workflow helper:
generate_with_ip_adapter(requires ComfyUI-IPAdapter-plus pack) - [ ] WebSocket progress events for long-running generations
License
MIT © Joe Miller
Support
If this tool saves you time, consider supporting development:
Every contribution funds maintenance, documentation, and the next release in the MCP Server Series.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。