ComfyUI MCP Server

by Overseer66

23 stars
396 downloads
Not rated
GitHub

About

Integrates ComfyUI with MCP, allowing the use of custom workflows. Requires a running ComfyUI server.

Details

Author
Overseer66
GitHub stars
23
Downloads
396
Categories
Developer Tools, AI, Automation, Other

- Integrates ComfyUI with MCP for AI agent workflows.
- Built-in tools: text_to_image, download_image, run_workflow_with_file, run_workflow_with_json.
- Custom workflows added by placing JSON files in the workflows directory.
- Supports UV and Docker deployment.
- Offers SSE transport for remote connections.
- Debugging scripts for ComfyUI and MCP are included.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name ComfyUI MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Configure the ComfyUI host and port in src/.env, place custom workflow JSON files in the workflows directory, then run the server using UV (with mcp run src/server.py:mcp) or Docker (using the prebuilt image overseer66/mcp-comfyui). Debug locally with python src/test_comfyui.py or mcp dev src/server.py.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "comfyui mcp server": {
            "comfyui-mcp-server-overseer66": {
                "command": "python",
                "args": [
                    "src/test_comfyui.py"
                ]
            }
        }
    }
}

McpServers

{
    "comfyui-mcp-server-overseer66": {
        "command": "python",
        "args": [
            "src/test_comfyui.py"
        ]
    }
}

ComfyUI MCP Server

1. Overview

- A server implementation for integrating ComfyUI with MCP.
- ⚠️ IMPORTANT: This server requires a running ComfyUI server.
- You must either host your own ComfyUI server,
- or have access to an existing ComfyUI server address.

<a href="https://glama.ai/mcp/servers/@Overseer66/comfyui-mcp-server">
ComfyUI Server MCP server
</a>

---

2. Debugging

### 2.1 ComfyUI Debugging

  python src/test_comfyui.py
  

### 2.2 MCP Debugging

  mcp dev src/server.py
  

---

3. Installation and Configuration

### 3.1 ComfyUI Configuration

- Edit src/.env to set ComfyUI host and port:

      COMFYUI_HOST=localhost
      COMFYUI_PORT=8188
      

### 3.2 Adding Custom Workflows

- To add new tools, place your workflow JSON files in the workflows directory and declare them as new tools in the system.

---

4. Built-in Tools

- text_to_image

- Returns only the URL of the generated image.
- To get the actual image:
- Use the download_image tool, or
- Access the URL directly in your browser.

- download_image

- Downloads images generated by other tools (like text_to_image) using the image URL.

- run_workflow_with_file

- Run a workflow by providing the path to a workflow JSON file.

        # You should ask to agent like this.
        Run comfyui workflow with text_to_image.json
        

- example image of CursorAI

- run_workflow_with_json

- Run a workflow by providing the workflow JSON data directly.

        # You should ask to agent like this.
        Run comfyui workflow with this 
        {
          "3": {
              "inputs": {
                  "seed": 156680208700286,
                  "steps": 20,
            ... (workflow JSON example)
        }
        

---

5. How to Run

### 5.1 Using UV (Recommended)

- Example mcp.json:

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

### 5.2 Using Docker

- Downloading images to a local folder with download_image may be difficult since the Docker container does not share the host filesystem.
- When using Docker, consider:
1. Set RETURN_URL=false in .env to receive image data as bytes.
2. Set COMFYUI_HOST in .env to the appropriate address (e.g., host.docker.internal or your server's IP).
3. Note: Large image payloads may exceed response limits when using binary data.

#### 5.2.1 Build Docker Image

  # First build image
  docker image build -t mcp/comfyui .
  
  {
    "mcpServers": {
      "comfyui": {
        "command": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "-p",
          "3001:3000",
          "mcp/comfyui"
        ]
      }
    }
  }
  

#### 5.2.2 Using Existing Images

Also you can use prebuilt image.

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

#### 5.2.3 Using SSE Transport

1. Run the SSE server with Docker:

      docker run -i --rm -p 8001:8000 overseer66/mcp-comfyui-sse
      

2. Configure mcp.json (change localhost to your IP or domain if needed):

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

> NOTE: When adding new workflows as tools, you need to rebuild and redeploy the Docker images to make them available.

---

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.