imagen-mcp
Generates images using Google Gemini's image models (Nano Banana Pro, Flash, Imagen 3.0) with support for photorealism, up to 4K resolution, reference images for character/style consistency, real-time data via Google Search grounding, and conversational history for iterative refinement.
Generates images using OpenAI's GPT-Image-1 model, optimized for text-heavy images like menus, infographics, comics, and diagrams with excellent text rendering capabilities.
Click on "Install 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., "@imagen-mcpcreate a logo for a coffee shop called 'Morning Brew' with a minimalist design"
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.
imagen-mcp
A Model Context Protocol (MCP) server for intelligent multi-provider image generation.
Quick Start
1. Get an API key (at least one):
Provider | Get a key at | Environment variable |
OpenAI |
| |
Google Gemini |
|
Having both keys gives you the best results — the server automatically picks the right provider for each prompt. With only one key, prompts better suited for the other provider will still work, but you'll see a fallback notice.
2. Add to your MCP client (pick one):
claude mcp add -s user imagen \
-e OPENAI_API_KEY=sk-... \
-e GEMINI_API_KEY=AI... \
-- npx -y imagen-mcpVerify it's registered:
claude mcp listReference: Claude Code MCP docs
Edit the config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"imagen": {
"command": "npx",
"args": ["-y", "imagen-mcp"],
"env": {
"OPENAI_API_KEY": "sk-...",
"GEMINI_API_KEY": "AI..."
}
}
}
}Restart Claude Desktop (Cmd+Q, then reopen) after editing.
Reference: Claude Desktop MCP docs
Option A — CLI command:
codex mcp add imagen -- npx -y imagen-mcpOption B — edit ~/.codex/config.toml directly:
[mcp_servers.imagen]
command = "npx"
args = ["-y", "imagen-mcp"]
[mcp_servers.imagen.env]
OPENAI_API_KEY = "sk-..."
GEMINI_API_KEY = "AI..."Reference: Codex MCP docs
Edit ~/.gemini/settings.json:
{
"mcpServers": {
"imagen": {
"command": "npx",
"args": ["-y", "imagen-mcp"],
"env": {
"OPENAI_API_KEY": "sk-...",
"GEMINI_API_KEY": "AI..."
}
}
}
}Reference: Gemini CLI MCP docs
Setting | Value |
Command |
|
Args |
|
Environment |
|
3. Generate an image — ask your AI assistant:
"Generate a professional headshot with studio lighting"
That's it. The server picks the best provider automatically.
Related MCP server: ImageGen MCP Server
Features
Auto Provider Selection — analyzes prompts to choose the best provider
Multi-Provider Support — OpenAI GPT-Image-1 and Google Gemini
Reference Images — up to 14 images for character/style consistency (Gemini)
Real-time Data — Google Search grounding for current info (Gemini)
Conversational Refinement — iteratively refine images with context
High Resolution — up to 4K output (Gemini)
Fallback Notices — clear warnings when a prompt would benefit from a provider you haven't configured
How Auto-Selection Works
The server analyzes your prompt and routes it to the best provider:
"Create a menu card for an Italian restaurant" -> OpenAI (text rendering)
"Professional headshot with studio lighting" -> Gemini (photorealism)
"Infographic about climate change" -> OpenAI (diagram + text)
"Product shot of perfume on marble" -> Gemini (product photography)What if the best provider isn't configured? The server falls back to whatever you have and tells you:
Provider Fallback: Gemini would be better for this prompt (Photorealistic content), but it's not configured. Using OpenAI instead. Set
GEMINI_API_KEYfor better results.
You can always override auto-selection with the provider parameter:
generate_image(prompt="...", provider="openai")
generate_image(prompt="...", provider="gemini")Provider Comparison
Feature | OpenAI GPT-Image-1 | Gemini Nano Banana Pro |
Text Rendering | Excellent | Good |
Photorealism | Good | Excellent |
Speed | ~60s | ~15s |
Max Resolution | 1536x1024 | 4K |
Sizes | 3 options | 1K, 2K, 4K |
Aspect Ratios | 3 | 10 |
Reference Images | No | Yes (up to 14) |
Real-time Data | No | Yes (Google Search) |
Use OpenAI for: text-heavy images, menus, infographics, comics, diagrams
Use Gemini for: portraits, product photography, 4K output, reference images
MCP Tools
Tool | Description |
| Main tool with auto provider selection (reports progress) |
| Generate many prompts concurrently (bounded fan-out, per-item error isolation) |
| Multi-turn refinement; native MCP elicitation with dialogue fallback |
| Edit/inpaint an existing image via OpenAI gpt-image-2 |
| List active conversations and their history |
| Show available providers and capabilities |
| Query available Gemini image models |
| Approximate generation cost without generating |
All tools advertise MCP tool annotations (read-only / open-world hints) so clients can reason about their side effects.
Output Location
Images are saved to ~/Downloads/images/{provider}/ by default (openai/ or gemini/ subdirectories).
Customize with:
# Save to a specific directory (auto-generated filename)
generate_image(prompt="...", output_path="~/Desktop/logos/")
# Save to a specific file
generate_image(prompt="...", output_path="~/Desktop/logos/my-logo.png")Set OUTPUT_DIR to change the base directory globally. Logs go to {OUTPUT_DIR}/logs/.
Gemini-Specific Features
# High resolution
generate_image(prompt="...", size="4K")
# Specific model
generate_image(prompt="...", gemini_model="gemini-2.0-flash-exp-image-generation")
# Reference images for style/character consistency (base64 encoded)
generate_image(prompt="...", reference_images=["base64..."])
# Real-time data via Google Search
generate_image(prompt="Current weather in NYC", enable_google_search=True)Available Models
OpenAI
Model ID | Description |
| Dedicated image generation model (default) |
| GPT-5 with image generation capabilities |
| Latest reasoning model (conversation orchestration) |
Gemini
Model ID | Description |
| Nano Banana Pro - highest quality (default) |
| Fast experimental |
| Alternative image model |
Architecture
flowchart TB
subgraph Clients["MCP Clients"]
CD[Claude Desktop]
CC[Claude Code CLI]
GC[Gemini CLI]
CX[Codex CLI]
end
subgraph Server["imagen-mcp Server"]
MCP[MCP Protocol Layer]
subgraph Tools["MCP Tools"]
GI[generate_image]
CI[conversational_image]
LP[list_providers]
LM[list_gemini_models]
end
subgraph Core["Core Components"]
PS[Provider Selector]
PR[Provider Registry]
end
subgraph Providers["Image Providers"]
OAI[OpenAI Provider<br/>GPT-Image-1]
GEM[Gemini Provider<br/>Nano Banana Pro]
end
end
subgraph APIs["External APIs"]
OAPI[OpenAI API]
GAPI[Google Gemini API]
end
subgraph Storage["Local Storage"]
DL[~/Downloads/images/]
end
CD & CC & GC & CX --> MCP
MCP --> Tools
GI & CI --> PS
PS --> PR
PR --> OAI & GEM
OAI --> OAPI
GEM --> GAPI
OAI & GEM --> DLEnvironment Variables
Variable | Description | Required |
| OpenAI API key | At least one API key |
| Google Gemini API key | is required |
| Alias for | |
| Base directory for saved images | No (default: |
| Force a default provider | No (default: |
| Default OpenAI image size | No (default: |
| Default Gemini image size | No (default: |
| Enable Google Search grounding | No (default: |
| Read-timeout ceiling in seconds for provider calls (covers slow high-quality renders) | No (default: |
| OpenAI client-side rate limits | No (defaults: |
| Gemini client-side rate limits | No (defaults: |
| Log directory override | No |
| Log level (DEBUG, INFO, etc.) | No |
| Log full prompts | No (default: |
|
| No |
| Bind address for HTTP transports | No (default: |
Troubleshooting
"No providers available"
You need at least one API key. Set OPENAI_API_KEY or GEMINI_API_KEY in your MCP client config (see Quick Start above).
Images generate but quality isn't great for portraits/products
You're probably missing GEMINI_API_KEY. The server fell back to OpenAI and showed a warning. Add a Gemini key for better photorealistic results.
Images generate but text looks bad
You're probably missing OPENAI_API_KEY. Add an OpenAI key for better text rendering.
"npx: command not found" Install Node.js (which includes npx): nodejs.org
Where are my images saved?
Default: ~/Downloads/images/openai/ or ~/Downloads/images/gemini/. Check the tool output for the exact path. Set OUTPUT_DIR to change this.
How do I check which providers are active?
Use the list_providers tool, or run:
python3 -c "from src.providers import get_provider_registry; print(get_provider_registry().list_providers())"Development
# Clone and install (runtime + dev tooling)
git clone https://github.com/michaeljabbour/imagen-mcp.git
cd imagen-mcp
pip install -e ".[dev]" # or: uv sync --extra dev
# Install pre-commit hooks (ruff + mypy)
pre-commit install
# Run the full quality gate (same as CI)
ruff format --check src/ tests/
ruff check src/ tests/
mypy src/
pytest --cov=src --cov-fail-under=80
# Verify server loads
python3 -c "from src.server import mcp; print('Server loads')"
# Run over HTTP instead of stdio
IMAGEN_MCP_TRANSPORT=streamable-http imagen-mcp
# Check Claude Desktop logs (macOS)
tail -f ~/Library/Logs/Claude/mcp-server-imagen.logProject Structure
imagen-mcp/
├── src/
│ ├── server.py # MCP entry point
│ ├── config/
│ │ ├── constants.py # Provider constants
│ │ └── settings.py # Environment configuration
│ ├── providers/
│ │ ├── base.py # Abstract provider interface
│ │ ├── openai_provider.py # OpenAI implementation
│ │ ├── gemini_provider.py # Gemini implementation
│ │ ├── selector.py # Auto-selection logic
│ │ └── registry.py # Provider factory
│ └── models/
│ └── input_models.py # Pydantic input models
├── tests/
│ ├── test_selector.py # Provider selection tests
│ ├── test_providers.py # Provider unit tests
│ └── test_server.py # Server integration tests
├── .github/
│ └── workflows/
│ └── ci.yml # GitHub Actions CI
├── run.sh # Wrapper script for MCP clients
├── requirements.txt
├── CLAUDE.md
└── README.mdRequirements
mcp>=1.16.0
fastmcp>=2.12.5
pydantic>=2.12.3
httpx>=0.24.0
google-genai>=1.52.0
pillow>=10.4.0License
MIT
Sources
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/michaeljabbour/imagen-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server