Repository avatar
Multimedia
v0.1.0
active

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 🖼️

PyPI

🖼️ 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

ToolWhat it does
load_modelPrepare a model up front (verifies files, auto-downloads missing weights)
unload_modelFree the image model's RAM/VRAM
generate_imageText → image (Z-Image-Turbo, anime/stylized)
edit_imageImage + instruction → edited image (FLUX.1 Kontext)
list_imagesList generated images, newest first
delete_imageDelete 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

RoleModelRepo
Generation (gen)Z-Image-Turbo Q5_K_Munsloth/Z-Image-Turbo-GGUF
Generation text encoderQwen3-4B-Instruct-2507 Q4_K_Munsloth/Qwen3-4B-Instruct-2507-GGUF
Editing (edit)FLUX.1 Kontext dev Q4_K_Munsloth/FLUX.1-Kontext-dev-GGUF
Editing text encodersclip_l + FLUX.1-schnell T5XXL FP8comfyanonymous/flux_text_encoders, unsloth/FLUX.1-schnell-FP8
VAE (both)FLUX VAEunsloth/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 .zip for 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:

VariableDefaultPurpose
IMAGE_MCP_HOME./image-mcp-homeWhere sd-cli + outputs/ live
SD_CLIIMAGE_MCP_HOME/bin/sd-cliPath to the sd-cli executable
HF_HOME~/.cache/huggingfaceHugging Face cache (models auto-download here)
IMAGE_MCP_HOST127.0.0.1Bind address
IMAGE_MCP_PORT8765Server 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.log and 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)

  1. pip install build twine && python -m build && twine upload dist/* (PyPI package name must be unique; verify with twine upload --dry-run)
  2. Install mcp-publisher, then:
    mcp-publisher login github
    mcp-publisher publish
    
    mcp-publisher reads server.json. The registry verifies the PyPI README contains <!-- mcp-name: io.github.<user>/meill -->.
PYPI
meill
Install Command
pip install meill