ComfyUI MCP
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 create an image from a prompt using the default workflow"
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
A universal Model Context Protocol server that lets MCP-capable agents discover ComfyUI nodes, build and edit API workflows, run them, inspect the queue, retrieve outputs, and optionally render the generated graph on an open ComfyUI canvas.
The core is agent-neutral. This repository also packages that same server and one portable Agent Skill for Codex, Claude Code, Gemini CLI, Cursor, and GitHub Copilot CLI. The host adapters contain only manifests and launch configuration; no agent gets a forked implementation.
Project status: alpha. The core workflow store, graph editing, validation, execution, and canvas bridge are implemented. Test against a non-production ComfyUI installation before giving an agent access to valuable models, paid nodes, or a shared GPU queue.
Agent plugins and built-in skill
The repository now includes skills/comfyui-workflow/SKILL.md. It teaches compatible agents how to
discover the live node schema, edit revisioned graphs, validate before execution, handle queue and
file operations safely, and report generated outputs. This is what makes an installed agent know
how to combine the MCP tools instead of seeing only a flat tool list.
Host | Included adapter | Local install or test |
Codex |
|
|
Claude Code |
|
|
Gemini CLI |
|
|
Cursor |
| Link or copy into |
GitHub Copilot CLI |
|
|
Other MCP clients | Generic example | Register |
All adapters share the same Python server and skill. They use uv to start the bundled source, so
uv must be on PATH; the first launch may need to download Python dependencies. See
docs/agent-integrations.md for persistent install commands,
non-default ComfyUI URLs, explicit skill invocation, verification, and packaging details.
Related MCP server: comfy-draftsman
What it does
Discovers installed core and custom node types through ComfyUI's live
/object_infoschema.Searches model folders and workflow templates without putting huge responses in agent context.
Imports, creates, versions, and edits ComfyUI API-format workflows.
Adds and removes nodes, sets literal inputs, and connects or disconnects graph edges.
Performs local graph checks and live validation against the connected ComfyUI instance.
Submits workflows, applies one-run-only overrides, inspects queue/history, and interrupts jobs.
Uploads allowed input images and downloads generated files to a managed output directory.
Optionally mirrors an API workflow onto every open ComfyUI canvas through the bundled bridge.
Supports local
stdio, Streamable HTTP, and legacy SSE MCP transports.
Architecture
MCP client (Codex, Claude, Cursor, custom agent, ...)
│
│ stdio / Streamable HTTP
▼
comfyui-mcp-server
┌───────────┴───────────┐
│ workflow store/editor │
│ typed MCP tools │
│ ComfyUI HTTP client │
└───────────┬───────────┘
│
ComfyUI HTTP API / WebSocket
│
┌───────────┴────────────┐
│ execution backend │
│ optional canvas bridge│
└────────────────────────┘The execution backend and visual canvas are intentionally separate:
ComfyUI's
/promptendpoint accepts an API-format workflow and executes it headlessly.An API submission does not modify an already open browser canvas.
The optional
comfyui_extensionreceives the same API workflow and reconstructs visible nodes, widgets, and links on the canvas. Execution still uses the standard ComfyUI API.
See docs/architecture.md for the design and trust boundaries.
Requirements
Python 3.11 or newer.
A reachable local or remote ComfyUI server.
An MCP client with
stdio, Streamable HTTP, or SSE support.uvfor the bundled agent-plugin launchers. It remains optional when the Python package is installed manually and a generic MCP client launchescomfyui-mcpdirectly.
ComfyUI defaults to http://127.0.0.1:8188, which is also this project's default.
Install from this repository
git clone https://github.com/yutianxiao6/comfyui-mcp.git
cd comfyui-mcp
uv sync
uv run comfyui-mcp --versionWith regular Python tooling:
python -m venv .venv
source .venv/bin/activate
pip install -e .
comfyui-mcp --versionAfter the package is published, clients will also be able to launch it with a command such as:
uvx --from comfyui-mcp-server comfyui-mcpStart the server
Local stdio
stdio is the safest and most widely supported mode. The MCP client starts one private server
process:
COMFYUI_URL=http://127.0.0.1:8188 uv run comfyui-mcpStreamable HTTP
Use this when several clients need the same MCP endpoint:
uv run comfyui-mcp --transport streamable-http --host 127.0.0.1 --port 8000Clients connect to http://127.0.0.1:8000/mcp.
The server refuses non-loopback binding by default because its tools can execute GPU workloads,
read configured input files, and control the ComfyUI queue. If remote access is required, place it
behind TLS and authentication, then explicitly set COMFYUI_MCP_ALLOW_REMOTE=true. See
SECURITY.md.
Connect an MCP client
Most desktop and IDE clients accept the same mcpServers shape. Replace the repository path:
{
"mcpServers": {
"comfyui": {
"command": "uv",
"args": [
"run",
"--directory",
"/absolute/path/to/comfyui-mcp",
"comfyui-mcp"
],
"env": {
"COMFYUI_URL": "http://127.0.0.1:8188"
}
}
}
}The exact file or settings screen differs between MCP clients, but the command, arguments, environment variables, and protocol are not vendor-specific. A copyable example is available at examples/mcp-client-config.example.json.
For an already running Streamable HTTP server, configure the client with:
http://127.0.0.1:8000/mcpSuggested agent workflow
A reliable agent should use the tools in this order:
Call
comfyui_health.Search with
comfyui_list_node_types, then inspect exact schemas withcomfyui_get_node_type.Create or import an API workflow.
Add nodes, set inputs, and connect outputs by zero-based index.
Call
comfyui_validate_workflow.Optionally call
comfyui_sync_canvasso a person can inspect the graph.Call
comfyui_run_workflowonly after execution has been requested.Poll
comfyui_get_run, then download selected outputs.
Example user request:
Import my SDXL API workflow as portrait-v1. Replace its checkpoint, add a
ControlNet branch, validate it, show it on the ComfyUI canvas, and run one copy
with seed 42.MCP tools
Area | Tools |
Connection |
|
Discovery |
|
Workflow store |
|
Graph editing |
|
Validation and canvas |
|
Execution |
|
Files |
|
Mutating workflow tools accept expected_revision. Agents should pass the revision returned by the
previous tool when concurrent edits are possible. A stale edit fails instead of silently
overwriting newer work.
Workflow format
The store uses ComfyUI's API format: node IDs are object keys, class_type identifies the node,
and a connection is [source_node_id, zero_based_output_index].
{
"4": {
"class_type": "CheckpointLoaderSimple",
"inputs": { "ckpt_name": "model.safetensors" }
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"text": "a cinematic portrait",
"clip": ["4", 1]
}
}
}The normal visual workflow JSON contains nodes and links and is not the same format. In
ComfyUI, use Save (API Format) before importing. The server detects visual workflow documents
and returns a specific error instead of storing an unusable graph.
Managed records are saved under:
<data-dir>/workflows/<name>.json
<data-dir>/outputs/<prompt-id>/<filename>The default data directory follows the operating system's user data convention. Override it with
COMFYUI_MCP_DATA_DIR.
Optional visual canvas bridge
Install the bridge from either a source checkout or a published package:
uv run comfyui-mcp --install-canvas-bridge /absolute/path/to/ComfyUIThe installer refuses to overwrite an existing bridge directory. During source development, you
can instead symlink comfyui_extension into the ComfyUI custom-node directory:
ln -s /absolute/path/to/comfyui-mcp/comfyui_extension \
/absolute/path/to/ComfyUI/custom_nodes/comfyui_mcp_bridgeRestart ComfyUI and refresh its browser page. comfyui_health should then report
canvas_bridge.installed: true.
Local loopback calls need no token. Docker, LAN, and remote deployments must configure the same random token in both processes:
# ComfyUI process
COMFYUI_MCP_BRIDGE_TOKEN="replace-with-a-long-random-value" python main.py
# MCP server process
COMFYUI_MCP_BRIDGE_TOKEN="replace-with-a-long-random-value" uv run comfyui-mcpCurrent bridge behavior:
replaceclears the canvas before reconstructing the API graph.mergeadds the reconstructed graph to the existing canvas.Nodes receive a deterministic layered layout because API-format workflows do not contain visual positions.
Unknown custom nodes and unresolved links are reported as canvas warnings.
The event is broadcast to open ComfyUI browser sessions connected to that server.
Canvas synchronization is a convenience and review surface, not the source of truth. The managed API workflow is what gets executed.
Configuration
Variable | Default | Purpose |
|
| ComfyUI base URL |
| empty | Prefix native routes; use |
| empty | API key sent to ComfyUI |
|
| Header used for the API key |
| empty | Key placed in |
| empty | Shared token for the optional canvas bridge |
|
| HTTP request timeout |
|
| Verify the ComfyUI HTTPS certificate |
| OS user data dir | Workflow and output storage |
| data dir | Allowed upload roots, separated by the OS path separator |
|
|
|
|
| HTTP bind host |
|
| HTTP bind port |
|
| Permit non-loopback MCP HTTP binding |
Example allowing two upload directories on Linux/macOS:
COMFYUI_MCP_INPUT_ROOTS="/data/comfy-inputs:/home/me/reference-images" uv run comfyui-mcpUse ; instead of : on Windows.
Local ComfyUI and Comfy Cloud
The implementation targets the stable local ComfyUI routes by default. A Comfy Cloud-compatible
deployment can use COMFYUI_API_PREFIX=/api and COMFYUI_API_KEY; cloud endpoint behavior and
available features may differ. The canvas bridge is intended for a ComfyUI instance where the
bundled custom extension can be installed.
Do not expose an unauthenticated local ComfyUI port directly to the internet. Put remote ComfyUI behind an authenticated reverse proxy or a private network.
Development
uv sync --extra dev
uv run pytest
uv run ruff check .
uv run ruff format --check .Run the MCP Inspector against stdio:
uv run mcp dev src/comfyui_mcp/dev_server.py:mcpOr start Streamable HTTP and connect the Inspector to http://127.0.0.1:8000/mcp:
uv run comfyui-mcp --transport streamable-http
npx -y @modelcontextprotocol/inspectorKnown limitations
Import currently accepts API-format workflows, not automatic conversion from arbitrary visual workflow JSON.
The bridge reconstructs a practical graph layout; it cannot recover original groups, comments, colors, or positions that are absent from API format.
Live progress is available from ComfyUI itself, while the current MCP API exposes pollable run status rather than a long-running streaming tool call.
Some custom nodes rely on browser-only state and cannot run correctly in ComfyUI API mode.
Streamable HTTP authentication must currently be supplied by a trusted reverse proxy.
Roadmap
Bidirectional canvas editing and explicit visual-workflow import/export.
WebSocket-backed progress notifications and preview resources.
Workflow transactions for multi-edit atomic changes.
Safer policy profiles for paid nodes, model allowlists, and maximum image dimensions.
Packaging the canvas bridge for the ComfyUI Registry.
Compatibility fixtures for major MCP hosts and ComfyUI releases.
Contributing
Issues and pull requests are welcome. Read CONTRIBUTING.md and SECURITY.md before publishing a change or vulnerability report.
License
Apache License 2.0. See LICENSE.
Available Tools
23 toolscomfyui_add_nodeC
Add a node to a managed workflow, optionally checking it against the live ComfyUI.
Inputs: class_type (required), workflow_name (required), title, inputs, +3 more. Returns: object
comfyui_clear_queueA
Remove pending workflows from the ComfyUI queue.
Inputs: no named parameters. Returns: object
comfyui_connect_nodesB
Connect one node output index to a named input on another node.
Inputs: source_node (required), target_node (required), target_input (required), source_output (required), +2 more. Returns: object
comfyui_create_workflowC
Create an empty managed API-format workflow.
Inputs: name (required), overwrite, description. Returns: object
comfyui_disconnect_inputB
Remove the node connection currently assigned to an input.
Inputs: target_node (required), target_input (required), workflow_name (required), expected_revision. Returns: object
comfyui_download_outputC
Download a generated ComfyUI file into this server's managed output directory.
Inputs: filename (required), prompt_id, subfolder, output_type. Returns: object
comfyui_get_node_typeA
Get the authoritative inputs, outputs, options, and metadata for one node class.
Inputs: class_type (required). Returns: object
comfyui_get_queueA
Inspect running and pending jobs; full workflow payloads are hidden by default.
Inputs: include_workflows. Returns: object
comfyui_get_runB
Get a run's pending, running, completed, failed, or unknown status and outputs.
Inputs: prompt_id (required). Returns: object
comfyui_get_workflowA
Read a managed workflow. Set include_graph=false for a compact summary.
Inputs: name (required), include_graph. Returns: object
comfyui_healthA
Check ComfyUI connectivity and whether the optional canvas bridge is installed.
Inputs: no named parameters. Returns: object
comfyui_import_workflowB
Import a ComfyUI API-format workflow object into the managed workflow store.
Inputs: name (required), workflow (required), overwrite, description. Returns: object
comfyui_interruptA
Interrupt the workflow currently executing in ComfyUI.
Inputs: no named parameters. Returns: object
comfyui_list_modelsA
List ComfyUI model folders, or models within one folder such as checkpoints or loras.
Inputs: folder. Returns: object
comfyui_list_node_typesA
Search installed core and custom node types without returning the full large schema.
Inputs: limit, query, category. Returns: object
comfyui_list_templatesA
List workflow templates exposed by installed ComfyUI node packages.
Inputs: no named parameters. Returns: object
comfyui_list_workflowsA
List workflows managed by this MCP server with revision and node counts.
Inputs: no named parameters. Returns: object
comfyui_remove_nodeA
Remove a node; force=true also disconnects inputs that reference the node.
Inputs: node_id (required), workflow_name (required), force, expected_revision. Returns: object
comfyui_run_workflowB
Submit a managed workflow to ComfyUI, with optional non-persistent input overrides.
Inputs: name (required), front, validate, client_id, +1 more. Returns: object
comfyui_set_inputB
Set a literal node input such as prompt text, seed, dimensions, or model name.
Inputs: value (required), node_id (required), input_name (required), workflow_name (required), +1 more. Returns: object
comfyui_sync_canvasC
Render a managed API workflow on an open ComfyUI canvas via the optional bridge.
Inputs: name (required), mode. Returns: object
comfyui_upload_imageB
Upload an allowed local image to ComfyUI for LoadImage-style nodes.
Inputs: file_path (required), overwrite, subfolder. Returns: object
comfyui_validate_workflowB
Validate graph structure and, by default, installed node schemas and required inputs.
Inputs: name (required), live. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 23 tools
Each tool targets a unique resource and action, from health checks to node introspection, workflow editing, execution, and queue control. Even closely related tools like add_node and set_input have clear boundaries, leaving no ambiguity.
All tools follow a consistent comfyui_verb_noun snake_case pattern. Verbs like list, get, create, add, remove, connect, disconnect, and validate are consistently used, making the toolset predictable and easy to navigate.
At 23 tools, this is on the heavy side, but the breadth is justified by the complex domain of ComfyUI workflow management. Each tool serves a distinct purpose, and the count remains reasonable given the need to cover discovery, editing, validation, execution, and file I/O.
The toolset covers the full lifecycle of workflow management, including creation, importing, editing, validation, running, queue inspection, and output retrieval. Minor gaps exist, such as the lack of a delete_workflow tool or a list_runs tool, but these are not critical for core usage.
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Remote MCP for RunComfy: ComfyUI deployments, hosted models, LoRA training. 31 tools.
Related MCP Servers
- AlicenseBqualityCmaintenanceAn MCP server that bridges AI agents with ComfyUI for automated workflow building, execution, monitoring, and output routing.961MIT
- AlicenseAqualityBmaintenanceThe MCP server that drafts ComfyUI workflows a human can actually read. It lets coding agents build, repair, port, validate, and run ComfyUI workflows against your own ComfyUI instance, delivering clean, organized, fully-labeled workflows.2966 PyPI2MIT
- FlicenseNot gradedqualityDmaintenanceMCP server exposing a local (or LAN) ComfyUI instance's HTTP API as tools, so an LLM client can queue generations, inspect the queue/history, upload reference images, browse installed models/nodes, and pull back generated images.-
- AlicenseNot gradedqualityDmaintenanceMCP server that enables AI agents to control a local ComfyUI instance for image generation, allowing workflow understanding, parameter modification, execution, and model discovery.16 npm3Apache 2.0