Nano-Banana-MCP
A Nano Banana MCP server, which you can integrate to cursor/claude code and any mcp client
README
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 2.5 Flash Image API. Generate stunning images, edit existing ones, and iterate on your creations with simple text prompts.
✨ 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": {
"command": "npx",
"args": ["nano-banana-mcp"],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
}
Option B: Without environment variable
{
"mcpServers": {
"nano-banana": {
"command": "npx",
"args": ["nano-banana-mcp"]
}
}
}
Usage Examples:
Generate an image of a sunset over mountains
Edit this image to add some birds in the sky
Continue editing to make it more dramatic
🎯 Usage with Cursor
Configuration:
Add to your Cursor MCP configuration:
Option A: With environment variable (Recommended)
{
"nano-banana": {
"command": "npx",
"args": ["nano-banana-mcp"],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
Option B: Without environment variable
{
"nano-banana": {
"command": "npx",
"args": ["nano-banana-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-mcp using any of these methods:
Configuration Methods
Method A: Environment Variable in MCP Config (Recommended)
{
"nano-banana": {
"command": "npx",
"args": ["nano-banana-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-mcp
Method C: Using the Configure Tool
npx nano-banana-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 config - Most secure as it's contained within the MCP configuration
- Example:
"env": { "GEMINI_API_KEY": "your-key" }
- Set in your
-
🥈 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_tokentool - Stored as
.nano-banana-config.jsonin current directory - Automatically ignored by Git and NPM
- Created when using the
💡 Recommendation: Use Method 1 (MCP config env variables) for the best security and convenience.
📁 File Storage
Images are automatically saved to platform-appropriate locations:
- Windows:
%USERPROFILE%\\Documents\\nano-banana-images\\ - macOS/Linux:
./generated_imgs/(in current directory) - System directories:
~/nano-banana-images/(when run from system paths)
File naming convention:
- Generated images:
generated-[timestamp]-[id].png - Edited 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 adjustments- Repeat 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 2.5 Flash 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!
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。