
meill
io.github.bara-eqnaibi/meill
MEILL: local MCP server to generate & edit images (Z-Image-Turbo, FLUX Kontext). No cloud or keys.
Documentation
MEILL 🖼️
🖼️ MEILL — Local MCP server that generates & edits images on your machine (Z-Image-Turbo, FLUX.1 Kontext via stable-diffusion.cpp). No cloud, no API keys — just ask your AI to make images.
A local MCP (Model Context Protocol) server that lets an AI chat model (e.g. Unsloth Studio's Qwen, Claude, etc.) generate and edit images on your own machine using free, open-source models — no cloud APIs, no subscriptions.
It runs stable-diffusion.cpp
(sd-cli) as a subprocess for every job, so image-model RAM/VRAM is fully
released between calls and never fights with your chat model.
Tools exposed
| Tool | What it does |
|---|---|
load_model | Prepare a model up front (verifies files, auto-downloads missing weights) |
unload_model | Free the image model's RAM/VRAM |
generate_image | Text → image (Z-Image-Turbo, anime/stylized) |
edit_image | Image + instruction → edited image (FLUX.1 Kontext) |
list_images | List generated images, newest first |
delete_image | Delete an image (safely scoped to the outputs folder) |
Models auto-download on first use into your Hugging Face cache
(~/.cache/huggingface), so a fresh machine only needs the server + sd-cli.
Supported models
| Role | Model | Repo |
|---|---|---|
Generation (gen) | Z-Image-Turbo Q5_K_M | unsloth/Z-Image-Turbo-GGUF |
| Generation text encoder | Qwen3-4B-Instruct-2507 Q4_K_M | unsloth/Qwen3-4B-Instruct-2507-GGUF |
Editing (edit) | FLUX.1 Kontext dev Q4_K_M | unsloth/FLUX.1-Kontext-dev-GGUF |
| Editing text encoders | clip_l + FLUX.1-schnell T5XXL FP8 | comfyanonymous/flux_text_encoders, unsloth/FLUX.1-schnell-FP8 |
| VAE (both) | FLUX VAE | unsloth/FLUX.1-Kontext-dev |
Quick start
1. Get sd-cli (the image engine)
Download a prebuilt binary for your OS from the stable-diffusion.cpp releases:
- Windows (NVIDIA GPU):
sd-master-*-bin-win-cuda12-x64.zip - Windows (AMD/Intel/any GPU):
sd-master-*-bin-win-vulkan-x64.zip - Linux: the
.zipfor your distro/GPU
Unzip it and put sd-cli (or sd-cli.exe) in image-mcp-home/bin/, or set the
SD_CLI environment variable to its full path.
On a machine without a dedicated GPU (e.g. Intel iGPU), use the Vulkan build — it works on almost anything.
2. Install Python dependencies
pip install -r requirements.txt
3. Start the server
Windows: double-click run.bat
Linux/macOS: ./run.sh (chmod +x first)
Any: python server.py
You should see:
Serving MCP at http://127.0.0.1:8765/mcp
4. Connect it to your AI client
Add it as a streamable-HTTP MCP server pointing at:
http://127.0.0.1:8765/mcp
For example, in Unsloth Desktop / Claude Desktop / any MCP client config:
{
"mcpServers": {
"image-tools": {
"url": "http://127.0.0.1:8765/mcp"
}
}
}
Then just ask the model: "generate an image of a cyberpunk cat" or "edit this image: make the sky a sunset."
Configuration (environment variables)
Everything is overridable without editing code:
| Variable | Default | Purpose |
|---|---|---|
IMAGE_MCP_HOME | ./image-mcp-home | Where sd-cli + outputs/ live |
SD_CLI | IMAGE_MCP_HOME/bin/sd-cli | Path to the sd-cli executable |
HF_HOME | ~/.cache/huggingface | Hugging Face cache (models auto-download here) |
IMAGE_MCP_HOST | 127.0.0.1 | Bind address |
IMAGE_MCP_PORT | 8765 | Server port |
Example — run on all interfaces, port 9000, custom model folder:
IMAGE_MCP_HOST=0.0.0.0 IMAGE_MCP_PORT=9000 IMAGE_MCP_HOME=/data/images python server.py
How memory is managed
Each generate_image / edit_image call spawns sd-cli as a separate process
that exits when done, so VRAM/RAM is physically freed after every job.
load_model / unload_model manage explicit state and are mostly a readiness
check (download missing weights, verify paths). Only one image job runs at a
time (protected by a lock).
Requirements
- Python 3.10+
- A GPU is recommended but not required — the Vulkan build of sd-cli runs on CPU/iGPU too (just slower). Expect ~1-3 min per image on modest hardware.
- ~15 GB disk for the models (auto-downloaded on first use)
Troubleshooting
- "Missing file role(s)" — a model file didn't download. Check internet
access, or download it manually into
~/.cache/huggingface. huggingface_hub not installed— run the server with a Python that has the deps (pip install -r requirements.txt).- sd-cli fails / no output — check
image-mcp-home/outputs/server_errors.logand the server console. - Very slow — expected on iGPU/CPU. Try smaller
width/height, or fewer steps.
License
MIT — see LICENSE.
Installing from the MCP Registry
Once published, clients can install it directly:
uvx --from meill meill --stdio
or add to your MCP client config (stdio):
{
"mcpServers": {
"image-tools": {
"command": "uvx",
"args": ["--from", "meill", "meill", "--stdio"]
}
}
}
Publishing (maintainers)
pip install build twine && python -m build && twine upload dist/*(PyPI package name must be unique; verify withtwine upload --dry-run)- Install
mcp-publisher, then:mcp-publisher login github mcp-publisher publishmcp-publisherreadsserver.json. The registry verifies the PyPI README contains<!-- mcp-name: io.github.<user>/meill -->.
meillpip install meill