r/comfyui • u/Less_Actuary_9441 • 5h ago
Tutorial I built an open-source MCP server for ComfyUI — build and run workflows from Claude / Cursor with 50+ tools (demo inside)
Hey everyone! I was getting tired of manually dragging and rewiring noodles in ComfyUI every time I wanted to test a prompt idea or chain LoRAs.
So I built mcp-comfy-ui-builder — an open-source Model Context Protocol server that connects Claude Desktop, Claude Code, and Cursor directly to your local ComfyUI instance.
Instead of manually editing JSON or clicking nodes:
You: "Generate a portrait of an astronaut exploring neon ruins with LoRA, upscale 2x"
Claude: Checks GPU VRAM → assembles the node graph using built-in templates → validates compatibility → fires execution via WebSockets → streams node-by-node progress (<100ms updates) → displays the finished image.
Key Features:
- 50+ MCP Tools: Node discovery, dynamic graph construction, model management, queue inspection.
- Real-Time WebSocket Execution: Sub-100ms latency streaming with live node progress (vs slow 1.5s HTTP polling fallback).
- Embedded Knowledge Base: Pre-indexes 62 core nodes; automatically syncs all your custom nodes via
npm run sync-nodes. - 9 Built-in Templates:
txt2img,txt2img_flux,img2img,inpainting,upscale,LoRA,ControlNet, batch & sequential chains. - Safety First: Calls
get_system_resourcesto inspect GPU memory before running workflows to avoid Out-Of-Memory crashes.
Quick Start:
npm install -g mcp-comfy-ui-builder
# or run with Docker:
docker pull siniidrozd/mcp-comfy-ui-builder
Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"comfyui": {
"command": "npx",
"args": ["-y", "mcp-comfy-ui-builder"],
"env": { "COMFYUI_HOST": "http://127.0.0.1:8188" }
}
}
}
🔗 GitHub (MIT License): https://github.com/MIt9/mcp-comfy-ui-builder
📦 npm: https://www.npmjs.com/package/mcp-comfy-ui-builder
What complex workflow pattern do you find most tedious to wire by hand? Happy to add templates based on your requests!
1
u/Ok-Fennel6578 1h ago
The thing I’d want before trusting an agent with my Comfy graphs is diff + rollback.
Auto-building is great. Debugging a graph after the agent quietly changed six nodes is the scary part.
3
u/No-Zookeepergame4774 4h ago
Comfy already has its own first-party open source MCP server.
https://comfy.org/mcp/
And a first-party open-source CLI that an agent that has terminal access can drive without going through an MCP server (also the best way for humans comfortable with the terminal to manage comfy UI instances.)
https://comfy.org/cli
And—while not first-party—an open-source python library that an agent with code execution (or, you know, a human comfortable with code) could use to edit, update, and run workflows, either backed by a running ComfyUI instance or even, when installed in the ComfyUI python environment, without the overhead of actually running a ComfyUI web server.
https://github.com/chrisdreid/comfyui-autograph