The ComfyUI MCP Server enables comprehensive automation and management of ComfyUI workflows through Claude and other MCP clients.
Image & Video Generation
Generate images using simple text prompts or execute saved workflow files with custom inputs
Submit workflows asynchronously with status tracking and result retrieval
Support for cloud GPU inference via fal.ai integration
Workflow Management
Create, load, modify, validate, and save workflows in both API and UI formats
Add, remove, and update nodes programmatically with automatic graph-based positioning
Access pre-built templates (Flux Dev, Flux Schnell) for common use cases
Convert between API format (execution) and UI format (editor)
Schema validation against ComfyUI v0.4 workflow schema
Discovery & Documentation
List and search available nodes, models (checkpoints, LoRAs, VAEs, embeddings, ControlNet, upscale models), and extensions
Get detailed node information including inputs, outputs, parameters, and types
Browse model folders and refresh node cache after installing new nodes
System Monitoring & Control
Check server health, version, memory usage, GPU info, and queue status
View generation history with configurable limits
Cancel running jobs (all or specific prompt IDs) and clear pending queue items
Integration Features
Compatible with ComfyUI 0.3.x - 0.4.x and custom node extensions
Supports both local and remote ComfyUI servers
File and URL-based output modes for flexibility
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ComfyUI MCP Servergenerate an image of a futuristic city at sunset"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Comfy MCP Server
MCP server for comprehensive ComfyUI workflow automation, management, and image generation.
Overview
This server provides Claude Code (and other MCP clients) with full access to ComfyUI capabilities:
System monitoring: Check server health, queue status, and history
Workflow execution: Run saved workflows or execute custom workflow dicts
Workflow management: Create, modify, save, and validate workflows
Node discovery: List available nodes, models, and their parameters
Image generation: Simple prompt-based generation or full workflow control
Key Features
ā Schema-Validated Workflows
All generated workflows are validated against the ComfyUI v0.4 workflow schema, ensuring compatibility and correct execution. No more invalid workflow errors.
šØ Beautiful Visual Layout
Programmatically generated workflows have coherent node positions with proper spacing and alignment. The built-in layout engine produces untangled, professional-looking workflows that are easy to read and modify in the ComfyUI editor.
Technical: Uses graph-based layout algorithms (NetworkX) to automatically position nodes, eliminating the typical spaghetti diagrams from programmatic workflow generation.
Prerequisites
uv - Python package manager
Running ComfyUI server (local or remote)
Workflow files exported from ComfyUI (API format)
Installation
Via PyPI (Recommended)
From Source
Configuration
Environment Variables
Variable | Required | Default | Description |
| No |
| ComfyUI server URL |
| No | Same as COMFY_URL | External URL for image retrieval |
| No | - | Directory for API format workflows (execution) |
| No | - | Directory for UI format workflows (editor) |
| No | - | Default workflow file for |
| No | - | Default prompt node ID for |
| No | - | Default output node ID |
| No |
| Output mode: |
| No |
| Max seconds to wait for workflow (1-300) |
| No |
| Seconds between status polls (0.1-10.0) |
Example Configuration
Claude Desktop Config
Or use the pre-configured .mcp.json from comfyui-template.
Available Tools
System Tools
Tool | Description |
| Get ComfyUI server health: version, memory, device info |
| Get current queue: running and pending jobs |
| Get recent generation history (1-100 entries) |
| Interrupt current generation |
| Clear queue or delete specific items |
Discovery Tools
Tool | Description |
| List available ComfyUI nodes (optional filter) |
| Get detailed node info: inputs, outputs, parameters |
| Search nodes by name, type, or category |
| List models in a folder |
| List available model folder types |
| List available embeddings |
| List loaded extensions (custom node packs) |
| Refresh cached node list from ComfyUI |
Workflow Management Tools
Tool | Description |
| List available workflow files |
| Load a workflow from file |
| Save workflow (format: "api" or "ui") |
| Create an empty workflow structure |
| Add a node to a workflow |
| Remove a node from a workflow |
| Update a node's input |
| Validate workflow structure and node types |
| Convert API format to UI/Litegraph format |
| List available workflow templates |
| Get a pre-built workflow template |
| Generate random funny workflow name |
Execution Tools
Tool | Description |
| Generate image using default workflow (simple interface) |
| Execute a saved workflow file |
| Execute an arbitrary workflow dict |
| Submit workflow without waiting (returns prompt_id) |
| Get status of a submitted prompt |
| Get result image from completed prompt |
Workflow Formats
ComfyUI uses two workflow formats. Understanding the difference is critical:
Format | Structure | Use Case | Directory |
API |
| MCP execution, automation |
|
UI |
| ComfyUI editor only |
|
IMPORTANT:
Only API format workflows can be executed via MCP (
run_workflow(),execute_workflow())UI format workflows are for loading/editing in the ComfyUI web editor
The MCP server will reject UI format workflows with an error if you try to execute them
Format Detection
The server automatically detects format by checking for "nodes" or "version" keys (UI format) vs "class_type" keys (API format).
Creating, Validating, and Saving Workflows
Recommended Workflow Process
Node Connections
Connections use the format ["source_node_id", output_index]:
Discovering Node Parameters
Before adding a node, check its required inputs:
Validation Errors
Common validation issues:
Error | Cause | Fix |
| Node class doesn't exist | Use |
| Required input not provided | Check |
| Source node/output doesn't exist | Verify node IDs and output indices |
| Trying to execute UI format | Use API format or re-export from ComfyUI |
Usage Examples
Simple Image Generation
Run a Named Workflow
Build and Execute Custom Workflow
Async Workflow Submission
Discover Available Nodes
Using fal.ai Connector
The ComfyUI-fal-Connector enables cloud GPU inference via fal.ai.
Environment Setup:
Architecture
Development
ComfyUI API Coverage
Target: ComfyUI 0.3.x - 0.4.x
API Endpoint | Method | Description | Status |
| POST | Submit workflow for execution | ā Implemented |
| GET | View running/pending jobs | ā Implemented |
| POST | Clear queue / delete items | ā Implemented |
| GET | View generation history | ā Implemented |
| GET | Get specific job result | ā Implemented |
| POST | Delete history entries | ā ļø Partial |
| POST | Stop current generation | ā Implemented |
| GET | List all available nodes | ā Implemented |
| GET | Get node parameters/inputs | ā Implemented |
| GET | List model folders | ā Implemented |
| GET | List models in folder | ā Implemented |
| GET | Server health/resources | ā Implemented |
| GET | Retrieve generated images | ā Implemented |
| GET | List available embeddings | ā Implemented |
| GET | List loaded extensions | ā Implemented |
| POST | Upload image for workflows | ā Not implemented |
| POST | Upload mask for inpainting | ā Not implemented |
| POST | Free VRAM/memory | ā Not implemented |
| * | User data management | ā Not implemented |
Implementation Notes
Partial: History deletion is not fully exposed as a tool
Not implemented: Image/mask upload, memory management, and user data APIs are planned for future releases
Compatibility
MCP Server Version: 0.2.0
Minimum ComfyUI: 0.3.0
Maximum Tested ComfyUI: 0.4.x
Python: 3.10+
The server includes a compatibility layer that handles API differences between ComfyUI versions and provides graceful degradation.
License
MIT License - see LICENSE file.
Credits
Originally forked from @lalanikarim/comfyui-mcp.