YN

ycse/nanobanana-mcp

效率工作流

本页由 AI 翻译,技术细节请以原文为准。 查看原文

32 stars 6 forks 质量 75 趋势 11MIT

Gemini Vision 与图像生成 MCP 适用于 Claude 桌面和 Claude 代码

概览

MCP服务器将Gemini的图像生成和编辑功能带入Claude桌面、Claude代码和光标。支持(Flash)和型号。 - - 根据文本提示创建2K图片 - - 使用自然语言指令转换图片 - - 跨代保持样式/字符 - - 无需重启即可在Flash和Pro型号之间切换 - - 支持图片的对话上下文 - Node.js 18+ - Google AI API 密钥(点击这里获取) 编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或 %APPDATA%\Claude\claude_desktop_config.json(Windows): 创建或编辑 .cursor/mcp.json(项目层面)或 ~/.cursor/mcp.json(全局): 详情请参见光标MCP文档。 生成或编辑图像前必须调用。 每次切换模型且无需重启:

概述(AI 翻译)

MCP服务器将Gemini的图像生成和编辑功能带入Claude Desktop、Claude Code和光标。支持Nano Banana 2(Flash)和Nano Banana Pro型号。

特色

  • 图像生成 - 从文本提示创建2K图像
  • 图像编辑 - 使用自然语言指令转换图像
  • 会话一致性 - 跨代保持风格/个性
  • 运行时模型切换 - 无需重启即可在Flash和Pro之间切换
  • 多回合聊天 - 带有图片支持的对话语境

快速启动

先决条件

  • Node.js 18+
  • Google AI API 密钥(点击这里获取)

添加到克劳德代码

添加到Claude桌面

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或%APPDATA%\Claude\claude_desktop_config.json(Windows):

添加到光标

创建或编辑.cursor/mcp.json(项目级)或~/.cursor/mcp.json(全局级):

详情请参见光标MCP文档。

工具

工具 目的
set_aspect_ratio 必填。 在图像生成前设置宽高比
set_model 运行时切换闪存/专业型号

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

NanoBanana MCP

MCP server that brings Gemini’s image generation and editing capabilities to Claude Desktop, Claude Code, and Cursor. Supports Nano Banana 2 (Flash) and Nano Banana Pro models.

Features

  • Image Generation - Create 2K images from text prompts
  • Image Editing - Transform images with natural language instructions
  • Session Consistency - Maintain style/character across generations
  • Runtime Model Switching - Switch between Flash and Pro models without restart
  • Multi-turn Chat - Conversational context with image support

Quick Start

Prerequisites

Add to Claude Code

claude mcp add nanobanana-mcp -- npx -y @ycse/nanobanana-mcp \
  -e "GOOGLE_AI_API_KEY=your_api_key"

Add to Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "nanobanana-mcp": {
      "command": "npx",
      "args": ["-y", "@ycse/nanobanana-mcp"],
      "env": {
        "GOOGLE_AI_API_KEY": "your_api_key"
      }
    }
  }
}

Add to Cursor

Create or edit .cursor/mcp.json (project-level) or ~/.cursor/mcp.json (global):

{
  "mcpServers": {
    "nanobanana-mcp": {
      "command": "npx",
      "args": ["-y", "@ycse/nanobanana-mcp"],
      "env": {
        "GOOGLE_AI_API_KEY": "your_api_key"
      }
    }
  }
}

See Cursor MCP Documentation for more details.

Tools

Tool Purpose
set_aspect_ratio Required. Set aspect ratio before image generation
set_model Switch between flash/pro models at runtime
gemini_generate_image Generate images from text prompts
gemini_edit_image Edit images with natural language
gemini_chat Multi-turn conversation with images
get_image_history View session image history
clear_conversation Reset session context

set_aspect_ratio (Required)

Must be called before generating or editing images.

Valid ratios: 1:1, 9:16, 16:9, 3:4, 4:3, 3:2, 2:3, 5:4, 4:5, 21:9

set_model

Switch models per-session without restarting:

Value Model Description
flash gemini-3.1-flash-image-preview Nano Banana 2 - Faster (default)
pro gemini-3-pro-image-preview Nano Banana Pro - Higher quality

gemini_generate_image

{
  prompt: string;              // Image description
在 GitHub 查看完整 README

安装

npx -y @ycse/nanobanana-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "nanobanana-mcp": { "command": "npx", "args": ["-y", "@ycse/nanobanana-mcp"], "env": { "GOOGLE_AI_API_KEY": "your_api_key" } } } }