Skip to main content
Glama

ComfyUI MCP Server

by Overseer66

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

      Related MCP Servers

      • -
        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 -
        29
        Python
        MIT License
      • A
        security
        A
        license
        A
        quality
        An MCP Server that integrates with Stability AI's API to provide high-quality image generation, editing, and manipulation capabilities including background removal, outpainting, search-and-replace, and upscaling.
        Last updated -
        13
        450
        73
        TypeScript
        MIT License
        • Apple
      • A
        security
        A
        license
        A
        quality
        A MCP server that integrates with Stable Diffusion WebUI to provide text-to-image generation and image upscaling capabilities through simple API calls.
        Last updated -
        5
        18
        JavaScript
        MIT License
      • -
        security
        F
        license
        -
        quality
        This MCP server enables interaction with the Giphy API through natural language, allowing users to search, retrieve, and manage GIFs through the Multi-Agent Conversation Protocol.
        Last updated -
        Python

      View all related MCP servers

      MCP directory API

      We provide all the information about MCP servers via our MCP API.

      curl -X GET 'https://glama.ai/api/mcp/v1/servers/Overseer66/comfyui-mcp-server'

      If you have feedback or need assistance with the MCP directory API, please join our Discord server