mcpField
M
mcp-nano-banana

mcp-nano-banana

Local
github.com/codeFiMedia & Design0Updated 18w ago

About mcp-nano-banana

mcp-nano-banana exposes Google Gemini Nano Banana image generation to coding assistants and other MCP clients. It supports text-based creation, image editing and compositing, with controls for resolution, aspect ratio and output format.

Key features

  1. 01Generate images from text
  2. 02Edit existing images with instructions
  3. 03Combine up to 14 reference images
  4. 04Set resolution, aspect ratio and format
  5. 05Create complete favicon packages
  6. 06Automatically fall back to Flash on rate limits

Use cases

  1. 01Create illustrations or wallpapers for projects
  2. 02Change backgrounds or content in photos
  3. 03Combine people and product reference images
  4. 04Generate favicon files for a website

MCP support

As an MCP server, it provides clients with tools for image generation, editing, compositing and favicon creation. Requests use the Google Gemini API.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"codefi-mcp-nano-banana": {
"command": "npx",
"args": [
"-y",
"mcp-nano-banana"
],
"env": {
"GEMINI_API_KEY": "<GEMINI_API_KEY>"
}
}
}
}
Run commandnpx -y mcp-nano-banana
Environment variables to set
GEMINI_API_KEYSecretGoogle Gemini API key used for image generation requests.

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmmcp-nano-banana1.2.2

Tools

2

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
modelenumNoModel to use: gemini-2.5-flash-image (fast) or gemini-3-pro-image-preview (high quality, default)gemini-2.5-flash-image | gemini-3-pro-image-preview
promptstringYesText description of the image to generate or instructions for editing/combining reference images
imagePathsarrayNoOptional array of file paths to reference images (up to 14). Supports png, jpg, jpeg, webp, gif.
outputPathstringNoFile path to save the generated image. If not provided, image data is returned inline.
resolutionenumNoResolution of the generated image. 512 only on gemini-3.1-flash-image-preview. Nano Banana Pro supports 1K, 2K, 4K.512 | 1K | 2K | 4K
aspectRatioenumNoAspect ratio of the generated image. Additional ratios (1:4, 4:1, 1:8, 8:1) available on gemini-3.1-flash-image-preview.1:1 | 16:9 | 9:16 | 4:3 | 3:4 | 2:3 | 3:2 | 4:5 | 5:4 | 21:9 | 1:4 | 4:1 | 1:8 | 8:1
outputFormatenumNoOutput image formatpng | jpeg | webp

Details

From the project README

mcp-nano-banana

MCP server for AI-powered image generation using Google Gemini Nano Banana models. Generate, edit, and combine images from text prompts — directly from your AI coding assistant.

npm version license

Features

  • Text-to-image generation — Create images from natural language descriptions
  • Image editing — Upload images and modify them with text instructions
  • Multi-image combination — Mix up to 14 reference images into one composite
  • Resolution control — Generate at 512px, 1K, 2K, or 4K resolution
  • 13+ aspect ratios — From square (1:1) to ultra-wide (21:9) and tall (1:8)
  • Auto-fallback — Pro model falls back to Flash on rate limits (429/403/402)
  • File output — Save to specific paths or return inline base64
  • Favicon generation — Generate complete favicon packages with one command
  • Multi-format output — PNG, JPEG, and WebP support

Quick Start

Prerequisites
  1. Get a Gemini API key from Google AI Studio
  2. Enable billing on your Google Cloud project — image generation requires a paid tier (~$0.04-0.05/image for NB2 at standard resolution)
Installation
npm install -g mcp-nano-banana

Set your API key:

export GEMINI_API_KEY=your-api-key

For MCP Registry publication metadata, the registry name is io.github.codeFi/mcp-nano-banana.

MCP Configuration

Codex
codex mcp add nano-banana --env GEMINI_API_KEY=your-api-key -- npx -y mcp-nano-banana@latest

Or add manually to ~/.codex/config.toml:

[mcp_servers.nano-banana]
command = "npx"
args = ["-y", "mcp-nano-banana@latest"]

[mcp_servers.nano-banana.env]
GEMINI_API_KEY = "your-api-key"
Qwen Code

Add to ~/.qwen/settings.json:

{
  "mcpServers": {
    "nano-banana": {
      "command": "npx",
      "args": ["-y", "mcp-nano-banana@latest"],
      "env": {
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}
Claude Code
claude mcp add nano-banana -e GEMINI_API_KEY=your-api-key -- npx -y mcp-nano-banana@latest

Or add manually to ~/.claude/claude_desktop_config.json:

{
  "mcpServers": {
    "nano-banana": {
      "command": "npx",
      "args": ["-y", "mcp-nano-banana@latest"],
      "env": {
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}
Other MCP Clients

For CLIs and desktop clients that use the standard mcpServers JSON format, register:

{
  "mcpServers": {
    "nano-banana": {
      "command": "npx",
      "args": ["-y", "mcp-nano-banana@latest"],
      "env": {
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}
Local / Development Build
git clone https://github.com/codeFi/mcp-nano-banana.git
cd mcp-nano-banana
npm install
npm run build

Then register with your MCP client:

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

Models

ModelMCP NameDescriptionMax Ref Images
gemini-3-pro-image-previewNano Banana ProHigh quality, thinking mode, professional assets6 object + 5 character
gemini-3.1-flash-image-previewNano Banana 2Fast, high-efficiency, 1:4/4:1/1:8/8:1 ratios10 object + 4 character
gemini-2.5-flash-imageNano BananaFastest, optimized for high-volume tasks-

The server defaults to Nano Banana Pro for best quality and automatically falls back to Flash on rate limits.

Available Parameters

Resolution
ValueApprox. PixelsSupported Models
"512"~512pxNano Banana 2 only
"1K"~1024pxAll models
"2K"~2048pxAll models
"4K"~4096pxAll models

Default: "1K"

Aspect Ratio
ValueDimensions at 1KCommon Use Case
1:11024×1024Social posts, icons
16:91344×768Headers, presentations
9:16768×1344Stories, mobile
4:31152×896Desktop, photos
3:4896×1152Portraits
2:3~896×1344Print, magazines
3:2~1344×896Photos
4:5~896×1120Instagram posts
5:4~1120×896Instagram landscape
21:9~2048×878Ultra-wide banners
1:4~512×2048Nano Banana 2 only — tall strips
4:1~2048×512Nano Banana 2 only — wide strips
1:8~512×4096Nano Banana 2 only — extra tall
8:1~4096×512Nano Banana 2 only — extra wide

Tools

generate_image

Generate or edit images from text prompts.

ParameterTypeRequiredDefaultDescription
promptstring✅ Yes—Text description or editing instructions
imagePathsstring[]No—Reference image paths on disk (up to 14)
modelstringNogemini-3-pro-image-previewModel to use
aspectRatiostringNo1:1See table above for all options
resolutionstringNo1K512, 1K, 2K, or 4K
outputFormatstringNopngpng, jpeg, webp
outputPathstringNo—Save image to this file path
Examples

Generate from text:

{
  "prompt": "A sunset over mountains with dramatic lighting",
  "aspectRatio": "16:9",
  "resolution": "2K",
  "outputPath": "/Users/currentUser/Desktop/sunset.png"
}

Edit an existing image:

{
  "prompt": "Change the background to a coffee shop interior",
  "imagePaths": ["/Users/currentUser/photo.jpg"],
  "outputPath": "/Users/currentUser/edited.png"
}

Combine multiple images:

{
  "prompt": "Put these glasses on this person's face",
  "imagePaths": ["/path/to/face.jpg", "/path/to/glasses.jpg"],
  "outputPath": "/path/to/result.png"
}

High-res wallpaper:

{
  "prompt": "A futuristic cityscape at night with neon lights and rain",
  "aspectRatio": "16:9",
  "resolution": "4K",
  "outputPath": "/path/to/wallpaper.png"
}
generate_favicons

Generate a complete favicon package from a prompt or existing image.

ParameterTypeRequiredDefaultDescription
promptstringNo*—Icon description (required if imagePath not set)
imagePathstringNo*—Path to existing master icon image
modelstringNogemini-3-pro-image-previewModel for prompt generation
outputDirstringNo—Directory for individual favicon files
outputPathstringNo—Save ZIP package to this path
returnZipBase64booleanNofalseReturn ZIP as base64 text
appNamestringNoMy AppManifest name
shortNamestringNoAppManifest short_name
themeColorstringNo#ffffffManifest theme color
backgroundColorstringNo#ffffffManifest background color
includeReadmebooleanNotrueInclude README.md in package
Example
{
  "prompt": "A minimalist banana icon with a soft gradient",
  "outputDir": "/path/to/favicon",
  "outputPath": "/path/to/favicon.zip",
  "appName": "MyBrand",
  "shortName": "Brand",
  "themeColor": "#1a1a2e",
  "backgroundColor": "#ffffff"
}

Generated files:

  • favicon.ico — Multi-size icon (16/32/48px)
  • favicon-16x16.png — Browser tabs
  • favicon-32x32.png — Higher-res tabs
  • apple-touch-icon.png — iOS home screen
  • android-chrome-192x192.png — Android
  • android-chrome-512x512.png — Android HD
  • site.webmanifest — PWA manifest

HTML snippet (included in response):

<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">

Pricing

Image generation requires a paid Google AI Studio account. Approximate costs:

Model1K2K4K
Nano Banana 2~$0.04~$0.08~$0.15
Nano Banana Pro~$0.06~$0.13~$0.24

You only pay for what you generate — no monthly minimum.

Supported Image Formats

Input (reference images): png, jpg, jpeg, webp, gif Output: png, jpeg, webp

Development

# Build TypeScript
npm run build

# Watch mode
npm run dev

# Run tests
npm test

# Run the server directly
node dist/index.js

Troubleshooting

IssueSolution
GEMINI_API_KEY is not setExport the env var or add it to your MCP config
429 Too Many RequestsServer auto-falls back to Flash model. Add billing to your account.
403/402 Quota exceededEnable billing at Google Cloud Console
503 UnavailableHigh demand — retry in a moment. Common with 4K requests.
Image not updating after editMake sure you rebuilt the TypeScript (npm run build)
imagePaths not foundUse absolute paths. Relative paths may not resolve correctly.

Architecture

AI Assistant (MCP Client)
       │  (MCP Protocol over stdio)
       ▼
mcp-nano-banana Server
       │  (HTTPS POST)
       ▼
Google Gemini API
       │
       ▼
Generated Image → saved to outputPath (or returned inline base64)

License

MIT

Author

codeFi

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.