Skip to main content

Add your description here

Project description

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.
ComfyUI Server MCP server

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.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_overseer66_comfyui_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_overseer66_comfyui_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_overseer66_comfyui_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2e41dbf02c360fdb87d4c539b24a861bf5ad1e5ebe4b57eeec81a27f0c537d7e
MD5 ce7e2bc48b61aa818e3a7c6ef6c871b4
BLAKE2b-256 321669d9b49048fca1bb203ffa09daf9392a10abadda04322b3cb72121813f7a

See more details on using hashes here.

File details

Details for the file iflow_mcp_overseer66_comfyui_mcp_server-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_overseer66_comfyui_mcp_server-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_overseer66_comfyui_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c63bb158079b090b55d2bd47b8bf70cc2b4d8d5d902d7b3ff7fac1f93263767f
MD5 c3728b6a74284a2112d250406c1607bb
BLAKE2b-256 7013500843c17acc51c586a0f15ae5aed6884316c2cfc2d4bd3ab06d7739415b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page