comfyui-mcp-server

by @joenorton

Comfyui MCP Server

Generate, inspect, regenerate, and web-publish AI images, audio, and video through a local ComfyUI instance from Cursor, Claude, or n8n over Streamable HTTP (http://127.0.0.1:9000/mcp). Built in Python 3.8+ under Apache-2.0 by joenorton with auto-discovered custom workflows and async job control.

Design & Creative412pythonApache-2.0

Server facts

comfyui-mcp-server

GitHub stars

412

Last commit

Feb 17, 2026

Runtime

python

License

Apache-2.0

Project

Author
joenorton
License
Apache-2.0

Tech

Runtime
python
Transports
streamable-http
Remote access
No
Authentication
None locally (binds 127.0.0.1:9000; front with auth reverse proxy for remote use)

Activity

GitHub stars
412
Last commit
Data as of

Overview

Creative technologists wiring a local `comfyui mcp` pipeline into Cursor, Claude, or n8n can pair a running ComfyUI server (default port `8188`) with `joenorton/comfyui-mcp-server` (Python 3.8+, Apache-2.0). After cloning and installing requirements (`pip install -r requirements.txt`), running `python server.py` exposes a local Streamable HTTP endpoint at `http://127.0.0.1:9000/mcp` (compatible with both `"type": "streamable-http"` and `"type": "http"` entries in `.mcp.json`, plus an included `test_client.py` verifier requiring no AI client). It needs no cloud API keys—models live in `<ComfyUI_dir>/models/checkpoints/`, while localhost binding avoids public exposure unless fronted by an authenticating reverse proxy.

Moving past single-shot generation bridges, its 17 tools implement stateful creative loops: agents generate images (`generate_image`) or songs (`generate_song`), visually inspect PNG/JPEG/WebP/GIF outputs inline (`view_image`), replay runs with parameter tweaks via stable `asset_id` handles (`regenerate`), poll or cancel long ComfyUI queues (`get_queue_status`, `get_job`, `cancel_job`), persist defaults (`~/.config/comfy-mcp/config.json` or `COMFY_MCP_DEFAULT_*`), and compress web assets straight into `public/gen`, `static/gen`, or `assets/gen` (`publish_asset`, default 600KB cap). Drop any ComfyUI JSON graph containing `PARAM_PROMPT`, `PARAM_INT_STEPS`, or `PARAM_FLOAT_CFG` placeholders into `workflows/` and the server auto-exposes it as a callable MCP tool.

Install & configure

Requirements

  • Python 3.8+ (`pip install -r requirements.txt`) after cloning `joenorton/comfyui-mcp-server`
  • A local ComfyUI instance running on port `8188` (`python main.py --port 8188`) with checkpoints under `<ComfyUI_dir>/models/checkpoints/`
  • An MCP client supporting Streamable HTTP (`type: "streamable-http"` or `"http"`) pointed at `http://127.0.0.1:9000/mcp`
Documented launch / install command
pip install -r requirements.txt

Start ComfyUI on port 8188, run `python server.py` to listen at `http://127.0.0.1:9000/mcp`, verify with `python test_client.py`, and add the `.mcp.json` block to Cursor, Claude, or n8n. Do not expose port 9000 publicly without an authenticating reverse proxy.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

A supported configuration example is not available for this client and transport. Check the client documentation for its connection flow; do not substitute an undocumented JSON format.

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

Cursor configuration
{
  "mcpServers": {
    "comfyui-mcp-server": {
      "url": "http://127.0.0.1:9000/mcp"
    }
  }
}

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "comfyui-mcp-server": {
      "type": "http",
      "url": "http://127.0.0.1:9000/mcp"
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

Windsurf configuration
{
  "mcpServers": {
    "comfyui-mcp-server": {
      "serverUrl": "http://127.0.0.1:9000/mcp"
    }
  }
}

Read the Windsurf setup guide

Config file · Project scope: .mcp.json at the repository root

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Code configuration
{
  "mcpServers": {
    "comfyui-mcp-server": {
      "type": "http",
      "url": "http://127.0.0.1:9000/mcp"
    }
  }
}

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Tools

Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.

ToolWhat it does
generate_imageGenerate an image via local ComfyUI using a required prompt while falling back to configured server defaults.
generate_songGenerate audio through ComfyUI using tags and lyrics parameters.
regenerateReplay an existing session asset's stored workflow with selective parameter overrides using its asset_id.
view_imageInject a generated PNG, JPEG, WebP, or GIF image inline into the AI agent's visual context.
get_queue_statusInspect running and pending jobs in the local ComfyUI queue.
get_jobPoll completion state for a specific ComfyUI generation job by prompt_id.
cancel_jobCancel a queued or actively running ComfyUI generation job.
list_assetsBrowse recently generated assets (with optional session filtering) for follow-up edits and iteration.
get_asset_metadataFetch provenance, workflow history, and generation parameters recorded for an asset_id.
list_modelsList available model checkpoints detected in your local ComfyUI installation.
get_defaultsInspect active default generation parameters (width, height, steps, model, and related settings).
set_defaultsUpdate default generation parameters at runtime with optional persistence.
list_workflowsEnumerate all auto-discovered ComfyUI workflow JSON files available in the workflows/ directory.
run_workflowExecute any discovered ComfyUI workflow with custom exposed parameters.
get_publish_infoCheck detected project root, publish directory, ComfyUI output root, and publish readiness.
set_comfyui_output_rootConfigure and persist the ComfyUI output directory path (helpful for Comfy Desktop or nonstandard installs).
publish_assetPublish a generated asset into the web project directory (demo filename or manifest-tracked library mode) with deterministic compression (default 600KB).

Use cases

  • Generate, visually inspect with `view_image`, and iteratively refine artwork via `regenerate` inside Cursor or Claude without retyping full prompts.
  • Expose custom local ComfyUI pipelines to agents automatically by saving workflow JSON files with `PARAM_PROMPT` and `PARAM_INT_STEPS` placeholders in `workflows/`.
  • Generate website hero graphics or logos and export compressed WebP/image files straight into `public/gen`, `static/gen`, or `assets/gen` via `publish_asset`.
  • Manage long local GPU renders asynchronously using `get_queue_status`, `get_job`, `get_asset_metadata`, and `cancel_job`.

Strengths

  • Runs completely against your local ComfyUI GPU stack over Streamable HTTP with no external cloud API keys.
  • Auto-discovers custom ComfyUI JSON workflows in `workflows/` via `PARAM_*` placeholders with no Python code changes.
  • Supports stateful iterative workflows: stable asset IDs, full provenance metadata, `regenerate` overrides, inline `view_image`, and web `publish_asset` compression.
  • Includes a standalone `test_client.py` smoke test and layered default precedence (per-call -> runtime -> `~/.config/comfy-mcp/config.json` -> `COMFY_MCP_DEFAULT_*`).

Limitations

  • Asset IDs live in an ephemeral session registry—restarting `server.py` invalidates prior `asset_id` handles, and assets expire after 24 hours by default (`COMFY_MCP_ASSET_TTL_HOURS`).
  • Requires cloning and running `python server.py` locally alongside an active ComfyUI server on port 8188 rather than installing via `uvx`.
  • Binds unauthenticated to localhost (`127.0.0.1:9000`), and `view_image` only supports image formats (PNG, JPEG, WebP, GIF), not audio or video.

comfyui-mcp-server setup notes

  • comfyui-mcp-server's example uses http, while its catalog transports are streamable-http; use the example's connection type.

Frequently asked questions

Start ComfyUI on port `8188` and run `python server.py` so the MCP server listens at `http://127.0.0.1:9000/mcp`, then create a project `.mcp.json` pointing `comfyui-mcp-server` to that URL with `"type": "streamable-http"` (or `"type": "http"` if auto-discovery fails). You can confirm connectivity first using `python test_client.py` without any AI client.

Related MCP servers