Nano Banana MCP Server
# Nano Banana MCP Server
An MCP (Model Context Protocol) server for AI image generation using Google's **Nano Banana 2** (Gemini 3.1 Flash Image) model. Works with Claude Code, Gemini CLI, and any MCP-compatible client.
Forked from [gemini-cli-extensions/nanobanana](https://github.com/gemini-cli-extensions/nanobanana) (v1.0.11) by Google LLC, with added support for **aspect ratio** and **image resolution** control.
## What's different from upstream
- `aspectRatio` parameter: `1:1`, `9:16`, `16:9`, `3:4`, `4:3`
- `imageSize` parameter: `512px`, `1K`, `2K`, `4K`
- Both passed to the Gemini API via `imageConfig` in `generateContent`
## Tools
| Tool | Description |
|---|---|
| `generate_image` | Text-to-image with styles, variations, aspect ratio, resolution |
| `edit_image` | Edit an existing image from a text prompt |
| `restore_image` | Enhance or repair an existing image |
| `generate_icon` | App icons, favicons, and UI elements |
| `generate_pattern` | Seamless patterns and textures |
| `generate_story` | Sequential visual narratives (2-8 steps) |
| `generate_diagram` | Flowcharts, architecture, wireframes |
## Setup
### Prerequisites
- Node.js >= 18
- A [Gemini API key](https://aistudio.google.com/apikey)
### Claude Code
Add to `~/.claude.json`:
```json
{
"mcpServers": {
"nanobanana": {
"command": "node",
"args": ["/path/to/mcp-server/dist/index.js"],
"env": {
"GEMINI_API_KEY": "your-api-key"
}
}
}
}
```
### Gemini CLI
Install as an extension:
```bash
gemini extensions install https://github.com/gemini-cli-extensions/nanobanana
```
Or point to this server in your `settings.json`:
```json
{
"mcpServers": {
"nanobanana": {
"command": "node",
"args": ["/path/to/mcp-server/dist/index.js"],
"env": {
"GEMINI_API_KEY": "your-api-key"
}
}
}
}
```
## Usage examples
```
Generate a mountain landscape at sunset, 16:9, 2K resolution
Edit chill-original.png: remove all floating icons, keep only the person
Generate an app icon for a banana delivery service
```
## Environment variables
| Variable | Description |
|---|---|
| `GEMINI_API_KEY` | Your Gemini API key (required) |
| `NANOBANANA_MODEL` | Override the model (default: `gemini-3.1-flash-image-preview`) |
## Development
```bash
npm install
npm run build # compile TypeScript
npm run dev # watch mode
npm start # run the server
```
## License
Apache-2.0 -- see [LICENSE](LICENSE).
Original work Copyright 2025 Google LLC. Modifications by [lennix](https://github.com/lennix).
TDQS
Scored across 7 tools
Most tools are clearly differentiated by output type: icons, patterns, stories, and diagrams are specialized generation modes. The main overlap is between restore_image and edit_image, since both modify an existing image, but the descriptions distinguish enhancement/restoration from prompt-based editing.
All seven tools follow a consistent snake_case verb_noun pattern: restore_image, edit_image, generate_image, generate_icon, generate_pattern, generate_story, and generate_diagram. The convention is predictable and easy to scan.
Seven tools is well-scoped for an image generation and editing server. Each tool maps to a meaningful image workflow, and there are no obviously redundant entries.
The surface covers core image creation, editing, restoration, and several important specialized generation cases. Minor gaps may exist around image management operations such as listing or retrieving generated assets, but the creative workflow is largely complete.