纳米香蕉MCP
](https://pypi.org/project/mcp-nanobanana-pro/) ](https://pypi.org/project/mcp-nanobanana-pro/)   
A. 模型上下文协议(MCP) 用于AI图像生成和编辑的服务器 谷歌的Nano Banana 模型通过 AceDataCloud API.
直接从Claude、VS Code或任何兼容MCP的客户端生成和编辑AI图像。
特性
- 图像生成 -根据文本提示创建高质量图像
- 图像编辑 -修改现有图像或组合多个图像
- 虚拟试穿 -给照片中的人穿衣服
- 植入式广告 -将产品放置在逼真的场景中
- 任务跟踪 -监控生成进度并检索结果
工具参考
| 工具 | 说明 |
|---|---|
nanobanana_generate_image | 使用谷歌的Nano Banana模型从文本提示中生成AI图像。 |
nanobanana_edit_image | 基于文本提示,使用AI编辑或组合图像。 |
nanobanana_get_task | 查询图像生成或编辑任务的状态和结果。 |
nanobanana_get_tasks_batch | 一次查询多个图像生成/编辑任务。 |
快速开始
1.获取您的API代币
- 注册地址: AceDataCloud平台
- 去 API文档页
- 点击 “收购” 获取您的API令牌
- 复制令牌以在下面使用
2.使用托管服务器(推荐)
AceDataCloud托管托管MCP服务器-- 无需本地安装.
端点: https://nanobanana.mcp.acedata.cloud/mcp
所有请求都需要一个Bearer令牌。使用步骤1中的API令牌。
Claude.ai
直接连接 Claude.ai 使用OAuth-- 不需要API令牌:
- 转到Claude.ai 设置→ 集成→ 添加更多
- 输入服务器URL:
https://nanobanana.mcp.acedata.cloud/mcp - 完成OAuth登录流程
- 开始在对话中使用工具
克劳德桌面版
添加到您的配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):
{
"mcpServers": {
"nanobanana": {
"type": "streamable-http",
"url": "https://nanobanana.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}光标/风帆
添加到MCP配置(.cursor/mcp.json 或 .windsurf/mcp.json):
{
"mcpServers": {
"nanobanana": {
"type": "streamable-http",
"url": "https://nanobanana.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}VS代码(副本)
添加到您的VS代码MCP配置中(.vscode/mcp.json):
{
"servers": {
"nanobanana": {
"type": "streamable-http",
"url": "https://nanobanana.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}或安装 Ace数据云MCP扩展 对于VS Code,它通过一键设置捆绑了所有15个MCP服务器。
JetBrains集成开发环境
- 首选 设置→ 工具→ AI助手→ 模型上下文协议(MCP)
- 点击 添加 → 超文本传输协议
- 粘贴:
{
"mcpServers": {
"nanobanana": {
"url": "https://nanobanana.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}克劳德代码
Claude Code原生支持MCP服务器:
claude mcp add nanobanana --transport http https://nanobanana.mcp.acedata.cloud/mcp \
-h "Authorization: Bearer YOUR_API_TOKEN"或添加到您的项目 .mcp.json:
{
"mcpServers": {
"nanobanana": {
"type": "streamable-http",
"url": "https://nanobanana.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}克莱恩
添加到Cline的MCP设置(.cline/mcp_settings.json):
{
"mcpServers": {
"nanobanana": {
"type": "streamable-http",
"url": "https://nanobanana.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}亚马逊Q开发者
添加到MCP配置中:
{
"mcpServers": {
"nanobanana": {
"type": "streamable-http",
"url": "https://nanobanana.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Roo代码
添加到Roo Code MCP设置:
{
"mcpServers": {
"nanobanana": {
"type": "streamable-http",
"url": "https://nanobanana.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Continue.dev
添加 .continue/config.yaml:
mcpServers:
- name: nanobanana
type: streamable-http
url: https://nanobanana.mcp.acedata.cloud/mcp
headers:
Authorization: "Bearer YOUR_API_TOKEN"泽德
添加到Zed的设置中(~/.config/zed/settings.json):
{
"language_models": {
"mcp_servers": {
"nanobanana": {
"url": "https://nanobanana.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}
}cURL测试
# Health check (no auth required)
curl https://nanobanana.mcp.acedata.cloud/health
# MCP initialize
curl -X POST https://nanobanana.mcp.acedata.cloud/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'3.或在本地运行(替代方案)
如果您更喜欢在自己的计算机上运行服务器:
# Install from PyPI
pip install mcp-nanobanana-pro
# or
uvx mcp-nanobanana-pro
# Set your API token
export ACEDATACLOUD_API_TOKEN="your_token_here"
# Run (stdio mode for Claude Desktop / local clients)
mcp-nanobanana-pro
# Run (HTTP mode for remote access)
mcp-nanobanana-pro --transport http --port 8000克劳德桌面(本地)
{
"mcpServers": {
"nanobanana": {
"command": "uvx",
"args": ["mcp-nanobanana-pro"],
"env": {
"ACEDATACLOUD_API_TOKEN": "your_token_here"
}
}
}
}Docker(自托管)
docker pull ghcr.io/acedatacloud/mcp-nanobanana-pro:latest
docker run -p 8000:8000 ghcr.io/acedatacloud/mcp-nanobanana-pro:latest客户端使用自己的Bearer令牌进行连接——服务器从每个请求中提取令牌 Authorization 头球
可用工具
图像生成
| 工具 | 说明 |
|---|---|
nanobanana_generate_image | 从文本提示生成图像 |
nanobanana_edit_image | 使用AI编辑或组合图像 |
任务
| 工具 | 说明 |
|---|---|
nanobanana_get_task | 查询单个任务状态 |
nanobanana_get_tasks_batch | 一次查询多个任务 |
用法示例
从提示符生成图像
User: Create an image of a sunset over mountains
Claude: I'll generate that image for you.
[Calls nanobanana_generate_image with detailed prompt]虚拟试穿
User: Put this shirt on this model
[Provides two image URLs]
Claude: I'll combine these images.
[Calls nanobanana_edit_image with both image URLs]产品摄影
User: Place this product in a modern kitchen scene
[Provides product image URL]
Claude: I'll create a product scene for you.
[Calls nanobanana_edit_image with scene description]快速写作技巧
为了获得最佳效果,请在提示中包含以下元素:
- 主题:主要关注点是什么?
- 大气:图像应该传达什么样的情绪?
- 照明场景是如何照明的?
- 相机/镜头:什么摄影风格?(85毫米人像、广角等)
- 质量关键词:技术描述符(散景、胶片颗粒、HDR等)
示例提示
A photorealistic close-up portrait of an elderly Japanese ceramicist
with deep wrinkles and a warm smile. Soft golden hour light streaming
through a window. Captured with an 85mm portrait lens, soft bokeh
background. Serene and masterful mood.配置
环境变量
| 变量 | 描述 | 默认值 |
|---|---|---|
ACEDATACLOUD_API_TOKEN | 来自AceDataCloud的API令牌 | 必需 |
ACEDATACLOUD_API_BASE_URL | API基本URL | https://api.acedata.cloud |
ACEDATACLOUD_OAUTH_CLIENT_ID | OAuth客户端ID(托管模式) | -- |
ACEDATACLOUD_PLATFORM_BASE_URL | 平台基础URL | https://platform.acedata.cloud |
NANOBANANA_REQUEST_TIMEOUT | 请求超时(秒) | 1800 |
LOG_LEVEL | 日志记录级别 | INFO |
命令行选项
mcp-nanobanana-pro --help
Options:
--version Show version
--transport Transport mode: stdio (default) or http
--port Port for HTTP transport (default: 8000)发展
设置开发环境
# Clone repository
git clone https://github.com/AceDataCloud/NanoBananaMCP.git
cd NanoBananaMCP
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # or `.venv\Scripts\activate` on Windows
# Install with dev dependencies
pip install -e ".[dev,test]"运行测试
# Run unit tests
pytest
# Run with coverage
pytest --cov=core --cov=tools
# Run integration tests (requires API token)
pytest tests/test_integration.py -m integration代码质量
# Format code
ruff format .
# Lint code
ruff check .
# Type check
mypy core tools构建和发布
# Install build dependencies
pip install -e ".[release]"
# Build package
python -m build
# Upload to PyPI
twine upload dist/*项目结构
NanoBanana/
├── core/ # Core modules
│ ├── __init__.py
│ ├── client.py # HTTP client for NanoBanana API
│ ├── config.py # Configuration management
│ ├── exceptions.py # Custom exceptions
│ ├── server.py # MCP server initialization
│ ├── types.py # Type definitions
│ └── utils.py # Utility functions
├── tools/ # MCP tool definitions
│ ├── __init__.py
│ ├── image_tools.py # Image generation/editing tools
│ └── task_tools.py # Task query tools
├── prompts/ # MCP prompt templates
│ └── __init__.py
├── tests/ # Test suite
├── deploy/ # Deployment configs
│ └── production/
│ ├── deployment.yaml
│ ├── ingress.yaml
│ └── service.yaml
├── .env.example # Environment template
├── .gitignore
├── Dockerfile # Docker image for HTTP mode
├── docker-compose.yaml # Docker Compose config
├── LICENSE
├── main.py # Entry point
├── pyproject.toml # Project configuration
└── README.mdAPI 参考
此服务器包装 AceDataCloud纳米香蕉API:
- NanoBanana图片API -图像生成和编辑
- 纳米香蕉任务API -任务查询
用例
- 肖像增强 -在同一个人身上尝试不同的衣服
- 产品场景构成 -将白色背景产品放置在逼真的环境中
- 属性替换 -更改材质、颜色或变体
- 海报快速编辑 -快速更改样式或主题
- 2D到3D转换 -将图像转换为3D产品模型
- 图像恢复 -恢复旧照片或损坏的照片
贡献
欢迎投稿!拜托:
- 分叉存储库
- 创建要素分支(
git checkout -b feature/amazing) - 提交您的更改(
git commit -m 'Add amazing feature') - 推到分支(
git push origin feature/amazing) - 打开拉取请求
许可证
MIT许可证-请参阅 许可证 了解详情。
链接
______________________________________________________________________
用爱制作 AceDataCloud
