A production-ready MCP server for AI-powered image generation using Gemini 3 Pro Image and Gemini 2.5 Flash Image with intelligent model selection
Project description
Banana Image MCP Server
A production-ready Model Context Protocol (MCP) server that provides AI-powered image generation capabilities through Google's Gemini models with intelligent model selection.
Features
- Multi-Model AI Image Generation: Intelligent selection between Flash (speed) and Pro (quality) models
- Gemini 2.5 Flash Image: Fast generation (1024px) for rapid prototyping
- Gemini 3 Pro Image: High-quality up to 4K with Google Search grounding
- Smart Model Selection: Automatically chooses optimal model based on your prompt
- Aspect Ratio Control: Specify output dimensions (1:1, 16:9, 9:16, 21:9, and more)
- Smart Templates: Pre-built prompt templates for photography, design, and editing
- File Management: Upload and manage files via Gemini Files API
- Resource Discovery: Browse templates and file metadata through MCP resources
- Production Ready: Comprehensive error handling, logging, and validation
- High Performance: Optimized architecture with intelligent caching
Quick Start
Prerequisites
- Google Gemini API Key - Get one free here
- Python 3.11+ (for development only)
Installation
Using uvx (Recommended):
uvx banana-image-mcp
Using pip:
pip install banana-image-mcp
Configuration
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"banana-image": {
"command": "uvx",
"args": ["banana-image-mcp"],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
}
Configuration file locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Claude Code (VS Code Extension)
Install and configure in VS Code:
- Install the Claude Code extension
- Open Command Palette (
Cmd/Ctrl + Shift + P) - Run "Claude Code: Add MCP Server"
- Configure:
{ "name": "banana-image", "command": "uvx", "args": ["banana-image-mcp"], "env": { "GEMINI_API_KEY": "your-gemini-api-key-here" } }
Cursor
Add to Cursor's MCP configuration:
{
"mcpServers": {
"banana-image": {
"command": "uvx",
"args": ["banana-image-mcp"],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
}
Model Selection
Banana Image MCP supports two Gemini models with intelligent automatic selection:
Pro Model (Gemini 3 Pro Image)
- Quality: Professional-grade, production-ready
- Resolution: Up to 4K (3840px)
- Speed: ~5-8 seconds per image
- Special Features:
- Google Search Grounding for accurate, contextual images
- Advanced Reasoning with configurable thinking levels
- Superior Text Rendering
- Best for: Production assets, marketing materials, professional photography
Flash Model (Gemini 2.5 Flash Image)
- Speed: Very fast (2-3 seconds)
- Resolution: Up to 1024px
- Quality: High quality for everyday use
- Best for: Rapid prototyping, iterations, drafts, sketches
Automatic Selection (Recommended)
By default, the server uses AUTO mode which intelligently analyzes your prompt:
Pro Model Selected When:
- Quality keywords: "4K", "professional", "production", "high-res"
- High resolution requested:
resolution="4k" - Google Search grounding enabled
- High thinking level requested
Flash Model Selected When:
- Speed keywords: "quick", "draft", "sketch", "rapid"
- High-volume batch generation
- Standard resolution requested
Usage Examples
# Automatic selection (recommended)
"Generate a professional 4K product photo" # Pro model
"Quick sketch of a cat" # Flash model
# Explicit model selection
generate_image(
prompt="A scenic landscape",
model_tier="flash" # Force Flash model
)
# Pro model with all features
generate_image(
prompt="Professional product photo",
model_tier="pro",
resolution="4k",
thinking_level="HIGH",
enable_grounding=True
)
# Aspect ratio control
generate_image(
prompt="Cinematic landscape",
aspect_ratio="21:9" # Ultra-wide format
)
Aspect Ratio Control
Supported aspect ratios:
1:1- Square (Instagram, profile pictures)4:3- Classic photo format3:4- Portrait orientation16:9- Widescreen (YouTube thumbnails)9:16- Mobile portrait (phone wallpapers)21:9- Ultra-wide cinematic2:3,3:2,4:5,5:4- Various photo formats
Environment Variables
# Required
GEMINI_API_KEY=your-gemini-api-key-here
# Model Selection (optional)
BANANA_IMAGE_MODEL=auto # Options: flash, pro, auto (default: auto)
# Optional
IMAGE_OUTPUT_DIR=/path/to/image/directory # Default: ~/banana-images
LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERROR
Development
# Clone repository
git clone https://github.com/zengwenliang416/banana-image-mcp.git
cd banana-image-mcp
# Install with uv
uv sync
# Set environment
export GEMINI_API_KEY=your-api-key-here
# Run locally
uv run python -m banana_image_mcp.server
License
MIT License - see LICENSE for details.
Support
- Issues: GitHub Issues
- Author: Wenliang Zeng
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file banana_image_mcp-0.1.1.tar.gz.
File metadata
- Download URL: banana_image_mcp-0.1.1.tar.gz
- Upload date:
- Size: 183.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad833a25b76c898d259d4b4f583162eb793002981fe7669e64e301d897b86a75
|
|
| MD5 |
7c658b9e7a883370bc2cd1588af32a0d
|
|
| BLAKE2b-256 |
a55efb0c8e76bfc3f9e1b65446c5b117717aa234bff6d38cf78b1b52f98aff05
|
File details
Details for the file banana_image_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: banana_image_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 80.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb3049305be35b09a1d0887919f387960df1cf46e1da81f01e77f7473a556fca
|
|
| MD5 |
56c52324ef0c4b42d0725d891221bc2d
|
|
| BLAKE2b-256 |
ce6ec05dbe9137a6613c07941d0313285d56a3fc301640e907b1bcb528eed2a0
|