mcpField
N
nanobanana-mcp

nanobanana-mcp

Local
github.com/getjoystickMedia & Design2Updated 11w ago

About nanobanana-mcp

nanobanana-mcp is an MCP server for generating and editing images and generating or extending videos with Google's Nano Banana and Veo models. It returns saved file paths rather than image data, keeping client context smaller.

Key features

  1. 01Generate and edit images
  2. 02Generate and extend videos
  3. 03Use reference images for editing
  4. 04Set image ratio and resolution
  5. 05Poll video jobs and list models
  6. 06Return saved file paths

Use cases

  1. 01Create images from prompts
  2. 02Edit images using reference files
  3. 03Generate video from text or an image
  4. 04Continue a Veo clip with an extension

MCP support

Exposes six tools to MCP clients: image generation and editing, video generation and extension, video-result polling, and model listing. Image and video outputs are saved to disk, with file paths returned to the client.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"getjoystick-nanobanana": {
"command": "npx",
"args": [
"-y",
"@nanobanana/mcp"
],
"env": {
"GEMINI_API_KEY": "<GEMINI_API_KEY>",
"NANOBANANA_MODEL": "<NANOBANANA_MODEL>",
"NANOBANANA_OUTPUT_DIR": "<NANOBANANA_OUTPUT_DIR>"
}
}
}
}
Run commandnpx -y @nanobanana/mcp
Environment variables to set
GEMINI_API_KEYSecretGemini API key from https://aistudio.google.com/apikey
NANOBANANA_MODELDefault image model override (default: gemini-3.1-flash-image)
NANOBANANA_OUTPUT_DIRDefault output directory override

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@nanobanana/mcp0.1.2

Tools

3

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
sizeenumNoOutput resolution1K | 2K | 4K
modelstringNoGemini image model id (default: gemini-3.1-flash-image)
promptstringYesImage description
filenamestringNoBase filename without extension
groundingbooleanNoGround with Google Search for factual accuracy
outputDirstringNoSave directory (default: ./nano-banana)
aspectRatiostringNoe.g. 1:1, 16:9, 9:16, 4:3, 21:9

Details

From the project README

@nanobanana/mcp 🍌

A lean MCP server for Google's Nano Banana (Gemini) image models and Veo video models. It generates and edits images and generates video from any MCP client (Claude Code, Claude Desktop, Cursor) and hands back file paths instead of base64, so your agent's context stays small.

  • Six tools and nothing else: generate_image, edit_image, generate_video, extend_video, get_video_result, list_models
  • Defaults to Nano Banana 2 (gemini-3.1-flash-image) and Veo 3.1 Fast (veo-3.1-fast-generate-preview). Switch models per call or via env. If a pinned model id ever goes stale, list_models shows what your key can actually use.
  • Multi-image editing: pass reference images for style transfer, characters, or compositing
  • Control over aspect ratio (1:1 through 21:9, out to 1:4 and 8:1) and resolution (512, 1K, 2K, 4K)
  • Google Search grounding for images that need real-world accuracy, like infographics
  • Video as a job, not a blocked call: generation takes 1–6 min, so generate_video returns a job id and get_video_result polls within every client's 60s timeout
  • Safe output paths. The server never writes to / when a desktop MCP client spawns it there.
  • Auth lives in env vars only, so your API key never passes through chat context

Quick start

Get a free Gemini API key at aistudio.google.com/apikey.

Claude Code

claude mcp add nanobanana -e GEMINI_API_KEY=your_key -- npx -y @nanobanana/mcp

Also listed in the MCP Registry as io.github.getjoystick/nanobanana-mcp.

Claude Desktop / Cursor: add this to claude_desktop_config.json or .cursor/mcp.json:

{
  "mcpServers": {
    "nanobanana": {
      "command": "npx",
      "args": ["-y", "@nanobanana/mcp"],
      "env": { "GEMINI_API_KEY": "your_key" }
    }
  }
}

Tools

generate_image
ParamRequiredDescription
prompt✅Image description
modelGemini image model id (default gemini-3.1-flash-image)
aspectRatio1:1, 16:9, 9:16, 21:9, extremes up to 1:4 and 8:1
size512, 1K, 2K, or 4K
groundingGround with Google Search for factual accuracy
thinkingLevelminimal or high; high helps complex or text-heavy images
outputDirSave directory (default ./nano-banana)
filenameBase filename without extension
edit_image

Same params, plus:

ParamRequiredDescription
images✅Input file path(s): png, jpg, webp, heic, or pdf. The first is the base; the rest are references.

Both tools save to disk and return the file path.

list_models

Takes no params. Lists the image and video model ids your API key can use, in two sections. Handy when a pinned model id stops working, which is how earlier Nano Banana servers broke — and Veo's ids are previews that will be renamed.

Video

Veo generation takes 1–6 minutes, and MCP clients kill a tool call at ~60s. So video is a job: you start one, then poll.

generate_video   →  "Video job started: <jobId>"
get_video_result →  "Still processing (<jobId>)…"   ← blocks up to 45s, then call again
get_video_result →  "Saved: /path/to/clip.mp4 (veo-3.1-fast-generate-preview)
                     Veo URI (needed for extend_video; expires ~2 days): https://…"

get_video_result does the waiting for you — each call blocks up to waitSeconds (45 by default, the most that fits inside a client's 60s timeout). Call it right away and call it again the moment it returns; there is no need to pause in between, which matters because an agent has no way to sleep.

The job id carries everything the server needs, so it keeps working even if the server process restarts in between. Download promptly: Google deletes generated videos server-side after ~2 days — and that server-side copy is the only thing extend_video can extend, so keep the Veo URI if you plan to continue the shot.

Animating an image you just generated? Give generate_image an aspectRatio of 16:9 or 9:16 first. Veo only outputs those two ratios and crops the frame you hand it, so a square image loses its edges — and you pay for the clip either way.

generate_video
ParamRequiredDescription
prompt✅Scene, motion, camera, and any dialogue or SFX — Veo generates native audio
imageImage path used as the starting frame (image-to-video). Veo crops it to aspectRatio, so make it 16:9 or 9:16.
referenceImagesImage paths for character/object/style consistency: up to 3 for asset, only 1 for style. Not combinable with image; not supported by Lite.
referenceTypeasset (characters, objects, scenes — default) or style (aesthetics)
modelVeo model id (default veo-3.1-fast-generate-preview)
aspectRatio16:9 or 9:16
resolution720p, 1080p, or 4k; 1080p and 4k require durationSeconds: 8
durationSeconds4, 6, or 8; must be 8 with referenceImages or 1080p/4k
negativePromptWhat should not appear
personGenerationallow_all (text-to-video and extension only) or allow_adult. Image-based generation — image, referenceImages — requires allow_adult, and EU/UK/CH/MENA accept only allow_adult.

Frames (image, referenceImages) must be png or jpg.

extend_video

Extends a Veo-generated clip by ~7s, continuing from its final second. Input up to ~141s, output up to ~148s across at most 20 extensions, always 720p. Not supported by Lite.

Extension runs on Google's copy of the video, not on your local file — pass the Veo URI that get_video_result prints. It expires with the video after ~2 days.

ParamRequiredDescription
prompt✅What happens next
video✅The Veo URI from get_video_result (an https:// URI, not a file path)
modelVeo model id (default veo-3.1-fast-generate-preview); Lite cannot extend
negativePromptWhat should not appear
get_video_result
ParamRequiredDescription
jobId✅The id returned by generate_video / extend_video
waitSecondsHow long this call blocks waiting for the job (default 45, which is also the max)
outputDirSave directory (default ./nano-banana)
filenameBase filename without extension

Saves the finished video as .mp4 and returns the absolute path, plus the Veo URI of the server-side copy that extend_video needs.

Configuration

Env varDescription
GEMINI_API_KEYRequired. Gemini API key (GOOGLE_API_KEY also works)
NANOBANANA_MODELDefault image model override
NANOBANANA_VIDEO_MODELDefault video model override
NANOBANANA_OUTPUT_DIRDefault output directory override

Models

Model idNotes
gemini-3.1-flash-imageDefault. Nano Banana 2: 4K output, strong text rendering
gemini-3-pro-imageNano Banana Pro, for complex scenes that need deeper reasoning
gemini-2.5-flash-imageThe original Nano Banana (legacy; Google retires it 2026-10-02)
Video models

Veo has no free tier — you need a billing-enabled API key, and you are charged per second of output.

Model idPrice8s clipNotes
veo-3.1-fast-generate-preview$0.10/s~$0.80Default. Full feature set; best quality-per-dollar
veo-3.1-generate-preview$0.40/s~$3.20Full feature set; highest fidelity
veo-3.1-lite-generate-preview$0.05/s~$0.40Cheapest; text- and image-to-video only — no extension, no reference images, 1080p max

All three do text-to-video, image-to-video, and native audio. Extension, reference images, and 4k are Veo 3.1 and 3.1 Fast only. Clips are 4, 6, or 8 seconds, in 16:9 or 9:16.

Development

npm install
npm run build
GEMINI_API_KEY=your_key npm run smoke   # end-to-end test against the live API
GEMINI_API_KEY=your_key SMOKE_VIDEO=1 npm run smoke   # also generates a 4s clip (~$0.20)

Acknowledgements

Inspired by other Nano Banana MCPs. Built with Claude Code.

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.