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 Serverexecute this workflow: checkpoint: CheckpointLoaderSimple ckpt_name: sd_xl_base_1.0.safetensors"
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.
ComfyUI MCP Server
DSL-first workflow management for ComfyUI via Model Context Protocol (MCP)
A production-ready MCP server that enables AI agents to manage ComfyUI workflows using a human-readable Domain Specific Language (DSL). The core design philosophy is DSL-first: agents work entirely in DSL format, with JSON conversion happening transparently.
π Quick Start
Installation
pip install comfy-mcpUsage with Claude Code
Create MCP configuration:
{
"mcpServers": {
"comfyui-workflows": {
"command": "comfy-mcp",
"args": [],
"env": {}
}
}
}Start Claude Code with MCP:
claude --mcp-config mcp_config.jsonUse in conversation:
"Execute this workflow: [paste DSL]"
"List workflows in examples directory"
"Show ComfyUI queue status"β¨ Features
π DSL-First Design
Agents work entirely in human-readable DSL
Automatic JSON β DSL conversion
No need to think about format conversion
π File Operations
read_workflow- Auto-converts JSON to DSLwrite_workflow- Saves DSL as JSON/DSLlist_workflows- Discovers workflow filesvalidate_workflow- DSL syntax validationget_workflow_info- Workflow analysis
β‘ Execution Operations
execute_workflow- Run DSL workflows on ComfyUIget_job_status- Monitor execution & download imageslist_comfyui_queue- View ComfyUI queue status
π¨ DSL Syntax Example
## Model Loading
checkpoint: CheckpointLoaderSimple
ckpt_name: sd_xl_base_1.0.safetensors
## Text Conditioning
positive: CLIPTextEncode
text: a beautiful landscape, detailed, photorealistic
clip: @checkpoint.clip
negative: CLIPTextEncode
text: blurry, low quality
clip: @checkpoint.clip
## Generation
latent: EmptyLatentImage
width: 1024
height: 1024
sampler: KSampler
model: @checkpoint.model
positive: @positive.conditioning
negative: @negative.conditioning
latent_image: @latent.latent
seed: 42
steps: 20
## Output
decode: VAEDecode
samples: @sampler.latent
vae: @checkpoint.vae
save: SaveImage
images: @decode.image
filename_prefix: outputποΈ Architecture
βββββββββββββββββββ ββββββββββββββββ βββββββββββββββ
β AI Agent ββββββ MCP Server ββββββ ComfyUI β
β (Claude) β β β β Server β
βββββββββββββββββββ ββββββββββββββββ βββββββββββββββ
β β β
β DSL Workflows β JSON API β
β β β
βΌ βΌ βΌ
Natural Language βββββΊ DSL Parser βββββΊ JSON ConverterKey Components:
DSL Parser: Converts human-readable DSL to Abstract Syntax Tree
JSON Converter: Bidirectional conversion between DSL and ComfyUI JSON
MCP Server: Exposes tools via Model Context Protocol
Execution Engine: Integrates with ComfyUI API for workflow execution
π Documentation
Core Classes
DSLParser: Parse DSL text into Abstract Syntax TreeDslToJsonConverter: Convert DSL AST to ComfyUI JSONJsonToDslConverter: Convert ComfyUI JSON to DSL AST
MCP Tools
Tool | Description | Example |
| Read and convert workflows to DSL |
|
| Write DSL to disk as JSON/DSL |
|
| Find workflow files |
|
| Check DSL syntax |
|
| Analyze structure |
|
| Run on ComfyUI |
|
| Monitor execution |
|
| View queue |
|
π οΈ Development
Setup
git clone https://github.com/christian-byrne/comfy-mcp.git
cd comfy-mcp
pip install -e ".[dev]"
pre-commit installTesting
# Run all tests
pytest
# Run with coverage
pytest --cov=comfy_mcp --cov-report=html
# Run specific test types
pytest -m unit
pytest -m integration
pytest -m "not slow"Code Quality
# Format code
black .
# Lint code
ruff check .
# Type checking
mypy comfy_mcpDocumentation
cd docs
make htmlπ§ Configuration
Environment Variables
COMFYUI_SERVER: ComfyUI server address (default:127.0.0.1:8188)MCP_DEBUG: Enable debug loggingMCP_LOG_LEVEL: Set log level (DEBUG, INFO, WARNING, ERROR)
ComfyUI Setup
Install ComfyUI
Start server:
python main.py --listen 0.0.0.0Ensure models are installed in
models/checkpoints/
π€ Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Workflow
Fork the repository
Create a feature branch:
git checkout -b feature-nameMake changes and add tests
Run tests and linting:
pytest && black . && ruff check .Submit a pull request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
ComfyUI - Amazing stable diffusion GUI
FastMCP - Excellent MCP framework
Anthropic - Model Context Protocol specification
π Roadmap
v0.2.0: Enhanced DSL features (templates, macros)
v0.3.0: Web UI for workflow management
v0.4.0: Git integration for workflow versioning
v0.5.0: ComfyUI node discovery and documentation
v1.0.0: Production deployment features
Built with β€οΈ for the ComfyUI and AI automation community