MCP Hub
Back to servers

nano-banana-mcp

A Model Context Protocol server for Google's Gemini-based image generation models, enabling text-to-image creation, image editing, and multi-image composition.

Tools
4
Updated
Dec 26, 2025

Nano Banana MCP Server

An MCP (Model Context Protocol) server for Google's Nano Banana Pro (Gemini 3 Pro Image) and Nano Banana (Gemini 2.5 Flash Image) AI image generation models.

Features

  • 🎨 Text-to-Image Generation - Create images from natural language descriptions
  • ✏️ Image Editing - Modify existing images with text prompts
  • 🖼️ Multi-Image Composition - Combine up to 14 reference images
  • 📐 Flexible Aspect Ratios - 10 aspect ratio options (1:1, 16:9, 9:16, etc.)
  • 🔍 High Resolution - Up to 4K output with Nano Banana Pro
  • 🔤 Text Rendering - Generate images with accurate, legible text
  • 🌐 Google Search Grounding - Real-time information for current events/weather

Prerequisites

Installation

From Source

# Clone or download this directory
cd nanobanana-mcp-server

# Install dependencies
npm install

# Build the TypeScript
npm run build

Configuration

Set your API key as an environment variable:

# Linux/macOS
export GEMINI_API_KEY="your-api-key-here"

# Windows (PowerShell)
$env:GEMINI_API_KEY="your-api-key-here"

# Windows (CMD)
set GEMINI_API_KEY=your-api-key-here

Usage

As stdio Server (for Claude Desktop, etc.)

npm start

Or directly:

node dist/index.js

As HTTP Server

TRANSPORT=http PORT=3000 npm start

The server will listen at http://localhost:3000/mcp.

Claude Desktop Configuration

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "nanobanana": {
      "command": "node",
      "args": ["/path/to/nanobanana-mcp-server/dist/index.js"],
      "env": {
        "GEMINI_API_KEY": "your-api-key-here"
      }
    }
  }
}

Available Tools

nanobanana_generate_image

Generate images from text descriptions.

Parameters:

NameTypeRequiredDescription
promptstringYesText description of the image
modelstringNoModel ID (default: gemini-3-pro-image-preview)
aspect_ratiostringNoAspect ratio (e.g., 1:1, 16:9)
resolutionstringNoResolution: 1K, 2K, 4K (Pro only)
use_google_searchbooleanNoEnable real-time info grounding (Pro only)

Example:

{
  "prompt": "A photorealistic portrait of an astronaut on Mars at sunset, dramatic lighting, 85mm lens",
  "model": "gemini-3-pro-image-preview",
  "aspect_ratio": "16:9",
  "resolution": "4K"
}

nanobanana_edit_image

Edit an existing image using text prompts.

Parameters:

NameTypeRequiredDescription
promptstringYesDescription of the edit
image_base64stringYesBase64-encoded image data
image_mime_typestringYesMIME type (e.g., image/png)
modelstringNoModel ID
aspect_ratiostringNoOutput aspect ratio
resolutionstringNoOutput resolution (Pro only)

Example:

{
  "prompt": "Add a wizard hat to the cat",
  "image_base64": "<base64-image-data>",
  "image_mime_type": "image/png"
}

nanobanana_compose_images

Compose images using multiple reference images (Nano Banana Pro only).

Parameters:

NameTypeRequiredDescription
promptstringYesDescription of composition
imagesarrayYesArray of {base64, mime_type} objects (max 14)
aspect_ratiostringNoOutput aspect ratio
resolutionstringNoOutput resolution

Example:

{
  "prompt": "Create a group photo of these 5 people at a beach party",
  "images": [
    {"base64": "<image1>", "mime_type": "image/jpeg"},
    {"base64": "<image2>", "mime_type": "image/jpeg"}
  ],
  "aspect_ratio": "16:9",
  "resolution": "2K"
}

nanobanana_list_models

List available models and their capabilities.

Parameters:

NameTypeRequiredDescription
response_formatstringNomarkdown (default) or json

Models

Nano Banana Pro (gemini-3-pro-image-preview)

Google's most advanced image generation model. Best for:

  • Professional asset production
  • Images with accurate text rendering
  • Complex compositions
  • High-resolution output (up to 4K)
  • Real-time information grounding

Nano Banana (gemini-2.5-flash-image)

Fast, low-latency image generation. Best for:

  • Quick experimentation
  • Batch processing
  • Iterative design
  • Cost-effective generation

Aspect Ratios

RatioUse Case
1:1Square, social media posts
16:9Landscape, presentations, YouTube thumbnails
9:16Portrait, mobile screens, Stories
4:3Classic photo format
3:2DSLR photo format
21:9Ultra-wide, cinematic

Tips for Best Results

Prompting

  1. Be Descriptive: Include details about style, lighting, composition, colors, and mood
  2. Use Photography Terms: For photorealistic images, mention camera angles, lens types, lighting setups
  3. Specify Style: "Oil painting", "3D render", "watercolor", "photorealistic", etc.
  4. Include Context: Describe the environment, atmosphere, and mood

Example Prompts

Photorealistic:

A photorealistic close-up portrait of an elderly Japanese ceramicist with 
deep wrinkles and a warm smile, inspecting a glazed tea bowl. Soft golden 
hour light from a window. Shot with 85mm portrait lens, bokeh background.

Stylized:

A kawaii-style sticker of a happy red panda wearing a bamboo hat, munching 
on a leaf. Bold outlines, cel-shading, vibrant colors. White background.

Logo:

Create a modern, minimalist logo for a coffee shop called 'The Daily Grind'. 
Clean, bold sans-serif font. Black and white. Circular design with a clever 
coffee bean element.

Error Handling

Common errors and solutions:

ErrorSolution
"GEMINI_API_KEY is required"Set the environment variable
Rate limit exceededWait and retry, or reduce request frequency
Content policy violationModify prompt to comply with Google's policies
Invalid image formatUse supported formats: PNG, JPEG, GIF, WebP

Development

# Install dependencies
npm install

# Build TypeScript
npm run build

# Watch mode for development
npm run dev

License

MIT

Links

Reviews

No reviews yet

Sign in to write a review