Nano Banana MCP Server
Enables 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.
README
Nano Banana MCP Server

Nano Banana is an MCP server that exposes Google Gemini Flash 2.5 Image Generation via a clean, focused interface. It is not a general multi‑model server — it is a thin wrapper around Gemini Flash 2.5 image generation only.
✨ What It Does
Generate, edit, and manipulate images using natural language via any MCP‑compatible client.
🚀 Compatible Tools
Works with any MCP‑compatible client. Below we document Gemini CLI (recommended) and a minimal generic MCP configuration.
Features
🎨 Image Generation (Powered by Gemini Flash 2.5)
- Text-to-Image Generation: Create images from text descriptions
- Image Editing: Modify existing images with text prompts
- Multi-Image Composition: Combine multiple images or transfer styles
- Batch Generation: Generate multiple variations at once
🛠️ Image Manipulation (Powered by Sharp)
- Combine Images: Stitch images into panoramas, grids, or strips
- Transform Images: Resize, crop, rotate, flip, and flop
- Adjust Images: Blur, sharpen, grayscale, tint, brightness, saturation
- Composite Images: Layer images with blend modes and positioning
- Batch Processing: Apply operations to entire directories
🔧 Developer Features
- Smart Path Handling: Automatically creates directories and handles file paths
- Image Validation: Verify generated images are valid and meet size requirements
- Comprehensive Error Handling: Clear feedback on API errors, quota issues, and failures
- MCP Protocol: Works with any MCP-compatible AI client
🚀 Quick Install (1 Minute!)
Option 1: Global Install (Recommended)
# Install globally
npm install -g @lyalindotcom/nano-banana-mcp
# Run setup wizard
nano-banana setup
Option 2: NPX (No Install)
# Run on demand via NPX (no global install)
# Great for Gemini CLI and generic MCP config
npx -y -p @lyalindotcom/nano-banana-mcp nano-banana --version
Set your API key once in your shell (required):
export GEMINI_API_KEY="your-api-key"
Gemini CLI configuration (~/.gemini/settings.json):
{
"mcpServers": {
"nano-banana": {
"command": "npx",
"args": ["-y", "-p", "@lyalindotcom/nano-banana-mcp", "nano-banana-server"],
"env": { "GEMINI_API_KEY": "${GEMINI_API_KEY}" },
"timeout": 60000,
"trust": true
}
}
}
Generic MCP configuration (for other clients using stdio):
{
"mcpServers": {
"nano-banana": {
"command": "npx",
"args": ["-y", "-p", "@lyalindotcom/nano-banana-mcp", "nano-banana-server"],
"env": { "GEMINI_API_KEY": "${GEMINI_API_KEY}" }
}
}
}
Option 3: From Source
# Clone the repo
git clone https://github.com/LyalinDotCom/nano-banana-mcp.git
cd nano-banana-mcp
# Run the quickstart script - it does EVERYTHING!
./quickstart.sh
# That's it! Start using it:
gemini chat
> "Create a robot holding a banana at ./robot.png"
The quickstart script will:
- ✅ Check Node.js version
- ✅ Install Gemini CLI if needed
- ✅ Build the project
- ✅ Configure your API key
- ✅ Set up Gemini CLI integration
- ✅ Verify everything works
Minimal Setup (from source)
- Configure API key:
cp .env.example .env
# Edit .env with your GEMINI_API_KEY
- Build:
npm run build
- Configure Gemini CLI using the JSON shown above.
Get your API key from: https://aistudio.google.com/apikey
CLI Commands
The Nano Banana CLI provides powerful management tools:
# Interactive setup wizard (configures Gemini CLI integration)
nano-banana setup
# Create .env file with API key (does NOT configure Gemini CLI)
nano-banana init --api-key YOUR_KEY
# Start the MCP server directly (for manual testing)
nano-banana serve
# Check installation status
nano-banana status
# Diagnose any issues
nano-banana doctor
# Safely remove configuration
nano-banana remove
Important: Use setup to configure with Gemini CLI. The init command only creates a .env file.
Usage
Once configured, use with your MCP client of choice. Simply describe what you want:
- "Generate a cyberpunk city at ./city.png"
- "Create 5 potion icons at ./items/potions.png"
- "Add a sunset to ./photo.jpg"
- "Combine these images into a panorama"
🌟 Why Nano Banana?
- 🎨 Full Gemini Flash 2.5 Power: Access the latest image generation capabilities
- 🚀 Natural Language Interface: Just describe what you want
- 🔧 Flexible Integration: Works with Gemini CLI and other MCP clients
- 📁 Direct File Management: Images save exactly where you need them
- 🎯 Smart Context: One tool handles generation, editing, and composition
- ⚡ Batch Operations: Generate up to 10 variations at once
📚 Documentation
This README contains the supported setup paths. Nano Banana targets the Gemini Flash 2.5 image generation model only.
Available Tools
generate_image
Generate, edit, or compose images using Gemini Flash 2.5.
Parameters:
prompt(optional): Text description for generationimages(optional): Array of input images (base64 or file paths)outputPath: Where to save the generated image(s)count(optional): Number of variations to generate (1-10)options(optional): Additional Gemini model options
Examples:
Text-to-image:
{
"prompt": "A cyberpunk city at night with neon lights",
"outputPath": "./assets/backgrounds/city.png"
}
Image editing:
{
"prompt": "Add a rainbow in the sky",
"images": [{ "data": "./photos/landscape.jpg" }],
"outputPath": "./photos/landscape-rainbow.jpg"
}
Batch generation:
{
"prompt": "Fantasy potion bottles, different colors",
"outputPath": "./items/potion.png",
"count": 5
}
validate_image
Check if an image file exists and is valid.
Parameters:
path: File path to validate
Returns:
exists: Whether the file existsvalid: Whether it's a valid imagedimensions: Image width and heightformat: Image format (png, jpeg, etc.)fileSize: File size in byteserror: Error message if validation failed
How It Works
-
Flexible Input: The server intelligently determines the operation mode:
- Text only → Text-to-image generation
- Text + 1 image → Image editing
- Text + multiple images → Composition/style transfer
-
Path Management: Automatically creates directories and handles both absolute and relative paths
-
Batch Support: When
count> 1, generates multiple variations with numbered suffixes -
Validation: Uses Sharp to verify images are properly generated and meet minimum size requirements
-
No Overwrites: The server never overwrites existing files. If the requested
outputPath(or any batch variation path) already exists, the server returns an error and does not write. Choose a new path or remove the file before retrying.
Error Handling
The server provides detailed error information:
INVALID_API_KEY: Authentication failedQUOTA_EXCEEDED: API limits reachedAPI_ERROR: General API failureINVALID_INPUT: Bad parametersFILE_WRITE_ERROR: Cannot save to pathVALIDATION_FAILED: Image corrupt or too smallFILE_EXISTS: Output file already exists; choose a new path
Testing
Run the example test script:
npm run dev examples/test.ts
This will test:
- Basic text-to-image generation
- Image validation
- Batch generation
Project Structure
nano-banana-mcp/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── tools.ts # Tool implementations
│ └── gemini-client.ts # Gemini API wrapper
├── examples/
│ └── test.ts # Example usage
├── .env.example # Environment template
└── README.md # This file
🎮 Real-World Use Cases
Game Development
> Generate a complete set of 16-bit RPG sprites: warrior, mage, archer at ./sprites/
> Create terrain tiles for a top-down game: grass, stone, water at ./tiles/
> Design UI elements: health bars, mana bars, inventory slots at ./ui/
Web Development
> Create a hero section background with gradients at ./public/hero.jpg
> Generate a set of feature icons for my SaaS landing page at ./icons/
> Design social media cards for my blog posts at ./social/
Content Creation
> Generate YouTube thumbnail about "AI Revolution" at ./thumbnails/ai.jpg
> Create Instagram carousel about productivity tips at ./instagram/
> Design presentation diagrams for cloud architecture at ./slides/
🛠️ Requirements
- Node.js 18 or higher
- Gemini API Key with image generation access (Get one here)
- TypeScript 5.0+ (for development)
🔧 Project Status
This is an experimental sample project. While GitHub issues are welcome for bug reports and feedback, this project is not actively seeking contributions and long-term maintenance is not guaranteed at this time.
📄 License
MIT License - see LICENSE file for details
🙏 Acknowledgments
- Built with the Model Context Protocol
- Powered by Gemini Flash 2.5
- Inspired by the amazing MCP community
🔗 Links
<p align="center"> Made with ❤️ and 🍌 by a Nano Banana fan </p>
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。