Server facts
nanobanana-mcp-server
GitHub stars
408
Last commit
Nov 20, 2026
Runtime
python
License
MIT
Project
- Author
- zhongweili
- License
- MIT
- Category
- AI Models & Agents
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`)
uvx nanobanana-mcp-server@latestAdd `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`.
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.
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.
{
"mcpServers": {
"nanobanana": {
"command": "uvx",
"args": [
"nanobanana-mcp-server@latest"
],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
}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.
{
"mcpServers": {
"nanobanana": {
"command": "uvx",
"args": [
"nanobanana-mcp-server@latest"
],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
}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.
{
"servers": {
"nanobanana": {
"type": "stdio",
"command": "uvx",
"args": [
"nanobanana-mcp-server@latest"
],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
}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.
{
"mcpServers": {
"nanobanana": {
"command": "uvx",
"args": [
"nanobanana-mcp-server@latest"
],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
}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.
{
"mcpServers": {
"nanobanana": {
"type": "stdio",
"command": "uvx",
"args": [
"nanobanana-mcp-server@latest"
],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key-here"
}
}
}
}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.
| Tool | What it does |
|---|---|
| generate_image | Generate images with automatic or explicit Gemini model tier selection (nb2, pro, flash), 4K resolution, Google Search grounding, aspect_ratio, and output_path control. |
| edit_image | Edit existing images through Google Gemini multimodal prompts directly inside coding and chat sessions. |
| upload_file | Upload 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.