Skip to main content

MCP server for AI image generation using NanoBanana Pro 2 -- 4K resolution

Project description

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 3.1 Flash Image 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 image generation — starting the server with no GEMINI_API_KEY set (e.g. nanobanana-imagen-mcp --help) does not create any files or directories.

Claude Desktop Configuration

From pip (recommended)

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nanobanana_imagen_mcp-1.1.1.tar.gz (165.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nanobanana_imagen_mcp-1.1.1-py3-none-any.whl (83.6 kB view details)

Uploaded Python 3

File details

Details for the file nanobanana_imagen_mcp-1.1.1.tar.gz.

File metadata

  • Download URL: nanobanana_imagen_mcp-1.1.1.tar.gz
  • Upload date:
  • Size: 165.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nanobanana_imagen_mcp-1.1.1.tar.gz
Algorithm Hash digest
SHA256 0d4ac1b1f966f8a80f1d848d35e045b6224629a49bfc6a88d92c5fb7c0e943c3
MD5 6ce4022a61f685d409a4436219071af6
BLAKE2b-256 534971830be8ca0129b4a07cec29163bb5ec0d78071cc87e068a56b47ed4ecb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanobanana_imagen_mcp-1.1.1.tar.gz:

Publisher: publish.yml on u2n4/gemini-media-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanobanana_imagen_mcp-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nanobanana_imagen_mcp-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 abb535e803562f0331bbe83a6a0b9da734ea0335713f3b576d967dbd9ed65dbb
MD5 69e9db228ab810f45c135c2bc62e7fcb
BLAKE2b-256 bd01b18be59554b29330bc52e659804870cf4fa413db53446b456ff890715128

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanobanana_imagen_mcp-1.1.1-py3-none-any.whl:

Publisher: publish.yml on u2n4/gemini-media-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page