- name
- comfyui-mcp-agent
- description
- Expert skill for driving ComfyUI (image/video/audio generation) via the comfyui-mcp MCP server — workflow authoring, model management, natural language graph editing, and agent-native control plane.
- triggers
- ["generate an image with ComfyUI","create a ComfyUI workflow for video generation","install a custom node pack in ComfyUI","debug why my ComfyUI workflow failed","edit the ComfyUI graph to change the prompt","download and configure a Flux model","convert this workflow to API format","list available ComfyUI models and custom nodes"]
# comfyui-mcp-agent
> Skill by [ara.so](https://ara.so) — MCP Skills collection.
Expert skill for **comfyui-mcp**, an agent-native control plane for [ComfyUI](https://github.com/comfyanonymous/ComfyUI). This MCP server exposes **108 tools** for image/video/audio generation, workflow authoring, model management, custom node installation, and **natural language graph editing**. It ships with **32 AI skills** (Flux, WAN, LTX 2.3, Qwen, Ideogram 4, Krea2), **13 installer packs**, and Claude Code plugin integration.
**comfyui-mcp** is local-first but not local-only: one config targets local installs, LAN, VPS, or Comfy Cloud. It authors and edits graphs node-by-node, runs and iterates on workflows, manages models and custom nodes, and ships model-specific expertise (samplers, CFG, resolutions, curated URLs) so agents get it right without trial and error.
## Installation
### As MCP Server (Claude Desktop / Claude Code)
Add to your Claude config (`~/.claude/settings.json`):
```json
{
"mcpServers": {
"comfyui": {
"command": "npx",
"args": ["-y", "comfyui-mcp"],
"env": {
"CIVITAI_API_TOKEN": "",
"COMFYUI_URL": "",
"COMFYUI_API_KEY": ""
}
}
}
}
```
**Environment variables** (all optional):
- `CIVITAI_API_TOKEN` — for downloading gated models from Civitai
- `COMFYUI_URL` — override auto-detected ComfyUI endpoint (default: `http://127.0.0.1:8188`)
- `COMFYUI_API_KEY` — for Comfy Cloud mode (cloud.comfy.org)
- `COMFYUI_MCP_HTTP_TOKEN` — auth token for remote HTTP transport (`--tunnel` or `--http`)
### As Claude Code Plugin
```bash
# In Claude Code
/plugin marketplace add artokun/comfyui-mcp
/plugin install comfy
```
### Remote / Hosted Connector (HTTP Transport)
Run as an authenticated, publicly-reachable server:
```bash
npx -y comfyui-mcp@latest --tunnel
```
This forces HTTP transport, generates an auth token, opens a cloudflared tunnel, and prints a `https://…/mcp` URL + token for Claude Desktop Custom Connectors.
### Panel Agent (Autonomous Sidebar in ComfyUI)
Install the **[ComfyUI Agent Panel](https://github.com/artokun/comfyui-mcp-panel)** via ComfyUI-Manager:
```bash
# Search "comfyui-agent-panel" in ComfyUI-Manager
# Or manual install:
cd custom_nodes
git clone https://github.com/artokun/comfyui-mcp-panel.git
cd comfyui-mcp-panel
npm install
```
Then start the orchestrator from your local machine:
```bash
npx -y comfyui-mcp@latest connect
```
## Core MCP Tools
### Workflow Execution
```typescript
// Generate an image from a prompt
use_mcp_tool({
server_name: "comfyui",
tool_name: "generate_image",
arguments: {
prompt: "a sunset over mountains, cinematic lighting",
negative_prompt: "blurry, low quality",
width: 1024,
height: 1024,
cfg: 7.0,
steps: 20,
seed: -1,
checkpoint: "flux1-dev-fp8.safetensors"
}
});
// Enqueue a custom workflow (API format)
use_mcp_tool({
server_name: "comfyui",
tool_name: "enqueue_workflow",
arguments: {
workflow: {
"1": {
"class_type": "CheckpointLoaderSimple",
"inputs": { "ckpt_name": "flux1-dev-fp8.safetensors" }
},
"2": {
"class_type": "CLIPTextEncode",
"inputs": { "text": "a photo of a cat", "clip": ["1", 1] }
}
// ...
}
}
});
// Get job status
use_mcp_tool({
server_name: "comfyui",
tool_name: "get_job_status",
arguments: { prompt_id: "abc-123" }
});
// Cancel running job
use_mcp_tool({
server_name: "comfyui",
tool_name: "interrupt_execution",
arguments: {}
});
```
### Graph Editing (Natural Language)
```typescript
// Add a node to the current workflow
use_mcp_tool({
server_name: "comfyui",
tool_name: "add_node",
arguments: {
node_type: "KSampler",
params: {
seed: 42,
steps: 30,
cfg: 8.0,
sampler_name: "euler_ancestral",
scheduler: "normal"
}
}
});
// Update existing node
use_mcp_tool({
server_name: "comfyui",
tool_name: "update_node",
arguments: {
node_id: "5",
updates: { "cfg": 9.0, "steps": 25 }
}
});
// Delete node
use_mcp_tool({
server_name: "comfyui",
tool_name: "delete_node",
arguments: { node_id: "12" }
});
// Connect two nodes
use_mcp_tool({
server_name: "comfyui",
tool_name: "connect_nodes",
arguments: {
source_node: "3",
source_output: 0,
target_node: "7",
target_input: "image"
}
});
// Get current workflow state
use_mcp_tool({
server_name: "comfyui",
tool_name: "get_workflow",
arguments: {}
});
```
### Model Management
```typescript
// List available checkpoints
use_mcp_tool({
server_name: "comfyui",
tool_name: "list_checkpoints",
arguments: {}
});
// Download a model from URL
use_mcp_tool({
server_name: "comfyui",
tool_name: "download_model",
arguments: {
url: "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/flux1-dev.safetensors",
filename: "flux1-dev.safetensors",
type: "checkpoints"
}
});
// Download from Civitai (requires CIVITAI_API_TOKEN)
use_mcp_tool({
server_name: "comfyui",
tool_name: "download_civitai_model",
arguments: {
model_id: "43331",
version_id: "47274",
filename: "majicmixRealistic_v7.safetensors",
type: "checkpoints"
}
});
// List LoRAs
use_mcp_tool({
server_name: "comfyui",
tool_name: "list_loras",
arguments: {}
});
// List VAEs
use_mcp_tool({
server_name: "comfyui",
tool_name: "list_vaes",
arguments: {}
});
```
### Custom Node Management
```typescript
// List installed custom nodes
use_mcp_tool({
server_name: "comfyui",
tool_name: "list_custom_nodes",
arguments: {}
});
// Install custom node pack
use_mcp_tool({
server_name: "comfyui",
tool_name: "install_custom_nodes",
arguments: {
repo_url: "https://github.com/ltdrdata/ComfyUI-Manager.git"
}
});
// Update custom node
use_mcp_tool({
server_name: "comfyui",
tool_name: "update_custom_nodes",
arguments: {
node_name: "ComfyUI-Manager"
}
});
// Uninstall custom node
use_mcp_tool({
server_name: "comfyui",
tool_name: "uninstall_custom_nodes",
arguments: {
node_name: "ComfyUI-Impact-Pack"
}
});
// Get node info from object_info
use_mcp_tool({
server_name: "comfyui",
tool_name: "get_node_info",
arguments: {
node_type: "KSampler"
}
});
```
### System Management
```typescript
// Get system stats (VRAM, RAM, disk)
use_mcp_tool({
server_name: "comfyui",
tool_name: "get_system_stats",
arguments: {}
});
// Restart ComfyUI
use_mcp_tool({
server_name: "comfyui",
tool_name: "restart_comfyui",
arguments: {}
});
// Stop ComfyUI
use_mcp_tool({
server_name: "comfyui",
tool_name: "stop_comfyui",
arguments: {}
});
// Get queue status
use_mcp_tool({
server_name: "comfyui",
tool_name: "get_queue",
arguments: {}
});
// Clear queue
use_mcp_tool({
server_name: "comfyui",
tool_name: "clear_queue",
arguments: {}
});
```
### Workflow Conversion & Visualization
```typescript
// Convert UI format to API format
use_mcp_tool({
server_name: "comfyui",
tool_name: "convert_workflow",
arguments: {
workflow: { /* UI format workflow JSON */ },
target_format: "api"
}
});
// Visualize workflow as Mermaid diagram
use_mcp_tool({
server_name: "comfyui",
tool_name: "visualize_workflow",
arguments: {
workflow: { /* workflow JSON */ }
}
});
// Compare two workflows
use_mcp_tool({
server_name: "comfyui",
tool_name: "compare_workflows",
arguments: {
workflow_a: { /* first workflow */ },
workflow_b: { /* second workflow */ }
}
});
```
## Claude Code Slash Commands
When installed as a plugin, comfyui-mcp adds these slash commands:
### `/comfy:gen <prompt>`
Generate an image from a text description. Auto-selects checkpoint, builds workflow, returns image.
```
/comfy:gen a portrait of a woman in cyberpunk style, neon lights
```
### `/comfy:viz <workflow>`
Visualize a workflow as a Mermaid diagram with nodes grouped by category.
```
/comfy:viz
```
### `/comfy:node-skill <pack>`
Generate a Claude skill for a custom node pack from Registry ID or GitHub URL.
```
/comfy:node-skill https://github.com/ltdrdata/ComfyUI-Impact-Pack
```
### `/comfy:debug [prompt_id]`
Diagnose why a workflow failed — reads history, logs, traces root cause, suggests fixes.
```
/comfy:debug abc-123
```
### `/comfy:batch <prompt, params>`
Parameter sweep generation across cfg, sampler, steps, seed, etc.
```
/comfy:batch "a forest scene" cfg=[6,7,8,9] steps=[20,30]
```
### `/comfy:convert <file>`
Convert between UI format and API format workflows.
```
/comfy:convert workflow.json
```
### `/comfy:install <pack>`
Install a custom node pack — git clone, pip install, optional restart.
```
/comfy:install ComfyUI-Manager
```
### `/comfy:gallery [filter]`
Browse generated outputs with metadata — filter by date, count, or filename.
```
/comfy:gallery today
```
### `/comfy:compare <a vs b>`
Diff two workflows side by side — shows added/removed nodes and changed parameters.
```
/comfy:compare workflow_v1.json workflow_v2.json
```
### `/comfy:recipe <name> <prompt>`
Multi-step recipes: `portrait`, `hires-fix`, `style-transfer`, `product-shot`.
```
/comfy:recipe portrait "a woman with curly hair"
```
## Model-Specific Patterns
عرض على GitHub