Nano Banana MCP Server
Enables AI image generation, editing, and composition using Google's Gemini image models (Nano Banana Pro and Nano Banana). Supports text-to-image generation, multi-image composition, flexible aspect ratios, high-resolution output up to 4K, and real-time information grounding.
README
Nano Banana MCP Server
An MCP (Model Context Protocol) server for Google's Nano Banana Pro (Gemini 3 Pro Image) and Nano Banana (Gemini 2.5 Flash Image) AI image generation models.
Features
- 🎨 Text-to-Image Generation - Create images from natural language descriptions
- ✏️ Image Editing - Modify existing images with text prompts
- 🖼️ Multi-Image Composition - Combine up to 14 reference images
- 📐 Flexible Aspect Ratios - 10 aspect ratio options (1:1, 16:9, 9:16, etc.)
- 🔍 High Resolution - Up to 4K output with Nano Banana Pro
- 🔤 Text Rendering - Generate images with accurate, legible text
- 🌐 Google Search Grounding - Real-time information for current events/weather
Prerequisites
- Node.js 18 or higher
- Google AI API key from Google AI Studio
Installation
From Source
# Clone or download this directory
cd nanobanana-mcp-server
# Install dependencies
npm install
# Build the TypeScript
npm run build
Configuration
Set your API key as an environment variable:
# Linux/macOS
export GEMINI_API_KEY="your-api-key-here"
# Windows (PowerShell)
$env:GEMINI_API_KEY="your-api-key-here"
# Windows (CMD)
set GEMINI_API_KEY=your-api-key-here
Usage
As stdio Server (for Claude Desktop, etc.)
npm start
Or directly:
node dist/index.js
As HTTP Server
TRANSPORT=http PORT=3000 npm start
The server will listen at http://localhost:3000/mcp.
Claude Desktop Configuration
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"nanobanana": {
"command": "node",
"args": ["/path/to/nanobanana-mcp-server/dist/index.js"],
"env": {
"GEMINI_API_KEY": "your-api-key-here"
}
}
}
}
Available Tools
nanobanana_generate_image
Generate images from text descriptions.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
prompt |
string | Yes | Text description of the image |
model |
string | No | Model ID (default: gemini-3-pro-image-preview) |
aspect_ratio |
string | No | Aspect ratio (e.g., 1:1, 16:9) |
resolution |
string | No | Resolution: 1K, 2K, 4K (Pro only) |
use_google_search |
boolean | No | Enable real-time info grounding (Pro only) |
Example:
{
"prompt": "A photorealistic portrait of an astronaut on Mars at sunset, dramatic lighting, 85mm lens",
"model": "gemini-3-pro-image-preview",
"aspect_ratio": "16:9",
"resolution": "4K"
}
nanobanana_edit_image
Edit an existing image using text prompts.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
prompt |
string | Yes | Description of the edit |
image_base64 |
string | Yes | Base64-encoded image data |
image_mime_type |
string | Yes | MIME type (e.g., image/png) |
model |
string | No | Model ID |
aspect_ratio |
string | No | Output aspect ratio |
resolution |
string | No | Output resolution (Pro only) |
Example:
{
"prompt": "Add a wizard hat to the cat",
"image_base64": "<base64-image-data>",
"image_mime_type": "image/png"
}
nanobanana_compose_images
Compose images using multiple reference images (Nano Banana Pro only).
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
prompt |
string | Yes | Description of composition |
images |
array | Yes | Array of {base64, mime_type} objects (max 14) |
aspect_ratio |
string | No | Output aspect ratio |
resolution |
string | No | Output resolution |
Example:
{
"prompt": "Create a group photo of these 5 people at a beach party",
"images": [
{"base64": "<image1>", "mime_type": "image/jpeg"},
{"base64": "<image2>", "mime_type": "image/jpeg"}
],
"aspect_ratio": "16:9",
"resolution": "2K"
}
nanobanana_list_models
List available models and their capabilities.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
response_format |
string | No | markdown (default) or json |
Models
Nano Banana Pro (gemini-3-pro-image-preview)
Google's most advanced image generation model. Best for:
- Professional asset production
- Images with accurate text rendering
- Complex compositions
- High-resolution output (up to 4K)
- Real-time information grounding
Nano Banana (gemini-2.5-flash-image)
Fast, low-latency image generation. Best for:
- Quick experimentation
- Batch processing
- Iterative design
- Cost-effective generation
Aspect Ratios
| Ratio | Use Case |
|---|---|
1:1 |
Square, social media posts |
16:9 |
Landscape, presentations, YouTube thumbnails |
9:16 |
Portrait, mobile screens, Stories |
4:3 |
Classic photo format |
3:2 |
DSLR photo format |
21:9 |
Ultra-wide, cinematic |
Tips for Best Results
Prompting
- Be Descriptive: Include details about style, lighting, composition, colors, and mood
- Use Photography Terms: For photorealistic images, mention camera angles, lens types, lighting setups
- Specify Style: "Oil painting", "3D render", "watercolor", "photorealistic", etc.
- Include Context: Describe the environment, atmosphere, and mood
Example Prompts
Photorealistic:
A photorealistic close-up portrait of an elderly Japanese ceramicist with
deep wrinkles and a warm smile, inspecting a glazed tea bowl. Soft golden
hour light from a window. Shot with 85mm portrait lens, bokeh background.
Stylized:
A kawaii-style sticker of a happy red panda wearing a bamboo hat, munching
on a leaf. Bold outlines, cel-shading, vibrant colors. White background.
Logo:
Create a modern, minimalist logo for a coffee shop called 'The Daily Grind'.
Clean, bold sans-serif font. Black and white. Circular design with a clever
coffee bean element.
Error Handling
Common errors and solutions:
| Error | Solution |
|---|---|
| "GEMINI_API_KEY is required" | Set the environment variable |
| Rate limit exceeded | Wait and retry, or reduce request frequency |
| Content policy violation | Modify prompt to comply with Google's policies |
| Invalid image format | Use supported formats: PNG, JPEG, GIF, WebP |
Development
# Install dependencies
npm install
# Build TypeScript
npm run build
# Watch mode for development
npm run dev
License
MIT
Links
- Google AI Studio - Get your API key
- Gemini API Docs - Official documentation
- MCP Protocol - Learn about MCP
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。