nanobanana-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@nanobanana-mcpgenerate an image of a sunset over the ocean"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
NanoBanana
AI 图像生成工具,使用 OpenAI 兼容协议,支持任何兼容的图像生成服务。
特性
🎨 文生图 - 根据文本描述生成图片
🖼️ 图生图 - 基于参考图片生成新图片
🔄 多 Provider 兼容 - OpenRouter 等
📦 双版本支持 - MCP Server + Clawdbot Plugin
Related MCP server: GPT Image MCP Server
版本选择
版本 | 适用场景 | 目录 |
MCP Server | Claude Desktop / Claude Code |
|
Clawdbot Plugin | Clawdbot AI 助手 |
|
MCP Server
用于 Claude Desktop 和 Claude Code。
快速使用
npx nanobanana-mcp从源码安装
git clone https://github.com/superboolgithub/nanobanana-mcp.git
cd nanobanana-mcp
npm install
npm run build环境变量
变量名 | 必填 | 说明 | 默认值 |
| ✅ | API 密钥 | - |
| ✅ | API 基础 URL | - |
| ✅ | 图片输出目录 | - |
| ❌ | 默认宽高比 |
|
| ❌ | 默认图片尺寸 |
|
| ❌ | 默认模型 |
|
Claude Desktop 配置
在 claude_desktop_config.json 中添加:
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": ["-y", "nanobanana-mcp"],
"env": {
"NANOBANANA_API_KEY": "your-api-key",
"NANOBANANA_BASE_URL": "https://openrouter.ai/api",
"NANOBANANA_OUTPUT_DIR": "/path/to/output"
}
}
}
}Claude Code 配置
在 ~/.claude.json 中添加:
{
"mcpServers": {
"nanobanana": {
"type": "stdio",
"command": "npx",
"args": ["-y", "nanobanana-mcp"],
"env": {
"NANOBANANA_API_KEY": "your-api-key",
"NANOBANANA_BASE_URL": "https://openrouter.ai/api",
"NANOBANANA_OUTPUT_DIR": "/path/to/output"
}
}
}
}Clawdbot Plugin
用于 Clawdbot AI 助手。
安装
cp -r clawdbot-plugin ~/.clawdbot/extensions/nanobanana配置
在 ~/.clawdbot/clawdbot.json 中添加:
{
"plugins": {
"entries": {
"nanobanana": {
"enabled": true,
"config": {
"apiKey": "your-api-key",
"baseUrl": "https://openrouter.ai/api",
"outputDir": "/tmp/nanobanana",
"defaultAspectRatio": "1:1",
"defaultImageSize": "1K",
"defaultModel": "google/gemini-2.5-flash-image-preview"
}
}
}
}
}配置项
配置项 | 必填 | 说明 | 默认值 |
| ✅ | API 密钥 | - |
| ✅ | API 基础 URL | - |
| ❌ | 图片输出目录 |
|
| ❌ | 默认宽高比 |
|
| ❌ | 默认图片尺寸 |
|
| ❌ | 默认模型 |
|
工具说明
generate_image - 文生图
根据文本描述生成图片。
参数:
prompt(必填) - 图片描述,最大 5000 字符aspectRatio- 宽高比imageSize- 图片尺寸model- 模型名称
edit_image - 图生图
基于参考图片生成新图片。
参数:
prompt(必填) - 图片描述referenceImageUrl(必填) - 参考图片 URLaspectRatio- 宽高比imageSize- 图片尺寸model- 模型名称
参数选项
宽高比 (aspectRatio)
值 | 分辨率 | 说明 |
| 1024×1024 | 方形(默认) |
| 1344×768 | 横版宽屏 |
| 768×1344 | 竖版 |
| 1184×864 | 横版 |
| 864×1184 | 竖版 |
| 832×1248 | 竖版 |
| 1248×832 | 横版 |
| 896×1152 | 竖版 |
| 1152×896 | 横版 |
| 1536×672 | 超宽屏 |
图片尺寸 (imageSize)
值 | 说明 |
| 标准分辨率(默认) |
| 高分辨率 |
| 最高分辨率 |
兼容模型
google/gemini-2.5-flash-image-preview- 快速生成google/gemini-3-pro-image-preview- 高质量gemini-2.5-flash-image- Gemini Flashblack-forest-labs/flux.2-pro- Flux Pro其他支持图像生成的模型
API 协议
使用 OpenAI Chat Completions API 格式:
请求
POST /v1/chat/completions
Content-Type: application/json
Authorization: Bearer <api-key>
{
"model": "gemini-2.5-flash-image",
"messages": [
{ "role": "user", "content": "Generate a beautiful sunset" }
],
"modalities": ["image", "text"],
"image_config": {
"aspect_ratio": "16:9",
"image_size": "2K"
}
}响应格式
支持两种响应格式:
格式 1:OpenRouter 风格
{
"choices": [{
"message": {
"content": "Here's your image",
"images": [{
"image_url": { "url": "data:image/png;base64,..." }
}]
}
}]
}格式 2:Markdown 内嵌
{
"choices": [{
"message": {
"content": ""
}
}]
}兼容的 Provider
任何使用 OpenAI Chat Completions API 格式的图像生成服务:
其他 OpenAI 兼容 API
使用示例
"生成一张可爱的猫咪图片"
"生成一张 4K 横版的日落海滩风景"
"基于这张图片,生成一个卡通风格的版本"开发
# 安装依赖
npm install
# 开发模式
npm run dev
# 构建
npm run build
# 运行
npm startLicense
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/superboolgithub/nanobanana-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server