Nanobanana MCP Server
# Nanobanana MCP Server
An MCP (Model Context Protocol) server for Google's Gemini image generation API. Generate and edit images using natural language prompts.
## Features
- **Text-to-Image Generation**: Create images from descriptive text prompts
- **Image Editing**: Modify existing images using natural language instructions
- **Multiple Models**: Support for Gemini 2.0 Flash image generation models
## Prerequisites
- Node.js 18 or higher
- A Google AI API key (get one at https://aistudio.google.com/apikey)
## Installation
```bash
npm install
npm run build
```
## Configuration
Set your Gemini API key as an environment variable:
```bash
export GEMINI_API_KEY="your-api-key-here"
```
## Usage with Claude Code
```bash
claude mcp add-json nanobanana '{
"command": "node",
"args": ["/path/to/nanobanana-mcp-server/dist/index.js"],
"env": {
"GEMINI_API_KEY": "your-api-key-here"
}
}'
```
## Available Tools
### `nanobanana_generate_image`
Generate an image from a text prompt.
**Parameters:**
- `prompt` (required): Text description of the image to generate
- `output_path` (required): File path to save the generated image
- `model` (optional): Gemini model to use (default: `gemini-2.0-flash-exp-image-generation`)
**Example:**
```
Generate an image of a serene mountain lake at sunset with purple and orange sky reflections
```
### `nanobanana_edit_image`
Edit an existing image using a text prompt.
**Parameters:**
- `prompt` (required): Description of the edit to apply
- `image_path` (required): File path to the image to edit (PNG, JPEG, WebP, or GIF)
- `output_path` (required): File path to save the edited image
- `model` (optional): Gemini model to use
**Example:**
```
Change the car color from blue to red
```
### `nanobanana_list_models`
List available Gemini models for image generation.
**Parameters:**
- `response_format` (optional): Output format - `markdown` or `json` (default: `markdown`)
## Development
```bash
# Watch mode with auto-reload
npm run dev
# Build
npm run build
# Run
npm start
```
## License
MIT
TDQS
Scored across 3 tools
The three tools target clearly different operations: creating a new image from a prompt, editing an existing image file, and listing available models. There is no plausible overlap, since the input shape (prompt-only vs. prompt+image_path) makes the boundary between generate and edit unambiguous.
All tools use the identical pattern of a server prefix plus a verb_noun suffix: nanobanana_generate_image, nanobanana_list_models, nanobanana_edit_image. This is a predictable, uniform convention with no deviation in casing or verb style.
Three tools is on the low end but each serves a distinct, necessary role for an image-generation server, with no filler. The surface is tightly scoped rather than bloated, though it sits near the 'thin' boundary.
The core lifecycle is covered: discover models, generate an image, and edit an existing image. Minor gaps exist, such as batch generation or an image-analysis/describe operation, but agents can work around these with repeated single-image calls.