Skip to main content
Glama

nano-banana-mcp

Servidor MCP (Model Context Protocol) en TypeScript que expone Nano Banana —el modelo de imagen Gemini 2.5 Flash Image de Google— a Claude. Permite generar, editar y componer imágenes desde Claude Desktop, Claude Code o cualquier cliente MCP.

Capacidades (tools)

Tool

Descripción

Entradas

generate_image

Texto → imagen

prompt

edit_image

Imagen + texto → imagen (inpainting, estilo, retoques)

prompt, image

compose_images

N imágenes + texto → imagen (fusión, composición, transferencia de estilo)

prompt, images[]

Las imágenes de entrada (image / images) aceptan: ruta a archivo local, data URL (data:image/png;base64,...) o base64 crudo. Las imágenes de salida se devuelven inline en base64 en la respuesta del tool.

Related MCP server: NanoBanana MCP

Requisitos

Instalación

npm install
npm run build

Copia .env.example a .env y coloca tu key:

cp .env.example .env
# edita .env -> GEMINI_API_KEY=...

El .env es solo para desarrollo local. Al conectarlo a un cliente MCP, la key se pasa por la variable de entorno del propio cliente (ver abajo).

Conectar a Claude

Claude Code (CLI)

claude mcp add nano-banana \
  -e GEMINI_API_KEY=tu_api_key \
  -- node /ruta/absoluta/nano-banana-mcp/dist/index.js

Claude Desktop

Edita claude_desktop_config.json:

{
  "mcpServers": {
    "nano-banana": {
      "command": "node",
      "args": ["/ruta/absoluta/nano-banana-mcp/dist/index.js"],
      "env": {
        "GEMINI_API_KEY": "tu_api_key"
      }
    }
  }
}

Reinicia el cliente y pídele, por ejemplo: "genera una imagen de un gato astronauta en acuarela".

Desarrollo

npm run dev        # ejecuta con tsx (sin compilar)
npm run typecheck  # verifica tipos
npm run build      # compila a dist/

Prueba rápida del protocolo (sin key, solo lista tools):

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"smoke","version":"0.0.0"}}}' \
  '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
  | node dist/index.js

Configuración

Variable

Requerida

Por defecto

Descripción

GEMINI_API_KEY

API key de Google AI Studio

NANO_BANANA_MODEL

No

gemini-2.5-flash-image

Modelo de imagen a usar

Ambientes

La configuración por ambiente (local / integración / QA / producción) está documentada en docs/environments/. Las decisiones de arquitectura en docs/architecture/.

Notas

  • En un servidor stdio, stdout está reservado para el protocolo MCP; los logs de diagnóstico van a stderr.

  • Nunca comitees tu .env ni la API key (ya está en .gitignore).

Available Tools

3 tools
compose_imagesComponer imágenes (Nano Banana)A

Combina varias imágenes en una sola según un prompt (composición, fusión, transferencia de estilo, consistencia de personaje). Cada imagen puede ser ruta local, data URL o base64.

ParametersJSON Schema
NameRequiredDescriptionDefault
imagesYesLista de 2 o más imágenes de entrada (rutas, data URLs o base64).
promptYesInstrucción de cómo combinar las imágenes.

TDQS

A3.9/5.0
Behavior3/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 states the operation and acceptable input formats (local paths, data URLs, base64), but it does not disclose output format, limitations, or potential failure modes.

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 a single, well-structured sentence that front-loads the main action and then provides supporting details about input formats. No wasted words.

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

Completeness3/5

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

The tool has moderate complexity with two parameters and no output schema. The description explains the operation and use cases, but it doesn't explicitly state the return value or constraints such as maximum image count or size, leaving some gaps.

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 descriptions for both parameters with 100% coverage. The description adds no new parameter semantics beyond repeating the input format information already present in the schema, so the baseline score of 3 applies.

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 specific verb 'Combina' (combines) and the resource 'varias imágenes en una sola' (multiple images into one), distinguishing it from sibling tools generate_image and edit_image which handle single-image operations.

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 provides clear context for when to use this tool (multi-image composition) and enumerates specific use cases (composition, fusion, style transfer, character consistency). However, it does not explicitly mention alternatives or when not to use it.

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

edit_imageEditar imagen (Nano Banana)A

Edita una imagen existente según un prompt (inpainting, cambio de estilo, retoques). La imagen puede ser una ruta a un archivo local, un data URL o base64 crudo.

ParametersJSON Schema
NameRequiredDescriptionDefault
imageYesImagen de entrada: ruta a archivo local, data URL o base64.
promptYesInstrucción de edición a aplicar sobre la imagen.

TDQS

A3.9/5.0
Behavior2/5

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

No annotations are provided, so the description must carry the full burden. It does not disclose whether the original image is modified in place, what the return value is, or any side effects. It only lists edit types and image input formats, which is more about purpose and parameters than behavioral transparency.

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 two sentences, front-loaded with the core action ('Edita una imagen existente según un prompt') and immediately followed by concrete examples. Every sentence earns its place with no redundancy.

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

Completeness3/5

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

The description covers what the tool does and input formats, but omits what the tool returns (presumably the edited image) and any behavioral caveats. Given the tool's moderate complexity and lack of output schema, this is a notable gap.

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

Parameters4/5

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

The schema already covers both parameters fully (100% coverage). The description adds value by providing examples of edit types ('inpainting, cambio de estilo, retoques'), which clarifies the expected prompt semantics beyond the schema's generic 'Instrucción de edición.'

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 edits an existing image based on a prompt, listing specific use cases (inpainting, style change, retouching). It distinguishes from siblings: generate_image creates new images, compose_images combines images, while edit_image modifies an existing one.

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 this tool: when you have an existing image and want to modify it via a prompt. However, it does not explicitly mention alternatives or exclusions, though the context is clear enough for an agent to decide.

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

generate_imageGenerar imagen (Nano Banana)A

Genera una imagen a partir de un prompt de texto usando Gemini 2.5 Flash Image (Nano Banana). Devuelve la imagen en base64.

ParametersJSON Schema
NameRequiredDescriptionDefault
promptYesDescripción detallada de la imagen a generar.

TDQS

A4.1/5.0
Behavior3/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 transparently states that the output is a base64-encoded image and specifies the model used. However, it does not disclose potential non-determinism, API costs, or any failure behavior. While the generation action is inherently non-destructive, the description is adequate but not rich in details, meriting a 3.

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 exceptionally concise, containing just two sentences. It front-loads the primary action ('Genera una imagen') and immediately provides the model and output format. Every word earns its place; no superfluous information, making it highly efficient for an agent to parse.

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

Completeness5/5

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

For a tool with a single parameter, no output schema, and no nested objects, the description is complete. It explains what the tool does, the input, the model, and the return format ('Devuelve la imagen en base64'). There is no ambiguity for this simple tool, and the description fully covers its 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 has 100% coverage for the single parameter (prompt), so the baseline is 3. The description adds no additional parameter semantics beyond what the schema already provides; it simply restates that the image is generated from a text prompt. No extra clarification about prompt formatting or constraints is offered.

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 generates an image from a text prompt, with a specific verb (genera), resource (imagen), and input (prompt de texto). It also identifies the underlying model (Gemini 2.5 Flash Image) and mentions the output format (base64), which distinguishes it from sibling tools like edit_image and compose_images that likely modify or compose existing images.

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 provides clear context on when to use the tool: when you need to generate an image from a text prompt. It does not explicitly mention alternatives or exclusions, but the sibling tool names (edit_image, compose_images) imply different use cases. Since it lacks explicit 'when not to use' guidance, it falls short of a 5 but meets the 'clear context' criterion.

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.1.0
    • First observedcompose_images
    • First observededit_image
    • First observedgenerate_image

TDQS

A4.2/5.0

Scored across 3 tools

Disambiguation5/5

Each tool serves a distinct purpose: generate creates from scratch, edit modifies a single existing image, and compose blends multiple images. No overlap or ambiguity in their scopes.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern: generate_image, edit_image, compose_images. The pattern is uniform and predictable.

Tool Count5/5

Three tools is a well-scoped set for an image generation server focused on create, edit, and compose operations. Each tool is essential and none are redundant.

Completeness4/5

The surface covers the core image workflows (generation, editing, composition). Minor gaps like image analysis or format conversion exist, but these are not critical for the primary purpose.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers