Skip to main content
Glama

Open Image MCP

Generate and edit images from Devin, Claude Code, Claude Desktop or Codex. Runs locally for free by default. Nano Banana is optional, uses your own Gemini API account, and stores its key in your operating system's credential store.

Local: MFLUX with FLUX.2 Klein 4B on Apple Silicon, or ComfyUI with an SDXL/SD 1.x checkpoint on Windows, Linux or macOS. No image API account or per-image fee. MFLUX downloads roughly 15 GB on first use; allow 25 GB of free disk and 16 GB or more RAM. ComfyUI uses a model you install.

Nano Banana: opt-in paid generation and editing through Google's Gemini API. Works wherever the Python package and a native OS keychain are available. Your Devin, ChatGPT or Gemini app subscription does not pay for these API calls.

Quick install in Devin

With uv installed and the devin command on your PATH, run this in your own terminal. The same command works in macOS/Linux shells and Windows PowerShell:

uvx --from "open-image-mcp[local] @ https://github.com/raffr85/open-image-mcp/archive/refs/tags/v0.2.0.tar.gz" open-image setup --client devin --register

Choose 1. Local. The command installs the Python dependencies in uv's cache and registers the MCP server with Devin. No Git clone, manual JSON editing or API key is needed. Reload MCP servers or start a new conversation, then ask:

Use Open Image MCP to generate a cabin in the mountains locally.

On Apple Silicon, the local model downloads on the first generation. On Windows/Linux, install and start Comfy Desktop and add an SDXL/SD 1.x checkpoint first. Follow the graphical setup guide; the MCP builds the workflows for you. The installer does not install GPU drivers or ComfyUI.

For Claude Code or Codex, replace --client devin with --client claude-code or --client codex. Claude Desktop uses --client claude-desktop; the wizard prints the configuration to merge into that app.

The registered launcher uses a pinned release URL, so it survives uv cache cleanup. uv may need internet to restore the package cache. To run another command without a checkout, reuse the same uvx --from "..." open-image prefix with doctor, configure or auth login instead of setup ....

Generated and edited locally with FLUX.2 Klein 4B:

Generate: fox in a pine forest

Edit: make the forest snowy

A locally generated fox in a forest

The same fox edited into a snowy forest

Related MCP server: Nano Banana MCP

Choose how to generate

Your chat client and your image generator are separate choices.

Image generator

Where it works

Key

Cost

Local, default

Any connected MCP client; MFLUX on Apple Silicon or ComfyUI on Windows/Linux/macOS

None

No image API fee

Nano Banana

Any connected MCP client

Your Gemini API key, stored in the OS keychain

Google API billing

Codex native image_gen

Inside Codex, when available in the session

No separate API key

Your Codex usage limits

This MCP implements Local and Nano Banana. Codex's native image tool is an alternative provided by Codex itself; this server does not export it to Devin or Claude. In Codex, you can ask $imagegen to use the built-in tool without an API fallback. OpenAI's imagegen skill documents this distinction.

Claude creates SVG/HTML visuals and understands images. For photos and illustrations it uses an image tool such as this MCP. Anthropic's explanation.

After installing, run uv run open-image setup for a guided choice. It shows the appropriate connection command, explains the generators and offers hidden key enrollment only if you choose Nano. Add --register to register the server with Devin, Claude Code or Codex automatically; without it, setup prints instructions.

In an MCP conversation, say "generate locally" or "use Nano Banana; I authorize the paid API request". Omitting the provider defaults to Local. Selecting Claude or Codex as the chat client never enables the paid Google API.

Install from a checkout

Requires Python 3.11+ and uv. This project is installed from GitHub; no PyPI release is required.

git clone https://github.com/raffr85/open-image-mcp.git
cd open-image-mcp
uv sync --extra local
uv run open-image doctor
uv run open-image setup

For ComfyUI or the optional cloud provider without MFLUX dependencies, use uv sync. The default provider remains local. Automatic local engine selection uses MFLUX when installed on Apple Silicon and ComfyUI otherwise. A failed request never switches engines or uses a paid API.

Connect to Devin

Run from the checkout:

devin mcp add -s user open-image -- "$PWD/.venv/bin/open-image" serve

Reload MCP servers or open a new conversation. Then ask:

Generate a picture of a red fox in a pine forest locally.

Or, to edit an image:

Edit /absolute/path/to/fox.png locally. Make the forest snowy.

For another MCP client, use its stdio server configuration:

{
  "mcpServers": {
    "open-image": {
      "command": "/absolute/path/to/open-image-mcp/.venv/bin/open-image",
      "args": ["serve"]
    }
  }
}

On Windows, the executable is .venv\\Scripts\\open-image.exe. Use absolute paths in client configuration. The quick installer handles the executable path for you.

Choose the local engine

From a checkout:

uv run open-image configure --engine comfyui --comfyui-url http://127.0.0.1:8188
uv run open-image doctor
uv run open-image configure --checkpoint sd_xl_base_1.0.safetensors

Only one installed checkpoint? It is selected automatically. With several checkpoints, setup lets you choose one, or doctor lists the filenames for configure --checkpoint. Use --checkpoint auto to clear the saved choice. --engine auto restores automatic engine selection; --engine mflux selects MFLUX explicitly. Settings are saved in your OS user config directory and shared by MCP clients. configure prints the file path. Settings contain no credentials.

Comfy Desktop may use port 8000. The wizard checks ports 8188 and 8000 during setup and remembers a discovered address. Runtime requests only use the configured address; they do not silently connect to a different instance.

Connect to Claude or Codex

The same installation can serve all clients. There is no dependency on the language model used for your conversation. When using this MCP, the client calls the selected local engine or Nano Banana. Codex can also use its own native image tool separately.

From the checkout, register with Claude Code:

claude mcp add --scope user open-image -- "$PWD/.venv/bin/open-image" serve

For Codex:

codex mcp add open-image -- "$PWD/.venv/bin/open-image" serve

For Claude Desktop, merge the mcpServers example above into its MCP configuration, using the absolute executable path, then restart the app. Local stdio support applies to the desktop app; a web-only client would need a remote bridge, which this project does not provide.

Restart or reload the client and check its MCP tool list. On the same OS account, clients share the model cache and the enrolled Gemini credential. You do not need to copy the key into each client's config. Simultaneous local generations are prevented by a shared lock for MFLUX. ComfyUI manages its own execution queue.

The repository verifies protocol behavior using the MCP SDK. Client registration syntax is documented here; individual clients may render image previews differently.

Generate from the terminal

uv run open-image generate "A red fox in a pine forest" --seed 42
uv run open-image generate "Make the forest snowy" --image /absolute/path/to/fox.png

The command waits and prints JSON with the image's absolute path. Images go to the OS application data directory, under open-image-mcp/images. doctor prints the location. To choose a directory:

uv run open-image generate "A tiny observatory" --output-dir ./outputs

The MCP server accepts the same --output-dir option. Files get unique names; new requests do not overwrite earlier images.

Enable Nano Banana

  1. Create a key at Google AI Studio and enable API billing for its project. Check Google's pricing.

  2. In your own terminal, run this from the checkout:

    uv run open-image auth login
  3. Paste the key at the hidden prompt. It will not echo.

  4. Request the paid provider explicitly:

    uv run open-image generate "An illustrated fox postcard" --provider nano --allow-paid

In the chat, ask:

Generate a fox postcard using Nano Banana. I authorize the paid API request.

The agent selects provider: "nano" and allow_paid: true. If there is no key, the tool returns auth_required with terminal enrollment instructions. Do not paste a key into chat. There is no MCP tool for setting or reading keys, and no API key argument, environment variable fallback, or key file.

The backend uses macOS Keychain, Windows Credential Manager, or Linux Secret Service directly. It refuses plaintext keyring plugins. A locked or unavailable credential store produces an error instead of writing the key elsewhere.

uv run open-image auth status
uv run open-image auth logout

status only reports whether a key is configured. Enrollment stores the key without making an API request, so it does not verify billing or model access. logout removes the local credential; it does not revoke it at Google.

Tools

Tool

Purpose

generate_image

Queue a new image, local by default

edit_image

Queue an edit using a local PNG, JPEG or WebP reference

get_job

Read queued, running, succeeded, failed or cancelled status

get_image

Return a completed image as MCP image content

list_providers

Inspect local readiness and provider requirements without reading keys

Generation returns a job ID immediately. Check get_job every few seconds, then call get_image when it succeeds. Clients that render MCP images can show the preview; other clients can open the returned file path.

There is one active job and at most four outstanding jobs per MCP server. A file lock prevents multiple instances from running MFLUX at the same time. The server keeps the latest 100 job records in memory; restarting clears job tracking but leaves completed images on disk. Closing the server cancels pending work and terminates its active MFLUX worker. For ComfyUI, it attempts to remove only its own queued prompt. An already-running ComfyUI prompt may finish there; the MCP never sends a global interrupt that could stop another user's job. You can remove old output images manually.

Local dimensions default to 512×512 and accept multiples of 64 from 256 to 1024. MFLUX uses four inference steps and 4-bit quantization. ComfyUI uses a stock SD/SDXL workflow with 20 Euler steps, CFG 7, and img2img denoise 0.65 for edits. For SDXL, 1024×1024 is usually preferable. ComfyUI edits are image-to-image variations: describe the desired final scene rather than assuming instruction-based editing. Supply a seed to reproduce a local request on the same software and hardware.

Nano uses gemini-nano-banana-2.1 at 1K. Requested dimensions select the nearest supported aspect ratio; the returned image's actual dimensions are reported. Nano does not use the local seed. Failed API requests are never retried automatically, since a timeout does not establish whether Google billed the call.

Privacy and limitations

  • Local prompts and reference images stay on your machine. The initial download contacts Hugging Face. Model libraries may check their cache against the hub; set HF_HUB_OFFLINE=1 after downloading the weights to prevent those checks.

  • Nano sends your prompt and, for editing, a normalized reference image to Google. The API key goes in a header to the fixed Google HTTPS endpoint.

  • Provider error bodies and exception details are not returned to the agent.

  • Credentials are protected at rest by the OS store. This is not isolation from another program running as your OS user. See SECURITY.md.

  • This is a local stdio tool for trusted MCP clients. Do not expose it as a public or multi-user server. Editing intentionally reads a user-selected local image.

  • ComfyUI connections are restricted to loopback HTTP addresses. Only local SD/SDXL nodes are used; Comfy cloud and paid API nodes are not supported. Uploaded references and generated outputs also remain in ComfyUI's own folders.

  • ComfyUI hardware support depends on its installation, model and GPU drivers. Multiple image references and custom ComfyUI workflows are not implemented.

  • Local jobs can take several minutes, especially on the first run. Their timeout is 30 minutes. A local failure never triggers a paid request.

Develop and test

uv sync
uv run pytest
uv run ruff check .
uv build

Tests use real stdio MCP sessions and controlled HTTP responses. They do not call Google, require credentials or download model weights. To test real local generation and editing:

uv sync --extra local
uv run python scripts/verify_local.py

For ComfyUI, use uv sync, start ComfyUI, and configure the engine/checkpoint first. The verification script uses the selected local engine. MFLUX downloads weights on first use. The script generates an image, edits it, verifies that both previews decode, and prints the saved paths. See docs/verification.md for recorded manual verification.

License

Code: MIT. The default FLUX.2 Klein 4B weights are Apache 2.0. MFLUX and other dependencies retain their own licenses. Google's models are a separate paid service; their weights are not included.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers