nanobanana-mcp-server

by @zhongweili

Nanobanana MCP Server

Generate and edit up to 4K AI images using Google Gemini from Claude Desktop, Claude Code, Cursor, Codex, or Open WebUI over local stdio. Distributed via uvx under MIT, nanobanana-mcp-server routes prompts across Gemini 3.1 Flash Image (NB2), Gemini 3 Pro, and Gemini 2.5 Flash.

AI Models & Agents408pythonMIT

Server facts

nanobanana-mcp-server

GitHub stars

408

Last commit

Nov 20, 2026

Runtime

python

License

MIT

Tech

Runtime
python
Transports
stdio
Remote access
No
Authentication
Google Gemini API key (GEMINI_API_KEY) or Vertex AI ADC (NANOBANANA_AUTH_METHOD=vertex_ai)

Activity

GitHub stars
408
Last commit
Data as of

Tags

  • gemini 2 5 flash image
  • nano banana

Overview

Creators and developers configuring `nanobanana mcp` (`zhongweili/nanobanana-mcp-server`, MIT license) can add Google Gemini image generation to Claude Desktop, Claude Code, Cursor, OpenAI Codex, Continue.dev, Open WebUI, or Gemini CLI over local `stdio`. Distributed on the MCP Registry (`io.github.zhongweili/nanobanana-mcp-server`), PyPI (`pip install nanobanana-mcp-server`), and `uvx nanobanana-mcp-server@latest` (Python 3.11+ for local development), the server accepts either a Google AI Studio `GEMINI_API_KEY` or Google Cloud Vertex AI Application Default Credentials (`NANOBANANA_AUTH_METHOD=vertex_ai`, `GCP_PROJECT_ID`, and `GCP_REGION=global` with `roles/aiplatform.user`).

By default, automatic routing selects the NB2 tier (model ID `gemini-3.1-flash-image-preview`), generating up to 4K (3840px) assets in roughly 2-4 seconds with Google Search grounding, text rendering, and consistency across up to 5 characters and 14 objects. Prompts requesting production quality keywords, `thinking_level="HIGH"`, or multi-image conditioning automatically upgrade to Nano Banana Pro (`gemini-3-pro-image-preview`), while legacy Gemini 2.5 Flash (`1024px`) remains selectable for rapid drafts. Callers control dimensions (`1:1`, `4:3`, `3:4`, `16:9`, `9:16`, `21:9`, `2:3`, `3:2`, `4:5`, `5:4`), exact save locations via `output_path` or `IMAGE_OUTPUT_DIR` (falling back to `~/nanobanana-images`), custom `GEMINI_BASE_URL` proxies, and Gemini Files API uploads.

Install & configure

Requirements

  • `uvx` (`uvx nanobanana-mcp-server@latest`) or `pip install nanobanana-mcp-server` (Python 3.11+ for local development)
  • Google Gemini API key (`GEMINI_API_KEY`) from Google AI Studio, OR Google Cloud Vertex AI ADC (`NANOBANANA_AUTH_METHOD=vertex_ai`, `GCP_PROJECT_ID`, `GCP_REGION=global`, `roles/aiplatform.user`)
  • Writable output directory (`~/nanobanana-images` by default, or custom `IMAGE_OUTPUT_DIR`)
Documented launch / install command
uvx nanobanana-mcp-server@latest

Add `uvx nanobanana-mcp-server@latest` with `GEMINI_API_KEY` to `claude_desktop_config.json`, Cursor MCP settings, Claude Code (`Add MCP Server`), or `~/.codex/config.toml` (`[mcp_servers.nanobanana]`). Intel Mac (`x86_64`) users hitting cryptography wheel build errors can run `uvx --with "cryptography<49" nanobanana-mcp-server`.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Desktop configuration
{
  "mcpServers": {
    "nanobanana": {
      "command": "uvx",
      "args": [
        "nanobanana-mcp-server@latest"
      ],
      "env": {
        "GEMINI_API_KEY": "your-gemini-api-key-here"
      }
    }
  }
}

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

Cursor configuration
{
  "mcpServers": {
    "nanobanana": {
      "command": "uvx",
      "args": [
        "nanobanana-mcp-server@latest"
      ],
      "env": {
        "GEMINI_API_KEY": "your-gemini-api-key-here"
      }
    }
  }
}

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "nanobanana": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "nanobanana-mcp-server@latest"
      ],
      "env": {
        "GEMINI_API_KEY": "your-gemini-api-key-here"
      }
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

Windsurf configuration
{
  "mcpServers": {
    "nanobanana": {
      "command": "uvx",
      "args": [
        "nanobanana-mcp-server@latest"
      ],
      "env": {
        "GEMINI_API_KEY": "your-gemini-api-key-here"
      }
    }
  }
}

Read the Windsurf setup guide

Config file · Project scope: .mcp.json at the repository root

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Code configuration
{
  "mcpServers": {
    "nanobanana": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "nanobanana-mcp-server@latest"
      ],
      "env": {
        "GEMINI_API_KEY": "your-gemini-api-key-here"
      }
    }
  }
}

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Tools

Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.

ToolWhat it does
generate_imageGenerate images with automatic or explicit Gemini model tier selection (nb2, pro, flash), 4K resolution, Google Search grounding, aspect_ratio, and output_path control.
edit_imageEdit existing images through Google Gemini multimodal prompts directly inside coding and chat sessions.
upload_fileUpload and manage reference image assets via the Gemini Files API for conditioning and editing workflows.

Use cases

  • Produce 4K marketing banners, YouTube thumbnails (`16:9`), mobile wallpapers (`9:16`), or square social graphics (`1:1`) directly inside Claude Desktop or Cursor.
  • Save generated assets directly into a repository's static folder using `output_path` file paths or directory paths with automatic numbering for batch outputs.
  • Leverage Nano Banana Pro (`model_tier="pro"`, `thinking_level="HIGH"`) with Google Search grounding for complex multi-character compositions and text-heavy graphics.
  • Run production Gemini image generation on Google Cloud (Cloud Run, GKE, GCE) without static API keys via Vertex AI ADC authentication.

Strengths

  • Ships ready-to-run configs for Claude Desktop, Claude Code, Cursor, OpenAI Codex (`config.toml`), Continue.dev, Open WebUI, and Gemini CLI.
  • Automatic model selection routes everyday requests to fast 4K NB2 (`gemini-3.1-flash-image-preview`) and escalates complex prompts to Gemini 3 Pro.
  • Supports both quick `GEMINI_API_KEY` setup and enterprise Google Cloud Vertex AI ADC, plus `GEMINI_BASE_URL` proxy overrides and model-ID env overrides.
  • Provides deterministic `output_path` precedence (per-call path -> `IMAGE_OUTPUT_DIR` -> `~/nanobanana-images`) and preset aspect ratios from `1:1` to `21:9`.

Limitations

  • Runs locally over `stdio` rather than exposing a hosted remote MCP server URL.
  • Vertex AI deployments using Gemini 3 Pro Image or NB2 must set `GCP_REGION=global` (`us-central1` works only for legacy Gemini 2.5 Flash Image).
  • Intel Mac (`x86_64`) environments may need the `uvx --with "cryptography<49"` workaround to avoid compiling cryptography from source.

nanobanana-mcp-server setup notes

  • Check GEMINI_API_KEY in the nanobanana-mcp-server configuration if startup or authentication fails.
  • nanobanana-mcp-server's stdio example needs a client that launches local processes.

Frequently asked questions

Run `uvx nanobanana-mcp-server@latest` over `stdio` with your `GEMINI_API_KEY` environment variable—no repository clone needed. Paste the JSON `mcpServers` block into `claude_desktop_config.json`, Cursor MCP settings, or Claude Code's Add MCP Server wizard, or add `[mcp_servers.nanobanana]` to `~/.codex/config.toml` for OpenAI Codex.

Related MCP servers