--- name: imagecreate description: Generate images locally using the five installed image-generation MCP servers (ComfyUI x3, DiffuGen/stable-diffusion.cpp, SD WebUI/Forge). Use when the user types /imagecreate or asks to generate, create, or render an image locally. --- # Local image generation — server picker and workflow Five local image-gen MCP servers are installed at user scope (all free, all run on this machine). Pick the right one, check its backend is up, generate, and return the saved file path. ## Decision order 1. **Is ComfyUI running?** `Invoke-WebRequest http://localhost:8188/system_stats -TimeoutSec 3` (desktop app may use port 8000 instead). - **Yes -> use `comfyui-artokun`** (`mcp__comfyui-artokun__*`). It is the most capable: authors workflows node-by-node, finds/downloads models, supports Flux/SDXL/SD3/video. Just ask it to generate; it builds the workflow itself. - Fallback A: `comfyui-shawn` (`mcp__comfyui-shawn__*`) -- template/workflow driven; `get_status`, `search_templates`, `run_workflow`. Also useful when ComfyUI is NOT running (it serves install/model guides). - Fallback B: `comfy-workflow` (`mcp__comfy-workflow__*`) -- runs ONE fixed exported workflow (currently `C:\Projects\_General\mcp-servers\Flux-Dev-ComfyUI-Workflow.json`, prompt node 6, output node 9, needs Flux Dev models in ComfyUI). Only use when that exact workflow's models are installed. 2. **Is SD WebUI / Forge running with `--api`?** Check `http://localhost:7860`. - **Yes -> use `sd-webui`** (`mcp__sd-webui__*`): `generate_image`, `get_sd_models`, `set_sd_model`, `upscale_images`. Output dir: `C:\Projects\_General\mcp-servers\outputs`. 3. **No GUI backend running -> `diffugen`** (`mcp__diffugen__*`): standalone stable-diffusion.cpp, no server needed -- calls the binary directly. Models: flux-schnell (fast), flux-dev, sdxl, sd3, sd15. 4. Nothing usable -> tell the user which backend to start, do not silently fail. ## Backend status (as of 2026-10-18 -- installed and verified) - **ComfyUI: INSTALLED** at `C:\Projects\_General\mcp-servers\ComfyUI` (v0.7.0, pinned to commit 1bdc9a94 for torch-directml compat). Python 3.12 venv with torch 2.4.1 + torch-directml 0.2.5 (AMD Radeon 890M). Model: `flux1-schnell-fp8.safetensors` (16 GB unified checkpoint with UNET+T5+CLIP+VAE). **Start:** `C:\Projects\_General\mcp-servers\ComfyUI\start.bat` or `venv\Scripts\python.exe main.py --directml --port 8188`. Caveat: DirectML is slow and may OOM on large models; ComfyUI warns it "barely works." - **DiffuGen/stable-diffusion.cpp: BUILT** (CPU-only, AVX512). Binary: `C:\Projects\_General\mcp-servers\diffugen\stable-diffusion.cpp\build\bin\sd.exe` (36 MB). Model: `models\flux1-schnell-Q4_0.gguf` (6.3 GB GGUF quantized). CPU generation is slow (minutes per image). No server needed -- DiffuGen calls the binary directly. - **SD WebUI Forge: INSTALLED** at `C:\Projects\_General\mcp-servers\stable-diffusion-webui-forge`. Python 3.10 venv with torch 2.4.1 + torch-directml 0.2.5. Model: `v1-5-pruned-emaonly.safetensors` (SD 1.5, 4.27 GB). **Start:** `cd C:\Projects\_General\mcp-servers\stable-diffusion-webui-forge; venv\Scripts\python.exe launch.py --api --directml --skip-torch-cuda-test --skip-prepare-environment`. API at `http://localhost:7860`. ## Housekeeping - Server code lives in `C:\Projects\_General\mcp-servers\` (shawn + image-gen-mcp are local builds; artokun runs via npx). Python MCP servers use the venv `C:\Projects\_General\mcp-servers\pyenv` with pinned `mcp==1.9.4` and `pydantic==2.10.6` -- do NOT upgrade those pins; the servers are v1-SDK code. - Generated images default to `C:\Projects\_General\mcp-servers\outputs`. Show the user the resulting file path, and send the image via SendUserFile when on remote control. - No API keys are involved. If the user later wants Civitai downloads through comfyui-artokun, read the token from the vault at call time (`vault.ps1 get civitai`) and pass it as env -- never write it into `.claude.json` or any config file. - If a server shows "Failed to connect" in `claude mcp list`, run its command manually to see the traceback before changing anything. - ComfyUI uses Python 3.12 venv (torch-directml doesn't support 3.13). Forge uses Python 3.10 venv. The system Python is 3.13 -- each backend has its own isolated env.