comfyui-local-mcp
Enables MCP clients to generate images using local ComfyUI with FLUX.2 Klein models optimized for Apple Silicon, plus model management and system diagnostics.
README
comfyui-local-mcp
Drive your local ComfyUI from MCP clients (Hermes, Claude Code, Cursor, any MCP agent) — with ready-made FLUX.2 Klein text-to-image workflows tuned for Apple Silicon (MLX + MPS).
Built and tested on: Mac mini M4 · 24GB unified memory · macOS 26 · ComfyUI 0.33 · mflux 0.19
Features
- 🖼️ generate_image — text-to-image with auto model discovery:
mflux:<name>— FLUX.2 Klein 4B / 9B, 4-bit MLX (fast, low memory)bf16— ComfyUI-native bf16 (MPS, best quality)auto— picks the best model automatically (9B preferred)
- 📦 list_models — list installed models (auto-scans
models/mflux/, add models without code changes) - 🗂️ list_outputs — recent generated images
- 🩺 system_status — one-call diagnosis (ComfyUI service, models, disk)
Quickstart
# 1. Install the server files into your ComfyUI + register the hermes MCP
./install.sh # optional; also fine to just copy files
# 2. Register the MCP server manually (or via install.sh) — e.g. in ~/.hermes/config.yaml:
# mcp_servers:
# comfyui-local:
# command: /path/to/python-with-mcp
# args: [/path/to/comfyui-local-mcp/mcp_comfyui_server.py]
# enabled: true
# 3. Test the server (stdio MCP handshake)
python mcp_comfyui_server.py
# 4. Ask your agent: "generate an image of ..." or "check my ComfyUI status"
Requirements
- macOS with Apple Silicon (MLX / Metal)
- ComfyUI running locally (default
127.0.0.1:8188) - Python env with
mcppackage (the server itself only needs stdlib +mcp) - Optional: mflux +
ComfyUI-mflux-AnyModelcustom node for the MLX path - Optional: FLUX.2 Klein bf16 weights + Qwen3-4B text encoder for the bf16 path
Model setup (Apple Silicon, 24GB friendly)
| Model | Path (under ~/ComfyUI/models/) |
Notes |
|---|---|---|
| FLUX.2 Klein 4B · 4bit MLX | mflux/FLUX.2-Klein-4B-4bit/ |
~4.3GB, ~12.7s/step @1024² |
| FLUX.2 Klein 9B · 4bit MLX | mflux/FLUX.2-Klein-9B-4bit/ |
~9.5GB, higher quality |
| FLUX.2 Klein 4B bf16 | diffusion_models/flux-2-klein-4b-bf16.safetensors |
MPS path, best quality |
| Qwen3-4B text encoder | text_encoders/qwen_3_4b.safetensors |
required by bf16 path |
| FLUX.2 VAE | vae/flux2-vae.safetensors |
Download mflux MLX models with HF cache and symlink them into models/mflux/
(see HF caching / symlinks) — the server auto-discovers them.
Apple Silicon notes
- fp8 weights don't work on MPS — convert to bf16 first (a CPU-side dequantize).
flux-2-klein-4b-bf16.safetensorsis a bf16 conversion of the official fp8 checkpoint. - HF downloads can stall in some networks —
export HF_HUB_DISABLE_XET=1fixes it. - Performance (M4 10-core GPU, 1024×1024): 4B-4bit ~12.7s/step (peak ~11GB), bf16 ~12.1s/step (peak ~15GB).
HF caching and symlinks
HuggingFace snapshot_download stores real data in ~/.cache/huggingface/hub/models--<org>--<name>/blobs/
and exposes symlinks under snapshots/<rev>/. This project keeps symlinks in
models/mflux/<Model-Name>/ pointing at those snapshots — zero duplicate disk usage,
and list_models picks them up automatically.
Troubleshooting
./check_system.sh # one-shot diagnosis
tail -50 ~/comfyui_run.log
- ComfyUI not responding? Make sure it runs on
127.0.0.1:8188(kill stale instances first). - Model missing from
list_models? Symlink (or copy) it intomodels/mflux/with atransformer/subdir. - MCP not visible in the agent? Restart the agent session after editing
config.yaml.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。