Skip to main content
Glama

MCP Nano Banana

MCP server for image generation using Nano Banana (Gemini). Use it with Claude Code to generate images directly from your prompts.

Setup

1. Get a Gemini API Key

  1. Go to Google AI Studio

  2. Create a new API key

  3. Save it securely (you'll use it in step 3)

2. Build the server

git clone https://github.com/baiano/mcp-nano-banana.git
cd mcp-nano-banana
npm install
npm run build

3. Store the API key securely

Add the key to your shell profile (~/.zshrc or ~/.bashrc):

echo 'export GEMINI_API_KEY=your_key_here' >> ~/.zshrc
source ~/.zshrc

Alternatively, you can set it per-project in the Claude Code MCP config (see below).

4. Add to Claude Code

Run the following command:

claude mcp add nano-banana -- node /absolute/path/to/mcp-nano-banana/dist/index.js

Or add it manually to ~/.claude/settings.json:

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

If you set GEMINI_API_KEY in your shell profile, you can omit the env block.

5. Optional: custom output directory

By default, images are saved to ~/Pictures/nano-banana/. Override it with:

{
  "env": {
    "GEMINI_API_KEY": "your_key_here",
    "NANO_BANANA_OUTPUT_DIR": "/path/to/your/folder"
  }
}

Related MCP server: Gemini Image MCP Server

Usage

Once configured, just ask Claude Code to generate images naturally:

  • "Generate an image of a medieval knight in pixel art style"

  • "Create a 16:9 landscape of a futuristic city at sunset"

  • "Draw a cute cartoon cat with a wizard hat, save as wizard-cat.png"

Claude will recognize the intent and call the generate_image tool via MCP.

Tool: generate_image

Parameter

Required

Description

prompt

Yes

Detailed description of the image to generate

aspect_ratio

No

1:1 (default), 16:9, 9:16, 4:3, 3:4, 3:2, 2:3

filename

No

Custom filename (e.g. my-image.png). Auto-generated if omitted

Development

npm test        # Run tests
npm run build   # Compile TypeScript

Available Tools

3 tools
generate_imageA

Generate an image using Nano Banana (Gemini). Saves the image to disk and returns the file path. Use this tool whenever the user asks to generate, create, draw, or make an image, picture, illustration, photo, artwork, or visual.

Inputs: prompt (required), model, filename, aspect_ratio.

list_modelsB

List all available image generation models for Nano Banana.

Inputs: no named parameters.

set_modelC

Change the active image generation model for Nano Banana.

Inputs: model (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: generate an image, list available models, and set the active model. There is no overlap or ambiguity between these operations.

    Naming Consistency5/5

    All tools follow a consistent snake_case verb_noun pattern: generate_image, list_models, set_model. The convention is predictable and readable.

    Tool Count5/5

    Three tools is well-scoped for this server's purpose. Each tool earns its place, covering generation and model management without unnecessary bloat.

    Completeness4/5

    The core lifecycle (generate image) and model management (list, set) are covered. A minor gap is the absence of an explicit way to query the currently active model, though list_models may implicitly indicate it.

    Maintenance

    ActivitySlowing
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers