Skip to main content
Glama

ComfyUI MCP Server

An MCP (Model Context Protocol) server that connects AI assistants to ComfyUI for image, video, and audio generation. Works with Claude Desktop, Claude Code, and any MCP-compatible client.

What It Does

This server gives AI agents full control over ComfyUI — from one-call image generation to building complex multi-node workflows. It exposes 40+ tools organized into three tiers:

Quick Generation (one-call tools)

All parameters have sensible defaults. Only a prompt is required:

Tool

Description

text_to_image

Generate images from text (local SD/SDXL model)

flux_text_to_image

Generate images using Flux (auto-detects GGUF/safetensors)

image_to_image

Transform an existing image with a prompt

text_to_video

Generate video from text (local LTX-Video model)

image_to_video

Animate an image into video (LTX-Video)

wan_text_to_video

Generate video from text (local Wan 2.2 model)

wan_image_to_video

Animate an image into video (Wan 2.2)

upscale_image

AI upscale with an upscale model

inpaint

Fill masked regions with AI-generated content

dalle3_image

DALL-E 3 image generation (cloud API)

gpt_image_generate

GPT Image generation/editing (cloud API)

sora_video_generate

Sora 2 video generation (cloud API)

merge_videos

Merge multiple videos into one

Any API Node (200+ cloud providers)

Run any of ComfyUI's 200+ API nodes in a single call — Kling, Runway, Luma, Stability, ElevenLabs, Gemini, Veo, Recraft, Minimax, and more:

  1. list_api_nodes(query="kling") — discover available API nodes

  2. get_node_schema("KlingTextToVideoNode") — see inputs, types, defaults

  3. run_api_node(node_class="KlingTextToVideoNode", inputs='{"prompt": "..."}') — execute

Automatically inserts loader nodes for image/video/audio inputs and save nodes for outputs. Validates COMBO values, INT/FLOAT ranges, and required inputs before submitting.

Supports async execution for parallel jobs:

run_api_node(..., queue_only=true)  # returns immediately with prompt_id
wait_for_jobs("id1,id2,id3")       # waits for all concurrently

Custom Workflows (multi-node graphs)

For complex workflows (ControlNet, multi-LoRA, regional prompting, IP-Adapter):

  1. search_nodes(query="controlnet") — find relevant nodes

  2. get_node_schema("ControlNetApplyAdvanced") — understand inputs/outputs

  3. create_workflow(template="txt2img") — start from a template

  4. add_node(workflow_id, "ControlNetLoader", ...) — add nodes incrementally

  5. suggest_next(workflow_id) — see what's missing

  6. validate_workflow(workflow_id) — check for errors

  7. execute_workflow(workflow_id) — generate results

System & Utility Tools

Tool

Description

list_models

List installed models by folder (checkpoints, loras, etc.)

list_samplers_and_schedulers

List valid sampler/scheduler names

get_system_stats

ComfyUI system info (VRAM, version, etc.)

get_queue_status

Current queue state

get_history

Generation history

get_logs

Server logs

upload_image

Upload an image to ComfyUI's input directory

upload_mask

Upload a mask image for inpainting

get_image_url

Get URL to view/download generated files

list_files

List files in ComfyUI directories

copy_output_to_input

Copy generated files to input for reuse

wait_for_jobs

Wait for multiple queued jobs concurrently

Related MCP server: ComfyUI MCP Hub

Prerequisites

ComfyUI

You need a running ComfyUI instance. Install it following the official instructions.

Make sure ComfyUI is running and accessible (default: http://127.0.0.1:8188).

Models (for local generation)

For local generation tools, you need models installed in ComfyUI:

  • SD/SDXL image (text_to_image): Any SD/SDXL checkpoint in models/checkpoints/

  • Flux image (flux_text_to_image): A Flux diffusion model (safetensors in models/diffusion_models/ or GGUF) + clip_l.safetensors and t5xxl encoder in models/text_encoders/ + ae.safetensors VAE in models/vae/

  • LTX-Video (text_to_video, image_to_video): LTX-Video checkpoint + T5-XXL text encoder

  • Wan 2.2 video (wan_text_to_video, wan_image_to_video): Wan 2.2 GGUF model + umt5_xxl encoder in models/text_encoders/ + wan2.2_vae.safetensors in models/vae/

  • Upscaling (upscale_image): Any upscale model in models/upscale_models/

All local tools auto-detect installed models. Use list_models() to see what's available.

Use list_models() through the MCP to see what's currently installed.

Comfy.org API Key (for cloud generation)

Cloud-based tools (dalle3_image, gpt_image_generate, sora_video_generate, run_api_node) require a Comfy.org API key with credits loaded. Set it via the COMFY_API_KEY environment variable.

Installation

From source

git clone https://github.com/halbert04/comfyui-mcp.git
cd comfyui-mcp
pip install .

For development:

pip install -e ".[dev]"

Verify installation

comfyui-mcp --help

Configuration

All configuration is via environment variables:

Variable

Default

Description

COMFYUI_URL

http://127.0.0.1:8188

ComfyUI server URL

COMFYUI_TIMEOUT

300

Max wait time for job completion (seconds)

COMFYUI_POLL_INTERVAL

1.0

Polling interval for job status (seconds)

COMFY_API_KEY

(empty)

Comfy.org API key for cloud API nodes

COMFYUI_MCP_TRANSPORT

stdio

Transport mode: stdio or streamable-http

COMFYUI_MCP_HOST

127.0.0.1

Host for HTTP transport

COMFYUI_MCP_PORT

8200

Port for HTTP transport

Usage with Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "comfyui": {
      "command": "comfyui-mcp",
      "env": {
        "COMFYUI_URL": "http://127.0.0.1:8188",
        "COMFYUI_TIMEOUT": "900",
        "COMFY_API_KEY": "your-comfy-api-key-here"
      }
    }
  }
}

Restart Claude Desktop after saving. The ComfyUI tools will appear in the tool list.

Usage with Claude Code

Add the MCP server to your Claude Code configuration:

claude mcp add comfyui -- comfyui-mcp

Or with environment variables:

claude mcp add comfyui -e COMFYUI_URL=http://127.0.0.1:8188 -e COMFY_API_KEY=your-key -- comfyui-mcp

Usage as HTTP Server

For non-stdio clients, run as an HTTP server:

COMFYUI_MCP_TRANSPORT=streamable-http comfyui-mcp

This starts an MCP server on http://127.0.0.1:8200 that any MCP client can connect to.

Project Structure

src/comfyui_mcp/
  server.py          # MCP server entry point and tool registration
  client.py          # HTTP client for ComfyUI API
  config.py          # Environment variable configuration
  workflows.py       # Workflow graph builder and templates
  node_cache.py      # Cached node schema from /object_info
  polling.py         # Job completion polling
  tools/
    generate.py      # One-call generation tools
    api_runner.py    # Generic API node runner (run_api_node, list_api_nodes)
    builder.py       # Workflow builder tools (create, add_node, execute, etc.)
    discovery.py     # Node discovery tools (search_nodes, get_node_schema)
    models.py        # Model listing tools
    system.py        # System info, queue, history, file browsing
  resources/
    resources.py     # MCP resources (workflow templates, system info)

Development

Run tests:

pip install -e ".[dev]"
pytest

License

MIT

Available Tools

46 tools
add_nodeA

Add a node to a workflow with auto-connection of typed inputs.

Inputs: class_type (required), workflow_id (required), inputs. Returns: object

cancel_jobA

Cancel the currently running ComfyUI job.

Inputs: no named parameters. Returns: object

clear_queueA

Clear all pending items from the ComfyUI queue.

Inputs: no named parameters. Returns: object

copy_output_to_inputA

Copy a file from ComfyUI's output directory to input directory.

Makes generated files (images, videos, audio) available as inputs for subsequent workflows. For example, copy a generated image to use it in image_to_image, image_to_video, or run_api_node.

Inputs: filename (required), new_name, subfolder. Returns: object

create_workflowB

Create a new workflow, optionally from a template.

Inputs: name, template, overrides. Returns: object

dalle3_imageA

Generate an image using DALL-E 3 via Comfy.org API.

All parameters except prompt are optional. Requires COMFY_API_KEY. For other API providers, use run_api_node() with list_api_nodes().

Inputs: prompt (required), seed, size, style, +1 more. Returns: object

delete_history_itemsA

Delete specific items from ComfyUI execution history.

Inputs: prompt_ids (required). Returns: object

delete_queue_itemsB

Delete specific items from the ComfyUI queue.

Inputs: prompt_ids (required). Returns: object

execute_workflowB

Execute a workflow that was built with builder tools.

Inputs: workflow_id (required), wait. Returns: object

flux_text_to_imageA

Generate images using Flux (local model).

All parameters except prompt are optional with sensible defaults. Auto-detects installed Flux model (GGUF or safetensors) and CLIP encoders. Produces high-quality 1024x1024 images by default.

Inputs: prompt (required), seed, steps, width, +7 more. Returns: object

free_memoryC

Free ComfyUI VRAM and RAM.

Inputs: free_memory, unload_models. Returns: object

get_featuresA

Get ComfyUI server feature flags and capabilities.

Returns: Dict of supported features (preview metadata, max upload size, extensions, node replacements, etc.).

Inputs: no named parameters. Returns: object

get_historyB

Get ComfyUI execution history.

Inputs: max_items, prompt_id. Returns: object

get_image_urlB

Get the URL to view or download a ComfyUI image/video/audio.

Inputs: filename (required), subfolder, folder_type. Returns: result

get_job_statusB

Get the status and outputs of a queued ComfyUI job.

Inputs: prompt_id (required). Returns: object

get_logsA

Get recent ComfyUI server log entries for debugging.

Inputs: max_entries. Returns: result

get_model_metadataA

Get metadata from a safetensors model file.

Useful for inspecting what a model was trained on, its configuration, resolution, license, etc.

Inputs: folder (required), filename (required). Returns: object

get_node_schemaA

Get the full input/output schema for a ComfyUI node class.

Inputs: class_type (required). Returns: object

get_queueA

Get the current ComfyUI queue with running and pending items.

Inputs: no named parameters. Returns: object

get_result_imagesA

Get all output images from a completed ComfyUI job.

Inputs: prompt_id (required). Returns: result

get_system_statsA

Get ComfyUI system information including OS, RAM, VRAM, and device info.

Inputs: no named parameters. Returns: object

get_workflowA

Get the full workflow graph state with type information.

Inputs: workflow_id (required). Returns: object

gpt_image_generateA

Generate or edit an image using GPT Image via Comfy.org API.

Can generate from text alone, or edit an existing image with a prompt. All parameters except prompt are optional. Requires COMFY_API_KEY.

Inputs: prompt (required), n, seed, size, +4 more. Returns: object

image_to_imageB

Transform an existing image guided by a text prompt.

All parameters except prompt and input_image are optional with sensible defaults. Change any parameter to customize.

Inputs: prompt (required), input_image (required), cfg, seed, +8 more. Returns: object

image_to_videoA

Generate a video from an image using LTX-Video (local model).

All parameters except prompt and input_image are optional with sensible defaults. Change any parameter to customize. For cloud-based I2V, use sora_video_generate(input_image=...) or run_api_node() with Kling/Runway/Luma/etc.

Inputs: prompt (required), input_image (required), cfg, seed, +9 more. Returns: object

inpaintA

Fill in masked regions of an image with AI-generated content.

All parameters except prompt, input_image, and mask_image are optional with sensible defaults. Change any parameter to customize.

Inputs: prompt (required), mask_image (required), input_image (required), cfg, +8 more. Returns: object

list_api_nodesA

List available API nodes (Kling, Runway, Luma, Stability, ElevenLabs, etc.).

These are cloud-based nodes that run via the Comfy.org API proxy. Use get_node_schema(name) to see full input/output details, then run_api_node(name, inputs) to execute.

Inputs: query, output_type. Returns: result

list_filesB

List files in a ComfyUI directory.

Inputs: directory_type. Returns: result

list_modelsB

List available models in ComfyUI.

Inputs: folder. Returns: result

list_samplers_and_schedulersA

List all available sampler algorithms and noise schedulers.

Returns a dict with 'samplers' and 'schedulers' lists.

Inputs: no named parameters. Returns: object

merge_videosA

Merge multiple videos into a single video.

Decomposes each video into frames and audio, batches the frames together, combines the audio tracks, and reassembles into one video.

Inputs: video_files (required), fps, audio_mode, output_prefix. Returns: object

remove_nodeA

Remove a node from a workflow and clean up dangling connections.

Inputs: node_id (required), workflow_id (required). Returns: object

run_api_nodeA

Run any ComfyUI node in a single call.

Builds a minimal workflow around the node, auto-inserting loader and save nodes as needed. Works with all 200+ API nodes (Kling, Runway, Luma, Stability, ElevenLabs, Gemini, etc.) and any built-in node.

Workflow: discover nodes with list_api_nodes() or search_nodes(), check inputs with get_node_schema(), then run with this tool.

For IMAGE/VIDEO/AUDIO-typed inputs, pass a filename string (e.g. "photo.png") and a LoadImage/LoadVideo/LoadAudio node is auto-inserted.

Inputs: node_class (required), inputs, timeout, queue_only, +1 more. Returns: object

search_nodesA

Search ComfyUI nodes by name, category, or input/output type.

Inputs: query, category, input_type, output_type. Returns: result

set_inputsB

Update inputs on an existing workflow node.

Inputs: inputs (required), node_id (required), workflow_id (required). Returns: object

sora_video_generateA

Generate a video using Sora 2 via Comfy.org API.

Can generate from text alone, or animate an existing image. All parameters except prompt are optional. Requires COMFY_API_KEY.

Inputs: prompt (required), seed, size, model, +2 more. Returns: object

suggest_nextA

Analyze a workflow and suggest next steps.

Checks for unconnected inputs, unused outputs, missing output nodes, and provides context-aware suggestions.

Inputs: workflow_id (required). Returns: object

text_to_imageB

Generate images from a text description.

All parameters except prompt are optional with sensible defaults. Change any parameter to customize the generation.

Inputs: prompt (required), cfg, seed, steps, +9 more. Returns: object

text_to_videoA

Generate a video from a text description using LTX-Video (local model).

All parameters except prompt are optional with sensible defaults. Change any parameter to customize. For cloud-based video generation, use sora_video_generate() or run_api_node() with Kling/Runway/Luma/etc.

Inputs: prompt (required), cfg, seed, steps, +7 more. Returns: object

upload_imageA

Upload a local image file to ComfyUI's input directory.

Inputs: image_path (required), overwrite, subfolder. Returns: object

upload_maskA

Upload a mask image to ComfyUI's input directory.

The mask is processed to extract the alpha channel for use with inpainting workflows. White areas in the mask will be inpainted.

Inputs: image_path (required), overwrite, subfolder, original_ref. Returns: object

upscale_imageC

Upscale an image using an AI upscaling model.

Inputs: input_image (required), upscale_model. Returns: object

validate_workflowA

Validate a workflow for correctness without executing it.

Checks: all node class_types exist, required inputs connected, connection type compatibility, output node exists.

Inputs: workflow_id (required). Returns: object

wait_for_jobsA

Wait for multiple queued jobs to complete and return all results.

Use this after queueing multiple jobs with queue_only=true to wait for all of them at once, enabling parallel execution.

Inputs: prompt_ids (required), timeout. Returns: object

wan_image_to_videoA

Generate video from an image using Wan 2.2 (local model).

All parameters except prompt and input_image are optional with sensible defaults. Auto-detects installed Wan model and encoder.

Inputs: prompt (required), input_image (required), cfg, seed, +11 more. Returns: object

wan_text_to_videoA

Generate video from text using Wan 2.2 (local model).

All parameters except prompt are optional with sensible defaults. Auto-detects installed Wan model and UMT5-XXL text encoder.

Inputs: prompt (required), cfg, seed, steps, +10 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 46 tools

    Disambiguation2/5

    Many tools have overlapping purposes, especially the image generation suite (text_to_image, flux_text_to_image, dalle3_image, gpt_image_generate) and video generation suite (text_to_video, wan_text_to_video, sora_video_generate). Job-related tools like get_job_status, get_result_images, and wait_for_jobs also have fuzzy boundaries that could cause misselection.

    Naming Consistency4/5

    Tool names predominantly follow a clear verb_noun snake_case pattern (get_queue, create_workflow, upload_image) with consistent use of get_/list_/create_/delete_ prefixes. Minor exceptions like 'inpaint' and 'suggest_next' deviate slightly, but the overall pattern is predictable and readable.

    Tool Count2/5

    With 46 tools, the server is heavily over-scoped. While it covers many subdomains, the generation tools are redundant and could be consolidated into generic tools with provider/model parameters. The workflow builder and API node tools add bulk but are useful for advanced users.

    Completeness4/5

    The tool set provides comprehensive coverage of ComfyUI operations: queue management, system stats, multiple generation paths, file handling, workflow construction/validation/execution, and cloud API node access. Minor gaps like no dedicated audio generation or workflow listing tools exist, but run_api_node covers arbitrary node types.

    Related MCP Connectors

    Related MCP Servers