Skip to main content
Glama

nano-banana-mcp

npm

Nano Banana MCP server for generating and editing images with Google Gemini. No Gemini CLI required -- just an API key.

Quick Start

  1. Get a Gemini API key from Google AI Studio

  2. Add to your Claude Code settings (~/.claude/settings.json) or Claude Desktop config:

{
  "mcpServers": {
    "nano-banana": {
      "command": "npx",
      "args": ["-y", "@daniel.barta/nano-banana-mcp"],
      "env": {
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}
  1. Restart Claude and ask it to generate an image.

Related MCP server: Gemini Gen MCP

Configuration

Environment Variable

Required

Default

Description

GEMINI_API_KEY

Yes

--

Your Google AI API key

GEMINI_MODEL

No

gemini-3.1-flash-image-preview

Gemini model for image generation/editing

GEMINI_DESCRIBE_MODEL

No

gemini-2.5-flash

Gemini model for image description (text-only output)

GEMINI_BASE_URL

No

--

Custom base URL for Gemini API (proxy support)

OUTPUT_DIR

No

~/nano-banana-output

Directory for saved images

Supported Models

Model

Notes

gemini-3.1-flash-image-preview

Default. Latest, fastest

gemini-3-pro-image-preview

Higher quality, slower

gemini-2.5-flash-image

Fast, cost-effective

Tools

generate_image

Generate an image from a text prompt. Supports batch generation (up to 4 images). Response contains a thumbnail preview; full-res image is saved to disk.

Parameter

Type

Required

Description

prompt

string

Yes

Text description of the image

aspectRatio

string

No

Aspect ratio (1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9)

size

string

No

Image size (512px, 1K, 2K, 4K)

n

number

No

Number of images to generate (1-4, default 1)

negativePrompt

string

No

Things to exclude from the generated image

systemInstruction

string

No

System instruction to guide the model

edit_image

Edit an existing image based on a text instruction. Supports multi-image input (up to 10 images total). Response contains a thumbnail preview; full-res image is saved to disk.

Parameter

Type

Required

Description

prompt

string

Yes

What to change

filePath

string

Yes

Path to the source image

additionalFilePaths

string[]

No

Additional image paths (up to 9) for multi-image editing

aspectRatio

string

No

Aspect ratio (1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9)

size

string

No

Image size (512px, 1K, 2K, 4K)

negativePrompt

string

No

Things to exclude from the edited image

systemInstruction

string

No

System instruction to guide the model

describe_image

Get a text description of an image.

Parameter

Type

Required

Description

filePath

string

Yes

Path to the image

question

string

No

Specific question about the image

systemInstruction

string

No

System instruction to guide the model

Supported Input Formats

For edit_image and describe_image, the following image formats are supported:

JPEG, PNG, WebP, GIF, BMP, TIFF, SVG, HEIC/HEIF

File Path Resolution

When you provide a file path for editing or describing, the server searches for the file in this order:

  1. Absolute path as given

  2. Relative to the current working directory

  3. Relative to the output directory

  4. Basename only in the output directory

Thumbnails

To avoid hitting Claude Code's session file size limits, MCP responses contain thumbnail previews (max 512px, JPEG quality 80, ~20-50KB) instead of full-resolution images. Full-res images are always saved to disk at the path shown in the response metadata.

The first content block in generate/edit responses is a JSON metadata object:

{
  "model": "gemini-3.1-flash-image-preview",
  "count": 1,
  "images": [
    { "filePath": "/Users/you/nano-banana-output/a-cat-1234567890.png", "mimeType": "image/png" }
  ]
}

Development

git clone https://github.com/bartadaniel/nano-banana-mcp.git
cd nano-banana-mcp
npm install
npm run build

Use the local build in your config:

{
  "mcpServers": {
    "nano-banana": {
      "command": "node",
      "args": ["path/to/nano-banana-mcp/dist/index.js"],
      "env": {
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}

Testing

npm test

Runs unit tests using Node.js built-in test runner (node:test). Tests cover error classes, all documented Gemini API response codes (BlockedReason, FinishReason), config shapes, image extraction edge cases, file operations, path security, and thumbnail generation.

License

MIT

Available Tools

3 tools
describe_imageA

Get a text description of an image using Google Gemini. Default model: gemini-2.5-flash.

ParametersJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the image
questionNoSpecific question about the image
systemInstructionNoSystem instruction to guide the model's behavior

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses the default model (gemini-2.5-flash), which is useful, but does not mention that it sends image data to an external API, potential rate limits, or that it performs no modification (read-only behavior). The description is not misleading but lacks depth.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, focused sentence that front-loads the purpose and adds the crucial default model detail. No redundant words or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is relatively simple with 3 params (1 required) and no output schema. The description states the return type (text description) and model, which is sufficient for an AI agent to invoke it generally. However, it doesn't mention the optional question/systemInstruction behaviors, but these are self-explanatory from the schema. Given the simplicity, the description is nearly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds no extra parameter-specific semantics beyond what the schema already provides. The default model note is not parameter-related, so the tool description does not enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the verb (get) and resource (text description of an image), and it implicitly differentiates from siblings generate_image/edit_image by focusing on analysis of an existing image. The addition of the default model further clarifies scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied (use when you need a text description of an image), but no explicit mention of when not to use it or alternatives. The presence of question parameter is not explained, so the description doesn't guide on whether to use this for specific queries or just general description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

edit_imageA

Edit an existing image based on a text instruction using Google Gemini. Default model: gemini-3.1-flash-image-preview. Supports multi-image input (up to 10 total). Response contains a thumbnail preview; full-res image is saved to /root/nano-banana-output.

ParametersJSON Schema
NameRequiredDescriptionDefault
sizeNoImage size (512, 1K, 2K, 4K)
promptYesWhat to change in the image
filePathYesPath to the source image
aspectRatioNoAspect ratio of the output image
negativePromptNoThings to exclude from the edited image
systemInstructionNoSystem instruction to guide the model's behavior
additionalFilePathsNoAdditional image paths for multi-image editing (up to 9)

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses output behavior (thumbnail preview, full-res saved to /root/nano-banana-output), the multi-image limit (up to 10 total), and the default model, going beyond basic operation. It does not mention potential side effects like overwriting, but the output path suggests new files.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, front-loaded with the core purpose, and then provides specific details about model, multi-image support, and output. Every sentence adds value with no waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the absence of output schema and annotations, the description sufficiently explains what the tool does and what the user gets (thumbnail preview, full-res saved to path). It is complete for a basic edit tool, though it lacks error handling details or explicit prerequisites.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the parameters are already well-documented. The description adds context about multi-image input (up to 10 total) which maps to additionalFilePaths, but this is inferable from the schema. No significant extra semantics are provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with a specific verb ('Edit'), resource ('existing image'), and method ('text instruction'). It distinguishes itself from siblings (generate_image, describe_image) by focusing on modification rather than generation or description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use the tool ('Edit an existing image') and provides context about multi-image input and output behavior. However, it does not explicitly reference alternative sibling tools or state exclusions, so it stops short of full usage guidelines.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generate_imageA

Generate an image from a text prompt using Google Gemini. Default model: gemini-3.1-flash-image-preview. Supports batch generation (n=1-4). Response contains a thumbnail preview; full-res image is saved to /root/nano-banana-output.

ParametersJSON Schema
NameRequiredDescriptionDefault
nNoNumber of images to generate (1-4, default 1)
sizeNoImage size (512, 1K, 2K, 4K)
promptYesText description of the image to generate
aspectRatioNoAspect ratio of the generated image
negativePromptNoThings to exclude from the generated image
systemInstructionNoSystem instruction to guide the model's behavior

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds valuable context by specifying the default model (gemini-3.1-flash-image-preview), batch generation capability, and the response format (thumbnail preview) plus the full-resolution save location (/root/nano-banana-output). This goes beyond the basic function and discloses the side effect of saving a file to disk.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences long, each earning its place: the first states the core purpose, the second gives the default model and batch support, and the third explains output behavior. It is front-loaded with the most important information and contains no filler or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given there is no output schema, the description adequately covers return values by stating that a thumbnail preview is returned and the full-resolution image is saved to a specific path. It also provides the default model and batch range. It could be more complete by mentioning potential errors or limitations, but for a generation tool this is a solid level of context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already provides detailed descriptions for all 6 parameters (100% coverage), so the description does not need to explain parameter syntax. It does touch on batch generation (n=1-4), which aligns with the schema, but adds no semantic nuance beyond what the schema already offers. The baseline of 3 is appropriate since the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with a specific verb and resource: 'Generate an image from a text prompt using Google Gemini.' This not only describes what it does but also naturally distinguishes it from its siblings (edit_image, describe_image), as those involve modifying or analyzing images rather than creating them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool is for generating new images from prompts, which provides clear context for when to use it. However, it does not explicitly mention alternatives or exclusions, such as 'for editing existing images use edit_image' or 'use describe_image to analyze an image.' The usage guidance is therefore implied rather than explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 3 tool updatesv0.2.0
    • First observeddescribe_image
    • First observededit_image
    • First observedgenerate_image

TDQS

A4.2/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: generating a new image, editing an existing image, and describing an image. There is no overlap or ambiguity between them.

Naming Consistency5/5

All tool names follow the consistent verb_noun pattern: generate_image, edit_image, describe_image. This makes the set highly predictable and easy to navigate.

Tool Count5/5

With 3 tools, the server is well-scoped for its purpose of image generation, editing, and analysis. Each tool earns its place and the count is appropriate for the domain.

Completeness5/5

The tool surface covers the core lifecycle of image handling: create (generate), modify (edit), and understand (describe). There are no obvious gaps for the stated purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers