Gemini 2.5 Flash Image MCP
Provides conversational image generation and editing capabilities using Google's Gemini 2.5 Flash Image Preview model, including text-to-image generation, image editing with natural language instructions, multi-image composition, and style transfer
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gemini 2.5 Flash Image MCP generate a photo of a cat wearing sunglasses on a sunny beach"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gemini 2.5 Flash Image MCP
A Model Context Protocol (MCP) server for conversational image generation and editing with Google's Gemini 2.5 Flash Image Preview. Designed to be easy to install and use from Claude Code and other MCP clients.
Key Features
Text-to-Image: Generate images from detailed prompts
Image Editing: Edit images with natural language instructions
Multi-Image Composition / Style Transfer: Combine images or transfer styles
File Save Option: Return base64 image and optionally save to file
Provider-Agnostic MCP: Works in any MCP-enabled client
Related MCP server: Nano Banana
Requirements
Node.js 18 or newer
An MCP client (Claude Code, Cursor, VS Code, Windsurf, etc.)
Google Gemini API Key: set
GEMINI_API_KEY
Get a Gemini API key
Follow these steps to obtain an API key from Google AI Studio:
Open Google AI Studio and sign in: https://aistudio.google.com/apikey
Click “Create API key” (or “Manage keys” if you already have one)
Copy the generated key
Set it as an environment variable on your machine when running this server
Examples:
# macOS / Linux (bash/zsh)
export GEMINI_API_KEY="YOUR_API_KEY"
# Windows PowerShell
$env:GEMINI_API_KEY="YOUR_API_KEY"Getting Started
First, install the MCP server with your client. The following examples center on Claude Code usage.
Standard config works in most tools:
{
"mcpServers": {
"gemini-2-5-flash-mcp": {
"command": "npx",
"args": ["@taiyokimura/gemini-2-5-flash-mcp@latest"]
}
}
}Quick usage (Claude Code)
# npx(非対話フラグ付き) + APIキー同時指定(Claudeの -e 指定)
claude mcp add gemini-2-5-flash-mcp -s user -e GEMINI_API_KEY="YOUR_API_KEY" -- npx -y @taiyokimura/gemini-2-5-flash-mcp@latest
# グローバルインストール + APIキー同時指定(Claudeの -e 指定)
npm i -g @taiyokimura/gemini-2-5-flash-mcp \
&& claude mcp add gemini-2-5-flash-mcp -s user -e GEMINI_API_KEY="YOUR_API_KEY" -- gemini-2-5-flash-mcp
# HTTP モードで登録(SSE既定)例(対応クライアントのみ)
# ※ HTTP モードはこのプロセス自体がHTTPサーバとして常駐します
claude mcp add gemini-2-5-flash-mcp -s user \
-e GEMINI_API_KEY="YOUR_API_KEY" \
-e MCP_TRANSPORT="http" \
-e MCP_HTTP_PORT="7801" \
-e MCP_HTTP_PATH="/mcp" \
-- npx -y @taiyokimura/gemini-2-5-flash-mcp@latestStreamable HTTP mode(実験的)
STDIO の代わりに Streamable HTTP を使うこともできます。MCP クライアントが Streamable HTTP に対応している場合のみ利用してください。
サーバーを HTTP モードで起動
export MCP_TRANSPORT=http
export GEMINI_API_KEY=YOUR_API_KEY
# 任意(既定: 7801, /mcp, SSE)
export MCP_HTTP_PORT=7801
export MCP_HTTP_PATH=/mcp
export MCP_HTTP_ENABLE_JSON=false
npm run build
node ./build/index.js
# => HTTP transport listening on http://localhost:7801/mcpクライアント側設定(例: Streamable HTTP対応クライアント)
Type: HTTP (Streamable)
URL:
http://localhost:7801/mcp
注:
SSE ストリーミングが既定。JSONレスポンスで使いたい場合は
MCP_HTTP_ENABLE_JSON=true。セッションはサーバー側で生成(stateful)。完全 stateless にしたい場合はコード側で
sessionIdGenerator: undefinedに変更可能です。
Use the Claude Code CLI to add the MCP server:
claude mcp add gemini-2-5-flash-mcp -s user -- npx @taiyokimura/gemini-2-5-flash-mcp@latestRemove if needed:
claude mcp remove gemini-2-5-flash-mcpFollow the MCP install guide and use the standard config above.
Go to Cursor Settings → MCP → Add new MCP Server.
Use the following:
Name: gemini-2-5-flash-mcp
Type: command
Command: npx
Args: @taiyokimura/gemini-2-5-flash-mcp@latest
Auto start: on (optional)
Add via CLI:
code --add-mcp '{"name":"gemini-2-5-flash-mcp","command":"npx","args":["@taiyokimura/gemini-2-5-flash-mcp@latest"]}'Or use the standard config in settings.
Add MCP Server with:
Command: npx
Args: ["@taiyokimura/gemini-2-5-flash-mcp@latest"]
Advanced settings → Extensions → Add custom extension:
Type: STDIO
Command: npx
Args: @taiyokimura/gemini-2-5-flash-mcp@latest
Enabled: true
Example ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"gemini-2-5-flash-mcp": {
"type": "local",
"command": [
"npx",
"@taiyokimura/gemini-2-5-flash-mcp@latest"
],
"enabled": true
}
}
}Open Qodo Gen → Connect more tools → + Add new MCP → Paste the standard config above → Save.
Follow Windsurf MCP documentation and use the standard config above.
Environment Variables
GEMINI_API_KEY(required)GEMINI_IMAGE_ENDPOINT(optional) default:https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContentMCP_NAME(optional, default:gemini-2-5-flash-mcp)
Available Tools
1. generate_image
Generate an image from a text prompt.
Parameters:
prompt(required): Detailed description to generatesaveToFilePath(optional): Path to save the image
Example input:
{
"prompt": "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme",
"saveToFilePath": "./gemini-native-image.png"
}2. edit_image
Edit an image using a prompt.
Parameters:
prompt(required): Edit instructionimage(required):{ dataBase64?: string, path?: string, mimeType?: string }saveToFilePath(optional)
Example input:
{
"prompt": "Add a small, knitted wizard hat to the cat",
"image": { "path": "./cat.jpeg", "mimeType": "image/jpeg" },
"saveToFilePath": "./gemini-edited-image.png"
}3. compose_images
Combine elements from multiple images.
Parameters:
prompt(required)images(required): Array of image inputs (2-3 recommended)saveToFilePath(optional)
4. style_transfer
Transfer the style of one image to another.
Parameters:
prompt(optional)baseImage(required)styleImage(required)saveToFilePath(optional)
Development
Run locally:
npm install
npm run build
npx .Name Consistency & Troubleshooting
Always use CANONICAL_ID (
gemini-2-5-flash-mcp) for identifiers and keys.Use CANONICAL_DISPLAY (
Gemini 2.5 Flash MCP) only for UI labels.Do not mix different names across clients.
Consistency Matrix:
npm package name →
gemini-2-5-flash-mcpBinary name →
gemini-2-5-flash-mcpMCP server name (SDK metadata) →
gemini-2-5-flash-mcpEnv default MCP_NAME →
gemini-2-5-flash-mcpClient registry key →
gemini-2-5-flash-mcpUI label →
Gemini 2.5 Flash MCP
Conflict Cleanup:
Remove any old entries like "GeminiFlash" and re-add with
gemini-2-5-flash-mcp.Ensure global registries only use
gemini-2-5-flash-mcpfor keys.Cursor: configure in the UI only. This project does not include
.cursor/mcp.json.
References
Architecture: https://modelcontextprotocol.io/docs/learn/architecture
Server concepts: https://modelcontextprotocol.io/docs/learn/server-concepts
Server spec (2025-06-18): https://modelcontextprotocol.io/specification/2025-06-18/server/index
Gemini image generation: https://ai.google.dev/gemini-api/docs/image-generation
Available Tools
4 toolscompose_imagesC
Compose a new image using multiple input images and a guiding prompt.
Inputs: images (required), prompt (required), saveToFilePath.
edit_imageC
Edit an image using a prompt. Provide one input image via base64 or file path.
Inputs: image (required), prompt (required), saveToFilePath.
generate_imageC
Generate an image from a text prompt using Gemini 2.5 Flash Image
Inputs: prompt (required), saveToFilePath.
style_transferB
Transfer style from a style image to a base image, guided by an optional prompt.
Inputs: baseImage (required), styleImage (required), prompt, saveToFilePath.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: compose_images combines multiple images with a prompt, edit_image modifies a single image, generate_image creates from text only, and style_transfer applies artistic style. There is no overlap or ambiguity between these functions.
All tools follow a consistent verb_noun pattern with snake_case naming: compose_images, edit_image, generate_image, style_transfer. The naming is predictable and readable throughout the set.
With 4 tools, this is well-scoped for an image generation/editing server. Each tool earns its place by covering distinct operations (composition, editing, generation, style transfer) without redundancy or bloat.
The toolset covers core image manipulation workflows: generation, editing, composition, and style transfer. A minor gap exists in lacking direct image analysis or metadata tools, but the provided tools allow agents to handle most image-related tasks effectively.
Maintenance
Related MCP Connectors
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
Generate and edit images (PNG, transparent, GIF, SVG) with GPT Image and Nano Banana models.
Generate and edit images: article covers, pet portraits, product shots. Each call spends credits.
Generate, edit, and explore AI images. Flux, Imagen, LoRA identity swap, upscale, and more.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables text-to-image generation, image editing, and multi-image composition using Google's Gemini 2.5 Flash Image API. Supports flexible aspect ratios and character consistency across generations.1MIT
- AlicenseBqualityDmaintenanceGenerate, edit, and restore images using natural language prompts through the Gemini 2.5 Flash image model. Supports creating app icons, seamless patterns, visual stories, and technical diagrams with smart file management.810Apache 2.0
- AlicenseAqualityDmaintenanceEnables AI image generation, editing, composition, and style transfer in Claude conversations using Google's Gemini 2.5 Flash model. Automatically saves generated images to a local directory.4175 npm11MIT
- AlicenseNot gradedqualityDmaintenanceEnables generating, editing, and manipulating images using Google Gemini Flash 2.5 through natural language prompts. Supports text-to-image generation, image editing, multi-image composition, and batch processing with direct file management.4MIT