Gemini Nanobanana Mcp

by Junhan2

11 stars
311 downloads
Not rated
GitHub

About

MCP server for Google Gemini 2.5 Flash Image preview (text-to-image, editing, composition)

Details

Author
Junhan2
GitHub stars
11
Downloads
311
Categories
AI

- Text-to-image generation from any description
- Edit uploaded images with natural language instructions
- Combine multiple images into a collage or composition
- Apply artistic style from one image to another
- Auto‑save images to disk or disable with AUTO_SAVE=false
- Optional HTTP mode for external integrations

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Gemini Nanobanana Mcp
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Configure the server in Claude Desktop, Claude Code, or Cursor by adding a JSON entry with the npx command and your GEMINI_API_KEY environment variable. After restarting your client, simply ask Claude to generate, edit, or compose images. Images are auto-saved to ~/Downloads/gemini-images/ by default, and you can specify a custom path in your prompt.

generate_image

Generate an image from a text prompt using Gemini 2.5 Flash Image

edit_image

Edit an image using a prompt. Provide one input image via base64 or file path.

compose_images

Compose a new image using multiple input images and a guiding prompt.

style_transfer

Transfer style from a style image to a base image, guided by an optional prompt.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "gemini nanobanana mcp": {
            "gemini-nanobanana-mcp": {
                "command": "npx",
                "args": [
                    "gemini-nanobanana-mcp@latest"
                ],
                "env": {
                    "GEMINI_API_KEY": "your-api-key",
                    "AUTO_SAVE": "true",
                    "DEFAULT_SAVE_DIR": "~/Pictures/AI-Images",
                    "LOG_LEVEL": "debug"
                }
            }
        }
    }
}

McpServers

{
    "gemini-nanobanana-mcp": {
        "command": "npx",
        "args": [
            "gemini-nanobanana-mcp@latest"
        ],
        "env": {
            "GEMINI_API_KEY": "your-api-key",
            "AUTO_SAVE": "true",
            "DEFAULT_SAVE_DIR": "~/Pictures/AI-Images",
            "LOG_LEVEL": "debug"
        }
    }
}

🎨 Gemini Nanobanana MCP

npm version
License: MIT
TypeScript
Node.js

> Generate images from text with Claude! Simply type "Draw a cute cat" and get instant AI-generated images.

A beginner-friendly Model Context Protocol (MCP) server that brings Google's Gemini 2.5 Flash Image generation directly into your Claude conversations.

Quick Start - Just 3 Steps

1️⃣ Get Your API Key (1 minute)

1. Visit Google AI Studio 2. Sign in with your Google account 3. Click "Create API key" → Copy the key

2️⃣ Install in Your Claude Client (2 minutes)

<details>
<summary><b>Claude Desktop (Windows)</b></summary>

1. Open Notepad
2. Copy this code and replace YOUR_API_KEY with your actual key:

{
"mcpServers": {
"gemini-nanobanana-mcp": {
"command": "npx",
"args": ["gemini-nanobanana-mcp@latest"],
"env": {
"GEMINI_API_KEY": "YOUR_API_KEY"
}
}
}
}

3. Save as: %APPDATA%/Claude/claude_desktop_config.json
4. Restart Claude Desktop

</details>

<details>
<summary><b>Claude Desktop (Mac)</b></summary>

1. Open Terminal (search "Terminal" in Spotlight)
2. Run this command (replace YOUR_API_KEY):

cat > ~/Library/Application\ Support/Claude/claude_desktop_config.json << 'EOF'
{
"mcpServers": {
"gemini-nanobanana-mcp": {
"command": "npx",
"args": ["gemini-nanobanana-mcp@latest"],
"env": {
"GEMINI_API_KEY": "YOUR_API_KEY"
}
}
}
}
EOF

3. Restart Claude Desktop

</details>

<details>
<summary><b>Claude Code (Easiest!)</b></summary>

Just run this one command in your terminal (replace YOUR_API_KEY):

claude mcp add gemini-nanobanana-mcp -s user -e GEMINI_API_KEY="YOUR_API_KEY" -- npx -y gemini-nanobanana-mcp@latest

</details>

<details>
<summary><b>Cursor</b></summary>

1. Go to Cursor SettingsMCPAdd new MCP Server
2. Fill in:
- Name: gemini-nanobanana-mcp
- Command: npx
- Args: gemini-nanobanana-mcp@latest
- Environment Variables: GEMINI_API_KEY = YOUR_API_KEY
3. Restart Cursor

</details>

3️⃣ Start Creating! (0 minutes)

Try these in Claude:
- "Generate a cute puppy playing in a garden"
- "Create a beautiful sunset over mountains"
- "Draw a red sports car"
- "Make an abstract colorful painting"

Your images automatically save to ~/Downloads/gemini-images/

---

See It In Action

Basic Usage

You: Generate a cozy coffee shop interior
Claude: [Generating image...]
Image generated and saved to: ~/Downloads/gemini-images/generate-2025-01-09-14-30-45.png
Size: 1.2MB | Format: PNG

Custom Save Location

You: Create a sunset landscape and save it as ./my-sunset.png
Claude: Image saved to: ./my-sunset.png

---

What You Can Do

Text-to-Image Generation

Create any image you can imagine from a text description.

Examples:
- "A majestic dragon flying over a medieval castle"
- "Modern minimalist living room with plants"
- "Vintage bicycle on a cobblestone street"

Image Editing

Edit existing images with natural language instructions.

How to use:
- Upload an image to Claude
- Say: "Make this image black and white"
- Or: "Add a sunset background to this photo"

Image Composition

Combine multiple images into one creative composition.

How to use:
- Upload 2-10 images to Claude
- Say: "Combine these images into a collage"
- Or: "Blend these photos together artistically"

Style Transfer

Apply the artistic style of one image to another.

How to use:
- Upload two images: a content image and a style reference
- Say: "Apply the style of the second image to the first"

---

Configuration Options

<details>
<summary><b>Environment Variables</b></summary>

| Variable | Default | Description |
|----------|---------|-------------|
| GEMINI_API_KEY | Required | Your Google AI Studio API key |
| AUTO_SAVE | true | Automatically save images when no path specified |
| DEFAULT_SAVE_DIR | ~/Downloads/gemini-images | Default directory for saved images |
| LOG_LEVEL | info | Logging level (error, warn, info, debug) |

Example with custom settings:

{
"mcpServers": {
"gemini-nanobanana-mcp": {
"command": "npx",
"args": ["gemini-nanobanana-mcp@latest"],
"env": {
"GEMINI_API_KEY": "your-api-key",
"AUTO_SAVE": "true",
"DEFAULT_SAVE_DIR": "~/Pictures/AI-Images",
"LOG_LEVEL": "debug"
}
}
}
}

</details>

<details>
<summary><b>Disable Auto-Save</b></summary>

To only save when you explicitly request it:

{
"env": {
"GEMINI_API_KEY": "your-api-key",
"AUTO_SAVE": "false"
}
}

Then images will only appear in the chat without saving to disk.

</details>

---

Instant Image Preview (Claude Code)

Want images to open automatically after generation? Set up Claude Code hooks for instant Quick Look previews!

One-Click Setup (Mac)

```bash
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.