nano-banana-mcp
# nano-banana-mcp
An MCP (Model Context Protocol) server for AI image generation using Google Gemini. Generate images from text prompts and optionally provide reference images to inform the output. Supports **MCP Apps** — generated images render as an interactive viewer directly inside the chat in VS Code Copilot, Claude, and other MCP Apps-capable clients.

## Features
- 🎨 **Text-to-image generation** via Google Gemini
- 🖼️ **Image editing** — pass reference images to restyle, edit, or combine
- ✨ **MCP Apps support** — images render as an interactive viewer inline in the conversation (VS Code Copilot, Claude Desktop, Goose, and more)
- 💾 **Save to disk** — optionally save outputs to a directory
## Quick start
```bash
npm install
npm run build
```
Get a free API key at [Google AI Studio](https://aistudio.google.com/apikey).
## Tool: `generate_image`
A single, flexible tool that handles all image generation — from scratch or informed by reference images.
| Parameter | Required | Description |
|-----------|----------|-------------|
| `prompt` | ✅ | Text prompt describing what to generate or how to transform the input |
| `images` | | Optional array of reference images (file paths, data URLs, or base64 strings) |
| `google_api_key` | | Google AI Studio API key (falls back to `GOOGLE_API_KEY` env var) |
| `output_dir` | | Directory to save images to disk |
| `output_name` | | Filename prefix (default: `generated`) |
### Examples
- **From scratch:** `"A minimalist app icon for a weather app, flat design, blue gradient"`
- **Edit an image:** `"Change the background to a sunset"` + `images: ["./photo.jpg"]`
- **Combine references:** `"Merge these two logo concepts into one"` + `images: ["./logo1.png", "./logo2.png"]`
## VS Code configuration
Add to your `mcp.json` (User or workspace):
```json
{
"servers": {
"nano-banana": {
"type": "stdio",
"command": "node",
"args": ["<path-to-this-repo>/dist/index.js"],
"env": {
"GOOGLE_API_KEY": "${input:google-api-key}"
}
}
},
"inputs": [
{
"id": "google-api-key",
"type": "promptString",
"description": "Google AI Studio key",
"password": true
}
]
}
```
## Claude Desktop configuration
Add to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"nano-banana": {
"command": "node",
"args": ["<path-to-this-repo>/dist/index.js"],
"env": {
"GOOGLE_API_KEY": "your-google-api-key"
}
}
}
}
```
## Development
```bash
npm run dev # Run with tsx (no build step)
npm run build # Compile TypeScript
npm start # Run compiled output
```
TDQS
Scored across 1 tool
There is only one tool, so there is no possibility of selecting the wrong one. Its purpose (generate or edit images from a prompt with optional references) is stated clearly and unambiguously.
The single name generate_image follows a clean verb_noun snake_case convention that describes exactly what the tool does. With only one tool there is nothing to be inconsistent with, and the name sets a predictable pattern.
One tool is defensible for a narrowly focused image-generation server, but the surface feels thin: generation and editing are collapsed into a single entry point with no separate controls or helpers. It sits at the borderline of the 'too few' band rather than being clearly well-scoped.
Core capability (text-to-image and reference-based editing) is covered in one call, but there are notable gaps: no exposure of output controls like aspect ratio, image count, or model/quality selection, and no separate edit endpoint for simpler prompting. Agents can partly work around this via prompt text, but the surface is minimal.