comfyui-mcp
comfyui-mcp
ComfyUI 用のMCPサーバーです。MCP互換クライアントから自然言語プロンプトを使用して画像を生成できます。
ステータス
v0.2では、コアツールに加え、アップスケール、画像プロキシ、パブリックURLサポートが実装されています。現在のツールセット: generate_image, generate_variations, generate_with_workflow, refine_image, upscale_image, list_models, list_workflows, upload_image, generate_with_controlnet, generate_with_ip_adapter、およびワークフローテンプレートレジストリ。今後の予定はロードマップを参照してください。
Related MCP server: ComfyUI MCP
インストール
npx (インストール不要)
npx @miller-joe/comfyui-mcp --comfyui-url http://your-comfyui-host:8188npm
npm install -g @miller-joe/comfyui-mcp
comfyui-mcp --comfyui-url http://your-comfyui-host:8188Docker
docker run -p 9100:9100 \
-e COMFYUI_URL=http://your-comfyui-host:8188 \
ghcr.io/miller-joe/comfyui-mcp:latestMCPクライアントへの接続
Claude Code:
claude mcp add --transport http comfyui http://localhost:9100/mcpまたは、ストリーム可能なHTTPエンドポイントをMCPゲートウェイ(MetaMCPなど)に登録して、他のサーバーと統合することも可能です。
設定
すべてのオプションはCLIフラグまたは環境変数で設定可能です:
CLIフラグ | 環境変数 | デフォルト | 説明 |
|
|
| バインドホスト (HTTPモードのみ) |
|
|
| バインドポート (HTTPモードのみ) |
|
| (未設定) | HTTPの代わりにstdio経由でMCP通信を行います。stdio優先のMCPクライアント(Claude Desktop、mcp-inspectorなど)からサブプロセスとして起動する場合に使用します。 |
|
|
| サーバー内部で使用するComfyUIのHTTP URL |
|
|
| クライアントに返される画像URLの外部URL。内部URLがMCPクライアントから到達できない場合(Dockerネットワークなどで一般的)に設定します。 |
(フラグなし) |
|
| デフォルトのチェックポイントファイル名 |
トランスポート
サーバーはデフォルトでストリーム可能なHTTPを使用します(Claude Code、MetaMCP、生の fetch に最適)。--stdio を渡す(または MCP_TRANSPORT=stdio を設定する)ことで、Claude DesktopやMCP Inspectorのようなstdio優先クライアントが期待するstdioモードに切り替わります:
# Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"comfyui": {
"command": "npx",
"args": ["-y", "@miller-joe/comfyui-mcp", "--stdio", "--comfyui-url", "http://127.0.0.1:8188"]
}
}
}クライアントに返される画像URL
生成ツールは <comfyui-public-url>/view?filename=… のような画像URLを返します。--comfyui-public-url が設定されていない場合、URLは内部の --comfyui-url 値を使用します。
また、サーバーはプロキシエンドポイント GET /images/<filename>?subfolder=&type=output を公開しており、クライアントがMCPサーバーには到達できるがComfyUIには直接到達できない場合に、このサーバー経由で画像バイトをストリーミングできます。
デフォルトのチェックポイントは、ComfyUIの models/checkpoints/ ディレクトリ内のファイルと一致している必要があります。COMFYUI_DEFAULT_CKPT で上書きするか、ツール引数として checkpoint を渡してください。
ツール
generate_image
ComfyUIのデフォルトのtxt2imgワークフローを使用して、テキストプロンプトから画像を生成します。
パラメータ: prompt (必須), negative_prompt, width, height, steps, cfg, seed, checkpoint。
generate_variations
シードを変更することで、同じプロンプトから複数のバリエーションを生成します。すべての画像を一度に返します。
パラメータ: prompt (必須), count (2~16、デフォルト4)、および generate_image と同じ生成パラメータ(seed の代わりに base_seed を使用)。
generate_with_workflow
任意のComfyUIワークフローJSON(完全なノードグラフ)を送信し、結果の画像URLを返します。カスタムワークフロー(ControlNet、アップスケール、またはComfyUIの Save (API Format) からエクスポートされたもの)に使用します。
パラメータ: workflow (オブジェクト)、完全なノードグラフ。
refine_image
ソース画像に対してimg2imgを実行します。サーバーはソースURLから画像を取得し、ComfyUIにアップロードして、新しいプロンプトに基づいたデノイズ処理を実行します。denoise を低くすると元の画像が保持され、高くするとプロンプトの自由度が増します。
パラメータ: prompt, source_image_url (必須), denoise (0~1、デフォルト0.5)、および標準の生成パラメータ。
list_models
ComfyUIインスタンス上の利用可能なチェックポイント、LoRA、サンプラー、スケジューラーを一覧表示します。
パラメータ: kind (checkpoints (デフォルト), loras, samplers, schedulers のいずれか)。
list_workflows
このサーバーに同梱されている組み込みワークフローテンプレート(現在は txt2img, img2img, upscale, controlnet, ip_adapter)を一覧表示します。
upload_image
img2img、ControlNet、またはIP-Adapterワークフローで使用するために、参照画像をComfyUIにアップロードします。
パラメータ: source_url または image_base64 (いずれか必須), filename (オプション), overwrite (デフォルトfalse)。
戻り値: 保存されたファイル名。これは LoadImage などのワークフローノードの image 入力として使用できます。
generate_with_controlnet
ControlNetで前処理された画像(ポーズスケルトン、深度マップ、Cannyエッジ、法線マップなど)とテキストプロンプトを使用して画像を生成します。
パラメータ: prompt, control_image_url (前処理済みの条件付け画像。このツールは前処理を実行しません), controlnet_model (models/controlnet/ 内のファイル名), strength (0~2、デフォルト1), start_percent / end_percent (0~1、サンプリング中にCNがアクティブになるタイミングを制御)、および標準の生成パラメータ。
ComfyUIの models/controlnet/ ディレクトリにControlNetモデルがインストールされている必要があります。
generate_with_ip_adapter
IP-Adapterを使用して、参照画像を見本(スタイルや被写体など)として画像を生成します。
パラメータ: prompt, reference_image_url, preset (例: "STANDARD (medium strength)", "PLUS FACE (portraits)", "VIT-G (medium strength)"), weight (0~3、デフォルト1), start_at / end_at (0~1)、および標準の生成パラメータ。
ComfyUI-IPAdapter-plus カスタムノードパックと、プリセットに対応するIPAdapterウェイトおよびCLIP Visionモデルが必要です。
ワークフローテンプレートレジストリ
複雑なワークフローJSONを一度保存し、後で名前で実行できます。テンプレートは --templates-dir(デフォルトは ~/.config/comfyui-mcp/templates/<name>.json)にディスク保存されるため、再起動後も保持され、MCPクライアント間でポータブルです。
ツール | 説明 |
| ワークフローJSONを名前付きスロットに保存します。 |
| 保存されたテンプレートを説明と最終更新日時とともに一覧表示します。 |
| 保存されたテンプレートのJSONとメタデータを取得します。 |
| 保存されたテンプレートを削除します。 |
| 保存されたテンプレートをComfyUIで実行し、画像URLを返します。 |
テンプレート名は英数字で始める必要があります。使用可能: a-z, A-Z, 0-9, -, _。最大64文字。
戻り値の形式
すべての生成ツールは、ComfyUIインスタンスによって直接提供される画像URL (http://<comfyui>/view?filename=…) を返します。これらのURLは、画像URLを受け入れるすべてのクライアントにそのまま渡すことができます。
アーキテクチャ
┌────────────────┐ ┌──────────────────┐ ┌──────────────┐
│ MCP client │────▶│ comfyui-mcp │────▶│ ComfyUI │
│ (Claude, etc.)│◀────│ (this server) │◀────│ instance │
└────────────────┘ └──────────────────┘ └──────────────┘
streamable HTTP HTTP REST + pollサーバーはステートレスです。単一のMCPリクエストがComfyUIにワークフローを送信し、完了するまで /history/{id} をポーリングして、画像URLを返します。
開発
git clone https://github.com/miller-joe/comfyui-mcp
cd comfyui-mcp
npm install
npm run dev # hot-reload via tsx watch
npm run build # compile TS to dist/
npm run typecheck # strict type checkingNode 20以上が必要です。
ロードマップ
v0.2で実装済み:
generate_image,generate_variations,generate_with_workflowrefine_image(ソースURLからのimg2img)upscale_image(ESRGAN / SwinIRスタイルのモデルアップスケール)list_models,list_workflows,upload_image画像プロキシエンドポイント (
/images/<filename>) - ComfyUIに直接到達できないクライアント用外部から正しくアクセス可能な画像URLのための設定可能なパブリックURL
ワークフローテンプレートレジストリ (保存/一覧/取得/削除/実行)
generate_with_controlnet(ComfyUI側にControlNetモデルが必要)generate_with_ip_adapter(ComfyUI-IPAdapter-plusパックが必要)
計画中:
長時間の生成のためのWebSocket進捗イベント。
ライセンス
MIT © Joe Miller
サポート
このツールが役に立った場合は、開発のサポートをご検討ください:
すべての寄付は、メンテナンス、ドキュメント作成、および次期リリースの資金となります。
Available Tools
15 toolsdelete_workflow_templateB
Delete a saved workflow template.
Inputs: name (required).
generate_imageB
Generate an image from a text prompt using ComfyUI's default txt2img workflow. Returns one or more image URLs served directly by the ComfyUI instance.
Inputs: prompt (required), negative_prompt, width, height, +4 more.
generate_variationsB
Generate multiple variations of the same prompt by varying the seed. Useful for picking the best result or exploring a concept.
Inputs: prompt (required), count, negative_prompt, width, +5 more.
generate_with_controlnetA
Generate an image conditioned by a ControlNet preprocessed image (pose, depth, canny, etc.) plus a prompt. Requires a ControlNet model installed in ComfyUI's models/controlnet/ directory. The control_image_url must already be the preprocessed conditioning image — this tool does not run preprocessors itself.
Inputs: prompt (required), control_image_url (required), controlnet_model (required), negative_prompt, +9 more.
generate_with_ip_adapterB
Generate an image using a reference image as an IP-Adapter visual/style/subject guide. Requires the ComfyUI-IPAdapter-plus custom node pack and the preset's matching models (IPAdapter weights + CLIP vision). Weight tunes how strongly the reference guides generation.
Inputs: prompt (required), reference_image_url (required), negative_prompt, preset, +9 more.
generate_with_workflowA
Submit an arbitrary ComfyUI workflow (full node graph) and return the resulting image URLs. Use this when you need a custom workflow like ControlNet, upscaling, or a node graph exported from ComfyUI's 'Save (API Format)'.
Inputs: workflow (required).
get_workflow_templateB
Fetch a saved workflow template's JSON and metadata.
Inputs: name (required).
list_modelsA
List available models or samplers on the ComfyUI instance. Use this to discover valid values for the 'checkpoint' parameter of other tools, or to see what LoRAs and samplers are installed.
Inputs: kind.
list_workflowsA
List built-in workflow templates shipped with this MCP server. These are the named workflows that can be used as a baseline; for arbitrary workflows use generate_with_workflow.
Inputs: no named parameters.
list_workflow_templatesA
List all saved workflow templates in the registry.
Inputs: no named parameters.
refine_imageA
Refine an existing image using img2img: fetch the source image, upload it to ComfyUI, and run a denoising pass guided by the prompt. Lower denoise preserves more of the original; higher denoise gives more freedom to the prompt.
Inputs: prompt (required), source_image_url (required), denoise, negative_prompt, +4 more.
run_workflow_templateB
Run a saved workflow template against ComfyUI and return the resulting image URLs.
Inputs: name (required).
save_workflow_templateA
Save a ComfyUI workflow JSON to the server's template registry under a named slot. Overwrites are disabled by default.
Inputs: name (required), workflow (required), description, overwrite.
upload_imageA
Upload a reference image to ComfyUI for use in img2img, ControlNet, or IP-Adapter workflows. Accepts either a source URL (will be fetched) or base64-encoded image data. Returns the stored filename for use as 'image' in workflow nodes like LoadImage.
Inputs: source_url, image_base64, filename, overwrite.
upscale_imageA
Upscale an image using a loaded upscaler model (ESRGAN, SwinIR, etc.). Fetches the source image, uploads to ComfyUI, runs the upscale node, and returns the output URL. Requires at least one upscaler model in ComfyUI's models/upscale_models/ directory.
Inputs: source_image_url (required), upscale_model (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Each tool has a clearly distinct purpose: generation methods (standard, variations, ControlNet, IP-Adapter, custom workflow), image manipulation (refine, upscale), workflow management (list, get, save, delete, run templates), and utilities (upload_image, list_models). No overlap in functionality.
All tools follow a consistent verb_noun pattern in snake_case (e.g., generate_image, list_models, save_workflow_template). No mixing of styles or ambiguous verbs.
15 tools cover the core capabilities of a ComfyUI integration (generation, conditioning, upscaling, workflow templates, and utilities) without being excessive. Each tool earns its place for a comprehensive image generation server.
The tool surface covers major workflows: txt2img, img2img, ControlNet, IP-Adapter, upscaling, and custom workflows via templates. Minor gaps like explicit inpainting/outpainting tools exist, but these can be handled through custom workflows.
Maintenance
Related MCP Connectors
AI image & video generation MCP server (16 models, DAG projects, MCP Apps UI, OAuth 2.1).
Remote MCP server for anime art, OCs, style pickers, inpainting, upscaling & anime video.
MCP server for Qwen Image 3 AI image generation
Remote MCP for RunComfy: ComfyUI deployments, hosted models, LoRA training. 31 tools.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables Claude Desktop to interact with local ComfyUI installations for AI-powered image generation, including workflow management, model selection, real-time monitoring, and custom workflow execution through natural language.1418MIT
- AlicenseAqualityAmaintenanceMCP server + Claude Code plugin for ComfyUI: execute workflows, generate images, visualize pipelines as Mermaid diagrams, compose/validate workflows, manage and download models, control VRAM, and explore custom nodes. 36 tools, cross-platform, installs via npx -y comfyui-mcp.4112,767 npm971MIT
- FlicenseNot gradedqualityDmaintenanceMCP server that connects local ComfyUI to AI agents, enabling natural language control of ComfyUI for creating workflows, generating images, and managing the queue.1-
- AlicenseAqualityDmaintenanceMCP server that provides image generation, captioning, and tagging via ComfyUI API, configurable for agent tools.43MIT