Nanobanana
A security-hardened MCP server for generating and editing images using Google Gemini models. It provides tools for text-to-image creation and iterative image editing with strict input validation and secure file handling.
What is Nanobanana?
Nanobanana is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to security-hardened mcp server for generating and editing images using google gemini models. it provides tools for text-to-image creation and iterative image editing with strict input validation and sec...
A security-hardened MCP server for generating and editing images using Google Gemini models. It provides tools for text-to-image creation and iterative image editing with strict input validation and secure file handling.
This server falls under the APIs category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A security-hardened MCP server for generating and editing im
Use Cases
Maintainer
Works with
Installation
NPM
npx -y nanobanana-mcp-serverPIP
pip install nanobanana-mcp-serverManual Installation
npx -y nanobanana-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Nanobanana
Nanobanana MCP Server is a security-hardened MCP server that gives AI clients the ability to generate and edit images using Google's Gemini image generation models. It exposes three tools — generate_image, edit_image, and upload_file — with strict input validation and sandboxed file handling to prevent path traversal and injection attacks. Developers use it to add text-to-image and iterative image editing capabilities to Claude Desktop or any MCP-compatible client, with support for multiple Gemini model tiers (nano, pro, flash) and configurable aspect ratios.
Prerequisites
- Python 3.10+ with pip or uv installed
- A Google Gemini API key (obtain at https://aistudio.google.com/app/apikey)
- An MCP-compatible AI client such as Claude Desktop
- Optional: A Google Cloud project with Vertex AI enabled (for Vertex AI authentication instead of API key)
Install the nanobanana-mcp-server package
Install via pip or uvx. The uvx method is recommended as it manages a virtual environment automatically.
# Recommended (uvx)
uvx nanobanana-mcp-server@latest
# Or via pip
pip install nanobanana-mcp-serverObtain a Gemini API key
Go to https://aistudio.google.com/app/apikey, sign in with a Google account, and create a new API key. Copy the key — you will need it in the next step.
Configure your MCP client with the API key
Add the server to your claude_desktop_config.json. The GEMINI_API_KEY environment variable is required for API key authentication.
{
"mcpServers": {
"nanobanana": {
"command": "uvx",
"args": ["nanobanana-mcp-server@latest"],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
}Configure output directory (optional)
By default, generated images are saved to ~/nanobanana-images. Set IMAGE_OUTPUT_DIR to use a different location.
{
"mcpServers": {
"nanobanana": {
"command": "uvx",
"args": ["nanobanana-mcp-server@latest"],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here",
"IMAGE_OUTPUT_DIR": "/Users/you/Desktop/ai-images"
}
}
}
}Generate your first image
Ask your AI client to generate an image. The server supports three model tiers: nb2 (fast/cheap), flash, and pro (highest quality, supports thinking_level parameter).
Nanobanana Examples
Client configuration (Claude Desktop)
Complete claude_desktop_config.json block for nanobanana with API key authentication.
{
"mcpServers": {
"nanobanana": {
"command": "uvx",
"args": ["nanobanana-mcp-server@latest"],
"env": {
"GEMINI_API_KEY": "AIza...",
"NANOBANANA_AUTH_METHOD": "api_key",
"IMAGE_OUTPUT_DIR": "~/nanobanana-images"
}
}
}
}Prompts to try
Example prompts that use the generate_image, edit_image, and aspect ratio features.
- "Generate a professional product photo on a white background using the pro model"
- "Create a 16:9 banner image of a mountain sunset for a website header"
- "Generate 4 variations of a logo concept for a coffee shop called 'The Morning Brew'"
- "Edit the image at ~/nanobanana-images/draft.png to add dramatic lighting"
- "Create a cinematic scene of three characters in a standoff at dusk with thinking level HIGH"Troubleshooting Nanobanana
API key error: 'GEMINI_API_KEY not set' or 'API key not valid'
Verify the GEMINI_API_KEY environment variable is set correctly in your MCP client config. Keys from Google AI Studio should start with 'AIza'. If using Vertex AI instead, set NANOBANANA_AUTH_METHOD=vertex_ai and provide GCP_PROJECT_ID and GCP_REGION — do not set GEMINI_API_KEY in this mode.
Images are not saved or cannot be found after generation
Check the IMAGE_OUTPUT_DIR value in your config. By default, images go to ~/nanobanana-images — make sure this directory exists or specify a path you have write access to. The server should create the directory automatically, but on some systems you may need to create it manually: mkdir -p ~/nanobanana-images.
Generation is slow or times out when using the pro model with thinking_level HIGH
The Gemini Pro model with high thinking level can take 30-60 seconds per image. This is expected behavior. Increase your MCP client's timeout setting if it cuts off the request. For faster results, switch to model_tier='nb2' or 'flash'.
Frequently Asked Questions about Nanobanana
What is Nanobanana?
Nanobanana is a Model Context Protocol (MCP) server that security-hardened mcp server for generating and editing images using google gemini models. it provides tools for text-to-image creation and iterative image editing with strict input validation and secure file handling. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Nanobanana?
Install via npm with the command: npx -y nanobanana-mcp-server. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with Nanobanana?
Nanobanana works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Nanobanana free to use?
Yes, Nanobanana is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
Nanobanana Alternatives — Similar APIs Servers
Looking for alternatives to Nanobanana? Here are other popular apis servers you can use with Claude, Cursor, and VS Code.
Kong
★ 43.4k🦍 The API and AI Gateway
API Mega List
★ 5.4kThis GitHub repo is a powerhouse collection of APIs you can start using immediately to build everything from simple automations to full-scale applications. One of the most valuable API lists on GitHub—period. 💪
Fetch
★ 5.4kFetch web content and convert to markdown for AI consumption
Fusio
★ 2.1kSelf-Hosted API Management for Builders
Korean Law
★ 1.8k국가법령정보MCP v4.0 | 법제처 41개 API → 17개 MCP 도구. 법령·판례·조례 검색 + LLM 환각 방지 인용검증 + 조문 영향 그래프(impact_map) + 시점 비교 자동 diff(time_travel) + 시민 5단계 실행 가이드(action_plan) | 41 Korean legal APIs → 17 MCP tools
RuleGo
★ 1.5k⛓️RuleGo is a lightweight, high-performance, embedded, next-generation component orchestration rule engine framework for Go.
Browse More APIs MCP Servers
Explore all apis servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Nanobanana in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Nanobanana?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.