NanoBanana MCP
MCP server that brings Gemini's image generation and editing capabilities to Claude Desktop, Claude Code, and Cursor. Supports (Flash) and models.
接入你的智能体
發布者自己的指令。不是 PlugMCP 端點。
用我們的金鑰與日誌託管一份副本。
npx -y @ycse/[email protected]Claude Code 沒有本機指令的安裝連結。複製下方指令並在終端機中執行。
claude mcp add ycse-nanobanana-mcp-github -- npx -y @ycse/nanobanana-mcp@1.1.1在終端機中執行。
{ "mcpServers": { "ycse-nanobanana-mcp-github": { "command": "npx", "args": [ "-y", "@ycse/[email protected]" ] } }}claude_desktop_config.json
遠端 URL 還是本機指令? 兩種安裝方式的差異
claude mcp add nanobanana-mcp -- npx -y @ycse/nanobanana-mcp \
-e "GOOGLE_AI_API_KEY=your_api_key"
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"
}
}
}
}
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.
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
Switch models per-session without restarting:
{
prompt: string; // Image description
aspect_ratio?: string; // Override session ratio
output_path?: string; // Save path (default: ~/Documents/nanobanana_generated/)
conversation_id?: string; // Session ID
use_image_history?: boolean; // Use previous images for consistency
reference_images?: string[]; // Reference images for style
}
{
image_path: string; // File path, "last", or "history:N"
edit_prompt: string; // Edit instructions
aspect_ratio?: string; // Override session ratio
output_path?: string; // Save path
conversation_id?: string; // Session ID
reference_images?: string[]; // Style references
}
npx @ycse/nanobanana-mcp --install-commands claude-code
# Or manually:
# mkdir -p ~/.claude/commands
# cp commands/claude-code/*.md ~/.claude/commands/
npx @ycse/nanobanana-mcp --install-commands cursor
# Or manually:
# mkdir -p .cursor/commands
# cp commands/cursor/*.md .cursor/commands/
See Cursor Slash Commands for more details.
/nb-flash - Switch to Flash model (faster)
/nb-pro - Switch to Pro model (higher quality)
1. Set aspect ratio: set_aspect_ratio("16:9")
2. Generate: "A cyberpunk cityscape at sunset"
// First image
{ prompt: "A red-hat cat", conversation_id: "cat" }
// Second image - same character
{ prompt: "The cat taking a nap", conversation_id: "cat", use_image_history: true }
// Edit the last generated image
{ image_path: "last", edit_prompt: "Change hat to blue" }
// Edit specific image from history
{ image_path: "history:0", edit_prompt: "Add sunglasses" }
// Start with Flash for quick iterations
set_model({ model: "flash" })
{ prompt: "Draft concept art" }
// Switch to Pro for final render
set_model({ model: "pro" })
{ prompt: "Final polished version", use_image_history: true }
Generated images save to ~/Documents/nanobanana_generated/:
generated_[timestamp].png[original]_edited_[timestamp].pnggit clone https://github.com/YCSE/nanobanana-mcp.git
cd nanobanana-mcp
npm install
npm run dev # Development mode with hot reload
npm run build # Production build
npm run start # Run compiled server
Image generation fails:
set_aspect_ratio was called firstTools not showing:
npx -y @ycse/nanobanana-mcp runs without errorsMIT
Gemini Vision & Image Generation MCP for Claude Desktop and Claude Code
{ "mcpServers": { "ycse-nanobanana-mcp-github": { "command": "npx", "args": [ "-y", "@ycse/[email protected]" ] } }}工具
尚無工具清單。遠端伺服器會在首次健康檢查後取得工具清單。
常見問題
在本頁複製適用於 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 設定。它使用發布者的安裝方式,而不是 PlugMCP 代理伺服器。
這筆記錄未列出必要的環境變數。
Nanobanana 透過 stdio 在本機執行。
上次檢查時間:2026-11-05。 Gemini Vision & Image Generation MCP for Claude Desktop and Claude Code