> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xhuoapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Nano Banana MCP Integration Guide

> nanobanana MCP 服务器集成

[MCP (Model Context Protocol)](https://modelcontextprotocol.io) is a model context protocol launched by Anthropic that allows AI models (such as Claude, GPT, etc.) to call external tools through standardized interfaces. With the Nano Banana MCP Server provided by XHuoAPI, you can directly generate and edit AI images in AI clients like Claude Desktop, VS Code, Cursor, etc.

## Feature Overview

The Nano Banana MCP Server offers the following core functionalities:

* **Image Generation** — Generate high-quality images from text prompts
* **Image Editing** — Modify existing images or combine multiple images
* **Virtual Try-On** — Dress clothing on photos of people
* **Product Placement** — Place products in real scenes
* **Multi-Model Support** — Supports nano-banana, nano-banana-2, and nano-banana-pro models
* **Task Querying** — Monitor generation progress and obtain results

## Prerequisites

Before use, you need to obtain an XHuoAPI API Token:

1. Register or log in to the [XHuoAPI platform](https://api.xhuoapi.ai)
2. Go to the [Nano Banana Images API](https://api.xhuoapi.ai/documents/nano-banana-images) page
3. Click "Acquire" to get the API Token (first-time applicants receive free credits)

## Installation Configuration

### Method 1: pip Installation (Recommended)

```bash theme={null}
pip install mcp-nanobanana-pro
```

### Method 2: Source Installation

```bash theme={null}
git clone https://github.com/XHuoAPI/NanoBananaMCP.git
cd NanoBananaMCP
pip install -e .
```

Once installed, you can start the service using the `mcp-nanobanana-pro` command.

## Using in Claude Desktop

Edit the Claude Desktop configuration file:

* **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
* **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

Add the following configuration:

```json theme={null}
{
  "mcpServers": {
    "nanobanana": {
      "command": "mcp-nanobanana-pro",
      "env": {
        "XHuoAPI_API_TOKEN": "Your API Token"
      }
    }
  }
}
```

If using `uvx` (no need to install packages in advance):

```json theme={null}
{
  "mcpServers": {
    "nanobanana": {
      "command": "uvx",
      "args": ["mcp-nanobanana-pro"],
      "env": {
        "XHuoAPI_API_TOKEN": "Your API Token"
      }
    }
  }
}
```

After saving the configuration, restart Claude Desktop to use Nano Banana related tools in the conversation.

## Using in VS Code / Cursor

Create `.vscode/mcp.json` in the project root directory:

```json theme={null}
{
  "servers": {
    "nanobanana": {
      "command": "mcp-nanobanana-pro",
      "env": {
        "XHuoAPI_API_TOKEN": "Your API Token"
      }
    }
  }
}
```

Or use `uvx`:

```json theme={null}
{
  "servers": {
    "nanobanana": {
      "command": "uvx",
      "args": ["mcp-nanobanana-pro"],
      "env": {
        "XHuoAPI_API_TOKEN": "Your API Token"
      }
    }
  }
}
```

## Available Tools List

| Tool Name                    | Description                       |
| ---------------------------- | --------------------------------- |
| `nanobanana_generate_image`  | Generate images from text prompts |
| `nanobanana_edit_image`      | Edit or combine existing images   |
| `nanobanana_get_task`        | Query the status of a single task |
| `nanobanana_get_tasks_batch` | Batch query task statuses         |

## Usage Examples

Once configured, you can directly call these functions in the AI client using natural language, for example:

* "Help me generate a watercolor landscape painting"
* "Photoshop this clothing onto this person"
* "Place this product in a café scene"
* "Generate a high-quality portrait using the nano-banana-pro model"

## More Information

* GitHub Repository: [XHuoAPI/NanoBananaMCP](https://github.com/XHuoAPI/NanoBananaMCP)
* PyPI Package: [mcp-nanobanana-pro](https://pypi.org/project/mcp-nanobanana-pro/)
* API Documentation: [Nano Banana API](https://api.xhuoapi.ai/documents/nano-banana)
