What it is
ComfyTV exposes a Model Context Protocol endpoint atPOST /comfytv/mcp on your ComfyUI server. Any MCP-capable agent (Claude Code, or anything speaking streamable HTTP JSON-RPC) can connect and use ComfyTV as a set of tools.
The design has one important twist: the canvas truth lives in the open ComfyTV page. Read tools answer from the server, but write tools (adding nodes, setting prompts, running stages) are executed by the open ComfyTV page — inside Comfy Desktop or a browser — and the server relays commands to it over the websocket. No open page → write tools fail with a clear timeout message.
Enabling
MCP is off by default. In the ComfyTV sidebar open Settings → Agent & MCP and turn on Enable MCP server. (The embedded Bot additionally requires its own switch.)Connecting a client
For Claude Code:~/.codex/config.toml:
Mcp-Session-Id on
initialize for clients that expect streamable-HTTP session management. No auth
is added on top of your ComfyUI instance, so treat network exposure of port 8188
accordingly.
The tool catalog
Read & discover
Build & run
Native ComfyUI graph
See & judge
Configure
Rich editors
Patterns that matter
The production loop.stage_catalog → add_stage (prompt, workflow, asset_refs) → connect_stages → run_stage → wait_stage → outputs → view_image to QC → iterate.
Waiting without polling. wait_stage blocks server-side (default 25 s per call, max 170 s) and returns the new output the second it lands. On timeout it returns after_output_id — call again with it to keep waiting. Total wait is unbounded; long renders just take a few re-calls.
Mentions are 1-based positions. Every stage keeps one ordered media list per type — wired inputs and asset_refs together, in the order get_stage reports under media. Prompt tokens like @image_1 / @video_1 address that list by position (@image_1 is the first image). Removing or reordering media renumbers the tokens in the stage’s prompt for you; set_stage media_order reorders a list, and connect_stages reports the position of the connection it made. Out-of-range tokens expand to nothing — and the tools warn you when that happens.
Real vision. view_image is the only tool that returns pixels. For video QC: media_frame to pull a frame, then view_image to actually look at it. Never judge an image by its filename.
Binding a freshly linked workflow. workflow_get shows the API graph’s node inventory; workflow_edit binds stage values with sources like option:seed, computed:width / computed:height (sizing engine), main_prompt, upstream_image:value[0] or literal:.... If the workflow needs a parameter ComfyTV has no key for, create one with stage_params first and bind option:<its key>. reset_to_preset is your undo.
Multi-machine. servers lists configured machines with live load; set_stage {server: <id>} routes a stage’s runs there. Results land back on the local machine.
Two graph layers. Stage tools (add_stage/set_stage/…) work at the ComfyTV product layer; the graph_* family edits the underlying native ComfyUI graph — any node from any plugin. Use stages when one exists for the job; drop to graph_edit + graph_run to build raw pipelines, and canvas_focus to show the user what you changed.
Skills. When the user has Agent Skills installed, the skill tool’s description lists them; read a matching skill before acting and follow it. Each enabled skill is also exposed as an MCP prompt — in Claude Code they appear as /mcp__comfytv__<skill-name> slash commands for explicit invocation.
Requirements and behavior notes
- Write tools need an open ComfyTV page in Desktop or a browser; the canvas mirror activates lazily after the first MCP call (retry
get_canvasafter ~10 s on a fresh connection). - MCP clients cache
tools/listper session — reconnect after the server gains new tools. - If your client enforces a per-call tool timeout, pass a smaller
timeout_stowait_stageand re-call in slices.
See also
- ComfyTV Bot — the embedded chat agent built on these same tools
- Agent Skills — instruction packs served through the
skilltool and MCP prompts - Custom workflows — what bindings are, hand-edited
- Sidebar — the Settings panel with the MCP switch