🍌 banana-mcp

↑ generated with this tool (scripts/make_hero.py).
An MCP server (+ standalone Python scripts) that generates images with your own
Google Gemini session — the "Nano Banana" image model — driven straight over
Gemini's web HTTP flow. No browser, no headful Chrome: it's headless by
nature.
You bring your own Google account cookies (exported with a browser
extension). The server signs requests as you, running your own prompts
against your own Gemini access.
⚠️ Personal use — read first
- This is a bring-your-own-credentials tool for personal use. It uses
your own Google/Gemini session, which you supply locally. The project
ships no tokens and stores nothing remotely.
- Automating a web product may be restricted by Google's Terms of Service. You
are solely responsible for how you use it, for the prompts you run, and for
the images you generate — including compliance with Google's policies and all
applicable laws in your jurisdiction.
- Do not use it to impersonate real people, produce content depicting
minors, or generate anything illegal. All example prompts are of fictional
adults or neutral scenes.
- Your cookies are a live login. Never commit
secrets/, storage dumps, or
HAR files. The repo's .gitignore blocks them by default — keep it that way.
How it works
Gemini's web UI generates images via an HTTP RPC endpoint
(.../BardFrontendService/StreamGenerate) — not a WebSocket. banana-mcp
replays that flow with your session cookies:
- Auth = your Google cookies (
__Secure-1PSID, optionally __Secure-1PSIDTS,
plus the standard SID/SAPISID/… set), captured once with a browser
extension.
- The prompt (plain text or a structured JSON "Nano Banana" object) is sent
as the message body, with an image-capable model header.
- The response returns the generated image URL(s); the tool downloads them to
output/.
Under the hood it uses the excellent
gemini_webapi library, which
handles the XSRF (SNlM0e) token and __Secure-1PSIDTS rotation.
Install
Pick one. All three read your cookies from the same place
(~/.config/banana-mcp/cookies.json — see Cookies below).
A) As a Claude Code plugin (easiest)
/plugin marketplace add nsozturk/banana-mcp
/plugin install banana-mcp@banana-mcp
Requires uv on your PATH (the plugin launches the
server with uvx). Install it once:
curl -LsSf https://astral.sh/uv/install.sh | sh (macOS/Linux) or
irm https://astral.sh/uv/install.ps1 | iex (Windows).
B) With uvx / pip (no clone)
# run the MCP server directly (no install)
uvx --from git+https://github.com/nsozturk/banana-mcp banana-mcp
# or install the console scripts
pip install git+https://github.com/nsozturk/banana-mcp
This exposes two commands: banana-mcp (the MCP server) and
banana-generate (the CLI batch generator).
C) From a clone (for development)
git clone https://github.com/nsozturk/banana-mcp && cd banana-mcp
python3.11 -m venv .venv
.venv/bin/python -m pip install -e . # or: -r requirements.txt
Python 3.11+ required (the upstream library needs enum.StrEnum).
Cookies (bring your own)
- Sign in to https://gemini.google.com in Chrome with the account you want to
use, and confirm you can generate an image there.
- Install the StorageDump Chrome extension:
https://chromewebstore.google.com/detail/storagedump/kihoghfekemdccfnpjefmggehpgnjnab
- On the Gemini tab, export the site's storage with StorageDump. It saves a
storagedump_gemini.google.com_<timestamp>/ folder containing cookies.json.
- Extract just the cookies this tool needs (values are never printed):
python scripts/extract_cookies.py path/to/storagedump_gemini.google.com_<timestamp>
# writes ~/.config/banana-mcp/cookies.json (chmod 600). Use --out to override.
You can also point at any cookie file with the BANANA_COOKIES env var.
Cookies rotate and go stale. If generations start returning "signed out",
re-export a fresh StorageDump and re-run extract_cookies.py.
Connect as an MCP server
banana-mcp speaks MCP over stdio and exposes four tools:
| Tool | What it does |
|---|
banana_account_status | Check the session is authenticated / image-capable |
banana_generate_image | Generate from a free-form prompt string |
banana_generate_from_file | Batch-generate from a *-image-prompts.json file |
banana_list_prompts | List prompt ids/titles inside a prompt JSON file |
Register with Claude Code
The plugin (Install → A) wires this up automatically. To register manually: