@nanobanana/mcp
An MCP server for generating and editing images using Google's Gemini Nano Banana models, returning file paths instead of base64 to keep context small.
README
@nanobanana/mcp 🍌
A lean MCP server for Google's Nano Banana (Gemini) image models. It generates and edits images from any MCP client (Claude Code, Claude Desktop, Cursor) and hands back file paths instead of base64, so your agent's context stays small.
- Three tools and nothing else:
generate_image,edit_image,list_models - Defaults to Nano Banana 2 (
gemini-3.1-flash-image). Switch models per call or via env. If a pinned model id ever goes stale,list_modelsshows what your key can actually use. - Multi-image editing: pass reference images for style transfer, characters, or compositing
- Control over aspect ratio (
1:1up to21:9) and resolution (1K,2K,4K) - Google Search grounding for images that need real-world accuracy, like infographics
- Safe output paths. The server never writes to
/when a desktop MCP client spawns it there. - Auth lives in env vars only, so your API key never passes through chat context
Quick start
Get a free Gemini API key at aistudio.google.com/apikey.
Claude Code
claude mcp add nanobanana -e GEMINI_API_KEY=your_key -- npx -y @nanobanana/mcp
Also listed in the MCP Registry as io.github.getjoystick/nanobanana-mcp.
Claude Desktop / Cursor: add this to claude_desktop_config.json or .cursor/mcp.json:
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": ["-y", "@nanobanana/mcp"],
"env": { "GEMINI_API_KEY": "your_key" }
}
}
}
Tools
generate_image
| Param | Required | Description |
|---|---|---|
prompt |
✅ | Image description |
model |
Gemini image model id (default gemini-3.1-flash-image) |
|
aspectRatio |
1:1, 16:9, 9:16, 21:9, extremes up to 1:4 and 8:1 |
|
size |
512, 1K, 2K, or 4K |
|
grounding |
Ground with Google Search for factual accuracy | |
thinkingLevel |
minimal or high; high helps complex or text-heavy images |
|
outputDir |
Save directory (default ./nano-banana) |
|
filename |
Base filename without extension |
edit_image
Same params, plus:
| Param | Required | Description |
|---|---|---|
images |
✅ | Input file path(s): png, jpg, webp, heic, or pdf. The first is the base; the rest are references. |
Both tools save to disk and return the file path.
list_models
Takes no params. Lists the image model ids your API key can use. Handy when a pinned model id stops working, which is how earlier Nano Banana servers broke.
Configuration
| Env var | Description |
|---|---|
GEMINI_API_KEY |
Required. Gemini API key (GOOGLE_API_KEY also works) |
NANOBANANA_MODEL |
Default model override |
NANOBANANA_OUTPUT_DIR |
Default output directory override |
Models
| Model id | Notes |
|---|---|
gemini-3.1-flash-image |
Default. Nano Banana 2: 4K output, strong text rendering |
gemini-3-pro-image |
Nano Banana Pro, for complex scenes that need deeper reasoning |
gemini-2.5-flash-image |
The original Nano Banana (legacy; Google retires it 2026-10-02) |
Development
npm install
npm run build
GEMINI_API_KEY=your_key npm run smoke # end-to-end test against the live API
Acknowledgements
Inspired by other Nano Banana MCPs. Built with Claude Code.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。