The Gemini 2.5 Flash Image MCP server provides a convenient way to generate and edit images using Google's Gemini 2.5 Flash Image model through the Model Context Protocol (MCP). It enables text-to-image generation, image editing, multi-image composition, and style transfer from any MCP-compatible client.
To obtain an API key from Google AI Studio:
# macOS / Linux (bash/zsh)
export GEMINI_API_KEY="YOUR_API_KEY"
# Windows PowerShell
$env:GEMINI_API_KEY="YOUR_API_KEY"
The standard configuration works in most MCP clients:
{
"mcpServers": {
"gemini-2-5-flash-mcp": {
"command": "npx",
"args": ["@taiyokimura/gemini-2-5-flash-mcp@latest"]
}
}
}
# Using npx with API key
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
# Using global installation
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 mode registration (for supported clients)
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@latest
You can use Streamable HTTP instead of STDIO if your MCP client supports it:
export MCP_TRANSPORT=http
export GEMINI_API_KEY=YOUR_API_KEY
# Optional settings (defaults: 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
http://localhost:7801/mcp
# Add the MCP server
claude mcp add gemini-2-5-flash-mcp -s user -- npx @taiyokimura/gemini-2-5-flash-mcp@latest
# Remove if needed
claude mcp remove gemini-2-5-flash-mcp
Cursor Settings
→ MCP
→ Add new MCP Server
Add via CLI:
code --add-mcp '{"name":"gemini-2-5-flash-mcp","command":"npx","args":["@taiyokimura/gemini-2-5-flash-mcp@latest"]}'
Add MCP Server with:
Advanced settings → Extensions → Add custom extension:
GEMINI_API_KEY
(required)GEMINI_IMAGE_ENDPOINT
(optional) default: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent
MCP_NAME
(optional, default: gemini-2-5-flash-mcp
)Generate an image from a text prompt.
Parameters:
prompt
(required): Detailed description to generatesaveToFilePath
(optional): Path to save the imageExample:
{
"prompt": "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme",
"saveToFilePath": "./gemini-native-image.png"
}
Edit an image using a prompt.
Parameters:
prompt
(required): Edit instructionimage
(required): { dataBase64?: string, path?: string, mimeType?: string }
saveToFilePath
(optional)Example:
{
"prompt": "Add a small, knitted wizard hat to the cat",
"image": { "path": "./cat.jpeg", "mimeType": "image/jpeg" },
"saveToFilePath": "./gemini-edited-image.png"
}
Combine elements from multiple images.
Parameters:
prompt
(required)images
(required): Array of image inputs (2-3 recommended)saveToFilePath
(optional)Transfer the style of one image to another.
Parameters:
prompt
(optional)baseImage
(required)styleImage
(required)saveToFilePath
(optional)For consistent operation, always use the canonical ID gemini-2-5-flash-mcp
for identifiers and keys. If you encounter conflicts, remove any old entries (like "GeminiFlash") and re-add with the correct name.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "gemini-2-5-flash-mcp" '{"command":"npx","args":["@taiyokimura/gemini-2-5-flash-mcp@latest"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"gemini-2-5-flash-mcp": {
"command": "npx",
"args": [
"@taiyokimura/gemini-2-5-flash-mcp@latest"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"gemini-2-5-flash-mcp": {
"command": "npx",
"args": [
"@taiyokimura/gemini-2-5-flash-mcp@latest"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect