Nano Banana
STDIO基于谷歌Gemini的AI图像生成编辑服务器
基于谷歌Gemini的AI图像生成编辑服务器
🤖 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.
Get your Gemini API key:
Configure the MCP server: See configuration examples for your specific client below (Claude Code, Cursor, or other MCP clients).
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"] } } }
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
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"] } }
If you're using a different MCP client, you can configure nano-banana-mcp using any of these 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
generate_imageCreate a new image from a text prompt.
generate_image({ prompt: "A futuristic city at night with neon lights" })
edit_imageEdit 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_editingContinue editing the last generated/edited image.
continue_editing({ prompt: "Make it more colorful", referenceImages?: ["/path/to/style.jpg"] // optional })
get_last_image_infoGet information about the last generated image.
get_last_image_info()
configure_gemini_tokenConfigure your Gemini API key.
configure_gemini_token({ apiKey: "your-gemini-api-key" })
get_configuration_statusCheck if the API key is configured.
get_configuration_status()
The MCP server loads your API key in the following priority order:
🥇 MCP Configuration Environment Variables (Highest Priority)
claude_desktop_config.json or MCP client config"env": { "GEMINI_API_KEY": "your-key" }🥈 System Environment Variables
export GEMINI_API_KEY="your-key"🥉 Local Configuration File (Lowest Priority)
configure_gemini_token tool.nano-banana-config.json in current directory💡 Recommendation: Use Method 1 (MCP config env variables) for the best security and convenience.
Images are automatically saved to platform-appropriate locations:
%USERPROFILE%\\Documents\\nano-banana-images\\./generated_imgs/ (in current directory)~/nano-banana-images/ (when run from system paths)File naming convention:
generated-[timestamp]-[id].pngedited-[timestamp]-[id].pnggenerate_image - Create your base imagecontinue_editing - Refine and improvecontinue_editing - Add final touchesgenerate_image - Create base contentedit_image - Use reference images for stylecontinue_editing - Fine-tune the resultgenerate_image - Start with a conceptget_last_image_info - Check current statecontinue_editing - Make adjustmentsThis project was created with Claude Code and follows these technologies:
# 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
This project was generated by Claude Code, but contributions are welcome! Please feel free to:
MIT License - see LICENSE file for details.
✨ Generated with love by Claude Code - The future of AI-powered development is here!