comfyui-mcp: an MCP server for ComfyUI

An MCP server plus a live sidebar agent that generates images, video and audio, authors and runs workflows, and manages models and custom nodes.

Verified

Core facts

Read by a script from the official API, not rewritten by a model.

License
MIT
Languages
TypeScript
Maintainer
artokun
Verified

What it is

comfyui-mcp is an MCP server plus a live sidebar agent that generates images, video and audio, authors and runs workflows, manages models and custom nodes, and edits the live ComfyUI graph in natural language. The package also ships as a Claude Code plugin that adds slash commands, skills, agents, and hooks on top of the MCP tools. It is built and maintained by @artokun. comfyui-mcp is licensed under MIT.

Main features

  1. comfyui-mcp provides 38 tools across workflow execution, generation, iteration, composition, models, and more.

  2. The gen slash command generates an image from a text description, auto-selects a checkpoint, builds a workflow, and returns the image.

  3. The viz slash command visualizes a workflow as a Mermaid diagram with nodes grouped by category.

  4. The debug slash command diagnoses why a workflow failed: it reads history and logs, traces the root cause, and suggests fixes.

  5. The convert slash command converts between UI format and API format workflows.

  6. The clear_vram tool frees GPU VRAM by unloading cached models, calls ComfyUI's free endpoint, and reports before/after stats.

Getting started

  1. comfyui-mcp runs as a standalone MCP server, so there is no need to clone this repo.

  2. To install the ComfyUI Agent Panel, search for comfyui-agent-panel in ComfyUI-Manager.

  3. comfyui-mcp auto-detects your ComfyUI installation and port.

  4. Port detection probes 8188 (CLI default) then 8000 (Desktop app default) via the system_stats endpoint.

From the README · json
{
  "mcpServers": {
    "comfyui": {
      "command": "npx",
      "args": ["-y", "comfyui-mcp"],
      "env": {
        "CIVITAI_API_TOKEN": ""
      }
    }
  }
}
From the README
> Generate an image of a sunset over mountains
From the README · bash
# In Claude Code
/plugin marketplace add artokun/comfyui-mcp
/plugin install comfy

Who it is for

comfyui-mcp works on macOS, Linux, and Windows. A self-hosted ComfyUI on Mac/Linux/Windows is the primary target, and the same agent reaches remote installs (RunPod, VPS, LAN, reverse-proxied) from one config. comfyui-mcp operates in one of three modes, auto-selected from the environment.

It runs on the user's own install and choice of model, including a free local model via Ollama with no account and no network. The server speaks stdio by default. The server communicates with ComfyUI through its REST API and WebSocket interface.

Development requires Node.js at least 22.0.0. The upload_image tool copies a local image into ComfyUI's input directory for img2img, inpaint, or ControlNet. Every enqueue_workflow call logs settings to a local SQLite database.

The built-in LLM Arena scores each model on real ComfyUI tasks. The extract-workflow-from-an-image example reads the PNG metadata chunks to recover the exact workflow and prompt used to generate the image. The validate-before-running example checks for missing node types, broken connections, invalid output indices, and missing model files without executing the workflow.

The parameter sweep supports cfg, steps, sampler, scheduler, seed, denoise, width, and height.

Sources

This page is written from the official sources below. Open them to check the original text.

Verified ·

This page is written by AI from the official sources above and checked automatically. This site has not tested it. Found a mistake? Tell us.