ComfyUI MCP Server
Click on "Deploy 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 Server execute 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"Related MCP server: ComfyUI MCP Server
⨠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
Available Tools
16 toolsexecute_workflowA
Execute a DSL workflow on ComfyUI server.
Converts DSL to JSON and submits to ComfyUI for execution. Can optionally wait for completion and return results.
Args: dsl: Workflow content in DSL format server_address: ComfyUI server address (default: 127.0.0.1:8188) wait_for_completion: Whether to wait for execution to complete timeout_seconds: Maximum time to wait for completion
Returns: Execution result with prompt_id, status, and outputs if completed
Examples: execute_workflow(dsl_content) execute_workflow(dsl_content, server_address="192.168.1.100:8188") execute_workflow(dsl_content, wait_for_completion=False)
Inputs: dsl (required), server_address, wait_for_completion, timeout_seconds. Returns: object
generate_from_templateA
Generate a workflow from a template with custom parameters.
Creates a complete DSL workflow by substituting parameters into the template. Optionally saves to file.
Args: template_name: Name of the template to use parameters: Dictionary of parameter values to substitute save_path: Optional path to save the generated workflow
Returns: Generated DSL content and validation results
Examples: generate_from_template("text2img_basic", {"prompt": "sunset"}) generate_from_template("img2img", {"image_path": "input.png"}, "workflows/my_img2img.dsl")
Inputs: template_name (required), parameters, save_path. Returns: object
get_job_statusA
Get status and results of a ComfyUI job.
Checks execution status and optionally downloads generated images.
Args: prompt_id: The prompt ID returned by execute_workflow server_address: ComfyUI server address download_images: Whether to download generated images image_save_path: Directory to save images (relative to workflows/)
Returns: Job status with completion info and image paths if downloaded
Examples: get_job_status("12345-abcde-67890") get_job_status("12345-abcde-67890", download_images=True)
Inputs: prompt_id (required), server_address, download_images, image_save_path. Returns: object
get_templateA
Get detailed information about a specific template.
Retrieves complete template information including parameters, requirements, and DSL preview.
Args: template_name: Name of the template to retrieve
Returns: Template details with parameters and DSL preview
Examples: get_template("text2img_basic") get_template("controlnet_pose")
Inputs: template_name (required). Returns: object
get_template_dslA
Get DSL content for any template (custom or official).
Retrieves the DSL representation of a template, which can then be modified or executed directly.
Args: template_name: Name of the template source: Template source ("custom", "official", or "auto")
Returns: Template DSL content and metadata
Examples: get_template_dsl("text2img_basic") get_template_dsl("openai_dalle_3_text_to_image", "official")
Inputs: template_name (required), source. Returns: object
get_workflow_infoB
Analyze workflow structure and return metadata.
Parses DSL and extracts structural information like node types, sections, and connections without executing the workflow.
Args: dsl: Workflow content in DSL format
Returns: Workflow metadata including nodes, sections, and connections
Examples: get_workflow_info(dsl_content)
Inputs: dsl (required). Returns: object
list_comfyui_queueA
List current ComfyUI execution queue.
Shows running and pending jobs in the ComfyUI queue.
Args: server_address: ComfyUI server address
Returns: Queue information with running and pending jobs
Examples: list_comfyui_queue() list_comfyui_queue("192.168.1.100:8188")
Inputs: server_address. Returns: object
list_official_templatesB
List official ComfyUI templates.
Returns templates from the official Comfy-Org repository that have been synced and converted to DSL format.
Returns: List of official template metadata
Examples: list_official_templates()
Inputs: no named parameters. Returns: result
list_templatesA
List available workflow templates.
Discover workflow templates by category, difficulty, or tags. Templates provide ready-to-use workflows for common use cases.
Args: category: Filter by category (Generation, Enhancement, Editing, etc.) difficulty: Filter by difficulty (beginner, intermediate, advanced) tag: Filter by tag (text2img, inpainting, controlnet, etc.)
Returns: List of template metadata with names, descriptions, and parameters
Examples: list_templates() list_templates(category="Generation") list_templates(difficulty="beginner") list_templates(tag="text2img")
Inputs: category, difficulty, tag. Returns: result
list_workflowsA
List workflow files in a directory.
Discovers workflow files (.json and .dsl) in the specified directory. Supports glob patterns for filtering.
Args: directory: Directory to search (default: "workflows") pattern: Glob pattern for filtering (default: "*" for all files)
Returns: List of workflow info dicts with name, size, modified time
Examples: list_workflows() list_workflows("workflows", "*.json") list_workflows("../dsl/examples/dsl")
Inputs: directory, pattern. Returns: result
read_workflowA
Read a workflow file and return it as DSL format.
Supports both JSON and DSL input files. Automatically detects format and converts JSON to DSL transparently.
Args: filepath: Path to workflow file (.json or .dsl)
Returns: Workflow content in DSL format
Examples: read_workflow("workflows/my_workflow.json") read_workflow("../dsl/examples/dsl/simple.dsl")
Inputs: filepath (required). Returns: result
search_templatesB
Search templates by name, description, or tags.
Performs fuzzy search across template metadata to find relevant workflow templates.
Args: query: Search query (searches name, description, tags)
Returns: List of matching templates
Examples: search_templates("pose") search_templates("upscaling") search_templates("text to image")
Inputs: query (required). Returns: result
sync_official_templatesA
Sync official ComfyUI templates from GitHub.
Downloads and processes official workflow templates from the Comfy-Org/workflow_templates repository. Converts them to DSL format for use with the template system.
Returns: Sync status with count of successfully processed templates
Examples: sync_official_templates()
Inputs: no named parameters. Returns: object
validate_template_parametersA
Validate parameters for a template without generating.
Checks if provided parameters are valid for the template and returns detailed validation results.
Args: template_name: Name of the template parameters: Dictionary of parameters to validate
Returns: Validation results with errors and warnings
Examples: validate_template_parameters("text2img_basic", {"width": "512"})
Inputs: template_name (required), parameters (required). Returns: object
validate_workflowA
Validate DSL workflow syntax.
Parses DSL and checks for syntax errors without executing the workflow. Returns validation status and any errors found.
Args: dsl: Workflow content in DSL format
Returns: Validation result with is_valid, errors, and warnings
Examples: validate_workflow(dsl_content)
Inputs: dsl (required). Returns: object
write_workflowA
Write a workflow to disk.
Takes DSL content and writes it to disk. By default, converts to JSON format. Can optionally save as .dsl format directly.
Args: filepath: Destination file path dsl: Workflow content in DSL format format: Output format ("json" or "dsl", default: "json")
Returns: Status dict with path, size, and format info
Examples: write_workflow("workflows/new_workflow.json", dsl_content) write_workflow("workflows/backup.dsl", dsl_content, format="dsl")
Inputs: filepath (required), dsl (required), format. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 16 tools
Most tools have distinct purposes, but there is some overlap between get_template and get_template_dsl, as both retrieve template details, which could cause confusion. However, descriptions clarify that get_template provides metadata while get_template_dsl focuses on DSL content, helping to differentiate them.
All tool names follow a consistent verb_noun pattern with snake_case, such as execute_workflow, list_templates, and validate_workflow. This predictability makes the set easy to navigate and understand.
With 16 tools, the count is slightly high but reasonable for a ComfyUI server covering workflow execution, template management, and file operations. It feels comprehensive without being overwhelming, though some tools like get_template and get_template_dsl could potentially be consolidated.
The tool set provides complete coverage for the domain, including workflow execution (execute_workflow), status tracking (get_job_status), template handling (list_templates, generate_from_template), file operations (read_workflow, write_workflow), and validation (validate_workflow). There are no obvious gaps for core ComfyUI operations.
Maintenance
Related MCP Connectors
Build and run visual creative-production workflows from your AI agent.
Build, test and publish agentic workflows from your AI client: approve steps, read tables, see runs.
Remote MCP for RunComfy: ComfyUI deployments, hosted models, LoRA training. 31 tools.
Create, validate, and manage agent-powered workflows with OutcomeCI.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables orchestration of ComfyUI workflows through natural language by discovering workflow templates, applying mutations, and submitting prompts to running ComfyUI instances. Provides asset validation and lightweight tooling for AI image generation experimentation.3-
- AlicenseAqualityDmaintenanceEnables comprehensive ComfyUI workflow automation including image generation, workflow management, node discovery, and system monitoring through natural language interactions with local or remote ComfyUI servers.3152 PyPI14MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI agents to generate and iteratively refine images, audio, and video by interacting with a local ComfyUI instance through natural conversation. It provides comprehensive tools for workflow management, node introspection, and publishing generated assets.Apache 2.0
- AlicenseNot gradedqualityDmaintenanceGive AI agents full control over your local ComfyUI by exposing 77 tools for workflow management, image generation, model handling, and real-time canvas control.4AGPL 3.0