jgkme/kilo-image-gen-mcp

jgkme/kilo-image-gen-mcp

MCP server for generating, editing, and processing images via multiple providers including Kilo, OpenRouter, OpenAI, and Gemini, with local tools for background removal, resizing, and cropping.

Category
Visit Server

README

img-gen-mcp

img-gen-mcp is a local-first MCP server for image generation, editing, background removal, optimization, and final asset delivery.

It combines:

  • OpenRouter-first image generation
  • Kilo Gateway support
  • OpenAI and Gemini image generation
  • local background cleanup with rmbg, imgly, and a shared Docker-backed withoutbg daemon
  • web optimization with sharp
  • deterministic prompt enhancement before generation

Features

  • generate_image for OpenRouter-first generation with response normalization
  • kilo_generate_image for Kilo Gateway routing
  • edit_image for prompt-driven image editing
  • background_remove for local cutouts and the shared local withoutBG daemon
  • resize_image and auto_crop for deterministic local transforms
  • optimize_image for web-ready re-encoding and compression
  • finalize_image for a one-call local workflow that can remove background, trim, crop, and resize
  • alpha stats and multi-background inspection sheets for post-processing QA
  • prompt enhancement before generation
  • automatic web optimization after background removal/finalize
  • debug mode via IMAGE_MCP_DEBUG=1

Install

npm install -g img-gen-mcp

Configuration

Set these environment variables in your MCP client:

  • IMAGE_MCP_DEFAULT_PROVIDER - default provider when none is supplied
  • IMAGE_MCP_DEFAULT_MODEL - default model when none is supplied
  • IMAGE_MCP_PROJECT_OUTPUT_DIR - optional project-specific output root
  • IMAGE_MCP_DEFAULT_BG_BACKEND - default local cleanup backend (rmbg, imgly, or withoutbg)
  • WITHOUTBG_DAEMON_URL - local daemon URL, defaults to http://127.0.0.1:8765
  • WITHOUTBG_AUTOSTART=1 - auto-start the shared withoutBG Docker daemon on demand
  • IMAGE_MCP_DEFAULT_BG_ALPHA_THRESHOLD - tighter default mask for logos/header assets
  • IMAGE_MCP_PROMPT_ENHANCE=0 - disable deterministic prompt enhancement
  • IMAGE_MCP_DEBUG=1 - include detailed tool errors and provider payloads

Example MCP config:

{
  "mcp": {
    "img-gen-mcp": {
      "type": "local",
      "command": ["npx", "-y", "img-gen-mcp"],
      "enabled": true,
      "environment": {
        "IMAGE_MCP_DEFAULT_PROVIDER": "openrouter",
        "IMAGE_MCP_DEFAULT_MODEL": "openai/gpt-image-1",
        "IMAGE_MCP_DEFAULT_BG_BACKEND": "imgly",
        "WITHOUTBG_DAEMON_URL": "http://127.0.0.1:8765",
        "WITHOUTBG_AUTOSTART": "1"
      }
    }
  }
}

See docs/public/clients.md for ready-to-use examples for Kilo, Cursor, and generic MCP clients.

Workflow

The typical pipeline is:

  1. Generate an image
  2. Remove background if needed
  3. Inspect the cutout on multiple backgrounds
  4. Optimize the final asset for the web
  5. Save and ship the final PNG/WebP/JPEG/AVIF

Common Uses

  • logos
  • icons
  • header artwork
  • product photography
  • realistic subject cutouts
  • transparent PNG delivery

Models

Supported OpenRouter image models include:

  • microsoft/mai-image-2.5
  • openai/gpt-image-1
  • openai/gpt-5-image-mini
  • openai/gpt-5.4-image-2
  • x-ai/grok-imagine-image-quality
  • google/gemini-2.5-flash-image
  • google/gemini-2.5-flash-image-preview
  • google/gemini-3-pro-image-preview
  • sourceful/riverflow-v2.5-fast
  • sourceful/riverflow-v2.5-pro
  • sourceful/riverflow-v2.5-fast:free
  • sourceful/riverflow-v2-fast
  • sourceful/riverflow-v2-pro
  • recraft/recraft-v4.1-utility
  • recraft/recraft-v4.1-vector
  • recraft/recraft-v4.1-utility-pro
  • recraft/recraft-v4.1-pro-vector
  • recraft/recraft-v3
  • black-forest-labs/flux.2-pro
  • black-forest-labs/flux.2-flex

Recommended defaults:

  • Photorealistic work: microsoft/mai-image-2.5 or openai/gpt-image-1
  • Quick stylized work: x-ai/grok-imagine-image-quality
  • Logos / vector-like work: recraft/recraft-v4.1-vector
  • Broad prompt-following general use: sourceful/riverflow-v2.5-pro

Background Removal Backends

  • rmbg - fastest lightweight local cleanup
  • imgly - higher-quality local cleanup
  • withoutbg - shared Docker-backed local daemon for harder edges, fur, and transparent cutouts

Start the shared daemon once:

docker compose -f withoutbg-daemon/docker-compose.yml up -d

If WITHOUTBG_AUTOSTART=1 is set, the MCP will try to start it automatically when backend=withoutbg is used.

Web Optimization

background_remove and finalize_image automatically run a web optimization pass after cleanup.

Use optimize_image directly when you want explicit control:

  • PNG for transparent cutouts
  • WebP for opaque assets
  • JPEG for flattened web images
  • AVIF for aggressive compression

Docs

  • Public docs drafts live in docs/public/
  • Wiki-ready pages live in docs/wiki/
  • Migration notes and setup details are documented there for public release

Troubleshooting

  • If withoutbg is not running, enable WITHOUTBG_AUTOSTART=1 or start the daemon manually.
  • If the model list looks wrong, set IMAGE_MCP_DEFAULT_MODEL explicitly.
  • If image generation fails with provider-specific errors, verify the provider API key in your MCP environment.
  • If you need the raw response details, set IMAGE_MCP_DEBUG=1.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured