Skip to main content
Glama

gemini-image-mcp

A simple, focused MCP server for Google Gemini's native image generation — the "Nano Banana" models. Generate, edit, and locally process images from Claude Code, Claude Desktop, or any stdio-based MCP client. Two tools, no bloat.

Built for agents: a single call returns a saved image — or, with one-call background removal, a ready-to-use transparent PNG — without streaming image data through your agent's context. Uses Gemini's generateContent API (not the deprecated Imagen API).

Install

npm install -g @jimothy-snicket/gemini-image-mcp

Or use directly with npx:

npx -y @jimothy-snicket/gemini-image-mcp

Claude Code (one command):

claude mcp add gemini-image -- npx -y @jimothy-snicket/gemini-image-mcp

Requires a GEMINI_API_KEY environment variable — see Setup for details.

Set up a config file (optional):

npx @jimothy-snicket/gemini-image-mcp --init

Creates ~/.gemini-image-mcp.json with commented defaults. For project-specific overrides:

npx @jimothy-snicket/gemini-image-mcp --init --local

Related MCP server: PixelForge MCP

Features

generate_image — AI-powered

  • Text-to-image — describe what you want, get an image

  • Image editing — provide reference images and an editing instruction

  • Video-to-image — the model watches a video and synthesizes a new image from what it understood: YouTube thumbnails, posters from footage, summary infographics, style-transferred stills. See Advanced Features

  • Thinking depth control — thinkingLevel: "HIGH" for renders that depend on reasoning (infographics, diagrams, dense typography); cheap MINIMAL default otherwise

  • Transparent assets in one call — removeBackground returns a clean transparent PNG: a local AI matte (works on any subject; optional add-on, see below) by default, or built-in green-screen / white-threshold keying. No extra API cost

  • Multi-turn edits — pass a sessionId to refine an image across calls, with prior turns kept as context

  • Multi-image input — reference images for editing and character/style consistency (per-model limits; the API enforces)

  • Cost reporting — every response includes token counts, estimated USD cost, and session totals

  • Rate limiting — configurable per-hour caps on requests and cost to prevent runaway agents

  • Auto model discovery — detects available image models from your API key at startup

  • Seed — reproducible generation with integer seeds

  • Search grounding — ground renders in live Google Search results; "web+image" also pulls image-search results for mood boards and trend references, with sources returned for attribution. See Advanced Features

process_image — Local (free, no API calls)

  • Crop — pixel-exact, aspect ratio (center), or focal point (attention/entropy)

  • Resize — to width, height, or both (maintains aspect ratio)

  • Background removal — threshold-based (white backgrounds) or chroma key (green screen, any solid colour)

  • Chroma key pipeline — HSV keying with smoothstep feather, spill suppression, and edge anti-aliasing

  • Trim — auto-remove whitespace borders

  • Format conversion — PNG, JPEG, WebP with quality control

Both tools

  • Output organization — meaningful filenames with auto-versioning, subfolders

  • Generation manifest — generations.jsonl logs every generation with prompt, params, cost

  • Full aspect ratio support — 1:1, 16:9, 9:16, 3:2, 2:3, 4:3, 3:4, 21:9

  • Resolution control — 1K, 2K, 4K

Setup

1. Get a Gemini API Key

Go to Google AI Studio and create an API key.

Billing required: image generation has no free tier — free-tier keys get 429 RESOURCE_EXHAUSTED (quota limit 0) on every image model. Enable pay-as-you-go billing on the key's Google Cloud project (usage & billing). Images cost ~$0.03–$0.24 each depending on model and resolution; the cheapest model (gemini-3.1-flash-lite-image, the default) is ~$0.034 per image.

2. Set the API Key

The server reads your key from the GEMINI_API_KEY environment variable. Set it once so it's available in every session:

Windows (PowerShell — run as admin):

[System.Environment]::SetEnvironmentVariable('GEMINI_API_KEY', 'your-key-here', 'User')

Then restart your terminal.

macOS / Linux:

echo 'export GEMINI_API_KEY="your-key-here"' >> ~/.bashrc
source ~/.bashrc

(Use ~/.zshrc if you're on zsh.)

Verify it's set:

echo $GEMINI_API_KEY

3. Connect to Your MCP Client

Pick the method that matches how you use MCP:

Claude Code (one-liner)

claude mcp add gemini-image -- npx -y @jimothy-snicket/gemini-image-mcp

Claude Code will pick up GEMINI_API_KEY from your environment automatically.

Claude Code (manual .mcp.json)

Add to .mcp.json in your project root or ~/.claude/.mcp.json for global access:

{
  "mcpServers": {
    "gemini-image": {
      "command": "npx",
      "args": ["-y", "@jimothy-snicket/gemini-image-mcp"],
      "env": {
        "GEMINI_API_KEY": "${GEMINI_API_KEY}"
      }
    }
  }
}

The ${GEMINI_API_KEY} syntax reads the value from your shell environment — your actual key never gets written into config files.

Claude Desktop

Edit claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "gemini-image": {
      "command": "npx",
      "args": ["-y", "@jimothy-snicket/gemini-image-mcp"],
      "env": {
        "GEMINI_API_KEY": "${GEMINI_API_KEY}"
      }
    }
  }
}

Restart Claude Desktop after saving.

Other MCP Clients

Any client that supports stdio transport works. Point it at npx -y @jimothy-snicket/gemini-image-mcp and pass GEMINI_API_KEY in the environment.

Security Notes

  • Never commit your API key to version control. The ${GEMINI_API_KEY} syntax in config files references your environment — the key itself stays in your shell profile.

  • If your .mcp.json is in a project repo, add it to .gitignore or use the global config at ~/.claude/.mcp.json instead.

  • For extra security, you can use a wrapper script that reads the key from your OS keychain (macOS Keychain, Windows Credential Manager) and launches the server with it injected.

Configuration

All optional. The only required setup is GEMINI_API_KEY (covered above).

Variable

Default

Description

OUTPUT_DIR

~/gemini-images

Default directory for saved images

DEFAULT_MODEL

gemini-3.1-flash-lite-image

Default Gemini model

LOG_LEVEL

info

debug, info, or error

REQUEST_TIMEOUT_MS

60000

API request timeout in milliseconds

MAX_REQUESTS_PER_HOUR

0 (unlimited)

Max image generations per rolling hour

MAX_COST_PER_HOUR

0 (unlimited)

Max estimated cost (USD) per rolling hour

SESSION_TIMEOUT_MS

1800000 (30min)

Multi-turn session expiry

GEMINI_IMAGE_AUTO_INSTALL

1 (on)

Auto-install the AI matte engine on first removeBackground: { mode: "auto" } use. Set 0 to disable (then auto falls back to chroma/threshold with instructions)

Set these the same way as GEMINI_API_KEY, or pass them in the env block of your MCP config.

Rate limiting is recommended when agents have access to this tool. An agent in a loop can generate images quickly — set MAX_REQUESTS_PER_HOUR=20 and MAX_COST_PER_HOUR=5 as sensible defaults.

Config File

Instead of environment variables, you can use a JSON config file. Create one with:

npx @jimothy-snicket/gemini-image-mcp --init

This creates ~/.gemini-image-mcp.json with all defaults and inline documentation. Edit it to set your preferences.

Priority: env vars > local config (.gemini-image-mcp.json in CWD) > global config (~/.gemini-image-mcp.json) > defaults.

You can also set per-tool defaults so every request uses your preferred settings:

{
  "defaultModel": "gemini-3.1-flash-image",
  "defaults": {
    "generate": {
      "aspectRatio": "16:9",
      "resolution": "2K"
    },
    "process": {
      "removeBackground": { "color": "#00FF00" },
      "trim": true
    }
  }
}

Per-request parameters always override config defaults.

Custom pricing. Cost estimates come from a built-in per-token rate table (there's no pricing API to fetch live). If you use a model the table doesn't know yet — or Google changes a rate before this package updates — add pricingOverrides so cost reporting stays accurate without waiting for a release:

{
  "pricingOverrides": {
    "some-new-image-model": {
      "inputPerMillion": 0.5,
      "textOutputPerMillion": 60,
      "imageOutputPerMillion": 60,
      "thinkingPerMillion": 60
    }
  }
}

Models with no entry (built-in or override) still generate — their cost is reported as unknown rather than guessed.

Tool: generate_image

Parameters

Parameter

Required

Description

prompt

Yes

Text description or editing instruction

images

No

Array of file paths to input/reference images

model

No

Gemini model ID

aspectRatio

No

1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, plus 1:4, 4:1, 1:8, 8:1 (gemini-3.1-flash-image). Validated by the API.

resolution

No

512 (gemini-3.1-flash-image only), 1K, 2K, 4K

outputDir

No

Override output directory for this request

filename

No

Base name for saved file (e.g. hero-banner). Auto-versioned if duplicate.

subfolder

No

Subfolder within output directory (e.g. landing-page)

sessionId

No

Continue a multi-turn editing session from a previous response

seed

No

Integer seed for reproducible generation

grounding

No

"web" = Google Search grounding; "web+image" adds image-search results (gemini-3.1-flash-image only). See Advanced Features

useSearchGrounding

No

Legacy alias for grounding: "web"

thinkingLevel

No

"MINIMAL" (default) or "HIGH" — thinking depth on the gemini-3.1-flash family. See Advanced Features

videos

No

Array of file paths to input videos for video-to-image (gemini-3.1-flash family). See Advanced Features

removeBackground

No

Return a transparent PNG cutout. { "mode": "auto" } = local AI matte (any subject; default); { "mode": "chroma" } = green screen; { "mode": "threshold" } = white removal (line art). No extra API cost

Example Response

{
  "imagePath": "/home/user/gemini-images/hero-banner.png",
  "mimeType": "image/png",
  "model": "gemini-3.1-flash-lite-image",
  "sessionId": "session-1711929600000-a1b2c3",
  "sessionTurn": 1,
  "usage": {
    "promptTokens": 5,
    "outputTokens": 1295,
    "imageTokens": 1290,
    "thinkingTokens": 412,
    "totalTokens": 1712,
    "estimatedCost": "$0.0390",
    "pricingVerifiedDate": "2026-09-16"
  },
  "session": {
    "generationsThisSession": 3,
    "totalCostThisSession": "$0.1161",
    "generationsThisHour": 5,
    "limit": {
      "maxPerHour": 20,
      "maxCostPerHour": 5,
      "remainingThisHour": 15
    }
  }
}

Usage Examples

Text-to-image:

"Generate a hero image for a SaaS landing page, modern gradient style, 16:9"

Image editing:

"Take this screenshot and redesign the header with a dark theme" (with image paths)

Iterative editing (multi-turn):

Generate an image, then call again with the returned sessionId and a refinement like "make it more minimal" — the prior image stays in context.

Organized output:

"Generate a hero banner" with filename: "hero", subfolder: "landing-page" → saves to ~/gemini-images/landing-page/hero.png

High quality:

"A photorealistic product shot of headphones on marble, 4K" (using gemini-3-pro-image)

Transparent asset (one call):

"A glossy red sneaker, product shot" with removeBackground: { "mode": "auto" } → a ready-to-place transparent PNG. The local AI matte works on any subject — no green screen needed.

Tool: process_image

Local image processing via sharp. Free, fast, no API calls.

Parameters

Parameter

Required

Description

imagePath

Yes

Path to the image file to process

crop

No

Crop by pixel dimensions, aspect ratio, or focal point strategy

resize

No

Resize to width/height (maintains aspect ratio)

removeBackground

No

Remove background: { "mode": "auto" } (AI matte, any subject), { "mode": "chroma" } (green screen), or { "mode": "threshold" } (white). Defaults to chroma if color set, else threshold

trim

No

Auto-remove whitespace/transparent borders

format

No

Convert to png, jpeg, or webp

quality

No

Output quality for JPEG/WebP (1-100)

filename

No

Base name for saved file. Auto-versioned if duplicate.

subfolder

No

Subfolder within output directory

outputDir

No

Override output directory

Crop Options

// Pixel-exact
{"width": 500, "height": 300, "left": 100, "top": 50}

// Aspect ratio (center crop)
{"aspectRatio": "16:9"}

// Focal point — shifts crop to the most interesting region
{"aspectRatio": "16:9", "strategy": "attention"}

// Detail-based — shifts crop to the most detailed region
{"aspectRatio": "16:9", "strategy": "entropy"}

Background Removal Options

// AI semantic matte — best quality, works on ANY subject
{"mode": "auto"}

// White/light background (threshold)
{"mode": "threshold", "threshold": 240}

// Green screen (chroma key)
{"mode": "chroma", "color": "#00FF00"}

// Any solid colour
{"mode": "chroma", "color": "#0000FF", "tolerance": 60}

mode: "auto" runs a local BiRefNet matte that isolates the subject semantically — so it handles hair, glass, and green/yellow subjects that chroma key can't. The matte engine isn't bundled (keeps the base install ~65 MB). On your first auto call the server auto-installs it (@huggingface/transformers, ~340 MB) plus the fp16 model (~109 MB) — a one-time pause of a minute or two, then it runs locally with no extra API cost. Set GEMINI_IMAGE_AUTO_INSTALL=0 to disable auto-install (then auto falls back to returning the image with instructions to install it manually). chroma and threshold need nothing extra.

Chroma key (mode: "chroma") uses HSV keying with smoothstep feathering, spill suppression, and 5-pass edge anti-aliasing (default tolerance 80). Use #00FF00 for AI-generated green screens — it works better than matching the exact shade Gemini produces.

Note: Chroma key destroys subjects that share the key colour (green/yellow) and transparent/reflective subjects (glass) — the green parrot vanishes. For those, use mode: "auto" (the AI matte preserves them), or the canvas approach: feed a solid-colour background image to generate_image and let Gemini place the subject with correct lighting. The canvas approach is still best for truly transparent objects like glass, which should transmit the final background rather than be cut out.

Common Pipelines

Subject on a specific background (canvas approach):

generate_image → "Place a [subject] on this background" with images: [solid colour canvas]

One API call. Best for yellow, green, or glass subjects where chroma key struggles.

Transparent asset (one call):

generate_image → "A product photo of <subject>" with removeBackground: {mode: "auto"}

One API call → a transparent PNG. The local AI matte works on any subject. (For truly transparent/reflective objects like glass, the canvas approach above is still best.)

Transparent asset from green screen (zero-dependency):

generate_image → "A product photo on a bright green background"
process_image → removeBackground {mode: "chroma"} + trim

Avoids the matte model entirely — best for high-contrast subjects on locked-down/offline machines.

Favicon from a generated logo:

process_image → removeBackground {threshold: 230} + trim + resize {width: 192, height: 192}

Social card from a photo:

process_image → crop {aspectRatio: "16:9", strategy: "attention"} + resize {width: 1200}

WebP conversion for web:

process_image → format: "webp" + quality: 85

Advanced Features

These are opt-in knobs on generate_image. Most requests don't need them — they're documented here rather than in the tool schema to keep agent context small.

Video-to-image (videos)

The model watches your video and synthesizes a new image from what it understood — the subject, mood, colors, and action — rather than copying a frame. If you just want a frame, use ffmpeg; this is for images that require understanding the footage:

  • YouTube thumbnails — "watch my video and make a click-worthy thumbnail" (the headline use case: no scrubbing for a non-blurry frame)

  • Posters and cover art — gameplay footage → key art, a gig recording → gig poster, a product demo → a clean product shot

  • Summary infographics — "diagram the key steps from this tutorial video"

  • Style-transferred stills — a pencil-sketch of a dance video, a comic panel from home footage

{
  "prompt": "A bold movie poster for this video, dramatic typography",
  "videos": ["./clip.mp4"],
  "model": "gemini-3.1-flash-image"
}
  • Supported on the gemini-3.1-flash family (gemini-3.1-flash-image, gemini-3.1-flash-lite-image); other models reject it.

  • Accepts local files (mp4, mov, webm, avi, mpeg, wmv, flv, 3gpp), max 500MB each, up to 3 per call. Each video is uploaded to Google's Files API, polled until processed, used for the call, then deleted. Video tokens count as input (a 2s clip ≈ 140 tokens).

  • Not combinable with sessionId — sessions are text+image only, and video turns don't create sessions (the upload is deleted after the call, so a stored session would replay a dead reference).

  • Upload + server-side processing happen before the generation call and are bounded by a 120s-per-video processing cap, not by REQUEST_TIMEOUT_MS (which only bounds the generation call itself).

  • You must have the necessary rights to any video you upload.

  • Scope note: this is video input. Video generation is a different model family (Google's Veo, accessed via its own API) and is out of this server's scope.

Thinking depth (thinkingLevel)

All Gemini 3 image models "think" before rendering. The default MINIMAL keeps cost and latency down. Use "HIGH" for renders where quality depends on reasoning: infographics, diagrams, menus, dense typography, multi-step compositions.

{ "prompt": "An infographic explaining the water cycle with labeled diagrams", "thinkingLevel": "HIGH" }

Supported on the gemini-3.1-flash family (API validates elsewhere). Can be set as a project default via defaults.generate.thinkingLevel in the config file.

Image-search grounding (grounding: "web+image")

grounding: "web" grounds the render in live Google Search results (weather, stock charts, current events). "web+image" — exclusive to gemini-3.1-flash-image — also pulls in image-search results, useful for mood boards and trend references.

When grounding is used, the response includes a grounding object: source chunks (URI + title, up to 5), searchQueries, and searchEntryPointHtml. Google's Terms of Service require displaying the search suggestions entry point when you show grounded results — pass searchEntryPointHtml through to the user (it is render-ready HTML provided by Google for exactly this purpose).

Not supported on gemini-3.1-flash-lite-image (the API rejects grounding there).

Models

Model

Strengths

Resolution

Notes

gemini-3.1-flash-lite-image

Cheapest (~$0.034/image), video input

1K

Default (Nano Banana 2 Lite). No search grounding; up to 14 reference images but not optimized for multi-image or multi-turn editing — prefer 3.1-flash for those

gemini-3.1-flash-image

Speed + quality, search grounding (web + image), video input

512, 1K, 2K, 4K

~$0.07/1K image. Up to 10 object + 4 character + 3 style reference images

gemini-3-pro-image

Best quality, text rendering

1K, 2K, 4K

~$0.13/1K image. Up to 6 object + 5 character reference images

gemini-2.5-flash-image

Legacy

1K

Shuts down 2026-10-02

The retired -preview IDs (gemini-3-pro-image-preview, gemini-3.1-flash-image-preview) may still appear in your key's model list but were retired 2026-06-25 — use the GA IDs above. The server discovers whichever image models your API key supports at startup and validates each request against that live list, so new models work without an update.

Development

bun install
bun run build     # TypeScript -> dist/
bun run dev       # Run directly with Bun

License

MIT

Available Tools

2 tools
generate_imageGenerate ImageA

Generate or edit images using Google Gemini. Provide just a prompt for text-to-image generation. Add image file paths to edit or use reference images. Set removeBackground to get a transparent PNG cutout in one call (local AI matte; works on any subject, no extra API cost). Returns the saved file path, model used, token counts, and estimated cost. Advanced inputs (video-to-image, thinking depth, image-search grounding): see the README's Advanced Features section.

ParametersJSON Schema
NameRequiredDescriptionDefault
seedNoSeed for reproducible generation. Same seed + prompt + model = same image.
modelNoGemini image model ID. Defaults to the configured default (gemini-3.1-flash-lite-image). Validated at request time against the models your API key supports (discovered at startup). Common: gemini-3.1-flash-lite-image (cheapest, 1K), gemini-3.1-flash-image (fast, grounding, 512-4K), gemini-3-pro-image (best quality, up to 4K), gemini-2.5-flash-image (legacy, 1K; shuts down 2026-10-02).
imagesNoFile paths to input/reference images for editing. Omit for text-to-image generation. Per-model reference limits vary (gemini-3.1-flash-lite-image up to 14; others less) — the API enforces.
promptYesText description of the image to generate, or editing instruction when images are provided
videosNoFile paths to input videos (mp4/mov/webm/etc, max 500MB each). The model watches the video and creates a NEW image from what it understood — thumbnails, posters, summary art. Not a frame grabber. gemini-3.1-flash family only; not combinable with sessionId.
filenameNoBase name for the saved file (e.g. 'hero-banner'). Extension added automatically. Duplicates get a version suffix (hero-banner-v2). Omit for auto-generated name.
groundingNoSearch grounding. 'web' = Google Search for real-world accuracy. 'web+image' adds image results (gemini-3.1-flash-image only; response includes searchEntryPointHtml which ToS requires displaying). Not supported on gemini-3.1-flash-lite-image.
outputDirNoDirectory to save the image. Defaults to config file outputDir, OUTPUT_DIR env var, or ~/gemini-images
sessionIdNoContinue a multi-turn edit. Pass the sessionId from a previous response to refine that image across calls — the server keeps the prior turns as context.
subfolderNoSubfolder within the output directory (e.g. 'landing-page'). Created automatically.
resolutionNoImage resolution. Defaults to config value or 1K. 512 only on gemini-3.1-flash-image; 2K/4K on gemini-3.1-flash-image and gemini-3-pro-image; gemini-3.1-flash-lite-image and gemini-2.5-flash-image are 1K.
aspectRatioNoImage aspect ratio (defers to the API — unsupported values are rejected by Gemini). Defaults to config value or 1:1. Current models support: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, plus 1:4, 4:1, 1:8, 8:1 on gemini-3.1-flash-image.
thinkingLevelNoThinking depth (gemini-3.1-flash family). Default MINIMAL = fast/cheap. Use HIGH for text-heavy or diagram/infographic renders.
removeBackgroundNoReturn a transparent PNG cutout in one call. Omit for a normal opaque image. Default mode 'auto' runs a local AI matte (no extra API cost; first use downloads a ~one-time model). Supplying `color` implies chroma and `threshold` implies threshold — these override the 'auto' default.
useSearchGroundingNoLegacy alias for grounding: 'web'. Prefer the grounding parameter.

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses return values ('Returns the saved file path, model used, token counts, and estimated cost'), notes the background-removal behavior ('local AI matte; works on any subject, no extra API cost'), and points to the README for advanced inputs. It could add side-effect details like file-writing behavior or the one-time model auto-install, but the description is reasonably transparent for a generation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four sentences with no wasted words. The purpose is front-loaded, the primary workflows are covered, the standout feature (removeBackground) is highlighted, return values are summarized, and a pointer to the README handles advanced topics. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 15 parameters and no output schema, the description covers the essentials: purpose, core workflows, a key feature, and return information. The schema fully documents all parameters, so the README pointer for advanced inputs (video-to-image, thinking depth, grounding) is acceptable. The only notable gap is the lack of any mention of the sibling tool process_image, but that falls under usage guidance rather than completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds workflow-level context (prompt-only, editing, removeBackground) but does not add meaning beyond what the schema already provides for individual parameters. It adds value in organizing usage, but not in explaining parameter semantics further.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Generate or edit images using Google Gemini'. This clearly communicates the tool's core function and differentiates it from a generic image utility. However, it does not explicitly distinguish itself from the sibling tool process_image, so it misses the top score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear, actionable usage context: 'Provide just a prompt for text-to-image generation. Add image file paths to edit or use reference images. Set removeBackground to get a transparent PNG cutout in one call.' This tells an agent how to choose among the main modes of the tool. It does not mention when to prefer process_image instead, so no exclusions are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

process_imageProcess ImageA

Process an existing image locally using sharp. Crop, resize, remove background, convert format, or trim whitespace. Free, fast, no API calls. For AI-powered editing (style changes, complex background removal), use generate_image with the image as input instead.

ParametersJSON Schema
NameRequiredDescriptionDefault
cropNoCrop image. Use width+height for pixel-exact, or aspectRatio for ratio-based. Strategy controls where to crop from.
trimNoAuto-trim whitespace borders
formatNoConvert to format. Defaults to original format.
resizeNoResize image. Maintains aspect ratio if only width or height given.
qualityNoOutput quality for JPEG/WebP (1-100). Default 90.
filenameNoBase name for saved file. Auto-versioned if duplicate.
imagePathYesPath to the image file to process
outputDirNoDirectory to save. Defaults to config file outputDir, OUTPUT_DIR env var, or ~/gemini-images
subfolderNoSubfolder within output directory
removeBackgroundNoRemove background. mode 'auto' (AI matte, any subject), 'chroma' (green screen), or 'threshold' (white). Defaults: chroma if color set, else threshold.

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses key traits: local execution, free, fast, no API calls. However, it does not mention potential side effects, file system modifications, or return behavior in detail.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, front-loaded with main action, then operations list, then alternative guidance. No redundancy or unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (10 parameters, nested objects, no output schema), the description covers core actions and context but omits explicit mention of output (e.g., saved file path). The output parameters imply saving, but it's not stated.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. Description adds a high-level summary of operations but does not significantly augment the detailed parameter descriptions already in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool processes existing images locally using sharp, enumerates specific operations (crop, resize, remove background, etc.), and distinguishes from sibling tool generate_image by noting when to use that alternative.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly advises to use generate_image for AI-powered editing, providing clear when-to-use guidance for this tool versus its sibling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 1 tool updatev0.6.2
    • Changedgenerate_image7 fields changed
      • addedInput schema / properties / grounding
        Added value: +{
        +  "description": "Search grounding. 'web' = Google Search for real-world accuracy. 'web+image' adds image results (gemini-3.1-flash-image only; response includes searchEntryPointHtml which ToS requires displaying). Not supported on gemini-3.1-flash-lite-image.",
        +  "enum": [
        +    "web",
        +    "web+image"
        +  ],
        +  "type": "string"
        +}
      • changedInput schema / properties / images / description
        Previous value: -"File paths to input/reference images for editing. Omit for text-to-image generation. Max references vary by model (gemini-3.1-flash-image ~14, gemini-3-pro-image ~11)."New value: +"File paths to input/reference images for editing. Omit for text-to-image generation. Per-model reference limits vary (gemini-3.1-flash-lite-image up to 14; others less) — the API enforces."
      • changedInput schema / properties / model / description
        Previous value: -"Gemini image model ID. Defaults to the configured default (gemini-2.5-flash-image). Validated at request time against the models your API key supports (discovered at startup). Common: gemini-3.1-flash-image (fast, grounding, 512-4K), gemini-3-pro-image (best quality, up to 4K), gemini-2.5-flash-image (cheapest, 1K; shuts down 2026-10-02)."New value: +"Gemini image model ID. Defaults to the configured default (gemini-3.1-flash-lite-image). Validated at request time against the models your API key supports (discovered at startup). Common: gemini-3.1-flash-lite-image (cheapest, 1K), gemini-3.1-flash-image (fast, grounding, 512-4K), gemini-3-pro-image (best quality, up to 4K), gemini-2.5-flash-image (legacy, 1K; shuts down 2026-10-02)."
      • changedInput schema / properties / resolution / description
        Previous value: -"Image resolution. Defaults to config value or 1K. 512 only on gemini-3.1-flash-image; 1K/2K/4K on gemini-3.x image models; gemini-2.5-flash-image is 1K."New value: +"Image resolution. Defaults to config value or 1K. 512 only on gemini-3.1-flash-image; 2K/4K on gemini-3.1-flash-image and gemini-3-pro-image; gemini-3.1-flash-lite-image and gemini-2.5-flash-image are 1K."
      • addedInput schema / properties / thinkingLevel
        Added value: +{
        +  "description": "Thinking depth (gemini-3.1-flash family). Default MINIMAL = fast/cheap. Use HIGH for text-heavy or diagram/infographic renders.",
        +  "enum": [
        +    "MINIMAL",
        +    "HIGH"
        +  ],
        +  "type": "string"
        +}
      • changedInput schema / properties / useSearchGrounding / description
        Previous value: -"Enable Google Search grounding for real-world accuracy. Supported on the gemini-3.x image models; the API rejects it on models that don't support it."New value: +"Legacy alias for grounding: 'web'. Prefer the grounding parameter."
      • addedInput schema / properties / videos
        Added value: +{
        +  "description": "File paths to input videos (mp4/mov/webm/etc, max 500MB each). The model watches the video and creates a NEW image from what it understood — thumbnails, posters, summary art. Not a frame grabber. gemini-3.1-flash family only; not combinable with sessionId.",
        +  "items": {
        +    "type": "string"
        +  },
        +  "maxItems": 3,
        +  "type": "array"
        +}
  2. 2 tool updatesv0.5.0
    • Changedgenerate_image9 fields changed
      • changedInput schema / properties / aspectRatio / description
        Previous value: -"Image aspect ratio. Defaults to config value or 1:1"New value: +"Image aspect ratio (defers to the API — unsupported values are rejected by Gemini). Defaults to config value or 1:1. Current models support: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, plus 1:4, 4:1, 1:8, 8:1 on gemini-3.1-flash-image."
      • removedInput schema / properties / aspectRatio / enum
        Removed value: -[
        -  "1:1",
        -  "16:9",
        -  "9:16",
        -  "3:2",
        -  "2:3",
        -  "4:3",
        -  "3:4",
        -  "21:9"
        -]
      • changedInput schema / properties / images / description
        Previous value: -"File paths to input/reference images for editing (max 14). Omit for text-to-image generation"New value: +"File paths to input/reference images for editing. Omit for text-to-image generation. Max references vary by model (gemini-3.1-flash-image ~14, gemini-3-pro-image ~11)."
      • changedInput schema / properties / model / description
        Previous value: -"Gemini model ID. Defaults to gemini-2.5-flash-image. Options: gemini-2.5-flash-image, gemini-3-pro-image-preview, gemini-3.1-flash-image-preview"New value: +"Gemini image model ID. Defaults to the configured default (gemini-2.5-flash-image). Validated at request time against the models your API key supports (discovered at startup). Common: gemini-3.1-flash-image (fast, grounding, 512-4K), gemini-3-pro-image (best quality, up to 4K), gemini-2.5-flash-image (cheapest, 1K; shuts down 2026-10-02)."
      • addedInput schema / properties / removeBackground
        Added value: +{
        +  "description": "Return a transparent PNG cutout in one call. Omit for a normal opaque image. Default mode 'auto' runs a local AI matte (no extra API cost; first use downloads a ~one-time model). Supplying `color` implies chroma and `threshold` implies threshold — these override the 'auto' default.",
        +  "properties": {
        +    "color": {
        +      "description": "Chroma-key target hex (chroma mode only). Default #00FF00.",
        +      "pattern": "^#?[0-9a-fA-F]{6}$",
        +      "type": "string"
        +    },
        +    "mode": {
        +      "description": "How to cut out the background. 'auto' (default) = local AI semantic matte (BiRefNet): best quality, works on ANY subject incl. green/yellow/glass/reflective, no special prompt, no extra API cost. On first use the matte engine ('@huggingface/transformers') auto-installs (a one-time pause; set GEMINI_IMAGE_AUTO_INSTALL=0 to disable, then it falls back with install instructions). 'chroma' = generate on a green screen then HSV-key it (zero-dependency, instant, but can damage green/yellow/reflective subjects — prefer 'auto' for those). 'threshold' = generate on white then remove white (line art / logos).",
        +      "enum": [
        +        "auto",
        +        "chroma",
        +        "threshold"
        +      ],
        +      "type": "string"
        +    },
        +    "threshold": {
        +      "description": "White brightness cutoff 0-255 (threshold mode only). Default 240.",
        +      "maximum": 255,
        +      "minimum": 0,
        +      "type": "integer"
        +    },
        +    "tolerance": {
        +      "description": "Chroma hue match tolerance 0-255 (chroma mode only). Default 80.",
        +      "maximum": 255,
        +      "minimum": 0,
        +      "type": "integer"
        +    }
        +  },
        +  "type": "object"
        +}
      • changedInput schema / properties / resolution / description
        Previous value: -"Image resolution. Defaults to config value or 1K. 2K/4K only on gemini-3-pro and gemini-3.1-flash. gemini-2.5-flash is 1K only."New value: +"Image resolution. Defaults to config value or 1K. 512 only on gemini-3.1-flash-image; 1K/2K/4K on gemini-3.x image models; gemini-2.5-flash-image is 1K."
      • changedInput schema / properties / resolution / enum
        Previous value: -[
        -  "1K",
        -  "2K",
        -  "4K"
        -]New value: +[
        +  "512",
        +  "1K",
        +  "2K",
        +  "4K"
        +]
      • changedInput schema / properties / sessionId / description
        Previous value: -"Continue a multi-turn editing session. Pass the sessionId from a previous response to refine the image iteratively. The server preserves conversation history."New value: +"Continue a multi-turn edit. Pass the sessionId from a previous response to refine that image across calls — the server keeps the prior turns as context."
      • changedInput schema / properties / useSearchGrounding / description
        Previous value: -"Enable Google Search grounding for real-world accuracy. Available on gemini-3.1-flash-image-preview."New value: +"Enable Google Search grounding for real-world accuracy. Supported on the gemini-3.x image models; the API rejects it on models that don't support it."
    • Changedprocess_image5 fields changed
      • changedInput schema / properties / removeBackground / description
        Previous value: -"Remove background. Use threshold for white backgrounds, or color for chroma key (green screen)."New value: +"Remove background. mode 'auto' (AI matte, any subject), 'chroma' (green screen), or 'threshold' (white). Defaults: chroma if color set, else threshold."
      • changedInput schema / properties / removeBackground / properties / color / description
        Previous value: -"Hex color to remove (e.g. '#00FF00' for green screen). Use #00FF00 for AI-generated green screens — works better than matching the exact background shade."New value: +"Hex color to remove (e.g. '#00FF00' for green screen). Chroma mode. Use #00FF00 for AI-generated green screens — works better than matching the exact background shade."
      • addedInput schema / properties / removeBackground / properties / color / pattern
        Added value: +"^#?[0-9a-fA-F]{6}$"
      • addedInput schema / properties / removeBackground / properties / mode
        Added value: +{
        +  "description": "'auto' = local AI semantic matte (BiRefNet): best quality, works on any subject, no green screen needed. 'chroma' = HSV green-screen key. 'threshold' = remove near-white. If omitted: 'chroma' when color is set, else 'threshold' (back-compatible).",
        +  "enum": [
        +    "auto",
        +    "chroma",
        +    "threshold"
        +  ],
        +  "type": "string"
        +}
      • changedInput schema / properties / removeBackground / properties / threshold / description
        Previous value: -"Brightness threshold (0-255). Pixels above this become transparent. Default 240. Ignored if color is set."New value: +"Brightness threshold (0-255). Pixels above this become transparent. Default 240. Threshold mode only."
  3. 2 tool updatesv0.4.0
    • First observedgenerate_image
    • First observedprocess_image

TDQS

A4.1/5.0

Scored across 2 tools

Disambiguation4/5

The two tools are largely distinct: one performs AI-powered generation/editing via Gemini, the other does local sharp-based processing. However, both support background removal, which could cause slight confusion, though the descriptions clarify the difference in approach and cost.

Naming Consistency5/5

Both tool names follow a consistent verb_noun pattern (generate_image, process_image) using snake_case. The naming is clear, predictable, and parallel.

Tool Count3/5

With only two tools, the server feels thin for a general-purpose image MCP. While they cover both AI generation/editing and local processing, the scope might benefit from additional tools like image analysis or format conversion, but this is borderline.

Completeness4/5

The core workflows of generating images from text, editing with reference images, and local image processing are covered. Minor gaps exist, such as no explicit tool for image analysis or advanced compositing, but the two tools together handle most primary use cases.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers