
ComfyUI MCP Server
A Model Context Protocol server that bridges Claude with ComfyUI, enabling AI image generation using Stable Diffusion through text prompts and custom workflows.
README
ComfyUI MCP Server - Enhanced Edition
A Model Context Protocol (MCP) server that enables Claude to interact with ComfyUI for AI image generation using Stable Diffusion - now with full API control!
Overview
This enhanced MCP server provides a comprehensive bridge between Claude and ComfyUI, allowing you to:
- Generate images with full control over models, samplers, and schedulers
- Build custom workflows programmatically
- Execute and manage saved ComfyUI workflows
- Upload images for img2img workflows
- List and use LoRAs, embeddings, and custom nodes
- Manage the generation queue
- Retrieve generated images
Special Focus: Optimized workflows for Crisis Corps logo and branding generation!
New Features in v0.2.0
- Model Swapping: Change checkpoints on the fly
- Workflow Builder: Create workflows programmatically without the UI
- Advanced Sampling: Control samplers and schedulers
- LoRA Support: List and use LoRA models (coming soon)
- Node Discovery: Get all available node types from ComfyUI
- Image Upload: Upload images for img2img and ControlNet workflows
- Queue Management: Clear queue, check status, interrupt generations
- Workflow Saving: Save custom workflows for reuse
Features
- Platform Agnostic: Works with any ComfyUI installation (local, remote, containerized)
- Full API Access: Complete control over ComfyUI's capabilities
- Workflow Support: Load, execute, build, and save complex workflows
- Queue Management: Monitor and control generation progress
- Flexible Output: Return images as base64 or file paths
- Logo Optimized: Includes pre-built workflows for logo generation
Prerequisites
- ComfyUI installed and running (see Setup Guide)
- Python 3.10+
- MCP SDK
Installation
# Clone the repository
git clone https://github.com/SamuraiBuddha/mcp-comfyui.git
cd mcp-comfyui
# Install dependencies
pip install -e .
Quick Start
1. Start ComfyUI
# If installed locally
cd /path/to/ComfyUI
python main.py --listen
# Or use Docker
docker-compose up -d
2. Configure MCP
# Copy example config
cp .env.example .env
# Edit .env with your settings
# COMFYUI_HOST=localhost
# COMFYUI_PORT=8188
3. Add to Claude Desktop
{
"mcpServers": {
"comfyui": {
"command": "python",
"args": ["-m", "mcp_comfyui"],
"cwd": "/path/to/mcp-comfyui",
"env": {
"COMFYUI_HOST": "localhost",
"COMFYUI_PORT": "8188"
}
}
}
}
Available Tools
generate_image
Generate an image with full control over all parameters.
generate_image(
prompt="A futuristic robot logo for Crisis Corps",
negative_prompt="blurry, low quality",
width=512,
height=512,
steps=20,
cfg_scale=7.0,
seed=-1, # Random seed
model="sd_xl_base_1.0.safetensors",
sampler="euler",
scheduler="normal"
)
build_workflow
Create a custom workflow programmatically.
build_workflow(
nodes=[
{
"id": "1",
"type": "CheckpointLoaderSimple",
"inputs": {"ckpt_name": "sd_xl_base_1.0.safetensors"}
},
{
"id": "2",
"type": "CLIPTextEncode",
"inputs": {"text": "robot logo", "clip": ["1", 1]}
},
{
"id": "3",
"type": "KSampler",
"inputs": {
"model": ["1", 0],
"positive": ["2", 0],
"seed": 42,
"steps": 20
}
}
]
)
save_workflow
Save a workflow for future use.
save_workflow(
name="my_logo_workflow",
workflow=built_workflow,
description="Custom workflow for Crisis Corps logos"
)
execute_workflow
Run a saved ComfyUI workflow with custom inputs.
execute_workflow(
workflow_name="logo_generator",
inputs={
"prompt": "Crisis Corps emblem",
"style": "military insignia"
}
)
list_models
Get all available model checkpoints.
list_models()
# Returns: ["sd_xl_base_1.0.safetensors", "dreamshaper_8.safetensors", ...]
list_samplers
Get available sampling methods.
list_samplers()
# Returns: ["euler", "euler_ancestral", "dpm_2", "dpm_2_ancestral", ...]
list_schedulers
Get available noise schedulers.
list_schedulers()
# Returns: ["normal", "karras", "exponential", "sgm_uniform", ...]
get_node_types
Discover all available ComfyUI nodes.
get_node_types()
# Returns complete node definitions with inputs/outputs
upload_image
Upload an image for img2img workflows.
upload_image(
image_path="/path/to/image.png",
name="reference_image"
)
list_workflows
Get all available workflow files.
list_workflows()
# Returns: ["logo_generator.json", "crisis_corps_logo.json", ...]
get_queue_status
Check the current generation queue.
get_queue_status()
# Returns: {"queue_remaining": 2, "currently_processing": "prompt_123"}
get_history
Retrieve recent generation history.
get_history(limit=10)
# Returns list of recent generations with IDs and parameters
get_image
Retrieve a generated image by ID.
get_image(prompt_id="abc123")
# Returns: base64 encoded image or filepath
interrupt_generation
Stop the current generation.
interrupt_generation()
clear_queue
Clear all pending generations.
clear_queue()
Logo Generation Examples
Generate Crisis Corps Logo with Different Models
# SDXL for high quality
result = await generate_image(
prompt="Crisis Corps logo, heroic robot emblem, orange and blue",
model="sd_xl_base_1.0.safetensors",
width=1024,
height=1024,
steps=35
)
# DreamShaper for stylized look
result = await generate_image(
prompt="Crisis Corps logo, heroic robot emblem, orange and blue",
model="dreamshaper_8.safetensors",
sampler="dpm_2_ancestral",
scheduler="karras"
)
Build Custom Logo Workflow
# Create a workflow with LoRA for consistent style
workflow = await build_workflow(
nodes=[
{"id": "1", "type": "CheckpointLoaderSimple",
"inputs": {"ckpt_name": "sd_xl_base_1.0.safetensors"}},
{"id": "2", "type": "LoraLoader",
"inputs": {"model": ["1", 0], "clip": ["1", 1],
"lora_name": "logo_style.safetensors",
"strength_model": 0.8, "strength_clip": 0.8}},
{"id": "3", "type": "CLIPTextEncode",
"inputs": {"text": "Crisis Corps emblem", "clip": ["2", 1]}},
# ... rest of workflow
]
)
# Save for reuse
await save_workflow(
name="crisis_corps_lora_workflow",
workflow=workflow,
description="Logo generation with consistent style LoRA"
)
Pre-Built Workflows
The workflows/
directory contains optimized workflows for Crisis Corps branding:
- logo_generator.json - General purpose logo creation
- crisis_corps_logo.json - Specific Crisis Corps branding (4 variations)
- robot_emblem.json - Military-style badges and emblems (6 variations)
- text_logo_variations.json - Typography-focused designs
See workflows/README.md for detailed documentation.
Brand Guidelines
For consistent Crisis Corps branding, see examples/brand_guidelines.md which includes:
- Color codes (#FF6B35 orange, #004E98 blue)
- Typography guidelines
- Prompt engineering tips
- Style references
Architecture
Claude ↔ MCP Server ↔ ComfyUI API
↓ ↓
Configuration WebSocket
↓ ↓
Return Data ← Generated Images
Error Handling
The server includes comprehensive error handling:
- Connection errors to ComfyUI
- Invalid workflow specifications
- Generation failures
- Timeout handling
- Model/sampler validation
Security Notes
- Never expose ComfyUI directly to the internet
- Use API keys if implementing authentication
- Validate all inputs before passing to ComfyUI
- Consider rate limiting for production use
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
TODO
- [ ] Add LoRA support implementation
- [ ] Implement ControlNet workflows for consistent shapes
- [ ] Add image-to-image generation for logo variations
- [ ] Support for SDXL specific features
- [ ] Batch processing optimizations
- [ ] Caching for frequently used workflows
- [ ] Auto-background removal for logos
- [ ] SVG conversion support
- [ ] Custom node support
- [ ] Workflow validation improvements
License
MIT License - see LICENSE file for details
Acknowledgments
- ComfyUI by comfyanonymous
- Model Context Protocol by Anthropic
- Crisis Corps branding examples included with permission
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。