Skip to main content
Glama

NanoBananaMCP

PyPI version PyPI downloads Python 3.10+ License: MIT MCP

一个用于 AI 图像生成和编辑的 Model Context Protocol (MCP) 服务器,通过 AceDataCloud API 使用 Google 的 Nano Banana 模型。

直接从 Claude、VS Code 或任何兼容 MCP 的客户端生成和编辑 AI 图像。

功能

  • 图像生成 - 根据文本提示创建高质量图像

  • 图像编辑 - 修改现有图像或组合多张图像

  • 虚拟试穿 - 为照片中的人物穿上服装

  • 产品植入 - 将产品放置在逼真的场景中

  • 任务跟踪 - 监控生成进度并获取结果

Related MCP server: MidjourneyMCP

工具参考

工具

描述

nanobanana_generate_image

使用 Google 的 Nano Banana 模型根据文本提示生成 AI 图像。

nanobanana_edit_image

根据文本提示使用 AI 编辑或组合图像。

nanobanana_get_task

查询图像生成或编辑任务的状态和结果。

nanobanana_get_tasks_batch

一次查询多个图像生成/编辑任务。

快速入门

1. 获取您的 API 令牌

  1. AceDataCloud 平台 注册

  2. 前往 API 文档页面

  3. 点击 “Acquire” 获取您的 API 令牌

  4. 复制令牌以供下方使用

2. 使用托管服务器(推荐)

AceDataCloud 托管了一个受管理的 MCP 服务器 —— 无需本地安装

端点: https://nanobanana.mcp.acedata.cloud/mcp

所有请求都需要 Bearer 令牌。请使用第 1 步中的 API 令牌。

Claude.ai

通过 OAuth 直接在 Claude.ai 上连接 —— 无需 API 令牌

  1. 前往 Claude.ai 设置 → 集成 → 添加更多

  2. 输入服务器 URL:https://nanobanana.mcp.acedata.cloud/mcp

  3. 完成 OAuth 登录流程

  4. 开始在对话中使用这些工具

Claude Desktop

添加到您的配置中(macOS 上为 ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "nanobanana": {
      "type": "streamable-http",
      "url": "https://nanobanana.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Cursor / Windsurf

添加到您的 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 Code (Copilot)

添加到您的 VS Code MCP 配置(.vscode/mcp.json):

{
  "servers": {
    "nanobanana": {
      "type": "streamable-http",
      "url": "https://nanobanana.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

或者为 VS Code 安装 Ace Data Cloud MCP 扩展,该扩展捆绑了所有 15 个 MCP 服务器,支持一键设置。

JetBrains IDEs

  1. 前往 设置 → 工具 → AI Assistant → Model Context Protocol (MCP)

  2. 点击 添加HTTP

  3. 粘贴:

{
  "mcpServers": {
    "nanobanana": {
      "url": "https://nanobanana.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Claude Code

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

添加到 Cline 的 MCP 设置(.cline/mcp_settings.json):

{
  "mcpServers": {
    "nanobanana": {
      "type": "streamable-http",
      "url": "https://nanobanana.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Amazon Q Developer

添加到您的 MCP 配置:

{
  "mcpServers": {
    "nanobanana": {
      "type": "streamable-http",
      "url": "https://nanobanana.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Roo Code

添加到 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

添加到 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

Claude Desktop (本地)

{
  "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]

提示词编写技巧

为了获得最佳效果,请在提示词中包含以下要素:

  • 主体: 主要焦点是什么?

  • 氛围: 图像应传达什么情绪?

  • 光照: 场景是如何照明的?

  • 相机/镜头: 什么摄影风格?(85mm 人像、广角等)

  • 质量关键词: 技术描述符(焦外成像、胶片颗粒、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.md

API 参考

此服务器封装了 AceDataCloud NanoBanana API

用例

  • 人像增强 - 在同一个人身上尝试不同的服装

  • 产品场景合成 - 将白色背景的产品放置在逼真的环境中

  • 属性替换 - 更改材质、颜色或变体

  • 海报快速编辑 - 快速更改风格或主题

  • 2D 转 3D - 将图像转换为 3D 产品模型

  • 图像修复 - 修复旧照片或损坏的照片

贡献

欢迎贡献!请:

  1. Fork 本仓库

  2. 创建功能分支 (git checkout -b feature/amazing)

  3. 提交您的更改 (git commit -m 'Add amazing feature')

  4. 推送到分支 (git push origin feature/amazing)

  5. 开启 Pull Request

许可证

MIT 许可证 - 详情请参阅 LICENSE

链接


AceDataCloud 用心制作

Install Server
A
license - permissive license
A
quality
B
maintenance

Maintenance

Maintainers
Response time
2dRelease cycle
80Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

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/AceDataCloud/NanoBananaMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server