Comfy-Org/comfy-mcp
View on GitHub ↗Local MCP server for ComfyUI — run your local ComfyUI from AI agents
20 ★3 forksPythonUpdated 21d ago
What you need to know
Official ComfyUI MCP server (beta, 39 tools) that wraps comfy-cli so agents can launch/manage a local ComfyUI, run workflows from JSON or templates, fetch outputs, and spend credits on hosted partner models (Flux/Ideogram/Kling/Seedream/Veo/Gemini) — a stdio subprocess on your own machine.
Install
pip install comfy-mcp "comfy-cli>=1.14.0" comfy install (creates a ComfyUI workspace) then comfy launch to keep ComfyUI running. comfy-mcp --version confirms the install; it only talks MCP over stdin/stdout. Upgrading from the old comfy-local-mcp name requires pip uninstall comfy-local-mcp first.
Usage
- •Register with your client: claude mcp add comfy-mcp -e COMFY_BIN=/path/to/venv/bin/comfy -e COMFY_API_KEY=<key> -- comfy-mcp (same stdio contract for Claude Desktop and Cursor).
- •Ask the agent to "confirm my local ComfyUI is running, then run the workflow at ~/workflows/txt2img.json" — under the hood it calls server_info, run_workflow, fetch_outputs.
- •Outputs land in the ComfyUI workspace output/; fetch_outputs(prompt_id, out_dir) copies finished job outputs to any directory you name.
- •partner_generate runs hosted partner models with no local ComfyUI; COMFYUI_URL/COMFYUI_HOST(+PORT) point the run/job tools at a ComfyUI on another machine.
- •node_dependencies reads packs on disk + venv to distinguish missing nodes from missing Python deps; workflow_deps resolves classes against the ComfyUI-Manager node-to-pack map.
Key features
- ✓Manage ComfyUI (launch/stop/restart server, tail logs, stage input assets) and run workflows from API-format JSON or UI exports.
- ✓server_info wraps `comfy env` for verifying URL/override state; COMFY_LOCAL_URL (localhost, needs comfy-cli >=1.14.0) vs COMFYUI_URL (remote) are separate knobs.
- ✓Partner-API nodes execute locally but call hosted models; requires COMFY_API_KEY.
- ✓Env details are strict: COMFYUI_URL must be plain http://, no base path, no query/fragment; malformed values are ignored with a stderr warning; IPv6 must be bracketed ([::1]).
- ✓Opt-in failure log (failures.jsonl, COMFY_MCP_DEBUG_LOG) with rotation; CI runs pytest + ruff on Python 3.10/3.14.
Best for
Agents building/executing image or video workflows against a local (or user-controlled remote) ComfyUI installation, including hosted partner-model generation.
Caveats
- ⚠Beta status — core loop (server_info -> run_workflow -> fetch_outputs) validated end-to-end but still developing.
- ⚠comfy-mcp does NOT install comfy-cli; if comfy is not on PATH every tool call fails with "comfy not found on PATH".
- ⚠macOS: keep ComfyUI out of ~/Documents, ~/Desktop, ~/Downloads or grant the client Full Disk Access, or installs fail with Operation not permitted.
- ⚠If output still reports :8188 after setting a URL, check env-block placement/client restart, malformed values, or comfy-cli ignoring COMFY_LOCAL_URL (unsupported builds silently ignore it — verify via server_info).
Platforms: LocalClients: Claude Code · Claude Desktop · Cursor
Reviewed 2026-08-18
Topics
- Stars
- 20★
- Forks
- 3
- Language
- Python
- License
- NOASSERTION
- Created
- 2026-07-01
- Last push
- 2026-08-14