Package Exports
- google-nanobanana-mcp-server
- google-nanobanana-mcp-server/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (google-nanobanana-mcp-server) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Nano Banana MCP Server
A Model Context Protocol (MCP) server that integrates the powerful Gemini 2.5 Flash Image model for advanced image generation, editing, and manipulation capabilities.
🌟 Features
- 🎨 Image Generation: Create stunning images from text prompts with customizable styles and variations
- ✏️ Image Editing: Modify existing images with natural language instructions
- 🔧 Image Restoration: Restore and enhance old or damaged photos
- 🎯 Icon Generation: Create app icons, favicons, and UI elements in multiple sizes
- 🎨 Pattern & Texture Generation: Generate seamless patterns and textures for backgrounds
- 📖 Story Sequencing: Generate sequential images that tell visual stories or processes
- 📊 Diagram Generation: Create technical diagrams, flowcharts, and architectural mockups
📋 Prerequisites
- Node.js 18+ and npm
- Gemini API Key: Set one of these environment variables:
NANOBANANA_GEMINI_API_KEY(recommended)NANOBANANA_GOOGLE_API_KEYGEMINI_API_KEY(fallback)GOOGLE_API_KEY(fallback)
For API key setup, see the official Gemini API documentation.
📦 Installation
From npm
npm install -g nanobanana-mcpFrom Source
git clone https://github.com/gemini-cli-extensions/nanobanana.git
cd nanobanana/mcp-server
npm install
npm run build
npm install -g .🚀 Usage
Standalone Server
Start the MCP server in stdio mode:
nanobanana-mcpOr with development mode:
npm run devIntegration with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"nanobanana": {
"command": "nanobanana-mcp",
"args": []
}
}
}Available Tools
1. generate_image
Generate single or multiple images from text prompts.
Parameters:
prompt(string, required): The text prompt describing the image to generateoutputCount(number): Number of variations (1-8, default: 1)styles(array): Artistic styles (photorealistic, watercolor, oil-painting, sketch, pixel-art, anime, vintage, modern, abstract, minimalist)variations(array): Variation types (lighting, angle, color-palette, composition, mood, season, time-of-day)format(string): Output format - "grid" or "separate" (default: "separate")seed(number): Seed for reproducible variationspreview(boolean): Automatically open generated images (default: false)
Example:
{
"name": "generate_image",
"arguments": {
"prompt": "sunset over mountains",
"outputCount": 3,
"styles": ["watercolor", "oil-painting"],
"preview": true
}
}2. edit_image
Edit an existing image based on a text prompt.
Parameters:
prompt(string, required): The text prompt describing the edits to makefile(string, required): The filename of the input imagepreview(boolean): Automatically open generated images (default: false)
Example:
{
"name": "edit_image",
"arguments": {
"prompt": "add sunglasses to the person",
"file": "portrait.jpg",
"preview": true
}
}3. restore_image
Restore or enhance an existing image.
Parameters:
prompt(string, required): The text prompt describing the restorationfile(string, required): The filename of the input imagepreview(boolean): Automatically open generated images (default: false)
Example:
{
"name": "restore_image",
"arguments": {
"prompt": "remove scratches and improve clarity",
"file": "old_photo.jpg"
}
}4. generate_icon
Generate app icons, favicons, and UI elements.
Parameters:
prompt(string, required): Description of the icon to generatesizes(array): Icon sizes in pixels (16, 32, 64, 128, 256, 512, 1024)type(string): "app-icon", "favicon", or "ui-element" (default: "app-icon")style(string): "flat", "skeuomorphic", "minimal", or "modern" (default: "modern")format(string): "png" or "jpeg" (default: "png")background(string): "transparent", "white", "black", or color name (default: "transparent")corners(string): "rounded" or "sharp" (default: "rounded")preview(boolean): Automatically open generated images (default: false)
Example:
{
"name": "generate_icon",
"arguments": {
"prompt": "coffee cup logo",
"sizes": [64, 128, 256],
"type": "app-icon",
"style": "minimal"
}
}5. generate_pattern
Generate seamless patterns and textures.
Parameters:
prompt(string, required): Description of the patternsize(string): Pattern tile size (default: "256x256")type(string): "seamless", "texture", or "wallpaper" (default: "seamless")style(string): "geometric", "organic", "abstract", "floral", or "tech" (default: "abstract")density(string): "sparse", "medium", or "dense" (default: "medium")colors(string): "mono", "duotone", or "colorful" (default: "colorful")repeat(string): "tile" or "mirror" (default: "tile")preview(boolean): Automatically open generated images (default: false)
Example:
{
"name": "generate_pattern",
"arguments": {
"prompt": "geometric hexagons",
"type": "seamless",
"style": "geometric",
"colors": "duotone"
}
}6. generate_story
Generate sequential images that tell a story or process.
Parameters:
prompt(string, required): Description of the story or processsteps(number): Number of sequential images (2-8, default: 4)type(string): "story", "process", "tutorial", or "timeline" (default: "story")style(string): "consistent" or "evolving" (default: "consistent")layout(string): "separate", "grid", or "comic" (default: "separate")transition(string): "smooth", "dramatic", or "fade" (default: "smooth")format(string): "storyboard" or "individual" (default: "individual")preview(boolean): Automatically open generated images (default: false)
Example:
{
"name": "generate_story",
"arguments": {
"prompt": "a seed growing into a tree",
"steps": 5,
"type": "process",
"style": "consistent"
}
}7. generate_diagram
Generate technical diagrams and visualizations.
Parameters:
prompt(string, required): Description of the diagramtype(string): "flowchart", "architecture", "network", "database", "wireframe", "mindmap", or "sequence" (default: "flowchart")style(string): "professional", "clean", "hand-drawn", or "technical" (default: "professional")layout(string): "horizontal", "vertical", "hierarchical", or "circular" (default: "hierarchical")complexity(string): "simple", "detailed", or "comprehensive" (default: "detailed")colors(string): "mono", "accent", or "categorical" (default: "accent")annotations(string): "minimal" or "detailed" (default: "detailed")preview(boolean): Automatically open generated images (default: false)
Example:
{
"name": "generate_diagram",
"arguments": {
"prompt": "user authentication flow",
"type": "flowchart",
"style": "professional",
"complexity": "detailed"
}
}🛠️ Development
Build
npm run buildDevelopment Mode with Watch
npm run devType Checking
npm run typecheckStart Server
npm start🏗️ Architecture
Core Components
index.ts: MCP server implementation using@modelcontextprotocol/sdkimageGenerator.ts: Handles all Gemini API interactions and response processingfileHandler.ts: Manages file I/O, smart filename generation, and file searchingtypes.ts: TypeScript interfaces for type safety
Key Features
- Type-Safe: Full TypeScript support with comprehensive interfaces
- Error Handling: Robust error handling with detailed debug logging
- Protocol Compliance: Strict adherence to Model Context Protocol (MCP) specification
- Resource Efficient: Optimized for Claude and other MCP clients
🔐 Environment Configuration
The server supports multiple environment variables for API key authentication:
# Recommended for Gemini API key
export NANOBANANA_GEMINI_API_KEY="your-api-key"
# Alternative for Vertex API
export NANOBANANA_GOOGLE_API_KEY="your-api-key"
# Fallbacks
export GEMINI_API_KEY="your-api-key"
export GOOGLE_API_KEY="your-api-key"🐛 Troubleshooting
No API Key Found
Ensure one of the supported environment variables is set:
export NANOBANANA_GEMINI_API_KEY="your-key"Build Errors
Ensure Node.js 18+ is installed:
node --version
npm run buildType Errors
Run type checking to identify issues:
npm run typecheckDebug Mode
The server includes detailed logging output on stderr for debugging:
nanobanana-mcp 2>&1 | grep -i "debug\|error"📄 Legal
- License: Apache License 2.0 - See LICENSE
- Author: Gemini CLI Extensions
- Repository: github.com/gemini-cli-extensions/nanobanana
🤝 Contributing
Contributions are welcome! Please see our Contributing Guidelines.
- Fork the repository
- Create a feature branch
- Make your changes
- Run
npm run build && npm run typecheck - Submit a pull request
📚 Related Resources
- Model Context Protocol Specification
- Gemini API Documentation
- Claude Desktop Setup Guide
- Main Nano Banana Repository
🙋 Support
For issues, questions, or suggestions, please open an issue on GitHub.
Made with ❤️ by the Gemini CLI Extensions team