ComfyUI MCP Server
Connects AI assistants to ComfyUI for image, video, and audio generation, providing full control over ComfyUI through 40+ tools including quick generation, cloud API nodes, and custom workflow building.
README
ComfyUI MCP Server
An MCP (Model Context Protocol) server that connects AI assistants to ComfyUI for image, video, and audio generation. Works with Claude Desktop, Claude Code, and any MCP-compatible client.
What It Does
This server gives AI agents full control over ComfyUI — from one-call image generation to building complex multi-node workflows. It exposes 40+ tools organized into three tiers:
Quick Generation (one-call tools)
All parameters have sensible defaults. Only a prompt is required:
| Tool | Description |
|---|---|
text_to_image |
Generate images from text (local SD/SDXL model) |
flux_text_to_image |
Generate images using Flux (auto-detects GGUF/safetensors) |
image_to_image |
Transform an existing image with a prompt |
text_to_video |
Generate video from text (local LTX-Video model) |
image_to_video |
Animate an image into video (LTX-Video) |
wan_text_to_video |
Generate video from text (local Wan 2.2 model) |
wan_image_to_video |
Animate an image into video (Wan 2.2) |
upscale_image |
AI upscale with an upscale model |
inpaint |
Fill masked regions with AI-generated content |
dalle3_image |
DALL-E 3 image generation (cloud API) |
gpt_image_generate |
GPT Image generation/editing (cloud API) |
sora_video_generate |
Sora 2 video generation (cloud API) |
merge_videos |
Merge multiple videos into one |
Any API Node (200+ cloud providers)
Run any of ComfyUI's 200+ API nodes in a single call — Kling, Runway, Luma, Stability, ElevenLabs, Gemini, Veo, Recraft, Minimax, and more:
list_api_nodes(query="kling")— discover available API nodesget_node_schema("KlingTextToVideoNode")— see inputs, types, defaultsrun_api_node(node_class="KlingTextToVideoNode", inputs='{"prompt": "..."}')— execute
Automatically inserts loader nodes for image/video/audio inputs and save nodes for outputs. Validates COMBO values, INT/FLOAT ranges, and required inputs before submitting.
Supports async execution for parallel jobs:
run_api_node(..., queue_only=true) # returns immediately with prompt_id
wait_for_jobs("id1,id2,id3") # waits for all concurrently
Custom Workflows (multi-node graphs)
For complex workflows (ControlNet, multi-LoRA, regional prompting, IP-Adapter):
search_nodes(query="controlnet")— find relevant nodesget_node_schema("ControlNetApplyAdvanced")— understand inputs/outputscreate_workflow(template="txt2img")— start from a templateadd_node(workflow_id, "ControlNetLoader", ...)— add nodes incrementallysuggest_next(workflow_id)— see what's missingvalidate_workflow(workflow_id)— check for errorsexecute_workflow(workflow_id)— generate results
System & Utility Tools
| Tool | Description |
|---|---|
list_models |
List installed models by folder (checkpoints, loras, etc.) |
list_samplers_and_schedulers |
List valid sampler/scheduler names |
get_system_stats |
ComfyUI system info (VRAM, version, etc.) |
get_queue_status |
Current queue state |
get_history |
Generation history |
get_logs |
Server logs |
upload_image |
Upload an image to ComfyUI's input directory |
upload_mask |
Upload a mask image for inpainting |
get_image_url |
Get URL to view/download generated files |
list_files |
List files in ComfyUI directories |
copy_output_to_input |
Copy generated files to input for reuse |
wait_for_jobs |
Wait for multiple queued jobs concurrently |
Prerequisites
ComfyUI
You need a running ComfyUI instance. Install it following the official instructions.
Make sure ComfyUI is running and accessible (default: http://127.0.0.1:8188).
Models (for local generation)
For local generation tools, you need models installed in ComfyUI:
- SD/SDXL image (
text_to_image): Any SD/SDXL checkpoint inmodels/checkpoints/ - Flux image (
flux_text_to_image): A Flux diffusion model (safetensors inmodels/diffusion_models/or GGUF) +clip_l.safetensorsandt5xxlencoder inmodels/text_encoders/+ae.safetensorsVAE inmodels/vae/ - LTX-Video (
text_to_video,image_to_video): LTX-Video checkpoint + T5-XXL text encoder - Wan 2.2 video (
wan_text_to_video,wan_image_to_video): Wan 2.2 GGUF model +umt5_xxlencoder inmodels/text_encoders/+wan2.2_vae.safetensorsinmodels/vae/ - Upscaling (
upscale_image): Any upscale model inmodels/upscale_models/
All local tools auto-detect installed models. Use list_models() to see what's available.
Use list_models() through the MCP to see what's currently installed.
Comfy.org API Key (for cloud generation)
Cloud-based tools (dalle3_image, gpt_image_generate, sora_video_generate, run_api_node) require a Comfy.org API key with credits loaded. Set it via the COMFY_API_KEY environment variable.
Installation
From source
git clone https://github.com/halbert04/comfyui-mcp.git
cd comfyui-mcp
pip install .
For development:
pip install -e ".[dev]"
Verify installation
comfyui-mcp --help
Configuration
All configuration is via environment variables:
| Variable | Default | Description |
|---|---|---|
COMFYUI_URL |
http://127.0.0.1:8188 |
ComfyUI server URL |
COMFYUI_TIMEOUT |
300 |
Max wait time for job completion (seconds) |
COMFYUI_POLL_INTERVAL |
1.0 |
Polling interval for job status (seconds) |
COMFY_API_KEY |
(empty) | Comfy.org API key for cloud API nodes |
COMFYUI_MCP_TRANSPORT |
stdio |
Transport mode: stdio or streamable-http |
COMFYUI_MCP_HOST |
127.0.0.1 |
Host for HTTP transport |
COMFYUI_MCP_PORT |
8200 |
Port for HTTP transport |
Usage with Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"comfyui": {
"command": "comfyui-mcp",
"env": {
"COMFYUI_URL": "http://127.0.0.1:8188",
"COMFYUI_TIMEOUT": "900",
"COMFY_API_KEY": "your-comfy-api-key-here"
}
}
}
}
Restart Claude Desktop after saving. The ComfyUI tools will appear in the tool list.
Usage with Claude Code
Add the MCP server to your Claude Code configuration:
claude mcp add comfyui -- comfyui-mcp
Or with environment variables:
claude mcp add comfyui -e COMFYUI_URL=http://127.0.0.1:8188 -e COMFY_API_KEY=your-key -- comfyui-mcp
Usage as HTTP Server
For non-stdio clients, run as an HTTP server:
COMFYUI_MCP_TRANSPORT=streamable-http comfyui-mcp
This starts an MCP server on http://127.0.0.1:8200 that any MCP client can connect to.
Project Structure
src/comfyui_mcp/
server.py # MCP server entry point and tool registration
client.py # HTTP client for ComfyUI API
config.py # Environment variable configuration
workflows.py # Workflow graph builder and templates
node_cache.py # Cached node schema from /object_info
polling.py # Job completion polling
tools/
generate.py # One-call generation tools
api_runner.py # Generic API node runner (run_api_node, list_api_nodes)
builder.py # Workflow builder tools (create, add_node, execute, etc.)
discovery.py # Node discovery tools (search_nodes, get_node_schema)
models.py # Model listing tools
system.py # System info, queue, history, file browsing
resources/
resources.py # MCP resources (workflow templates, system info)
Development
Run tests:
pip install -e ".[dev]"
pytest
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。