A dynamic MCP (Model Context Protocol) server that lets you expose ComfyUI workflows as tools for LLMs. Ships with a web admin UI for configuring tools without writing any code.
- Zero hardcoded tools — all tools are loaded dynamically from user-defined workflow configurations
- Web Admin UI — upload ComfyUI API workflows, name tools, map node inputs to parameters, configure output types
- Multi-media output — handles images, audio, video, and generic files
- Per-tool output delivery — choose between inline base64 binary or URL-based delivery for each tool
- Persistent configuration — tool definitions saved as JSON files, survive restarts
- Optional API key auth — protect the admin UI with a simple API key
- ComfyUI health monitoring — real-time connection status in the UI
# Install with uv
uv venv
uv pip install -e .
# Run the server
uv run comfyui-mcp
# Or with environment variables
COMFYUI_URL=http://localhost:8188 COMFYUI_API_KEY=your_key_here uv run comfyui-mcpOpen http://localhost:4206/ui to access the admin dashboard.
The MCP endpoint is available at http://localhost:4206/mcp.
All configuration is via environment variables:
| Variable | Default | Description |
|---|---|---|
COMFYUI_URL |
http://localhost:8188 |
ComfyUI HTTP API endpoint |
COMFYUI_API_KEY |
(empty) | Bearer token for ComfyUI auth |
ADMIN_API_KEY |
(empty) | API key for admin UI access |
DATA_DIR |
./data |
Directory for persisted tool definitions |
HOST |
0.0.0.0 |
Server bind address |
PORT |
4206 |
Server port |
MAX_WAIT_TIME |
600 |
Default max wait for ComfyUI jobs (seconds) |
- Export your ComfyUI workflow in API format (enable Dev Mode in ComfyUI → Save API Format)
- Upload it via the admin UI at
/ui - Name your tool and write a description (the LLM sees this)
- Map parameters — click on any node input to expose it as a tool parameter
- Configure output — set the output type (image/audio/video) and delivery method
- Save — the tool is immediately available via MCP
Add this to your MCP client configuration:
{
"mcpServers": {
"comfyui": {
"url": "http://localhost:4206/mcp"
}
}
}┌─────────────────────────────────────────┐
│ FastMCP Server │
│ ┌───────────────────────────────────┐ │
│ │ Dynamic Tool Registry │ │
│ │ tool1(prompt, steps) → ComfyUI │ │
│ │ tool2(tags, lyrics) → ComfyUI │ │
│ └───────────────────────────────────┘ │
│ ┌───────────────────────────────────┐ │
│ │ Admin UI (/ui) │ │
│ │ - Tool CRUD │ │
│ │ - Workflow upload │ │
│ │ - Parameter mapping │ │
│ └───────────────────────────────────┘ │
│ ┌───────────────────────────────────┐ │
│ │ ComfyUI Client │ │
│ │ - HTTP submission │ │
│ │ - WebSocket tracking │ │
│ │ - Output download │ │
│ └───────────────────────────────────┘ │
└─────────────────────────────────────────┘
↕ MCP Protocol (/mcp)
┌──────────┐
│ LLM/Agent│
└──────────┘
MIT