Nano-Banana Pro MCP Server
Uses Google's Gemini 3 Pro Image API to generate new images from text prompts and edit existing images, including iterative edits and optional reference images.
Click on "Deploy 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., "@Nano-Banana Pro MCP Server Generate an image of a sunset over snowy mountains"
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.
Nano-Banana MCP Server π
π€ This project was entirely generated by Claude Code - an AI coding assistant that can create complete, production-ready applications from scratch.
A Model Context Protocol (MCP) server that provides AI image generation and editing capabilities using Google's Gemini 3 Pro Image API. Generate stunning images, edit existing ones, and iterate on your creations with simple text prompts.
π One-Line Install for Claude Code
npx nano-banana-pro-mcp install --key YOUR_GEMINI_API_KEYThat's it! Restart Claude Code and start generating images.
Uninstall: npx nano-banana-pro-mcp uninstall
Related MCP server: nano-banana-mcpv2
β¨ Features
π¨ Generate Images: Create new images from text descriptions
βοΈ Edit Images: Modify existing images with text prompts
π Iterative Editing: Continue editing the last generated/edited image
πΌοΈ Multiple Reference Images: Use reference images for style transfer and guidance
π Cross-Platform: Smart file paths for Windows, macOS, and Linux
π§ Easy Setup: Simple configuration with API key
π Auto File Management: Automatic image saving with organized naming
π Setup
Get your Gemini API key:
Visit Google AI Studio
Create a new API key
Copy it for configuration
Configure the MCP server: See configuration examples for your specific client below (Claude Code, Cursor, or other MCP clients).
π» Usage with Claude Code
Configuration:
Add this to your Claude Code MCP settings:
Option A: With environment variable (Recommended - Most Secure)
{
"mcpServers": {
"nano-banana-pro": {
"command": "npx",
"args": ["-y", "nano-banana-pro-mcp"],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
}Option B: Without environment variable
{
"mcpServers": {
"nano-banana-pro": {
"command": "npx",
"args": ["-y", "nano-banana-pro-mcp"]
}
}
}Usage Examples:
Generate an image of a sunset over mountainsEdit this image to add some birds in the skyContinue editing to make it more dramaticπ― Usage with Cursor
Configuration:
Add to your Cursor MCP configuration:
Option A: With environment variable (Recommended)
{
"nano-banana-pro": {
"command": "npx",
"args": ["-y", "nano-banana-pro-mcp"],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}Option B: Without environment variable
{
"nano-banana-pro": {
"command": "npx",
"args": ["-y", "nano-banana-pro-mcp"]
}
}Usage Examples:
Ask Cursor to generate images for your app
Create mockups and prototypes
Generate assets for your projects
π§ For Other MCP Clients
If you're using a different MCP client, you can configure nano-banana-pro-mcp using any of these methods:
Configuration Methods
Method A: Environment Variable in MCP Config (Recommended)
{
"nano-banana-pro": {
"command": "npx",
"args": ["-y", "nano-banana-pro-mcp"],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}Method B: System Environment Variable
export GEMINI_API_KEY="your-gemini-api-key-here"
npx nano-banana-pro-mcpMethod C: Using the Configure Tool
npx nano-banana-pro-mcp
# The server will prompt you to configure when first used
# This creates a local .nano-banana-config.json fileπ οΈ Available Commands
generate_image
Create a new image from a text prompt.
generate_image({
prompt: "A futuristic city at night with neon lights"
})edit_image
Edit a specific image file.
edit_image({
imagePath: "/path/to/image.png",
prompt: "Add a rainbow in the sky",
referenceImages?: ["/path/to/reference.jpg"] // optional
})continue_editing
Continue editing the last generated/edited image.
continue_editing({
prompt: "Make it more colorful",
referenceImages?: ["/path/to/style.jpg"] // optional
})get_last_image_info
Get information about the last generated image.
get_last_image_info()configure_gemini_token
Configure your Gemini API key.
configure_gemini_token({
apiKey: "your-gemini-api-key"
})get_configuration_status
Check if the API key is configured.
get_configuration_status()βοΈ Configuration Priority
The MCP server loads your API key in the following priority order:
π₯ MCP Configuration Environment Variables (Highest Priority)
Set in your
claude_desktop_config.jsonor MCP client configMost secure as it's contained within the MCP configuration
Example:
"env": { "GEMINI_API_KEY": "your-key" }
π₯ System Environment Variables
Set in your shell/system environment
Example:
export GEMINI_API_KEY="your-key"
π₯ Local Configuration File (Lowest Priority)
Created when using the
configure_gemini_tokentoolStored as
.nano-banana-config.jsonin current directoryAutomatically ignored by Git and NPM
π‘ Recommendation: Use Method 1 (MCP config env variables) for the best security and convenience.
π File Storage - Smart Path Resolution π§
Nano-Banana now features Smart Path Resolution to ensure images are saved correctly in any environment. It checks locations in this priority:
Environment Variable (
NANO_BANANA_OUTPUT_DIR) - Highest PriorityCurrent Working Directory (
cwd) - If writable and non-system path (enables "Save to Project")Documents Folder (
~/Documents/nano-banana-images) - Desktop defaultHome Directory (
~/nano-banana-images) - Server fallbackTemp Directory - Fail-safe
π§ Configuration for "Save to Project"
To have images saved directly to your project folder, add the cwd (Current Working Directory) setting to your MCP configuration:
"nano-banana": {
"command": "node",
"args": ["/path/to/dist/index.js"],
"cwd": "${workspaceFolder}",
"env": { ... }
}π³οΈ Overriding Output Directory
You can force a specific output directory by setting the NANO_BANANA_OUTPUT_DIR environment variable:
"env": {
"GEMINI_API_KEY": "...",
"NANO_BANANA_OUTPUT_DIR": "/Users/me/Desktop/my-images"
}File naming convention:
Generated images:
generated-[timestamp]-[id].pngEdited images:
edited-[timestamp]-[id].png
π¨ Example Workflows
Basic Image Generation
generate_image- Create your base imagecontinue_editing- Refine and improvecontinue_editing- Add final touches
Style Transfer
generate_image- Create base contentedit_image- Use reference images for stylecontinue_editing- Fine-tune the result
Iterative Design
generate_image- Start with a conceptget_last_image_info- Check current statecontinue_editing- Make adjustmentsRepeat until satisfied
π§ Development
This project was created with Claude Code and follows these technologies:
TypeScript - Type-safe development
Node.js - Runtime environment
Zod - Schema validation
Google GenAI - Image generation API
MCP SDK - Model Context Protocol
Local Development
# Clone the repository
git clone https://github.com/claude-code/nano-banana-mcp.git
cd nano-banana-mcp
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build for production
npm run build
# Run tests
npm testπ Requirements
Node.js 18.0.0 or higher
Gemini API key from Google AI Studio
Compatible with Claude Code, Cursor, and other MCP clients
π€ Contributing
This project was generated by Claude Code, but contributions are welcome! Please feel free to:
Report bugs
Suggest new features
Submit pull requests
Improve documentation
π License
MIT License - see LICENSE file for details.
π Acknowledgments
Claude Code - For generating this entire project
Google AI - For the powerful Gemini 3 Pro Image API
Anthropic - For the Model Context Protocol
Open Source Community - For the amazing tools and libraries
π Support
π Issues: GitHub Issues
π Documentation: This README and inline code comments
π¬ Discussions: GitHub Discussions
β¨ Generated with love by Claude Code - The future of AI-powered development is here!
Available Tools
6 toolsconfigure_gemini_tokenA
Configure your Gemini API token for nano-banana image generation
Inputs: apiKey (required).
continue_editingA
Continue editing the LAST image that was generated or edited in this session, optionally using additional reference images. Use this for iterative improvements, modifications, or changes to the most recent image. This automatically uses the previous image without needing a file path.
Inputs: prompt (required), referenceImages.
edit_imageA
Edit a SPECIFIC existing image file, optionally using additional reference images. Use this when you have the exact file path of an image to modify.
Inputs: prompt (required), imagePath (required), referenceImages.
generate_imageA
Generate a NEW image from text prompt. Use this ONLY when creating a completely new image, not when modifying an existing one.
Inputs: prompt (required).
get_configuration_statusA
Check if Gemini API token is configured
Inputs: no named parameters.
get_last_image_infoA
Get information about the last generated/edited image in this session (file path, size, etc.). Use this to check what image is currently available for continue_editing.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 6 tools
Each tool targets a distinct action in the image workflow: token setup, token status, new image generation, editing a known file path, iterating on the last session image, and inspecting that last image. The descriptions explicitly draw the boundaries (e.g. generate_image says 'ONLY when creating a completely new image', edit_image requires an exact file path, continue_editing uses the previous image automatically), leaving little room for misselection.
All names are snake_case with a verb-first pattern (configure_, generate_, edit_, get_, continue_), which is predictable throughout. The only minor deviation is the gerund form 'continue_editing' versus the noun-object pattern of the others, but it remains readable and idiomatic.
Six tools is a tight, well-scoped set for an image generation/editing server; every tool maps to a necessary operation (auth, config check, create, edit, iterate, inspect). There is no visible redundancy or filler.
The surface covers the core lifecycle: configure auth, verify config, generate, edit by path, iterate on the last result, and inspect that result. Minor gaps existβno way to list or browse previously generated images, choose explicit output destinations, or clean up filesβbut agents can work around these with normal filesystem access.
Maintenance
Related MCP Connectors
Generate, edit and upscale images with references, batch jobs, cost previews and original downloads.
Generate and edit realistic images from a prompt. Returns the image and a download link.
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
Generate and edit images, video, voiceovers, music and sound effects from chat.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables generating, editing, and manipulating images using Google Gemini Flash 2.5 through natural language prompts. Supports text-to-image generation, image editing, multi-image composition, and batch processing with direct file management.4MIT
- AlicenseAqualityCmaintenanceEnables AI image generation and editing using Google's Gemini Multimodal Image APIs.61MIT
- AlicenseAqualityCmaintenanceEnables AI image generation and editing using Google's Gemini models via natural language, supporting multi-turn editing, search grounding, storyboards, icon sets, and video-to-image.516 npm1MIT
- AlicenseAqualityDmaintenanceEnables AI-powered image generation and editing using Google Gemini models, with support for transparency, reference images, and flexible output sizes.2MIT