npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

google-nanobanana-mcp-server

v1.0.0

Published

MCP server for Nano Banana - Gemini 2.5 Flash Image generation, editing, and manipulation

Readme

Nano Banana MCP Server

npm version License: Apache 2.0

A Model Context Protocol (MCP) server that integrates the powerful Gemini 2.5 Flash Image model for advanced image generation, editing, and manipulation capabilities.

🌟 Features

  • 🎨 Image Generation: Create stunning images from text prompts with customizable styles and variations
  • ✏️ Image Editing: Modify existing images with natural language instructions
  • 🔧 Image Restoration: Restore and enhance old or damaged photos
  • 🎯 Icon Generation: Create app icons, favicons, and UI elements in multiple sizes
  • 🎨 Pattern & Texture Generation: Generate seamless patterns and textures for backgrounds
  • 📖 Story Sequencing: Generate sequential images that tell visual stories or processes
  • 📊 Diagram Generation: Create technical diagrams, flowcharts, and architectural mockups

📋 Prerequisites

  • Node.js 18+ and npm
  • Gemini API Key: Set one of these environment variables:
    • NANOBANANA_GEMINI_API_KEY (recommended)
    • NANOBANANA_GOOGLE_API_KEY
    • GEMINI_API_KEY (fallback)
    • GOOGLE_API_KEY (fallback)

For API key setup, see the official Gemini API documentation.

📦 Installation

From npm

npm install -g nanobanana-mcp

From Source

git clone https://github.com/gemini-cli-extensions/nanobanana.git
cd nanobanana/mcp-server
npm install
npm run build
npm install -g .

🚀 Usage

Standalone Server

Start the MCP server in stdio mode:

nanobanana-mcp

Or with development mode:

npm run dev

Integration with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "nanobanana": {
      "command": "nanobanana-mcp",
      "args": []
    }
  }
}

Available Tools

1. generate_image

Generate single or multiple images from text prompts.

Parameters:

  • prompt (string, required): The text prompt describing the image to generate
  • outputCount (number): Number of variations (1-8, default: 1)
  • styles (array): Artistic styles (photorealistic, watercolor, oil-painting, sketch, pixel-art, anime, vintage, modern, abstract, minimalist)
  • variations (array): Variation types (lighting, angle, color-palette, composition, mood, season, time-of-day)
  • format (string): Output format - "grid" or "separate" (default: "separate")
  • seed (number): Seed for reproducible variations
  • preview (boolean): Automatically open generated images (default: false)

Example:

{
  "name": "generate_image",
  "arguments": {
    "prompt": "sunset over mountains",
    "outputCount": 3,
    "styles": ["watercolor", "oil-painting"],
    "preview": true
  }
}

2. edit_image

Edit an existing image based on a text prompt.

Parameters:

  • prompt (string, required): The text prompt describing the edits to make
  • file (string, required): The filename of the input image
  • preview (boolean): Automatically open generated images (default: false)

Example:

{
  "name": "edit_image",
  "arguments": {
    "prompt": "add sunglasses to the person",
    "file": "portrait.jpg",
    "preview": true
  }
}

3. restore_image

Restore or enhance an existing image.

Parameters:

  • prompt (string, required): The text prompt describing the restoration
  • file (string, required): The filename of the input image
  • preview (boolean): Automatically open generated images (default: false)

Example:

{
  "name": "restore_image",
  "arguments": {
    "prompt": "remove scratches and improve clarity",
    "file": "old_photo.jpg"
  }
}

4. generate_icon

Generate app icons, favicons, and UI elements.

Parameters:

  • prompt (string, required): Description of the icon to generate
  • sizes (array): Icon sizes in pixels (16, 32, 64, 128, 256, 512, 1024)
  • type (string): "app-icon", "favicon", or "ui-element" (default: "app-icon")
  • style (string): "flat", "skeuomorphic", "minimal", or "modern" (default: "modern")
  • format (string): "png" or "jpeg" (default: "png")
  • background (string): "transparent", "white", "black", or color name (default: "transparent")
  • corners (string): "rounded" or "sharp" (default: "rounded")
  • preview (boolean): Automatically open generated images (default: false)

Example:

{
  "name": "generate_icon",
  "arguments": {
    "prompt": "coffee cup logo",
    "sizes": [64, 128, 256],
    "type": "app-icon",
    "style": "minimal"
  }
}

5. generate_pattern

Generate seamless patterns and textures.

Parameters:

  • prompt (string, required): Description of the pattern
  • size (string): Pattern tile size (default: "256x256")
  • type (string): "seamless", "texture", or "wallpaper" (default: "seamless")
  • style (string): "geometric", "organic", "abstract", "floral", or "tech" (default: "abstract")
  • density (string): "sparse", "medium", or "dense" (default: "medium")
  • colors (string): "mono", "duotone", or "colorful" (default: "colorful")
  • repeat (string): "tile" or "mirror" (default: "tile")
  • preview (boolean): Automatically open generated images (default: false)

Example:

{
  "name": "generate_pattern",
  "arguments": {
    "prompt": "geometric hexagons",
    "type": "seamless",
    "style": "geometric",
    "colors": "duotone"
  }
}

6. generate_story

Generate sequential images that tell a story or process.

Parameters:

  • prompt (string, required): Description of the story or process
  • steps (number): Number of sequential images (2-8, default: 4)
  • type (string): "story", "process", "tutorial", or "timeline" (default: "story")
  • style (string): "consistent" or "evolving" (default: "consistent")
  • layout (string): "separate", "grid", or "comic" (default: "separate")
  • transition (string): "smooth", "dramatic", or "fade" (default: "smooth")
  • format (string): "storyboard" or "individual" (default: "individual")
  • preview (boolean): Automatically open generated images (default: false)

Example:

{
  "name": "generate_story",
  "arguments": {
    "prompt": "a seed growing into a tree",
    "steps": 5,
    "type": "process",
    "style": "consistent"
  }
}

7. generate_diagram

Generate technical diagrams and visualizations.

Parameters:

  • prompt (string, required): Description of the diagram
  • type (string): "flowchart", "architecture", "network", "database", "wireframe", "mindmap", or "sequence" (default: "flowchart")
  • style (string): "professional", "clean", "hand-drawn", or "technical" (default: "professional")
  • layout (string): "horizontal", "vertical", "hierarchical", or "circular" (default: "hierarchical")
  • complexity (string): "simple", "detailed", or "comprehensive" (default: "detailed")
  • colors (string): "mono", "accent", or "categorical" (default: "accent")
  • annotations (string): "minimal" or "detailed" (default: "detailed")
  • preview (boolean): Automatically open generated images (default: false)

Example:

{
  "name": "generate_diagram",
  "arguments": {
    "prompt": "user authentication flow",
    "type": "flowchart",
    "style": "professional",
    "complexity": "detailed"
  }
}

🛠️ Development

Build

npm run build

Development Mode with Watch

npm run dev

Type Checking

npm run typecheck

Start Server

npm start

🏗️ Architecture

Core Components

  • index.ts: MCP server implementation using @modelcontextprotocol/sdk
  • imageGenerator.ts: Handles all Gemini API interactions and response processing
  • fileHandler.ts: Manages file I/O, smart filename generation, and file searching
  • types.ts: TypeScript interfaces for type safety

Key Features

  • Type-Safe: Full TypeScript support with comprehensive interfaces
  • Error Handling: Robust error handling with detailed debug logging
  • Protocol Compliance: Strict adherence to Model Context Protocol (MCP) specification
  • Resource Efficient: Optimized for Claude and other MCP clients

🔐 Environment Configuration

The server supports multiple environment variables for API key authentication:

# Recommended for Gemini API key
export NANOBANANA_GEMINI_API_KEY="your-api-key"

# Alternative for Vertex API
export NANOBANANA_GOOGLE_API_KEY="your-api-key"

# Fallbacks
export GEMINI_API_KEY="your-api-key"
export GOOGLE_API_KEY="your-api-key"

🐛 Troubleshooting

No API Key Found

Ensure one of the supported environment variables is set:

export NANOBANANA_GEMINI_API_KEY="your-key"

Build Errors

Ensure Node.js 18+ is installed:

node --version
npm run build

Type Errors

Run type checking to identify issues:

npm run typecheck

Debug Mode

The server includes detailed logging output on stderr for debugging:

nanobanana-mcp 2>&1 | grep -i "debug\|error"

📄 Legal

🤝 Contributing

Contributions are welcome! Please see our Contributing Guidelines.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run npm run build && npm run typecheck
  5. Submit a pull request

📚 Related Resources

🙋 Support

For issues, questions, or suggestions, please open an issue on GitHub.


Made with ❤️ by the Gemini CLI Extensions team