Comfyui Mcp

io.github.miller-joe由 GitHub 帳號 miller-joe 發布v0.2.1更新於 Oct 24, 2026

MCP server for ComfyUI: text-to-image, variations, img2img refine, upscale, image proxy.

已驗證STDIO僅桌面媒體與設計AI 與機器學習

概覽

AI 產生的概覽

一個本機 MCP 伺服器,把助理連接到 ComfyUI 實例,讓它能依文字提示與工作流程產生、精修、放大圖片並製作圖片變體。

可以做什麼
依文字提示產生圖片,可控制負向提示、尺寸、步數、cfg 與種子,並以不同種子批次產生同一提示的變體。對既有圖片執行 img2img 去噪精修、放大,以及依 ControlNet 圖片或 IP-Adapter 參考圖進行條件式生成。執行任意 ComfyUI 工作流程 JSON,以及 txt2img、img2img、upscale、ControlNet、IP-Adapter 內建範本。儲存、列出、讀取、刪除並執行存放在磁碟上的具名工作流程範本。列出可用的 checkpoint、LoRA、取樣器與排程器,並把參考圖上傳到 ComfyUI。
適用情境
當你已經執行 ComfyUI 實例,希望助理在對話中直接驅動圖片生成、變體、精修、放大或自訂工作流程,而不必切換到 ComfyUI 介面時使用。
執行需求
需要一個可透過 HTTP 存取的 ComfyUI 實例,由 COMFYUI_URL 指定(預設 npm 套件需要 Node.js 20+,也可使用 Docker 映像。當用戶端無法直接連到 ComfyUI 時可選設 COMFYUI_PUBLIC_URL;COMFYUI_DEFAULT_CKPT 需指向 ComfyUI 的 models/checkpoints 目錄中存在的 checkpoint。ControlNet 與 IP-Adapter 工具需要在 ComfyUI 中安裝對應模型與自訂節點。
安裝前請注意
生成類工具會向你的 ComfyUI 實例提交工作並佔用其 GPU 時間。伺服器會從你提供的 URL 抓取來源圖片並上傳到 ComfyUI,啟用 overwrite 時 upload_image 可能覆蓋既有檔案。工作流程範本會在範本目錄中被寫入與刪除。回傳給用戶端的圖片 URL 指向 ComfyUI,若設定公開 URL,產生的圖片可能被他人存取。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Comfyui Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

comfyui-mcp

MCP server for ComfyUI. Generate images from natural language prompts in any MCP-compatible client.

[comfyui-mcp MCP server]

[GitHub Sponsors] [Ko-fi]

Status

v0.2 ships the core tools plus upscale, an image proxy, and public-URL support. Current tool surface: generate_image, generate_variations, generate_with_workflow, refine_image, upscale_image, list_models, list_workflows, upload_image, generate_with_controlnet, generate_with_ip_adapter, plus a workflow template registry. See Roadmap for what's next.

Install

npx (no install required)

bash
npx @miller-joe/comfyui-mcp --comfyui-url http://your-comfyui-host:8188

npm

bash
npm install -g @miller-joe/comfyui-mcpcomfyui-mcp --comfyui-url http://your-comfyui-host:8188

Docker

bash
docker run -p 9100:9100 \  -e COMFYUI_URL=http://your-comfyui-host:8188 \  ghcr.io/miller-joe/comfyui-mcp:latest

Connect an MCP client

Claude Code:

bash
claude mcp add --transport http comfyui http://localhost:9100/mcp

Or register the streamable HTTP endpoint with an MCP gateway (e.g. MetaMCP) to aggregate with other servers.

Configuration

All options can be set via CLI flag or environment variable:

CLI flagEnv varDefaultDescription
--hostMCP_HOST0.0.0.0Bind host (HTTP mode only)
--portMCP_PORT9100Bind port (HTTP mode only)
--stdioMCP_TRANSPORT=stdio(unset)Speak MCP over stdio instead of HTTP. Use when launched as a subprocess by a stdio-first MCP client (Claude Desktop, mcp-inspector).
--comfyui-urlCOMFYUI_URLhttp://127.0.0.1:8188ComfyUI HTTP URL used internally by this server
--comfyui-public-urlCOMFYUI_PUBLIC_URLsame as --comfyui-urlExternal URL in image URLs returned to clients. Set this when the internal URL is not reachable from MCP clients (common with Docker networks).
(no flag)COMFYUI_DEFAULT_CKPTsd_xl_base_1.0.safetensorsDefault checkpoint filename

Transports

The server speaks streamable HTTP by default (great for Claude Code, MetaMCP, raw fetch). Pass --stdio (or set MCP_TRANSPORT=stdio) to switch into stdio mode, which is what stdio-first clients like Claude Desktop and the MCP Inspector expect:

bash
# 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"]    }  }}

Image URLs returned to clients

Generation tools return image URLs like <comfyui-public-url>/view?filename=…. If --comfyui-public-url is not set, URLs use the internal --comfyui-url value.

The server also exposes a proxy endpoint: GET /images/<filename>?subfolder=&type=output streams the image bytes through this server, which is useful when clients can reach the MCP server but not ComfyUI directly.

The default checkpoint must match a file in your ComfyUI models/checkpoints/ directory. Override via COMFYUI_DEFAULT_CKPT or pass checkpoint as a tool argument.

Tools

generate_image

Generate an image from a text prompt using ComfyUI's default txt2img workflow.

Parameters: prompt (required), negative_prompt, width, height, steps, cfg, seed, checkpoint.

generate_variations

Generate multiple variations of the same prompt by varying the seed. Returns all images at once.

Parameters: prompt (required), count (2–16, default 4), plus the same generation params as generate_image, with base_seed instead of seed.

generate_with_workflow

Submit an arbitrary ComfyUI workflow JSON (full node graph) and return the resulting image URLs. Use this for custom workflows — ControlNet, upscaling, or anything exported from ComfyUI's Save (API Format).

Parameter: workflow (object), the complete node graph.

refine_image

Run img2img on a source image. The server fetches a source URL, uploads it to ComfyUI, and runs a denoising pass guided by a new prompt. Lower denoise preserves more of the original; higher gives the prompt more freedom.

Parameters: prompt, source_image_url (required), denoise (0–1, default 0.5), plus standard generation params.

list_models

List available checkpoints, LoRAs, samplers, or schedulers on the ComfyUI instance.

Parameter: kind, one of checkpoints (default), loras, samplers, schedulers.

list_workflows

List built-in workflow templates shipped with this server (currently txt2img, img2img, upscale, controlnet, ip_adapter).

upload_image

Upload a reference image to ComfyUI for use in img2img, ControlNet, or IP-Adapter workflows.

Parameters: source_url or image_base64 (one required), filename (optional), overwrite (default false).

Returns: the stored filename, which can be used as the image input in workflow nodes like LoadImage.

generate_with_controlnet

Generate an image conditioned by a ControlNet preprocessed image (pose skeleton, depth map, canny edges, normal map, etc.) plus a text prompt.

Parameters: prompt, control_image_url (the preprocessed conditioning image; this tool doesn't run preprocessors), controlnet_model (filename from models/controlnet/), strength (0–2, default 1), start_percent / end_percent (0–1, controlling when CN is active during sampling), plus standard generation params.

Requires a ControlNet model installed in your ComfyUI models/controlnet/ directory.

generate_with_ip_adapter

Generate an image using a reference image as a visual/style/subject guide via IP-Adapter.

Parameters: prompt, reference_image_url, preset (e.g. "STANDARD (medium strength)", "PLUS FACE (portraits)", "VIT-G (medium strength)"), weight (0–3, default 1), start_at / end_at (0–1), plus standard generation params.

Requires the ComfyUI-IPAdapter-plus custom node pack plus the preset's matching IPAdapter weights and CLIP Vision models.

Workflow template registry

Save complex workflow JSON once, run by name later. Templates are stored on disk under --templates-dir (defaults to ~/.config/comfyui-mcp/templates/<name>.json) so they survive restarts and are portable across MCP clients.

ToolDescription
save_workflow_templateSave a workflow JSON under a named slot. overwrite=true to replace.
list_workflow_templatesList saved templates with descriptions and last-updated timestamp.
get_workflow_templateFetch a stored template's JSON plus metadata.
delete_workflow_templateDelete a stored template.
run_workflow_templateRun a saved template against ComfyUI and return image URLs.

Template names must start alphanumeric. Allowed: a-z, A-Z, 0-9, -, _. Max 64 chars.

Return format

All generation tools return image URLs served directly by the ComfyUI instance (http://<comfyui>/view?filename=…). These URLs can be passed straight to any client that accepts image URLs.

Architecture

┌────────────────┐     ┌──────────────────┐     ┌──────────────┐│  MCP client    │────▶│  comfyui-mcp     │────▶│  ComfyUI     ││  (Claude, etc.)│◀────│  (this server)   │◀────│  instance    │└────────────────┘     └──────────────────┘     └──────────────┘     streamable HTTP        HTTP REST + poll

The server is stateless. A single MCP request submits a workflow to ComfyUI, polls /history/{id} until complete, and returns image URLs.

Development

bash
git clone https://github.com/miller-joe/comfyui-mcpcd comfyui-mcpnpm installnpm run dev       # hot-reload via tsx watchnpm run build     # compile TS to dist/npm run typecheck # strict type checking

Requires Node 20+.

Roadmap

Shipped in v0.2:

  • generate_image, generate_variations, generate_with_workflow
  • refine_image (img2img from a source URL)
  • upscale_image (ESRGAN / SwinIR-style model upscale)
  • list_models, list_workflows, upload_image
  • Image proxy endpoint (/images/<filename>) for clients that can't reach ComfyUI directly
  • Configurable public URL for externally-correct image URLs
  • Workflow template registry (save/list/get/delete/run)
  • generate_with_controlnet (requires ControlNet models on the ComfyUI side)
  • generate_with_ip_adapter (requires ComfyUI-IPAdapter-plus pack)

Planned:

  • WebSocket progress events for long-running generations.

License

MIT © Joe Miller

Support

If this tool saves you time, consider supporting development:

[GitHub Sponsors] [Ko-fi]

Every contribution funds maintenance, documentation, and the next release.

來源:README.md,提交 9f3481f

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分