
Nano Banana 🍌 API MCP 服务器
概览
MCP(模型上下文协议)服务器,用于使用 Google Gemini API 生成和编辑图像。 - : 使用 Google Gemini AI 从文本提示生成图片 - : 根据文本描述编辑现有图片 - 支持参考图片以指导生成/编辑 - 多种模型选项(Pro 和 Normal) - 使用 TypeScript 构建类型安全 - 通过 CLI 参数或环境变量灵活配置 生成图像:“夕阳下的宁静山景,前景有湖泊” 要通过Smithery自动为任何客户端安装Nanobanana MCP服务器: 可用客户端:cursor、claude、vscode、windsurf、cline、zed 等。 这会自动配置你所选客户端中的MCP服务器。 你需要一个可以访问Gemini模型的Google API密钥。从Google AI Studio获取你的API密钥。 你可以通过CLI参数提供API密钥:
概述(AI 翻译)
MCP(模型上下文协议)服务器,用于使用 Google Gemini API 生成和编辑图像。
特色
- generate_image:利用Google Gemini AI从文本提示生成图片
- edit_image:根据文本描述编辑现有图片
- 支持参考图像以指导生成/编辑
- 多种模型选项(专业版和普通版)
- 使用 TypeScript 构建以实现类型安全
- 通过CLI参数或环境变量实现灵活配置
图像生成示例
生成图像:“夕阳下的宁静山景,前景有湖泊”
安装
NPM
史密瑟里
要通过Smithery自动为任何客户端安装Nanobanana MCP服务器:
可用客户端:cursor、claude、vscode、windsurf、cline、zed等。
光标示例:
这会自动配置你所选客户端中的MCP服务器。
先修条件
你需要一个可以访问Gemini模型的Google API密钥。从Google AI Studio获取你的API密钥。
你可以通过CLI参数提供API密钥:
或者把它设为环境变量:
MCP 客户端集成
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Nanobanana API MCP
MCP (Model Context Protocol) server for generating and editing images using Google Gemini API.
Features
- generate_image: Generate images from text prompts using Google Gemini AI
- edit_image: Edit existing images based on text descriptions
- Support for reference images to guide generation/editing
- Multiple model options (Pro and Normal)
- Built with TypeScript for type safety
- Flexible configuration via CLI arguments or environment variables
Image Generation Example
Generated image: “A serene mountain landscape at sunset with a lake in the foreground”
Installation
NPM
npm install -g nanobanana-api-mcp
Smithery
To install Nanobanana MCP Server for any client automatically via Smithery:
npx -y @smithery/cli@latest install nanobanana-api-mcp --client
Available clients: cursor, claude, vscode, windsurf, cline, zed, etc.
Example for Cursor:
npx -y @smithery/cli@latest install nanobanana-api-mcp --client cursor
This will automatically configure the MCP server in your chosen client.
Prerequisites
You need a Google API key with access to Gemini models. Get your API key from Google AI Studio.
You can provide the API key via CLI argument:
nanobanana-api-mcp --apiKey "your-api-key-here"
Or set it as an environment variable:
export GOOGLE_API_KEY="your-api-key-here"
nanobanana-api-mcp
MCP Client Integration
Nanobanana MCP can be integrated with various AI coding assistants and IDEs that support the Model Context Protocol (MCP).
Requirements
- Node.js >= v18.0.0
- Google API key with Gemini access
- An MCP-compatible client (Cursor, Claude Code, VS Code, Windsurf, etc.)
Go to: Settings -> Cursor Settings -> MCP -> Add new global MCP server
Add the following configuration to your ~/.cursor/mcp.json file:
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": ["-y", "nanobanana-api-mcp", "--apiKey", "your-api-key-here"]
}
}
}
Optionally, you can fix the model to use for all operations:
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": [
"-y",
安装
npx -y nanobanana-api-mcp --apiKey your-api-key-here配置
{
"mcpServers": {
"nanobanana": {
"command": "npx",
"args": ["-y", "nanobanana-api-mcp", "--apiKey", "your-api-key-here"]
}
}
}