Skip to main content
Glama

Nano-Banana MCP Server 🍌

🤖 This project was entirely generated by Claude Code - an AI coding assistant that can create complete, production-ready applications from scratch.

A Model Context Protocol (MCP) server that provides AI image generation and editing capabilities using Google's Gemini 2.5 Flash Image API. Generate stunning images, edit existing ones, and iterate on your creations with simple text prompts.

✨ Features

  • 🎨 Generate Images: Create new images from text descriptions

  • ✏️ Edit Images: Modify existing images with text prompts

  • 🔄 Iterative Editing: Continue editing the last generated/edited image

  • 🖼️ Multiple Reference Images: Use reference images for style transfer and guidance

  • 🌍 Cross-Platform: Smart file paths for Windows, macOS, and Linux

  • 🔧 Easy Setup: Simple configuration with API key

  • 📁 Auto File Management: Automatic image saving with organized naming

Related MCP server: cursor-mcp-server

🔑 Setup

  1. Get your Gemini API key:

  2. Configure the MCP server: See configuration examples for your specific client below (Claude Code, Cursor, or other MCP clients).

💻 Usage with Claude Code

Configuration:

Add this to your Claude Code MCP settings:

Option A: With environment variable (Recommended - Most Secure)

{
  "mcpServers": {
    "nano-banana": {
      "command": "npx",
      "args": ["nano-banana-mcp"],
      "env": {
        "GEMINI_API_KEY": "your-gemini-api-key-here"
      }
    }
  }
}

Option B: Without environment variable

{
  "mcpServers": {
    "nano-banana": {
      "command": "npx",
      "args": ["nano-banana-mcp"]
    }
  }
}

Usage Examples:

Generate an image of a sunset over mountains
Edit this image to add some birds in the sky
Continue editing to make it more dramatic

🎯 Usage with Cursor

Configuration:

Add to your Cursor MCP configuration:

Option A: With environment variable (Recommended)

{
  "nano-banana": {
    "command": "npx",
    "args": ["nano-banana-mcp"],
    "env": {
      "GEMINI_API_KEY": "your-gemini-api-key-here"
    }
  }
}

Option B: Without environment variable

{
  "nano-banana": {
    "command": "npx",
    "args": ["nano-banana-mcp"]
  }
}

Usage Examples:

  • Ask Cursor to generate images for your app

  • Create mockups and prototypes

  • Generate assets for your projects

🔧 For Other MCP Clients

If you're using a different MCP client, you can configure nano-banana-mcp using any of these methods:

Configuration Methods

Method A: Environment Variable in MCP Config (Recommended)

{
  "nano-banana": {
    "command": "npx",
    "args": ["nano-banana-mcp"],
    "env": {
      "GEMINI_API_KEY": "your-gemini-api-key-here"
    }
  }
}

Method B: System Environment Variable

export GEMINI_API_KEY="your-gemini-api-key-here"
npx nano-banana-mcp

Method C: Using the Configure Tool

npx nano-banana-mcp
# The server will prompt you to configure when first used
# This creates a local .nano-banana-config.json file

🛠️ Available Commands

generate_image

Create a new image from a text prompt.

generate_image({
  prompt: "A futuristic city at night with neon lights"
})

edit_image

Edit a specific image file.

edit_image({
  imagePath: "/path/to/image.png",
  prompt: "Add a rainbow in the sky",
  referenceImages?: ["/path/to/reference.jpg"] // optional
})

continue_editing

Continue editing the last generated/edited image.

continue_editing({
  prompt: "Make it more colorful",
  referenceImages?: ["/path/to/style.jpg"] // optional
})

get_last_image_info

Get information about the last generated image.

get_last_image_info()

configure_gemini_token

Configure your Gemini API key.

configure_gemini_token({
  apiKey: "your-gemini-api-key"
})

get_configuration_status

Check if the API key is configured.

get_configuration_status()

⚙️ Configuration Priority

The MCP server loads your API key in the following priority order:

  1. 🥇 MCP Configuration Environment Variables (Highest Priority)

    • Set in your claude_desktop_config.json or MCP client config

    • Most secure as it's contained within the MCP configuration

    • Example: "env": { "GEMINI_API_KEY": "your-key" }

  2. 🥈 System Environment Variables

    • Set in your shell/system environment

    • Example: export GEMINI_API_KEY="your-key"

  3. 🥉 Local Configuration File (Lowest Priority)

    • Created when using the configure_gemini_token tool

    • Stored as .nano-banana-config.json in current directory

    • Automatically ignored by Git and NPM

💡 Recommendation: Use Method 1 (MCP config env variables) for the best security and convenience.

📁 File Storage

Images are automatically saved to platform-appropriate locations:

  • Windows: %USERPROFILE%\\Documents\\nano-banana-images\\

  • macOS/Linux: ./generated_imgs/ (in current directory)

  • System directories: ~/nano-banana-images/ (when run from system paths)

File naming convention:

  • Generated images: generated-[timestamp]-[id].png

  • Edited images: edited-[timestamp]-[id].png

🎨 Example Workflows

Basic Image Generation

  1. generate_image - Create your base image

  2. continue_editing - Refine and improve

  3. continue_editing - Add final touches

Style Transfer

  1. generate_image - Create base content

  2. edit_image - Use reference images for style

  3. continue_editing - Fine-tune the result

Iterative Design

  1. generate_image - Start with a concept

  2. get_last_image_info - Check current state

  3. continue_editing - Make adjustments

  4. Repeat until satisfied

🔧 Development

This project was created with Claude Code and follows these technologies:

  • TypeScript - Type-safe development

  • Node.js - Runtime environment

  • Zod - Schema validation

  • Google GenAI - Image generation API

  • MCP SDK - Model Context Protocol

Local Development

# Clone the repository
git clone https://github.com/claude-code/nano-banana-mcp.git
cd nano-banana-mcp

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build for production
npm run build

# Run tests
npm test

📋 Requirements

  • Node.js 18.0.0 or higher

  • Gemini API key from Google AI Studio

  • Compatible with Claude Code, Cursor, and other MCP clients

🤝 Contributing

This project was generated by Claude Code, but contributions are welcome! Please feel free to:

  • Report bugs

  • Suggest new features

  • Submit pull requests

  • Improve documentation

📄 License

MIT License - see LICENSE file for details.

🙏 Acknowledgments

  • Claude Code - For generating this entire project

  • Google AI - For the powerful Gemini 2.5 Flash Image API

  • Anthropic - For the Model Context Protocol

  • Open Source Community - For the amazing tools and libraries

📞 Support


✨ Generated with love by Claude Code - The future of AI-powered development is here!

Available Tools

6 tools
configure_gemini_tokenA

Configure your Gemini API token for nano-banana image generation

Inputs: apiKey (required).

continue_editingA

Continue editing the LAST image that was generated or edited in this session, optionally using additional reference images. Use this for iterative improvements, modifications, or changes to the most recent image. This automatically uses the previous image without needing a file path.

Inputs: prompt (required), referenceImages.

edit_imageA

Edit a SPECIFIC existing image file, optionally using additional reference images. Use this when you have the exact file path of an image to modify.

Inputs: imagePath (required), prompt (required), referenceImages.

generate_imageA

Generate a NEW image from text prompt. Use this ONLY when creating a completely new image, not when modifying an existing one.

Inputs: prompt (required).

get_configuration_statusA

Check if Gemini API token is configured

Inputs: no named parameters.

get_last_image_infoA

Get information about the last generated/edited image in this session (file path, size, etc.). Use this to check what image is currently available for continue_editing.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no ambiguity. The descriptions explicitly differentiate between generating new images, editing specific files, continuing from the last image, and configuration tasks. The boundaries are well-defined, preventing misselection.

    Naming Consistency5/5

    All tools follow a consistent verb_noun naming pattern (e.g., configure_gemini_token, generate_image, edit_image). The naming is uniform throughout, using snake_case and clear action-object pairs without any deviations.

    Tool Count5/5

    With 6 tools, this server is well-scoped for image generation and editing. Each tool earns its place by covering essential operations like configuration, generation, editing, continuation, and status checks, without being overly sparse or bloated.

    Completeness5/5

    The tool set provides complete coverage for the nano-banana image generation domain. It includes configuration setup, new image generation, specific image editing, iterative editing, status checks, and session management, with no obvious gaps or dead ends for agents.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Token-efficient MCP server for multi-language project analysis (Java, TypeScript, JavaScript, Markdown, Python) with plugins, semantic search, and static analysis.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server wrapping the Cursor CLI agent, enabling Claude Code and other MCP clients to delegate tasks to Cursor's AI agent for file writing, bash commands, and codebase queries.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      An experimental MCP server offering calculator, GitHub repository fetching, a movie database resource, and JavaScript code review capabilities. Designed for learning and compatible with Cursor and Claude Desktop.
      1,950 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that bridges CLI coding agents like Claude Code, Codex, opencode, and Antigravity into any MCP client, enabling synchronous and asynchronous task execution, follow-up input, and a structured code review tool.
      34 npm
      2
      MIT