Home / MCP / ComfyUI MCP Server

ComfyUI MCP Server

Provides an MCP integration for ComfyUI, enabling workflows via HTTP SSE transport or local UV-based execution.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "comfyui": {
            "url": "http://localhost:8001/sse"
        }
    }
}

This MCP Server enables you to integrate ComfyUI with MCP, letting you run ComfyUI-powered workflows from your MCP client. It supports running locally via UV as well as deploying with Docker and routing through an HTTP SSE transport for remote access. You can choose the method that fits your environment and scale your automation accordingly.

How to use

Start by choosing your preferred connection method. If you want to run the server locally, you can use UV to execute the MCP workflow runner alongside ComfyUI. If you prefer containerized deployment, you can run a Docker container that exposes the MCP interface. You can also connect through an HTTP SSE transport to use a remote endpoint.

How to install

Prerequisites you need before starting: you must have a running ComfyUI server available at the address you configure. You should also have UVX (the MCP runner) or Docker installed on your host depending on the deployment path you choose.

Recommended installation and run flow if you use UV to run the MCP server: follow the provided MCP command to start the compositor and connect to ComfyUI through the MCP gateway.

Using UV (Recommended)

{
  "mcpServers": {
    "comfyui": {
      "command": "uv",
      "args": [
        "--directory",
        "PATH/MCP/comfyui",
        "run",
        "--with",
        "mcp",
        "--with",
        "websocket-client",
        "--with",
        "python-dotenv",
        "mcp",
        "run",
        "src/server.py:mcp"
      ]
    }
  }
}

Using Docker

When using Docker, you can either build a custom image or run a prebuilt one. You may need to adjust how images access the host filesystem and how image payloads are transmitted.

Build a custom image example:

# Build your custom image
docker image build -t mcp/comfyui .

Docker run configuration (custom image)

{
  "mcpServers": {
    "comfyui": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-p",
        "3001:3000",
        "mcp/comfyui"
      ]
    }
  }
}

Docker run configuration (existing image)

{
  "mcpServers": {
    "comfyui": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-p",
        "3001:3000",
        "overseer66/mcp-comfyui"
      ]
    }
  }
}

Using SSE Transport

To connect via SSE, run the SSE server in Docker and configure the MCP client to use the SSE endpoint.

{
  "mcpServers": {
    "comfyui": {
      "url": "http://localhost:8001/sse" 
    }
  }
}

Notes

When you add new workflows as tools, you need to rebuild and redeploy the Docker images to make them available.

Available tools

text_to_image

Returns the URL of the generated image. To obtain the actual image, use the download_image tool or open the URL in a browser.

download_image

Downloads images generated by other tools using the provided image URL.

run_workflow_with_file

Executes a workflow by providing the path to a workflow JSON file.

run_workflow_with_json

Executes a workflow by providing the workflow JSON data directly.