AI image generation and editing for Claude Code via Gemini. Generate, edit, and iteratively refine images using text prompts without leaving your terminal.
A hardened MCP server for Gemini image generation. Fork of ConechoAI/Nano-Banana-MCP with security fixes, strict TypeScript, and model selection.
generate_image, edit_image, continue_editingNANOBANANA_MODEL env var with whitelist validationany types, Zod validation on all inputsAdd to ~/.claude/settings.json:
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": ["tsx", "/path/to/nanobanana-mcp/src/index.ts"],
"env": {
"GEMINI_API_KEY": "your-api-key",
"NANOBANANA_MODEL": "gemini-2.5-flash-image"
}
}
}
}
GEMINI_API_KEY=your-key npx tsx src/index.ts
The server communicates over stdio using the MCP protocol.
generate_imageGenerate a new image from a text prompt.
prompt (required): Text describing the image to create (max 10,000 chars)
edit_imageEdit an existing image with a text prompt.
imagePath (required): Full file path to the image to edit
prompt (required): Text describing the modifications (max 10,000 chars)
referenceImages (optional): Array of file paths to reference images
continue_editingContinue editing the last generated/edited image in the current session.
prompt (required): Text describing changes to make (max 10,000 chars)
referenceImages (optional): Array of file paths to reference images
All configuration is via environment variables. No config files are written to disk.
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY | Yes | Google Gemini API key |
NANOBANANA_GEMINI_API_KEY | No | Override for GEMINI_API_KEY (takes priority) |
NANOBANANA_MODEL | No | Model to use (see below) |
| Model ID | Description |
|---|---|
gemini-2.5-flash-image | Fast generation, good for high-volume use (default) |
gemini-3-pro-image-preview | Pro quality, complex prompts, better text rendering |
gemini-3.1-flash-image-preview | Latest model, advanced features |
Generated images are saved to ~/nanobanana-images/ with unique filenames. The tool response includes both the file path and the image data inline.
This fork addresses the following security issues from the original:
| Issue | Fix |
|---|---|
| API key saved to disk in plaintext | Removed config file persistence entirely |
configure_gemini_token tool accepts key via MCP | Tool removed; keys only via env vars |
Path traversal in editImage | validatePath() checks paths resolve within $HOME or $TMPDIR |
| No prompt length validation | Capped at 10,000 chars via Zod |
| Hardcoded model | NANOBANANA_MODEL env var with whitelist |
| Silent swallowing of reference image errors | Errors now thrown and reported |
Math.random() for filenames | crypto.randomUUID() |
| No file size limit on reads | Max 20MB |
| Verbose errors leak internal paths | Sanitized error messages |
process.cwd() fallback for output dir | Fixed to ~/nanobanana-images/ |
npm install
npm run typecheck # Type check without emitting
npm run dev # Run with tsx (hot reload)
npm run build # Compile to dist/
src/
index.ts # MCP server entry point (3 tool handlers)
gemini-client.ts # Gemini API wrapper with model selection
file-handler.ts # Secure file I/O with path validation
types.ts # TypeScript interfaces and Zod schemas
MIT - Based on ConechoAI/Nano-Banana-MCP
Admin access level
Server config contains admin-level keywords
Requires secrets
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
Needs API keys or credentials to function
Needs API keys or credentials to function
Uses power tools
Uses Bash, Write, or Edit tools
Uses power tools
Uses Bash, Write, or Edit tools
npx claudepluginhub dojocodinglabs/nanobanana-mcp --plugin nanobanana-mcpFull video production pipeline for Remotion — gives Claude eyes (video analysis), voice (TTS/voiceover), ears (music/SFX), stock footage, AI image/video generation, TikTok captions, 3D content, and more. By Dojo Coding Labs.
In-context coding tutor for Claude Code. Learn from your real project with explanations, quizzes, diagnostics, and belt-based progression — locally and privately.
The disciplined dev lifecycle — implement issues, review PRs, sync releases, test E2E, manage sessions, stash secrets, and enforce manifest-driven tool-call hooks. One plugin to make no mistakes.
The non-engineer's development guardrails. A full dev lifecycle workflow — from spike to PR to review — built by a Head of Product who got tired of asking engineers for permission to ship. By Dojo Coding Labs.
Backwards-from-success product methodology for AI-native development teams. Define what done looks like, then reverse-engineer the path to get there. Includes Synthetic Demand Validation to forecast whether an offer, creative, copy, feature, or price will sell.
Access thousands of AI prompts and skills directly in your AI coding assistant. Search prompts, discover skills, save your own, and improve prompts with AI.
Feature development with code-architect/explorer/reviewer agents, CLAUDE.md audit and session learnings, and Agent Skills creation with eval benchmarking from Anthropic.
Production-grade engineering skills for AI coding agents — covering the full software development lifecycle from spec to ship.
Permanent coding companion for Claude Code — survives any update. MCP-based terminal pet with ASCII art, stats, reactions, and personality.
Intelligent draw.io diagramming plugin with AI-powered diagram generation, multi-platform embedding (GitHub, Confluence, Azure DevOps, Notion, Teams, Harness), conditional formatting, live data binding, and MCP server integration for programmatic diagram creation and management.
Complete developer toolkit for Claude Code