Nano Banana Pro MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Nano Banana Pro MCP Generate an image of a Senegalese market at sunset"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Nano Banana Pro MCP Server
A minimal, auditable MCP server that gives Claude Desktop the ability to generate and edit images using Google's Gemini image models (Nano Banana / Nano Banana Pro).
All logic lives in src/index.ts. No hidden dependencies — read it before you run it.
What it does
Tool | Description |
| Switch between Gemini image models at runtime |
| Set source resolution ( |
| Set how long download URLs stay valid (default 30 min) |
| Generate an image from a text prompt |
| Generate several images from a list of prompts |
| Edit an image (fetched from a URL) with instructions |
Images are never written to local disk. generate_image and edit_image return an inline
preview (an MCP Apps HTML widget with the image embedded, rendered in the chat) plus, when
Firebase Storage is configured, a time-limited signed download URL. generate_image_batch
returns URLs only (no previews). Another environment (e.g. Claude's sandbox) fetches a URL to
embed the image in a document.
Inline preview rendering depends on the client supporting MCP Apps; if it doesn't render, the image is still available via the signed URL. Images are compressed only if they exceed the size threshold (500KB by default); smaller images are kept as-is.
Related MCP server: Banana Image MCP
Prerequisites
Node.js 18+ — check with
node --versionGemini API key — from Google AI Studio. Enable billing for image generation (pay-per-image).
(Optional) Firebase Storage — only needed if you want generated images usable outside the chat (see below).
Setup
1. Build
npm install
npm run build2. Configure Claude Desktop
Open the config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"nano-banana-pro": {
"command": "node",
"args": ["/absolute/path/to/nano-banana-mcp/build/index.js"],
"env": {
"GEMINI_API_KEY": "your-api-key-here"
}
}
}
}3. Fully quit and reopen Claude Desktop
Use Cmd+Q (not just closing the window) — the config is only read at launch.
Usage
"Generate an image of a Senegalese market at sunset"
"Create a 16:9 hero banner for a blog about climate resilience"
"Switch to nano-banana-pro and generate a 2K product shot"
Models
Friendly name | Model ID | Notes |
|
| Fast, good quality |
|
| Highest quality, slower |
|
| Original flash model |
Switch at runtime with the set_model tool (e.g. "use nano-banana-pro").
Optional: Firebase Storage (use images outside the chat)
Inline previews work without Firebase. Firebase is what makes an image usable outside the chat: each image is uploaded and a signed download URL is returned, which another environment (e.g. Claude's sandbox) can fetch to embed in a document.
Point at your service-account JSON key file (recommended):
"env": {
"GEMINI_API_KEY": "your-api-key-here",
"SERVICE_ACCOUNT_KEY_PATH": "/Users/you/keys/firebase-adminsdk.json",
"FIREBASE_STORAGE_BUCKET": "your-project.firebasestorage.app"
}Download the key from Firebase Console → Project Settings → Service Accounts → Generate new private key.
Copy the bucket name exactly from the Storage page (newer projects use
*.firebasestorage.app, older ones*.appspot.com).A leading
~in the key path is expanded automatically; a full absolute path also works.Alternatively supply
FIREBASE_PROJECT_ID,FIREBASE_CLIENT_EMAIL, andFIREBASE_PRIVATE_KEYinstead of a key file.Optional:
FIREBASE_SIGNED_URL_MINUTES(default 30) sets the default download-URL lifetime. Change it at runtime with theset_url_lifetimetool (accepts 1–10080 minutes, i.e. up to 7 days).Optional:
FIREBASE_OBJECT_TTL_DAYS(default 1) — uploaded images auto-delete after this many days via a bucket lifecycle rule (see below).For the download to work, the environment fetching the URL needs outbound access to
storage.googleapis.com.
Auto-deletion of stored images
Images are deleted from the bucket automatically after FIREBASE_OBJECT_TTL_DAYS days (default 1) so nothing accumulates indefinitely. The server tries to apply this as a bucket lifecycle rule at startup. If the service account lacks permission to update bucket metadata, apply it once manually with the gcloud CLI:
cat > /tmp/lifecycle.json <<'JSON'
{ "rule": [ { "action": {"type": "Delete"}, "condition": {"age": 1} } ] }
JSON
gcloud storage buckets update gs://YOUR_BUCKET --lifecycle-file=/tmp/lifecycle.json(age is in days.) This runs on Google Cloud regardless of whether the MCP server is running.
Confidentiality notes (important for org rollout)
Generation sends prompts and receives images via Google's Gemini API; treat prompt content accordingly.
Download URLs are signed URLs — anyone with the link can open the image until it expires (default 30 min). Keep the lifetime short and avoid pasting URLs into shared/persistent places.
All images share one bucket under one service-account key; there is no per-user separation or audit trail. If your images may be sensitive, review this against your data-handling policy before org-wide use.
Storage rules
The server authenticates with the Admin SDK, which bypasses Storage rules, and hands out signed URLs that carry their own auth. So you can keep rules fully locked down:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} { allow read, write: if false; }
}
}Remote (HTTP) mode
Besides the default stdio mode above, the server can run as a Streamable HTTP MCP server
(node build/http.js) for central hosting (e.g. Cloud Run). Each MCP session gets its own
settings, so one user's set_model / set_resolution / set_url_lifetime doesn't affect
another's. Endpoints: /mcp (MCP, POST/GET/DELETE), /healthz (unauthenticated health check).
Environment variables (in addition to the ones above):
Variable | Description |
| Port to listen on (default |
| Public base URL of this server, advertised in OAuth protected-resource metadata (e.g. |
| Supabase project URL (e.g. |
| Set to |
# Local test run without auth (never expose this publicly):
GEMINI_API_KEY=... ALLOW_UNAUTHENTICATED=1 node build/http.jsKnobs
Set in the env block if needed:
NANO_BANANA_MAX_IMAGE— max stored file size in bytes; larger images are compressed down (default512000, i.e. 500KB). Images under the threshold are stored untouched in their original format.NANO_BANANA_INLINE_PREVIEW— whethergenerate_image/edit_imageinclude an inline image preview by default (trueby default; setfalseto return URL/text only, which makes responses smaller and faster). Each call can override this with aninline_previewargument.NANO_BANANA_TIMEOUT_MS— per-operation timeout in milliseconds for the Gemini call, Firebase upload, and edit-image fetch (default60000). A stuck call fails cleanly with a "timed out" error instead of hanging until the client aborts the turn.
Security notes
The Gemini key and Firebase credentials stay in the MCP server process — never sent to Claude or its sandbox (the sandbox only ever sees a plain signed URL).
Keep the service-account
.jsonout of any git repo or synced folder — it's a real credential.No telemetry, no analytics.
License
MIT
Available Tools
6 toolsedit_imageEdit ImageA
Edit an existing image using natural language instructions. Provide the URL of the source image (e.g. a URL returned by generate_image) and describe the changes. The edited image is uploaded to Firebase Storage and a signed URL is returned. Nothing touches local disk.
Inputs: prompt (required), source_url (required), resolution, aspect_ratio, +1 more.
generate_imageGenerate ImageA
Generate an image from a text prompt, upload it to Firebase Storage, and return a signed download URL. The image is compressed only if it exceeds the size limit. Nothing is written to local disk and the image is not returned inline.
Inputs: prompt (required), resolution, aspect_ratio, inline_preview.
generate_image_batchGenerate Images (Batch)A
Generate multiple images from an array of prompts in a single call. Each image is uploaded to Firebase Storage (when configured) and a signed download URL is returned. Nothing is written to local disk and no inline previews are returned. Returns a text summary with one download URL per prompt.
Inputs: items (required).
set_modelSet Image ModelA
Switch the Gemini image model used by generate_image and edit_image. Options: 'nano-banana-pro' (highest quality, ~$0.09/img), 'nano-banana-2' (newest Flash, 4K capable, ~$0.05/img), 'nano-banana' (original Flash, fastest, ~$0.04/img). You can also pass a raw Gemini model ID directly.
Inputs: model (required).
set_resolutionSet Image ResolutionA
Set the source resolution the model generates at, for all subsequent generate/edit calls. The API supports '1K' (default), '2K', and '4K'. Note that images are always compressed to stay under the size limit regardless — higher values mainly affect source detail, not final file size.
Inputs: resolution (required).
set_url_lifetimeSet Signed URL LifetimeA
Set how long the download URLs returned by generate/edit stay valid, in minutes. Default is 30. Shorten it for tighter confidentiality (a leaked link expires sooner) or lengthen it if you need more time to fetch images. Applies to subsequent calls.
Inputs: minutes (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct role: three configuration setters (model, resolution, URL lifetime) and three distinct image operations (single generate, batch generate, edit). An agent can easily tell generate_image from generate_image_batch by the array-of-prompts semantics, and edit_image is clearly separated by requiring a source URL.
All tool names use snake_case with a verb_noun structure (set_model, set_resolution, set_url_lifetime, generate_image, generate_image_batch, edit_image). The set_* vs generate_*/edit_* split cleanly reflects configuration versus action tools.
Six tools is well-scoped for an image generation server: three configuration knobs and three generation/editing operations, with nothing redundant. Batch generation is the only adjacent tool, and it earns its place by avoiding repeated round trips.
The core lifecycle (generate, batch generate, edit, plus model/resolution/link-lifetime control) is covered and the returned signed URLs close the retrieval loop. Minor gaps remain: no getters to read back current model/resolution/lifetime settings, and no explicit aspect-ratio or other generation parameter control.
Related MCP Connectors
Generate and edit images and create short videos inside Claude. Prepaid credits, no subscription.
Generate images and video from Claude with one API key.
Make any photo or video you can describe, right from Claude.
Generate images from Claude, ChatGPT, Cursor and Codex with 12 top AI image models. Up to 4 images per call, SVG vectorization, background removal, upscaling and image-to-video. Remote MCP with OAuth, no API keys.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables Claude Desktop users to generate and edit high-quality images using Google's Gemini AI. Supports text-to-image generation, image transformations with text prompts, and automatic local saving with multilingual support.31MIT
- AlicenseAqualityDmaintenanceEnables Claude and other AI assistants to generate high-quality images up to 4K resolution using Google's Gemini image models, with support for flexible aspect ratios, natural language editing, and Google Search grounding for accurate results.412MIT
- FlicenseNot gradedqualityDmaintenanceEnables image generation and prompt enhancement within Claude.ai by leveraging Google Gemini models. It allows users to create visual content in various styles like photorealistic and 3D render directly through natural language.-
- AlicenseAqualityDmaintenanceEnables Claude Code to generate, edit, blend, and create variations of images using BytePlus SeeDream AI models, with streaming and Firebase sync.6MIT