JC

joenorton/comfyui-mcp-server

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

411 stars 87 forks 品質 71 トレンド 19Apache-2.0

ローカルComfyUI向けの軽量PythonベースのMCP(Model Context Protocol)サーバー

概要

自然な会話を通じてAIの画像・音声・映像を生成・洗練します AIエージェントがローカルのComfyUIインスタンスを使って画像、音声、動画を生成し、反復的に洗練できる軽量MCP(Model Context Protocol)サーバーです。 サーバーを動かし、クライアントを接続し、ツール呼び出しを発行します。それ以外はすべてオプションの深さ設定です。 ComfyUIがローカルでインストールされ、動作していることを確認してください。 * MCPサーバーに接続 * 利用可能なツールのリスト * サーバーのデフォルト(幅、高さ、ステップ、モデルなど)を取得し表示する * プロンプト(またはデフォルト)でgenerate_imageを実行する * 他のすべてのパラメータに対してサーバーのデフォルトを自動的に使用する * 結果として得られたアセット情報を印刷する このステップが成功すれば、システムは機能している証拠です。 テストクライアントは設定ファイル、環境変数、またはset_defaults呼び出しによって設定されたサーバーのデフォルトを尊重します。プロンプトパラメータのみが必要です。その他のパラメータはすべて自動的にサーバーのデフォルトを使用します。 サーバーが稼働したら、AIクライアントに接続できます。

概要(AI 翻訳)

自然な会話を通じてAI画像・音声・映像を生成・洗練する

AIエージェントがローカルのComfyUIインスタンスを使って画像、音声、動画を生成し、反復的に洗練できる軽量MCP(Model Context Protocol)サーバーです。

サーバーを動かし、クライアントを接続し、ツール呼び出しを発行します。それ以外はすべてオプションの深さ設定です。


クイックスタート(2〜3分)

これはすべてがうまくいっている証拠です。

1) クローンとセットアップ

2) ComfyUIを始める

ComfyUIがローカルでインストールされ、動作していることを確認してください。

3) MCPサーバーを起動する

リポジトリディレクトリから:

サーバーは以下で聴取します:

4) 動作確認(AIクライアント不要)

付属のテストクライアントを実行します:

test_client.py は:

  • MCPサーバーに接続
  • 利用可能なツール一覧
  • フェッチおよび表示サーバーのデフォルト(幅、高さ、ステップ、モデルなど)
  • プロンプト(またはデフォルト)でgenerate_imageを実行する
  • 他のすべてのパラメータに対して自動的にサーバーのデフォルトを使用
  • 結果として得られた資産情報を印刷します

このステップが成功すれば、システムは機能している証拠です。

注: テストクライアントは設定ファイル、環境変数、またはset_defaults呼び出しで設定されたサーバーのデフォルトを尊重します。

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

ComfyUI MCP Server

Generate and refine AI images/audio/video through natural conversation

A lightweight MCP (Model Context Protocol) server that lets AI agents generate and iteratively refine images, audio, and video using a local ComfyUI instance.

You run the server, connect a client, and issue tool calls. Everything else is optional depth.


Quick Start (2–3 minutes)

This proves everything is working.

1) Clone and set up

git clone https://github.com/joenorton/comfyui-mcp-server.git
cd comfyui-mcp-server
pip install -r requirements.txt

2) Start ComfyUI

Make sure ComfyUI is installed and running locally.

cd 
python main.py --port 8188

3) Run the MCP server

From the repository directory:

python server.py

The server listens at:

http://127.0.0.1:9000/mcp

4) Verify it works (no AI client required)

Run the included test client:

# Use default prompt
python test_client.py

# Or provide your own prompt
python test_client.py -p "a beautiful sunset over mountains"
python test_client.py --prompt "a cat on a mat"

test_client.py will:

  • connect to the MCP server
  • list available tools
  • fetch and display server defaults (width, height, steps, model, etc.)
  • run generate_image with your prompt (or a default)
  • automatically use server defaults for all other parameters
  • print the resulting asset information

If this step succeeds, the system is working.

Note: The test client respects server defaults configured via config files, environment variables, or set_defaults calls. Only the prompt parameter is required; all other parameters use server defaults automatically.

That’s it.


Use with an AI Agent (Cursor / Claude / n8n)

Once the server is running, you can connect it to an AI client.

Create a project-scoped .mcp.json file:

{
  "mcpServers": {
    "comfyui-mcp-server": {
      "type": "streamable-http",
      "url": "http://127.0.0.1:9000/mcp"
    }
  }
}

Note: Some clients use "type": "http" instead of "streamable-http". Both work with this server. If auto-discovery doesn’t work, try changing the type field.

Restart your AI client. You can now call tools such as:

  • generate_image
  • view_image
  • regenerate
  • get_job
  • list_assets

This is the primary intended usage mode.


What You Can Do After It Works

Once you’ve confirmed the server runs and a client can connect, the system supports:

  • Iterative refinement via regenerate (no re-prompting)
  • Explicit asset identity for reliable follow-ups
  • Job polling and cancellation for long-running generations
  • Optional image injection into the AI’s context (view_image)
  • Auto-discovered ComfyUI workflows with parameter exposure
  • Configurable defaults to avoid repeating common settings

Everything below builds on the same basic loop you just tested.

Migration Notes (Previous Versions)

GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "comfyui-mcp-server": { "type": "streamable-http", "url": "http://127.0.0.1:9000/mcp" } } }