nanobanana-mcp
Provides tools for generating and editing images using Google Gemini models, including support for text-to-image prompts, reference images, and session-based iterative editing.
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., "@nanobanana-mcpGenerate a high-quality photo of a cozy cabin in a snowy forest at sunset"
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.
nanobanana-mcp
A hardened MCP server for Gemini image generation. Fork of ConechoAI/Nano-Banana-MCP with security fixes, strict TypeScript, and model selection.
Features
3 tools:
generate_image,edit_image,continue_editingModel selection via
NANOBANANA_MODELenv var with whitelist validationSecurity hardened: path traversal protection, file size limits, no plaintext key storage
Strict TypeScript: zero
anytypes, Zod validation on all inputs
Related MCP server: Nano-Banana MCP Server
Quick Start
Claude Code
Add to ~/.claude/settings.json:
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": ["tsx", "/path/to/nanobanana-mcp/src/index.ts"],
"env": {
"GEMINI_API_KEY": "your-api-key",
"NANOBANANA_MODEL": "gemini-2.5-flash-image"
}
}
}
}Other MCP Clients
GEMINI_API_KEY=your-key npx tsx src/index.tsThe server communicates over stdio using the MCP protocol.
Tools
generate_image
Generate a new image from a text prompt.
prompt (required): Text describing the image to create (max 10,000 chars)edit_image
Edit an existing image with a text prompt.
imagePath (required): Full file path to the image to edit
prompt (required): Text describing the modifications (max 10,000 chars)
referenceImages (optional): Array of file paths to reference imagescontinue_editing
Continue editing the last generated/edited image in the current session.
prompt (required): Text describing changes to make (max 10,000 chars)
referenceImages (optional): Array of file paths to reference imagesConfiguration
All configuration is via environment variables. No config files are written to disk.
Variable | Required | Description |
| Yes | Google Gemini API key |
| No | Override for |
| No | Model to use (see below) |
Available Models
Model ID | Description |
| Fast generation, good for high-volume use (default) |
| Pro quality, complex prompts, better text rendering |
| Latest model, advanced features |
Output
Generated images are saved to ~/nanobanana-images/ with unique filenames. The tool response includes both the file path and the image data inline.
Security
This fork addresses the following security issues from the original:
Issue | Fix |
API key saved to disk in plaintext | Removed config file persistence entirely |
| Tool removed; keys only via env vars |
Path traversal in |
|
No prompt length validation | Capped at 10,000 chars via Zod |
Hardcoded model |
|
Silent swallowing of reference image errors | Errors now thrown and reported |
|
|
No file size limit on reads | Max 20MB |
Verbose errors leak internal paths | Sanitized error messages |
| Fixed to |
Development
npm install
npm run typecheck # Type check without emitting
npm run dev # Run with tsx (hot reload)
npm run build # Compile to dist/Project Structure
src/
index.ts # MCP server entry point (3 tool handlers)
gemini-client.ts # Gemini API wrapper with model selection
file-handler.ts # Secure file I/O with path validation
types.ts # TypeScript interfaces and Zod schemasLicense
MIT - Based on ConechoAI/Nano-Banana-MCP
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityDmaintenanceAn MCP server that enables AI image generation, editing, and analysis using Google's Gemini 3.0 models. It supports high-resolution outputs up to 4K, style transfers, and multi-image mixing through specialized tools.3
- AlicenseAqualityDmaintenanceAn MCP server that provides AI image generation and editing capabilities using Google's Gemini 2.5 Flash Image API. It allows users to create new images from text, modify existing files, and perform iterative edits through natural language prompts.6543MIT
- AlicenseAqualityCmaintenanceA privacy-conscious MCP server that enables image analysis via Google Gemini with safety features like two-step confirmation and SSRF defenses.2MIT
- AlicenseAqualityDmaintenanceMCP server for Google Gemini image generation with configurable model support, enabling text-to-image generation, image editing, and iterative refinement.639MIT
Related MCP Connectors
MCP server for Google Veo AI video generation
MCP server for Grok Imagine AI video generation
MCP server for NanoBanana AI image generation and editing
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/DojoCodingLabs/nanobanana-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server