comfy-workflow-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., "@comfy-workflow-mcp run my portrait workflow with a red fox in the snow and seed 7"
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.
comfy-workflow-mcp
Run the workflows saved in a ComfyUI server as tools for any MCP agent (Claude Code, Claude Desktop, Cursor, your own agent).
Build and tune a workflow in the ComfyUI editor and save it. Agents can then list it, see its inputs, and run it with their own prompt, images and seed. Edit the workflow and save again: the next run uses the new version, because the saved file is loaded on every run.
Works with a local or remote ComfyUI, and with a vast.ai instance found from your API key.
Source-available, not open source. The code is public to read and evaluate. Using, copying, modifying or redistributing it needs written permission from the owner (jinsoo96); PlateerLab members have it within Plateer products. See LICENSE.
Tools
Tool | What it does |
| Which server, ComfyUI version, GPU, free VRAM, queue length |
| Workflows saved in the editor |
| Each node's id, title, class and the values you can change; which nodes take images, which produce outputs, which seeds re-roll |
| Run with your values. Returns a |
|
|
| Put a local image in the server's input folder |
| Model folders, or the files in one ( |
| Score an image against a rubric and a description of what it must show (harness) |
| Run a workflow under the harness: generate, judge, fix, judge again, keep the best. Returns a job id |
| Progress and result of a |
Inputs are addressed as <node id | title | class>.<input>:
{
"name": "portrait.json",
"set": {"Positive.text": "a red fox in the snow", "KSampler.seed": 7, "EmptyLatentImage.width": 1024},
"images": {"Reference": "C:/pics/fox.png"},
"enable": ["Turbo LoRA"],
"wait_seconds": 25
}A title wins over a class name, so give the nodes you want agents to touch a clear title in the editor (Positive, Reference). If a name matches more than one node, the error lists the ids to use instead. images takes a local file (uploaded for you) or a file name already on the server. enable / bypass switch nodes on or off for that run only. Seeds saved as "randomize" get a new value each run unless you set them.
Related MCP server: ComfyUI MCP Server
Harness: judge and retry
A generated image is often almost right: someone faces the camera instead of the person they talk to, there are three mugs instead of two, the left and right of a scene swap. The harness runs any saved workflow as a loop, so these get caught and fixed without anyone looking:
generate -> judge (rubric) -> fix -> judge -> ... -> keep the best attemptThe rules are data, not prompt text, so every agent that uses the workflow gets the same checks. A rubric has:
criteria: scored 0 to 1 by an isolated vision judge against your description of the image (
{name, description, weight, hard}, a pass threshold, a retry limit). A second judge pass drops problems that are guesses or say the same thing differently.checks: one focused question each. A long checklist misses things a single question catches.
fixes:
regenerate(new seed, the problems appended to the prompt),mirror(flip left-right for a swapped scene, no re-run), oredit(run your edit workflow with the problems as the instruction).
See examples/rubrics/story_panel.json for comics and storyboards. Set JUDGE_URL (an OpenAI-compatible /v1 endpoint), JUDGE_MODEL (a vision model) and, if needed, JUDGE_API_KEY, and install the extra: pip install "comfy-workflow-mcp[harness]".
Install
pip install git+https://github.com/PlateerLab/comfy-workflow-mcp
# or from a checkout
pip install -e .Python 3.10+. The only dependency is the mcp SDK; the ComfyUI client uses the standard library.
Configure
Variable | |
| ComfyUI base URL, e.g. |
| Basic auth / bearer token / extra headers as JSON, if your server needs them |
| Instead of |
| Which instance (default: the first running one that exposes the port) |
| ComfyUI's container port on the instance (default |
| Where results are saved (default |
| Longest a single call blocks, in seconds (default |
| Finished image results also come back as up to this many preview images (default |
On vast.ai the ComfyUI template puts basic auth in front of the port: user vastai, password = the instance's Jupyter token. The server reads both from the vast.ai API, so the address and token stay right when you recreate the instance.
Claude Code / Claude Desktop
{
"mcpServers": {
"comfy": {
"command": "comfy-workflow-mcp",
"env": {"VAST_API_KEY": "...", "COMFY_DOWNLOAD_DIR": "D:/comfy_outputs"}
}
}
}Use it from other machines (HTTP)
With stdio every machine runs its own copy, so each one needs Python, the code and the ComfyUI settings. In HTTP mode one machine runs the server and any MCP host connects to its URL:
comfy-workflow-mcp --http --port 8765 --public-url https://comfy.example.comMCP host (any PC) ──https + auth──▶ tunnel / reverse proxy ──▶ 127.0.0.1:8765/mcp ──▶ ComfyUIThe server binds to
127.0.0.1and has no authentication of its own. Put a tunnel or reverse proxy that authenticates in front of it, for example a Cloudflare Tunnel with a Cloudflare Access application and a service token (the host then sendsCF-Access-Client-IdandCF-Access-Client-Secretheaders).--public-urladds the public host to the SDK's DNS-rebinding allow list (otherwise requests through the proxy get421) and adds aurlnext tosaved_tofor each result, served from/files/(media files underCOMFY_DOWNLOAD_DIRonly). Extra hosts:--allow-host.Client config (Claude Code, Claude Desktop with a remote-capable host, XGEN Dex):
{
"mcpServers": {
"comfy": {
"type": "http",
"url": "https://comfy.example.com/mcp",
"headers": {"CF-Access-Client-Id": "...", "CF-Access-Client-Secret": "..."}
}
}
}The server is stateless (no per-client sessions), so restarting it or a long idle gap does not disconnect hosts. Long calls stay alive through proxies: responses stream as SSE with keep-alive pings every 15 s.
How it works
ComfyUI saves workflows in the editor format (nodes, positional widget values, numbered links). The /prompt endpoint needs the API format (named inputs). The server converts one into the other on every run, using the server's own /object_info to name the widgets, so any installed custom node works without a mapping table.
The conversion handles bypassed nodes (links pass through), muted nodes, notes, Reroute, legacy PrimitiveNode values, the seed "control after generate" slot, and widgets converted to inputs. API-format files saved in the workflows folder run as they are. Subgraphs and group nodes are not supported yet: unpack them in the editor and save again.
The editor workflow is sent along with each run, so every output PNG opens as the exact canvas that made it.
Security
The vast.ai API key can control your whole account. This server only reads the instance list (
GET /instances); it never creates, stops or deletes anything. The key and the instance token are not logged or returned by any tool.Agents can run any saved workflow and read the server's model and input lists. Point the server at a ComfyUI you are happy to share with the agent.
HTTP mode has no authentication of its own: anyone who reaches the URL can run workflows on your GPU. Keep the default
127.0.0.1bind and expose it only through an authenticating proxy; give each person their own token so one can be revoked.
Development
pip install -e ".[dev]"
pytestThe tests cover the conversion offline with a hand-made /object_info, the harness, and the HTTP-mode helpers.
License
Source-available, all rights reserved: LICENSE. Reading, evaluating and citing are allowed; any other use needs written permission from the owner (jinsoo96, wlstn010203@gmail.com, or an issue on this repository). PlateerLab/comfy-workflow-mcp is the origin; jinsoo96/js-comfy-workflow-mcp mirrors it automatically.
Available Tools
10 toolsdescribe_workflowB
The nodes of a saved workflow and the values you can change: per node its id, title, class and widget inputs. 'image_input' nodes take an image (see run_workflow images), 'output' nodes produce the files, 'rerolls_each_run' seeds get a new random value on each run unless you set them.
Inputs: name (required). Returns: result
get_jobA
Status of a run (queued | running | done | error). When done, output files are downloaded ('saved_to' has the local path, 'url' the public one in HTTP mode) and image results also come back as preview images. wait_seconds waits up to that long (capped by COMFY_MAX_WAIT).
Inputs: prompt_id (required), download_dir, wait_seconds.
get_judgedA
Status of a run_judged job: running | done | error, the attempt log, and when done the best image, whether it passed, and every attempt's score and problems.
Inputs: job_id (required). Returns: result
judge_imageB
Judge one image with a rubric (path to a rubric JSON file, or the JSON itself) against a description of what it must show. Returns score, pass/fail, the problems found (criteria + focused checks) and the suggested fix. Needs JUDGE_URL and JUDGE_MODEL.
Inputs: path (required), rubric (required), description (required). Returns: result
list_modelsC
Model folders on the server, or the files in one folder (e.g. 'checkpoints', 'loras', 'diffusion_models').
Inputs: folder. Returns: result
list_workflowsC
Names of the workflows saved in the ComfyUI editor (Workflows panel).
Inputs: no named parameters. Returns: result
run_judgedA
Run a saved workflow under the harness: generate -> judge with the rubric -> fix -> judge ..., keeping the best result. prompt_field: the input that holds the prompt, e.g. "Positive.text"; on a retry the judge's problems are appended to it. description: what the image must show (the judge checks against it). rubric: rubric JSON file path or JSON (see harness.py). Starts in the background and returns a job id at once; poll get_judged(job_id). Needs JUDGE_URL and JUDGE_MODEL.
Inputs: name (required), prompt (required), rubric (required), description (required), +4 more. Returns: result
run_workflowA
Run a saved workflow with your inputs. set: {"<node id|title|class>.": value}, e.g. {"Positive.text": "a cat", "KSampler.seed": 7, "EmptyLatentImage.width": 1024}. images: {"<LoadImage node id|title>": local file path (uploaded) or a file name already on the server}. enable / bypass: node ids or titles to switch on or bypass for this run (e.g. an optional LoRA). wait_seconds: wait up to this long (capped by COMFY_MAX_WAIT) and download results; otherwise poll get_job.
Inputs: name (required), set, bypass, enable, +3 more.
server_statusA
ComfyUI server: which server, version, GPU and free VRAM, queue length.
Inputs: no named parameters. Returns: result
upload_imageA
Upload a local image to the server's input folder; returns the name to use in run_workflow images.
Inputs: path (required), name. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools have distinct targets, but two clear pairs shade into each other: run_workflow vs run_judged and get_job vs get_judged. The descriptions do explain the pairing (get_job polls run_workflow, get_judged polls run_judged) and judge_image vs run_judged is clarified as single-image judging versus an iterative harness, so a careful agent can pick correctly, but misselection risk remains for an inattentive one.
The dominant pattern is verb_noun (list_workflows, describe_workflow, run_workflow, judge_image, get_job, upload_image, list_models). Deviations are minor: server_status is noun_phrase rather than verb_noun, and run_judged/get_judged use a past-participle object instead of a noun, which slightly muddies the run/poll pairing.
Ten tools sit squarely in the well-scoped range, and each earns its place: discovery (server_status, list_workflows, describe_workflow, list_models), execution (run_workflow, upload_image), polling (get_job), and the judging layer (judge_image, run_judged, get_judged). No obvious filler or redundant tool.
The lifecycle is largely covered: inspect server, discover/describe workflows, upload inputs, run, poll results, and iterate with a judge. The notable gap is queue control — there is no cancel/interrupt for a running job or a way to clear the ComfyUI queue, which agents will need when a run hangs or a seed sweep should stop.
Maintenance
Related MCP Connectors
Remote MCP for RunComfy: ComfyUI deployments, hosted models, LoRA training. 31 tools.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Official hosted MCP server for Wiro AI. Run 1,000+ image, video, audio and LLM models, build and run workflows that chain them, and deploy and talk to AI agents from any MCP client.
Create, browse, remix, collaborate on, and run durable AI workflow nodes from MCP hosts.
Related MCP Servers
- 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.3114MIT
- AlicenseNot gradedqualityDmaintenanceDynamically loads ComfyUI workflows as MCP tools, enabling AI assistants to generate images, videos, and audio by executing workflows across categories like text-to-image, image-to-video, and text-to-audio with automatic parameter mapping and progress monitoring.3MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to generate images and videos through natural language by exposing ComfyUI workflows as parameter-configurable MCP tools.10MIT
- AlicenseNot gradedqualityCmaintenanceExposes ComfyUI workflows as 12 MCP tools on ComfyUI's own port, letting AI agents generate, edit, and remove backgrounds from images plus create videos by passing semantic parameters instead of whole workflow graphs. Agents can list models, submit and track async tasks, fetch artifact URLs, and jump to a visual asset/task page.6MIT