@willh/nano-banana-mcp
v1.1.2
Published
MCP server for Nano Banana extension
Downloads
361
Readme
@willh/nano-banana-mcp
MCP server for Nano Banana - 使用 Gemini 進行圖片生成與編修的 MCP 伺服器。
安裝與使用
npx @willh/nano-banana-mcp環境變數設定
需設定下列任一 API Key 環境變數:
NANOBANANA_GEMINI_API_KEY(建議)NANOBANANA_GOOGLE_API_KEYGEMINI_API_KEY(備援)GOOGLE_API_KEY(備援)
模型選擇
預設使用 gemini-2.5-flash-image。若要使用 Gemini 3 系列模型:
export NANOBANANA_MODEL=gemini-3.1-flash-image-preview或:
export NANOBANANA_MODEL=gemini-3-pro-image-previewMCP 工具
此 MCP server 提供以下工具:
| 工具 | 說明 |
|------|------|
| generate_image | 文字轉圖片生成(支援風格/變化選項) |
| edit_image | 圖片編修 |
| restore_image | 圖片修復 |
| generate_icon | 生成多尺寸 App 圖示、Favicon、UI 元件 |
| generate_pattern | 生成無縫拼接圖樣與材質 |
| generate_story | 生成視覺故事或流程序列圖 |
| generate_diagram | 生成技術圖表、流程圖、架構示意 |
MCP 設定範例
Claude Desktop
設定檔位置:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": ["-y", "@willh/nano-banana-mcp"],
"env": {
"NANOBANANA_GEMINI_API_KEY": "your-api-key"
}
}
}
}GitHub Copilot Chat (VS Code)
在專案根目錄建立 .vscode/mcp.json:
{
"servers": {
"nanobanana": {
"command": "npx",
"args": ["-y", "@willh/nano-banana-mcp"],
"env": {
"NANOBANANA_GEMINI_API_KEY": "${input:nanobanana-api-key}"
}
}
},
"inputs": [
{
"id": "nanobanana-api-key",
"type": "promptString",
"description": "Enter your Gemini API key",
"password": true
}
]
}或透過 VS Code 設定檔 settings.json:
{
"chat.mcp.discovery.enabled": true,
"mcp.servers": {
"nanobanana": {
"command": "npx",
"args": ["-y", "@willh/nano-banana-mcp"],
"env": {
"NANOBANANA_GEMINI_API_KEY": "your-api-key"
}
}
}
}命令列安裝:
code --add-mcp "{\"name\":\"nanobanana\",\"command\":\"npx\",\"args\":[\"-y\",\"@willh/nano-banana-mcp\"],\"env\":{\"NANOBANANA_GEMINI_API_KEY\":\"your-api-key\"}}"Codex CLI
設定檔位置:~/.codex/config.toml
[mcp_servers.nanobanana]
command = "npx"
args = ["-y", "@willh/nano-banana-mcp"]
[mcp_servers.nanobanana.env]
NANOBANANA_GEMINI_API_KEY = "your-api-key"命令列安裝:
codex mcp add nanobanana --env NANOBANANA_GEMINI_API_KEY=your-api-key -- npx -y @willh/nano-banana-mcpClaude Code
命令列安裝:
claude mcp add nanobanana --env NANOBANANA_GEMINI_API_KEY=your-api-key -- npx -y @willh/nano-banana-mcp或直接編輯設定檔 ~/.claude/settings.json:
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": ["-y", "@willh/nano-banana-mcp"],
"env": {
"NANOBANANA_GEMINI_API_KEY": "your-api-key"
}
}
}
}Cursor
在專案根目錄建立 .cursor/mcp.json:
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": ["-y", "@willh/nano-banana-mcp"],
"env": {
"NANOBANANA_GEMINI_API_KEY": "your-api-key"
}
}
}
}Windsurf
設定檔位置:~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": ["-y", "@willh/nano-banana-mcp"],
"env": {
"NANOBANANA_GEMINI_API_KEY": "your-api-key"
}
}
}
}搭配 Gemini CLI 使用
此套件也是 Nano Banana Gemini CLI 擴充套件 的一部分。
授權
Apache-2.0
