Skip to main content

NanoBanana MCP Server

MCP server for AI image generation using NanoBanana Pro 2. Supports Pro (maximum quality) and Flash (fast generation) models with default 4K resolution.

Inspired by the nano-banana naming convention used across the MCP community. This is an independent implementation.

Quick Install

pip install nanobanana-imagen-mcp
# or
uvx nanobanana-imagen-mcp --help

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "nanobanana": {
      "command": "uvx",
      "args": ["nanobanana-imagen-mcp"],
      "env": {
        "GEMINI_API_KEY": "your_key_here"
      }
    }
  }
}
Variable Description Default
GEMINI_API_KEY Gemini API key — required for all generation --
IMAGE_OUTPUT_DIR Directory where generated images are saved ~/nanobanana-images
NANOBANANA_DB_PATH SQLite database path for image metadata ~/nanobanana-images/images.db

What It Does

Generates AI images using NanoBanana Pro 2 models. Supports text-to-image generation, image editing with reference images, file uploads, and server maintenance. Produces high-quality images at up to 4K resolution.

Tools (4)

Tool Description
generate_image Generate images using NanoBanana Pro 2. Supports model selection (Pro/Flash), aspect ratio, resolution (up to 4K), negative prompts, thinking level, grounding, reference images, and batch generation.
upload_file Upload a reference image for use in image editing or conditioning.
show_output_stats Display statistics about generated images — count, total size, file details.
maintenance Server maintenance and cleanup — clear caches, remove temporary files, optimize storage.

Models

Model Engine Best For
Pro gemini-3-pro-image Maximum quality, complex scenes, photorealism
Flash gemini-nano-banana-2.1 Fast generation, simple scenes, quick iterations

Configuration

Variable Description Default
GEMINI_API_KEY Gemini API key (required) --
IMAGE_OUTPUT_DIR Output directory for generated images ~/nanobanana-images

Storage

Generated image metadata is tracked in a SQLite database.

Variable Description Default
NANOBANANA_DB_PATH Path to the SQLite metadata database ~/nanobanana-images/images.db

Opt out of persistent storage by setting NANOBANANA_DB_PATH=:memory:. This uses an in-memory database that is discarded when the server exits — useful for ephemeral or read-only environments. Trade-off: image history is lost on restart; the show_output_stats tool will show an empty database each session.

The database and output directories are created lazily on first use. The server starts and lists its four tools without credentials. Image generation and uploads require authentication; with no API key configured, they return a clear error naming GEMINI_API_KEY.

Claude Desktop Configuration

pip install nanobanana-imagen-mcp
{
  "mcpServers": {
    "nanobanana": {
      "command": "uvx",
      "args": ["nanobanana-imagen-mcp"],
      "env": {
        "GEMINI_API_KEY": "your_key_here"
      }
    }
  }
}

From this repository

{
  "mcpServers": {
    "nanobanana": {
      "command": "python",
      "args": ["-m", "servers.nanobanana.nanobanana_mcp_server.server"],
      "env": {
        "GEMINI_API_KEY": "your_key_here"
      },
      "cwd": "path/to/gemini-media-mcp"
    }
  }
}

Features

  • Default 4K resolution for maximum detail
  • Pro model for complex, photorealistic scenes
  • Flash model for fast iterations and simple subjects
  • Reference image support for consistent multi-angle shots
  • Negative prompt support for quality control
  • Thinking level control for complex multi-element scenes
  • Google Search grounding for real-world subjects

License

MIT

Credits

Inspired by the nano-banana naming convention used across the MCP community. This is an independent implementation.

Refresh verification — 2026-11-05

Gemini paths were tested only with a fake client and never live. Both API keys were unset for all test runs; tests block real SDK clients and HTTP requests. gemini-3.1-flash-image is also listed as Stable; this server's Flash route uses the documented preview replacement gemini-nano-banana-2.1.

Dependencies: fastmcp>=4,<5, google-genai>=2.5.0,<3. Clean tool registration checked with FastMCP 4.1.6 and SDK 2.34.0. The ToolResult imports now use the FastMCP 4 module path.

env -u GEMINI_API_KEY -u GOOGLE_API_KEY -u GEMINI_API_KEY_BACKUP uv run --locked pytest tests -q

Metadata

Release files for nanobanana-imagen-mcp 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanobanana-imagen-mcp 1.2.0
File Size Uploaded Provenance Actions
nanobanana_imagen_mcp-1.2.0.tar.gz 235.3 kB With provenance Details for nanobanana_imagen_mcp-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nanobanana-imagen-mcp 1.2.0
File Interpreter ABI Platform Actions
nanobanana_imagen_mcp-1.2.0-py3-none-any.whl Python 3 none any Details for nanobanana_imagen_mcp-1.2.0-py3-none-any.whl

Total release size: 321.9 kB

Release files / nanobanana_imagen_mcp-1.2.0.tar.gz

Download URL nanobanana_imagen_mcp-1.2.0.tar.gz
Size 235.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b03ceeb66e05d7145833983819adb38611eb7d135651d865d8bf3d9e4eaffbbe
BLAKE2b-256 checksum
How to use checksums
5ad09fdd021cd8ab477786edb59e23e2358e133677a145c32f9c6b76bfe90d1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / nanobanana_imagen_mcp-1.2.0-py3-none-any.whl

Download URL nanobanana_imagen_mcp-1.2.0-py3-none-any.whl
Size 86.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09dfd3ce7305f120b25f12c35ad33763a989fda3de2beedb0cce4ba77ad6915f
BLAKE2b-256 checksum
How to use checksums
d3dc80b78c51acd21181557d3253f13e29c2143a4c43731d169f0e4a601decab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for nanobanana-imagen-mcp 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nanobanana_imagen_mcp-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page