nano-banana-mcp-g3
v2.1.0
Published
MCP server for Google's Gemini 3 Pro Image generation API with 4K output, aspect ratio control, Google Search grounding, conversational editing, and image description/analysis
Maintainers
Readme
Nano-Banana MCP (Gemini 3 Pro Image)
A Model Context Protocol (MCP) server for AI image generation and editing using Google's Gemini 3 Pro Image model. Supports 4K output, aspect ratio control, Google Search grounding, and conversational multi-turn editing with thought signatures.
Fork of ConechoAI/Nano-Banana-MCP, upgraded from Gemini 2.5 Flash to Gemini 3 Pro Image.
Features
- Generate images from text prompts with configurable aspect ratio and resolution (up to 4K)
- Edit existing images by providing a file path and edit instructions
- Conversational editing — multi-turn editing that preserves full context via Gemini 3 thought signatures
- Google Search grounding — generate fact-based images using real-time web data
- Cross-platform file management (macOS, Linux, Windows)
Quick Setup
Claude Code
claude mcp add nano-banana \
-e GEMINI_API_KEY=your-api-key \
-- npx -y nano-banana-mcp-g3Manual (Claude Code / Cursor / other MCP clients)
Add to your MCP configuration:
{
"nano-banana": {
"type": "stdio",
"command": "npx",
"args": ["-y", "nano-banana-mcp-g3"],
"env": {
"GEMINI_API_KEY": "your-api-key"
}
}
}Restart your client after saving.
Package name:
nano-banana-mcp-g3(notnano-banana-mcp). The originalnano-banana-mcpon npm is the upstream version using the older Gemini 2.5 model.
Available Tools
| Tool | Description |
|------|-------------|
| generate_image | Create a new image from a text prompt |
| edit_image | Modify an existing image file with a text prompt |
| continue_editing | Iterate on the last image (preserves context via thought signatures) |
| get_last_image_info | Show file path and info for the last image |
| configure_gemini_token | Set your Gemini API key |
| get_configuration_status | Check if the API key is configured |
Generation Parameters
These optional parameters work with generate_image, edit_image, and continue_editing:
| Parameter | Values | Description |
|-----------|--------|-------------|
| aspectRatio | 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9 | Output aspect ratio. Default is model-chosen. |
| imageSize | 1K, 2K, 4K | Output resolution. Default is 1K. |
| useGoogleSearch | true / false | Enable Google Search grounding for fact-based images (generate_image only). |
Usage Examples
Ask your AI assistant naturally:
- "Generate an image of a sunset over mountains"
- "Generate a 16:9 widescreen banner for a tech blog in 2K resolution"
- "Generate an infographic of today's weather in Tokyo" (uses Google Search grounding)
- "Edit this image to add a rainbow" (provide file path)
- "Make the background darker" (continues editing the last image)
- "Now change the text to be gold colored" (multi-turn editing with context)
Conversational Editing
The continue_editing tool uses Gemini 3's thought signatures to maintain full context between turns. The model truly "remembers" the previous image — it doesn't just re-read the file. This enables coherent multi-turn editing:
Turn 1: "Generate a logo for Morning Ritual coffee shop"
Turn 2: "Make it dark background with gold text" <- remembers the logo
Turn 3: "Add a coffee bean pattern in the background" <- remembers logo + dark/gold schemeGenerated images are saved to ./generated_imgs/ in your current working directory.
Configuration Priority
The API key is loaded in this order:
- MCP config environment variables — set via
"env": { "GEMINI_API_KEY": "..." }in your MCP config - System environment variables —
export GEMINI_API_KEY="..." - Local config file — created via the
configure_gemini_tokentool (stored as.nano-banana-config.json)
Proxy Support
If you need to route requests through a proxy (e.g., for geo-restricted regions), set the GOOGLE_GEMINI_BASE_URL environment variable:
{
"nano-banana": {
"type": "stdio",
"command": "npx",
"args": ["-y", "nano-banana-mcp-g3"],
"env": {
"GEMINI_API_KEY": "your-api-key",
"GOOGLE_GEMINI_BASE_URL": "https://your-proxy-url.example.com"
}
}
}The @google/genai SDK reads this env var and routes all API calls through the specified URL.
Development
git clone https://github.com/mascotbot/nano-banana-mcp.git
cd nano-banana-mcp
npm install
npm run dev # Development mode
npm run build # Production build
npm run typecheckTech Stack
- TypeScript, Node.js >= 20
@google/genaiSDK (^1.41.0) — Gemini 3 Pro Image@modelcontextprotocol/sdk— MCP protocol- Zod — schema validation
Requirements
- Node.js 20.0.0 or higher
- Gemini API key from Google AI Studio
- Compatible with Claude Code, Cursor, and other MCP clients
License
MIT
