Nano Banana MCP Server
Provides image generation capabilities using Google's Gemini 2.5 Flash Image Preview model via Google AI Studio, supporting text-to-image and image-to-image generation.
Click on "Install 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 MCP Servergenerate a realistic portrait of a samurai warrior"
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
A Model Context Protocol (MCP) server for AI-powered image generation using Google's Gemini 2.5 Flash Image Preview model. This server enables text-to-image and image-to-image generation through the MCP interface.
Features
Text-to-Image Generation: Generate images from text prompts
Image-to-Image Generation: Create variations or modifications of existing images
Base64 Support: Handle image data in base64 format for MCP compatibility
Google AI Studio Integration: Uses Google's latest Gemini 2.5 Flash Image Preview model
Error Handling: Comprehensive error handling and logging
Environment Variable Support: Secure API key management
Related MCP server: MCP MediaCrea
Prerequisites
Python 3.7+
Google AI Studio API key
Internet connection for API calls
Installation
Clone or download this repository
Install dependencies:
pip install -r requirements.txtSet up your Google AI Studio API key:
export GOOGLE_AI_STUDIO_API_KEY="your_api_key_here"
Configuration
MCP Configuration
Add the following to your MCP configuration file:
{
"mcpServers": {
"nano-banana": {
"command": "python3",
"args": ["nano_banana_server.py"],
"env": {
"GOOGLE_AI_STUDIO_API_KEY": "${GOOGLE_AI_STUDIO_API_KEY}"
}
}
}
}Environment Variables
GOOGLE_AI_STUDIO_API_KEY: Your Google AI Studio API key (required)
Usage
MCP Tool Function
The server provides a single MCP tool function:
generate_image_with_nano_banana
Generate images using Google's Gemini 2.5 Flash Image Preview model.
Parameters:
prompt(string, required): Text description of the image to generateinput_image_b64(string, optional): Base64 encoded input image for variationsinput_image_mime_type(string, optional): MIME type of input image (e.g., 'image/png', 'image/jpeg')
Returns:
success(boolean): Whether the generation was successfulgenerated_image_b64(string): Base64 encoded generated image (if successful)generated_image_size(integer): Size of generated image in bytesmodel_used(string): Name of the model used ("gemini-2.5-flash-image-preview")error(string): Error message (if failed)
Example Usage
Text-to-Image Generation
result = await generate_image_with_nano_banana(
prompt="A beautiful handcrafted ceramic bowl with intricate patterns"
)Image-to-Image Generation
result = await generate_image_with_nano_banana(
prompt="Transform this into a watercolor painting",
input_image_b64="iVBORw0KGgoAAAANSUhEUgAA...", # Base64 encoded image
input_image_mime_type="image/png"
)Testing
Run the test function to verify the server is working:
python nano_banana_server.pyThis will generate a test image and display the results.
API Reference
Classes
ImageGenerationRequest
Data class for image generation requests.
Attributes:
prompt(str): Text prompt for image generationinput_image_data(Optional[bytes]): Raw image datainput_image_mime_type(Optional[str]): MIME type of input image
ImageGenerationResponse
Data class for image generation responses.
Attributes:
success(bool): Whether generation was successfulgenerated_image_data(Optional[bytes]): Generated image dataerror_message(Optional[str]): Error message if failedmodel_used(str): Model name used for generation
NanoBananaMCPServer
Main server class for handling image generation.
Methods:
__init__(api_key: Optional[str] = None): Initialize server with API keygenerate_image(request: ImageGenerationRequest) -> ImageGenerationResponse: Generate image from requestgenerate_image_from_base64(prompt: str, input_image_b64: Optional[str] = None, input_image_mime_type: Optional[str] = None) -> Dict[str, Any]: Generate image with base64 input
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceAllows AI assistants to generate and transform high-quality images from text prompts using Google's Gemini model via the MCP protocol.Last updated333MIT
- Alicense-quality-maintenanceEnables image generation, editing, and blending using Gemini 2.5 Flash capabilities, plus text generation for AI-powered creative workflows through MCP tools.Last updated
- AlicenseAqualityCmaintenanceEnables AI image generation, editing, and upscaling via Google Gemini and Imagen models, supporting dynamic model switching and multiple MCP-compatible clients.Last updated12MIT
- Alicense-qualityFmaintenanceEnables AI-powered image generation and editing using Gemini and Imagen models, supporting text-to-image, image editing, and multi-image composition through MCP tools.Last updatedMIT
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
MCP server for Google Veo AI video generation
Generate on-brand images from your AI agent: design, edit, and render templates over MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Vineexoxo/Nano-Banana-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server