Generate Images in Gemini CLI: MCP Server Setup
Connect Gemini CLI to a remote MCP server and generate Nano Banana images and Veo video from your terminal. Real config, five quirks the docs skip, costs from $0.03.

Gemini CLI is Google's open-source terminal agent, and MCP is the protocol it uses to reach tools that live outside itself. Point it at a remote MCP server and the same chat session that edits your code can also produce images, video and speech, writing the files straight into your working directory.
Quick answer: run gemini mcp add --transport http --scope user bananabanana https://bananabanana.pro/api/mcp -H "Authorization: Bearer $BB_KEY", trust the folder when the CLI asks, then check gemini mcp list for a green Connected. Images cost from $0.03 each, billed per generation from your balance.

Everything below was run against Gemini CLI 0.55.1 on August 17, 2026, with a live bb_live_… key. Where the official docs and the actual CLI disagree, I say so.
Setup, honestly
Two commands. The first registers the server:
export BB_KEY=bb_live_… # create one at https://bananabanana.pro/profile
gemini mcp add --transport http --scope user \
bananabanana https://bananabanana.pro/api/mcp \
-H "Authorization: Bearer $BB_KEY"
The second checks it:
gemini mcp list
# ✓ bananabanana: https://bananabanana.pro/api/mcp (http) - Connected
If you get Disabled instead of Connected, read the next section before you touch anything else. That one caught me for a good five minutes.
Five quirks the docs don't mention
Folder trust silently disables everything. Run gemini mcp list in a directory the CLI doesn't trust and you get this:
Warning: MCP servers are configured but disabled because this folder is untrusted.
User-level servers are also suppressed in untrusted folders to prevent accidental side-effects.
○ bananabanana: https://bananabanana.pro/api/mcp (http) - Disabled
Note the second line. Even a --scope user server stays off. The CLI prompts you to trust a folder on first interactive launch; if you're scripting, the trust decision lives in ~/.gemini/trustedFolders.json as a plain map of path to TRUST_FOLDER. Sensible default, terrible failure mode, because nothing about "Disabled" points at the folder.
gemini mcp add writes url, not httpUrl. The docs describe httpUrl for streamable HTTP. What CLI 0.55.1 actually produced for me was:
{
"mcpServers": {
"bananabanana": {
"url": "https://bananabanana.pro/api/mcp",
"type": "http",
"headers": { "Authorization": "Bearer $BB_KEY" }
}
}
}
Both shapes connect. But if you're copying a config from the docs and comparing it to what the CLI generated, you'll think one of them is broken. Neither is.
Default scope is project, and that's where your key goes. Leave off --scope user and the key lands in .gemini/settings.json inside your repository. One git add . later it's in your history. Use --scope user, or keep the header as a variable reference like the block above.
$BB_KEY interpolation works, and fails quietly. With the variable exported, Connected. Open a fresh shell without exporting it, and the same config reports Disconnected rather than anything about authentication. Worth a line in your shell profile.
Gemini CLI probes for SSE and gets a 405. Watching server logs during a connection, the sequence was: POST initialize (200), POST notification (202), GET /api/mcp (405), POST tools/list (200). The GET is the CLI trying to open a server-sent-events channel on a stateless server. It fails, the CLI shrugs, everything works. If you run your own MCP server, don't chase that 405.

What you get and what it costs
Ten tools land in the session, the same set every other client sees on the tool reference. Five are free to call: list_models, get_account, top_up, get_result, list_generations. The rest bill per generation from your account balance.
| What | Model | Price |
|---|---|---|
| Image, 1K | Nano Banana 2 Lite | $0.03 |
| Image, 512 → 4K | Nano Banana 2 | $0.03 – $0.13 |
| Image, 1K → 4K | Nano Banana Pro | $0.11 – $0.20 |
| Video, 3–10 s with sound | Gemini Omni Flash | $0.10 per second |
| Video, 4–8 s | Veo 3.1 family | up to $4.40 per clip |
| Speech | Gemini Flash TTS | $0.01 per 200 characters |
Video and multi-image calls always quote first. The agent gets a price back, nothing is charged, and the generation starts only after it confirms that exact number. Content-filter rejections and upstream failures are refunded automatically, which matters more than it sounds when you're batching prompts unattended.
Top-ups carry bonuses: 5% from $50, 10% from $100, and an active promo code adds another 10% of the deposit. A $100 deposit with a code credits $120.

Yes, Gemini generating Nano Banana images is funny

Gemini CLI talking to a Gemini image model through a third server does look like a detour. There is a plainer path: set up a cloud billing account, get provisioned for the model APIs, wire up credentials, handle quotas per region. That's a fine afternoon if you're building infrastructure.
This is the other trade. One bearer token, a prepaid balance, no billing account, no quota tickets, no region pinning. You also get the Veo and Omni video models and TTS through the same connection, priced per generation instead of per project. If your work is making things rather than operating a platform, that's usually the better shape.
I'd be lying if I said it's cheaper at scale. It isn't, past some volume. It's just faster to start and impossible to accidentally leave running.
If your editor is somewhere else, the same server plugs into Claude Code, Cursor and Codex with a different config file and the same key.
A use case that earns its keep: docs illustrations
Here's the thing I actually use this for. A repository with a docs/ folder, twelve pages, each needing a header image in one consistent style.
In the session:
Read every heading in docs/*.md. For each file, generate a 16:9 illustration matching the page topic, in this style: editorial illustration, pastel paper background, dark ink details, violet and amber accents, no text. Use nano-banana-pro. Save each as docs/img/.png and add the image reference under the page title.
The agent reads the files, calls generate_image per page, polls get_result, downloads, writes the markdown. Twelve images at $0.11 comes to $1.32, and the whole thing runs while you get coffee. Every illustration in this article came out of the same pipeline, Nano Banana Pro, same style paragraph.
Two things I'd tell you before you try it. Ask for one image first and check the style, because a wrong style paragraph multiplied by twelve is $1.32 of nothing. And keep --trust off: confirmation prompts per tool call are mildly annoying and much better than an agent looping on a paid tool.

Does OAuth work instead of a key?
Gemini CLI documents OAuth 2.0 support for remote MCP servers, with discovery and a /mcp auth command. Our server is a full OAuth 2.1 authorization server (dynamic client registration, PKCE S256, RFC 9728 discovery), and clients like Claude Code and claude.ai sign in that way without a key at all.
I tested the API-key path end to end and it works. The OAuth path through Gemini CLI I did not verify in this session, so treat it as "should work, unconfirmed" rather than a promise. The key takes ten seconds and never expires unless you revoke it.
FAQ
Where does the settings file live?
~/.gemini/settings.json for user scope, .gemini/settings.json for project scope. gemini mcp add --scope user writes to the first one.
Why does the server show Disabled?
The folder isn't trusted. Trust it interactively on launch, or add the path to ~/.gemini/trustedFolders.json with the value TRUST_FOLDER. User-scope servers are suppressed too, so scope won't save you.
Can I limit which tools the model sees?
Yes. --include-tools and --exclude-tools on gemini mcp add, or includeTools / excludeTools in settings. Excluding wins over including. Handy if you want images available but video off-limits.
Does it work in a project my team shares?
Put the server in project scope and the key in an environment variable, never inline. Everyone runs export BB_KEY=… with their own key, and the committed config stays clean.
What if a generation fails?
You're refunded automatically, including content-filter rejections. Retrying a borderline prompt is genuinely worth it — the safety check that runs on the finished file judges pixels, and a second run draws a different picture.
Prefer clicking to typing? The browser generator runs the same models on the same balance. Otherwise start with list_models once you're connected. It's free, it prints current prices, and it confirms the whole chain works before you spend three cents.