Mcp Nano Banana

io.github.codeFi由 GitHub 帳號 codeFi 發布v1.2.2更新於 Oct 24, 2026

MCP server for Google Nano Banana (Gemini) image generation

已驗證STDIO僅桌面媒體與設計AI 與機器學習

概覽

AI 產生的概覽

一個本機 MCP 伺服器,讓 AI 助理透過 Google Gemini Nano Banana 模型產生、編輯與合成圖片。

可以做什麼
依文字提示產生圖片,可指定解析度、長寬比與輸出格式,存到指定路徑或以 base64 內嵌回傳。編輯既有圖片,或將磁碟上最多 14 張參考圖合成為一張。產生完整的 favicon 套件,包含圖示檔案、Web 資訊清單與 HTML 片段。可在 Nano Banana Pro、Nano Banana 2 與 Nano Banana Flash 模型間選擇,遇到限流時自動退回 Flash。
適用情境
適合在工作過程中讓助理直接建立或修改圖片,例如示意圖、桌布、社群素材或網站圖示,不必離開對話。最適合已擁有付費 Google AI Studio 帳戶並接受依圖計費的使用者。
執行需求
透過 stdio 在本機執行,通常以 npx 從 npm 套件 mcp-nano-banana 啟動,需要 Node.js。需要以 GEMINI_API_KEY 環境變數提供 Gemini API 金鑰,並在 Google Cloud 專案中啟用付費層級的帳單。需要連線至 Google Gemini API 的網路存取。
安裝前請注意
GEMINI_API_KEY 是可計費的憑證,請勿放入共用設定或版本控制。圖片產生依模型與解析度每張約 0.04 至 0.24 美元,計入你的 Google 帳戶。提示詞以及從磁碟讀取的參考圖片會傳送到 Google 的 Gemini API。伺服器會寫入圖片檔案與 favicon 套件到你指定的路徑,執行前請確認輸出路徑。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mcp Nano Banana,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcp-nano-banana

MCP server for AI-powered image generation using Google Gemini Nano Banana models. Generate, edit, and combine images from text prompts — directly from your AI coding assistant.

[npm version] [license]

Features

  • Text-to-image generation — Create images from natural language descriptions
  • Image editing — Upload images and modify them with text instructions
  • Multi-image combination — Mix up to 14 reference images into one composite
  • Resolution control — Generate at 512px, 1K, 2K, or 4K resolution
  • 13+ aspect ratios — From square (1:1) to ultra-wide (21:9) and tall (1:8)
  • Auto-fallback — Pro model falls back to Flash on rate limits (429/403/402)
  • File output — Save to specific paths or return inline base64
  • Favicon generation — Generate complete favicon packages with one command
  • Multi-format output — PNG, JPEG, and WebP support

Quick Start

Prerequisites

  1. Get a Gemini API key from Google AI Studio
  2. Enable billing on your Google Cloud project — image generation requires a paid tier (~$0.04-0.05/image for NB2 at standard resolution)

Installation

bash
npm install -g mcp-nano-banana

Set your API key:

bash
export GEMINI_API_KEY=your-api-key

For MCP Registry publication metadata, the registry name is io.github.codeFi/mcp-nano-banana.

MCP Configuration

Codex

bash
codex mcp add nano-banana --env GEMINI_API_KEY=your-api-key -- npx -y mcp-nano-banana@latest

Or add manually to ~/.codex/config.toml:

toml
[mcp_servers.nano-banana]command = "npx"args = ["-y", "mcp-nano-banana@latest"]
[mcp_servers.nano-banana.env]GEMINI_API_KEY = "your-api-key"

Qwen Code

Add to ~/.qwen/settings.json:

json
{  "mcpServers": {    "nano-banana": {      "command": "npx",      "args": ["-y", "mcp-nano-banana@latest"],      "env": {        "GEMINI_API_KEY": "your-api-key"      }    }  }}

Claude Code

bash
claude mcp add nano-banana -e GEMINI_API_KEY=your-api-key -- npx -y mcp-nano-banana@latest

Or add manually to ~/.claude/claude_desktop_config.json:

json
{  "mcpServers": {    "nano-banana": {      "command": "npx",      "args": ["-y", "mcp-nano-banana@latest"],      "env": {        "GEMINI_API_KEY": "your-api-key"      }    }  }}

Other MCP Clients

For CLIs and desktop clients that use the standard mcpServers JSON format, register:

json
{  "mcpServers": {    "nano-banana": {      "command": "npx",      "args": ["-y", "mcp-nano-banana@latest"],      "env": {        "GEMINI_API_KEY": "your-api-key"      }    }  }}

Local / Development Build

bash
git clone https://github.com/codeFi/mcp-nano-banana.gitcd mcp-nano-banananpm installnpm run build

Then register with your MCP client:

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

Models

ModelMCP NameDescriptionMax Ref Images
gemini-3-pro-image-previewNano Banana ProHigh quality, thinking mode, professional assets6 object + 5 character
gemini-3.1-flash-image-previewNano Banana 2Fast, high-efficiency, 1:4/4:1/1:8/8:1 ratios10 object + 4 character
gemini-2.5-flash-imageNano BananaFastest, optimized for high-volume tasks-

The server defaults to Nano Banana Pro for best quality and automatically falls back to Flash on rate limits.

Available Parameters

Resolution

ValueApprox. PixelsSupported Models
"512"~512pxNano Banana 2 only
"1K"~1024pxAll models
"2K"~2048pxAll models
"4K"~4096pxAll models

Default: "1K"

Aspect Ratio

ValueDimensions at 1KCommon Use Case
1:11024×1024Social posts, icons
16:91344×768Headers, presentations
9:16768×1344Stories, mobile
4:31152×896Desktop, photos
3:4896×1152Portraits
2:3~896×1344Print, magazines
3:2~1344×896Photos
4:5~896×1120Instagram posts
5:4~1120×896Instagram landscape
21:9~2048×878Ultra-wide banners
1:4~512×2048Nano Banana 2 only — tall strips
4:1~2048×512Nano Banana 2 only — wide strips
1:8~512×4096Nano Banana 2 only — extra tall
8:1~4096×512Nano Banana 2 only — extra wide

Tools

generate_image

Generate or edit images from text prompts.

ParameterTypeRequiredDefaultDescription
promptstring✅ Yes—Text description or editing instructions
imagePathsstring[]No—Reference image paths on disk (up to 14)
modelstringNogemini-3-pro-image-previewModel to use
aspectRatiostringNo1:1See table above for all options
resolutionstringNo1K512, 1K, 2K, or 4K
outputFormatstringNopngpng, jpeg, webp
outputPathstringNo—Save image to this file path
Examples

Generate from text:

json
{  "prompt": "A sunset over mountains with dramatic lighting",  "aspectRatio": "16:9",  "resolution": "2K",  "outputPath": "/Users/currentUser/Desktop/sunset.png"}

Edit an existing image:

json
{  "prompt": "Change the background to a coffee shop interior",  "imagePaths": ["/Users/currentUser/photo.jpg"],  "outputPath": "/Users/currentUser/edited.png"}

Combine multiple images:

json
{  "prompt": "Put these glasses on this person's face",  "imagePaths": ["/path/to/face.jpg", "/path/to/glasses.jpg"],  "outputPath": "/path/to/result.png"}

High-res wallpaper:

json
{  "prompt": "A futuristic cityscape at night with neon lights and rain",  "aspectRatio": "16:9",  "resolution": "4K",  "outputPath": "/path/to/wallpaper.png"}

generate_favicons

Generate a complete favicon package from a prompt or existing image.

ParameterTypeRequiredDefaultDescription
promptstringNo*—Icon description (required if imagePath not set)
imagePathstringNo*—Path to existing master icon image
modelstringNogemini-3-pro-image-previewModel for prompt generation
outputDirstringNo—Directory for individual favicon files
outputPathstringNo—Save ZIP package to this path
returnZipBase64booleanNofalseReturn ZIP as base64 text
appNamestringNoMy AppManifest name
shortNamestringNoAppManifest short_name
themeColorstringNo#ffffffManifest theme color
backgroundColorstringNo#ffffffManifest background color
includeReadmebooleanNotrueInclude README.md in package
Example
json
{  "prompt": "A minimalist banana icon with a soft gradient",  "outputDir": "/path/to/favicon",  "outputPath": "/path/to/favicon.zip",  "appName": "MyBrand",  "shortName": "Brand",  "themeColor": "#1a1a2e",  "backgroundColor": "#ffffff"}

Generated files:

  • favicon.ico — Multi-size icon (16/32/48px)
  • favicon-16x16.png — Browser tabs
  • favicon-32x32.png — Higher-res tabs
  • apple-touch-icon.png — iOS home screen
  • android-chrome-192x192.png — Android
  • android-chrome-512x512.png — Android HD
  • site.webmanifest — PWA manifest

HTML snippet (included in response):

html
<link rel="icon" href="/favicon.ico" sizes="any"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest">

Pricing

Image generation requires a paid Google AI Studio account. Approximate costs:

Model1K2K4K
Nano Banana 2~$0.04~$0.08~$0.15
Nano Banana Pro~$0.06~$0.13~$0.24

You only pay for what you generate — no monthly minimum.

Supported Image Formats

Input (reference images): png, jpg, jpeg, webp, gif Output: png, jpeg, webp

Development

bash
# Build TypeScriptnpm run build
# Watch modenpm run dev
# Run testsnpm test
# Run the server directlynode dist/index.js

Troubleshooting

IssueSolution
GEMINI_API_KEY is not setExport the env var or add it to your MCP config
429 Too Many RequestsServer auto-falls back to Flash model. Add billing to your account.
403/402 Quota exceededEnable billing at Google Cloud Console
503 UnavailableHigh demand — retry in a moment. Common with 4K requests.
Image not updating after editMake sure you rebuilt the TypeScript (npm run build)
imagePaths not foundUse absolute paths. Relative paths may not resolve correctly.

Architecture

AI Assistant (MCP Client)       │  (MCP Protocol over stdio)       ▼mcp-nano-banana Server       │  (HTTPS POST)       ▼Google Gemini API       │       ▼Generated Image → saved to outputPath (or returned inline base64)

License

MIT

Author

codeFi

來源:README.md,提交 7b722eb

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.2.2最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。