ComfyUI MCP Server

by Overseer66
Integrations
  • Supports environment variable configuration for ComfyUI connections through .env files, allowing users to customize host and port settings.

  • Supports containerized deployment of the MCP server through Docker, with instructions for building and configuring the Docker image.

  • Provides integration with ComfyUI, a Python-based stable diffusion interface, enabling AI image generation through tools like text_to_image and download_image capabilities.

ComfyUI MCP サーバー

1. 概要

  • ComfyUI を MCP と統合するためのサーバー実装。
  • ⚠️ 重要: このサーバーでは、実行中の ComfyUI サーバーが必要です。
    • 独自のComfyUIサーバーをホストするか、
    • または、既存の ComfyUI サーバー アドレスにアクセスできる必要があります。

2. デバッグ

2.1 ComfyUI デバッグ

python src/test_comfyui.py

2.2 MCPデバッグ

mcp dev src/server.py

3. インストールと設定

3.1 ComfyUI の設定

  • src/.envを編集して、ComfyUI のホストとポートを設定します。
    COMFYUI_HOST=localhost COMFYUI_PORT=8188

3.2 カスタムワークフローの追加

  • 新しいツールを追加するには、ワークフロー JSON ファイルをworkflowsディレクトリに配置し、システム内で新しいツールとして宣言します。

4. 組み込みツール

  • テキストを画像に変換する
    • 生成された画像の URL のみを返します。
    • 実際の画像を取得するには:
      • download_imageツールを使用するか、
      • ブラウザで直接 URL にアクセスします。
  • ダウンロード画像
    • 画像 URL を使用して、他のツール ( text_to_imageなど) によって生成された画像をダウンロードします。
  • ファイルを使ったワークフローの実行
    • ワークフロー JSON ファイルへのパスを指定してワークフローを実行します。
      # You should ask to agent like this. Run comfyui workflow with text_to_image.json
    • CursorAIの例画像
  • json を使用したワークフローの実行
    • ワークフロー JSON データを直接提供してワークフローを実行します。
      # You should ask to agent like this. Run comfyui workflow with this { "3": { "inputs": { "seed": 156680208700286, "steps": 20, ... (workflow JSON example) }

5. 実行方法

5.1 UVの使用(推奨)

  • 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 Dockerの使用

  • Docker コンテナはホスト ファイル システムを共有しないため、 download_imageを使用してイメージをローカル フォルダーにダウンロードするのは難しい場合があります。
  • Docker を使用する場合は、次の点を考慮してください。
    1. 画像データをバイトとして受信するには、 .envRETURN_URL=false設定します。
    2. .envCOMFYUI_HOST適切なアドレス (例: host.docker.internalまたはサーバーの IP) に設定します。
    3. 注意: バイナリ データを使用する場合、大きな画像ペイロードは応答制限を超える可能性があります。
5.2.1 Dockerイメージのビルド
# 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 既存の画像の使用

事前に構築されたイメージを使用することもできます。

{ "mcpServers": { "comfyui": { "command": "docker", "args": [ "run", "-i", "--rm", "-p", "3001:3000", "overseer66/mcp-comfyui" ] } } }
5.2.3 SSEトランスポートの使用
  1. Docker で SSE サーバーを実行します。
    docker run -i --rm -p 8001:8000 overseer66/mcp-comfyui-sse
  2. mcp.jsonを設定します (必要に応じて localhost を自分の IP またはドメインに変更します)。
    { "mcpServers": { "comfyui": { "url": "http://localhost:8001/sse" } } }

注意: 新しいワークフローをツールとして追加する場合は、Docker イメージを再構築して再デプロイし、使用できるようにする必要があります。


-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

ComfyUI と MCP を統合し、ユーザーが自然言語による対話を通じて画像を生成し、ダウンロードできるようにするサーバー。

  1. 概要
    1. デバッグ
      1. 2.1 ComfyUI デバッグ
      2. 2.2 MCPデバッグ
    2. インストールと設定
      1. 3.1 ComfyUI の設定
      2. 3.2 カスタムワークフローの追加
    3. 組み込みツール
      1. 実行方法
        1. 5.1 UVの使用(推奨)
        2. 5.2 Dockerの使用

      Related MCP Servers

      • A
        security
        A
        license
        A
        quality
        A powerful MCP server for fetching and transforming web content into various formats (HTML, JSON, Markdown, Plain Text) with ease.
        Last updated -
        4
        146
        12
        TypeScript
        MIT License
        • Apple
        • Linux
      • -
        security
        A
        license
        -
        quality
        The Comfy MCP Server uses the FastMCP framework to generate images from prompts by interacting with a remote Comfy server, allowing automated image creation based on workflow configurations.
        Last updated -
        7
        Python
        MIT License
      • -
        security
        A
        license
        -
        quality
        A MCP server that integrates with Cursor IDE to generate images based on text descriptions using JiMeng AI, allowing users to create and save custom images directly within their development environment.
        Last updated -
        82
        Python
        MIT License
        • Apple
        • Linux
      • -
        security
        -
        license
        -
        quality
        A TypeScript-based MCP server that lets users generate images using OpenAI's dall-e-3 model by providing a prompt and image name.
        Last updated -
        1

      View all related MCP servers

      ID: 1ohqlsrp1j