> ## 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.

# Flux MCP Integration Guide

> flux 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 a standardized interface. With the Flux MCP Server provided by XHuoAPI, you can directly generate and edit AI images within AI clients like Claude Desktop, VS Code, Cursor, and more.

## Feature Overview

Flux MCP Server offers the following core features:

* **Text-to-Image Generation** — Generate high-quality images from text prompts
* **Image Editing** — Edit existing images based on text instructions
* **Multi-Model Support** — Supports various models including Flux Pro, Flux Dev, Flux Schnell, Flux Kontext, etc.
* **Model Query** — View all available models and their capabilities
* **Task Query** — Monitor generation progress and retrieve 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 [Flux Images API](https://api.xhuoapi.ai/documents/flux-images) page
3. Click "Acquire" to get the API Token (free quota granted on first application)

## Installation and Configuration

### Method 1: pip Installation (Recommended)

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

### Method 2: Source Installation

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

After installation, you can start the service using the `mcp-flux-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": {
    "flux": {
      "command": "mcp-flux-pro",
      "env": {
        "XHuoAPI_API_TOKEN": "your API Token"
      }
    }
  }
}
```

If using `uvx` (no need to pre-install packages):

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

Save the configuration and restart Claude Desktop to use Flux-related tools in conversations.

## Using in VS Code / Cursor

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

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

Or use `uvx`:

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

## Available Tools

| Tool Name              | Description                                      |
| ---------------------- | ------------------------------------------------ |
| `flux_generate_image`  | Generate images from text prompts                |
| `flux_edit_image`      | Edit existing images based on text instructions  |
| `flux_get_task`        | Query the status of a single task                |
| `flux_get_tasks_batch` | Batch query task statuses                        |
| `flux_list_models`     | List all available models and their capabilities |
| `flux_list_actions`    | List all available tools and workflow examples   |

## Usage Examples

After configuration, you can directly invoke these features in AI clients using natural language, for example:

* "Help me generate a cyberpunk-style city nightscape with Flux"
* "Change the background of this photo to a beach"
* "Use the Flux Kontext Pro model to edit this image and change the clothing color to red"
* "List all available Flux models"

## More Information

* GitHub Repository: [XHuoAPI/FluxMCP](https://github.com/XHuoAPI/FluxMCP)
* PyPI Package: [mcp-flux-pro](https://pypi.org/project/mcp-flux-pro/)
* API Documentation: [Flux Image Generation API](https://api.xhuoapi.ai/documents/flux)
