Skip to main content
Glama

FluxMCP

PyPI version PyPI downloads CI License: MIT MCP Python 3.10+

一个基于 Model Context Protocol (MCP) 的服务器,用于通过 AceDataCloud 平台使用 Flux 进行 AI 图像生成和编辑。

直接在 Claude、Cursor 或任何兼容 MCP 的客户端中,使用 Flux 模型(flux-dev、flux-pro、flux-kontext)生成和编辑惊艳的 AI 图像。

功能特性

  • 图像生成 - 使用 6 种 Flux 模型从文本提示生成图像

  • 图像编辑 - 使用上下文感知的 Flux Kontext 模型编辑现有图像

  • 任务管理 - 跟踪异步生成任务并批量查询状态

  • 模型指南 - 内置模型选择和提示词编写指导

  • 双传输模式 - 支持 stdio(本地)和 HTTP(远程/云端)模式

  • Docker 就绪 - 容器化并附带 K8s 部署清单

  • 安全 - Bearer 令牌认证,HTTP 模式下每个请求相互隔离

Related MCP server: DiffuGen

工具参考

工具

描述

flux_generate_image

使用 Flux 根据文本提示生成 AI 图像。

flux_edit_image

使用 Flux 根据文本提示编辑现有图像。

flux_list_models

列出所有可用的 Flux 模型及其功能。

flux_list_actions

列出所有可用的 Flux 工具及其用例。

flux_get_task

查询 Flux 图像生成任务的状态和结果。

flux_get_tasks_batch

一次查询多个 Flux 图像生成任务。

快速开始

1. 获取你的 API 令牌

  1. 在 AceDataCloud 平台 注册

  2. 前往 API 文档页面

  3. 点击 "获取" 获取你的 API 令牌

  4. 复制令牌供后续使用

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

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

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

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

Claude.ai

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

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

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

  3. 完成 OAuth 登录流程

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

Claude Desktop

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

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

Cursor / Windsurf

添加到你的 MCP 配置中(.cursor/mcp.json 或 .windsurf/mcp.json):

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

VS Code (Copilot)

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

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

或者为 VS Code 安装 Ace Data Cloud MCP 扩展,该扩展可通过一键设置注册托管的 MCP 服务器。

JetBrains IDEs

  1. 前往 设置 → 工具 → AI 助手 → 模型上下文协议 (MCP)

  2. 点击 添加 → HTTP

  3. 粘贴:

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

Claude Code

Claude Code 原生支持 MCP 服务器:

claude mcp add flux --transport http https://flux.mcp.acedata.cloud/mcp \
  -h "Authorization: Bearer YOUR_API_TOKEN"

或者添加到项目的 .mcp.json 中:

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

Cline

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

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

Amazon Q Developer

添加到你的 MCP 配置中:

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

Roo Code

添加到 Roo Code 的 MCP 设置中:

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

Continue.dev

添加到 .continue/config.yaml 中:

mcpServers:
  - name: flux
    type: streamable-http
    url: https://flux.mcp.acedata.cloud/mcp
    headers:
      Authorization: "Bearer YOUR_API_TOKEN"

Zed

添加到 Zed 的设置中(~/.config/zed/settings.json):

{
  "language_models": {
    "mcp_servers": {
      "flux": {
        "url": "https://flux.mcp.acedata.cloud/mcp",
        "headers": {
          "Authorization": "Bearer YOUR_API_TOKEN"
        }
      }
    }
  }
}

cURL 测试

# Health check (no auth required)
curl https://flux.mcp.acedata.cloud/health

# MCP initialize
curl -X POST https://flux.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-flux-pro
# or
uvx mcp-flux-pro

# Set your API token
export ACEDATACLOUD_API_TOKEN="your_token_here"

# Run (stdio mode for Claude Desktop / local clients)
mcp-flux-pro

# Run (HTTP mode for remote access)
mcp-flux-pro --transport http --port 8000

Claude Desktop(本地)

{
  "mcpServers": {
    "flux": {
      "command": "uvx",
      "args": ["mcp-flux-pro"],
      "env": {
        "ACEDATACLOUD_API_TOKEN": "your_token_here"
      }
    }
  }
}

Docker(自托管)

docker pull ghcr.io/acedatacloud/mcp-flux-pro:latest
docker run -p 8000:8000 ghcr.io/acedatacloud/mcp-flux-pro:latest

客户端使用自己的 Bearer 令牌连接 — 服务器从每个请求的 Authorization 头中提取令牌。

可用工具

工具

描述

flux_generate_image

使用模型选择从文本提示生成图像

flux_edit_image

使用文本指令编辑现有图像

flux_get_task

查询单个生成任务的状态

flux_get_tasks_batch

一次查询多个任务状态

flux_list_models

列出所有可用的 Flux 模型及其功能

flux_list_actions

显示所有工具和工作流示例

可用提示词

提示词

描述

flux_image_generation_guide

选择正确工具和模型的指南

flux_prompt_writing_guide

编写有效提示词的最佳实践

flux_workflow_examples

常见工作流模式和示例

支持的模型

模型

质量

速度

尺寸格式

最适合用途

flux-dev

良好

快速

像素(256-1440px)

快速原型设计

flux-pro

高

中等

像素(256-1440px)

生产环境使用

flux-kontext-pro

高

中等

宽高比

图像编辑

flux-kontext-max

最高

较慢

宽高比

复杂编辑

flux-2-flex

高

快速

宽高比

Flux 2 均衡质量

flux-2-pro

较高

中等

宽高比

Flux 2 生产环境

flux-2-max

最高

较慢

宽高比

Flux 2 最高质量

flux-2-klein

良好

快速

宽高比

Flux 2 高效输出

使用示例

生成图像

"Generate a photorealistic mountain landscape at golden hour"
→ flux_generate_image(prompt="...", model="flux-2-max", size="16:9")

编辑图像

"Add sunglasses to the person in this photo"
→ flux_edit_image(prompt="Add sunglasses", image_url="https://...", size="1:1", model="flux-kontext-pro")

检查任务状态

"What's the status of my generation?"
→ flux_get_task(task_id="...")

环境变量

变量

必需

默认值

描述

ACEDATACLOUD_API_TOKEN

是(stdio)

—

来自 AceDataCloud 的 API 令牌

ACEDATACLOUD_API_BASE_URL

否

https://api.acedata.cloud

API 基础 URL

ACEDATACLOUD_OAUTH_CLIENT_ID

否

—

OAuth 客户端 ID(托管模式)

ACEDATACLOUD_PLATFORM_BASE_URL

否

https://platform.acedata.cloud

平台基础 URL

FLUX_REQUEST_TIMEOUT

否

1800

请求超时时间(秒)

MCP_SERVER_NAME

否

flux

MCP 服务器名称

LOG_LEVEL

否

INFO

日志级别

开发

设置

git clone https://github.com/AceDataCloud/FluxMCP.git
cd FluxMCP
pip install -e ".[all]"
cp .env.example .env
# Edit .env with your API token

代码检查与格式化

ruff check .
ruff format .
mypy core tools main.py

测试

# Unit tests
pytest --cov=core --cov=tools

# Skip integration tests
pytest -m "not integration"

# With coverage report
pytest --cov=core --cov=tools --cov-report=html

Git 钩子

git config core.hooksPath .githooks

API 参考

此 MCP 服务器使用 AceDataCloud Flux API:

  • POST /flux/images — 生成或编辑图像

  • POST /flux/tasks — 查询任务状态(单个或批量)

完整 API 文档:platform.acedata.cloud

文档

文档

许可证

MIT 许可证 — 详情请参阅 LICENSE。

链接

Available Tools

7 tools
flux_edit_imageAInspect

Edit an existing image using Flux with a text prompt.

This allows you to modify an existing image based on a text description.
The kontext models (flux-kontext-pro, flux-kontext-max) are specifically
designed for high-quality image editing and style transfer.

Use this when:
- You want to modify or transform an existing image
- You want to change specific elements in an image
- You want to apply style changes or artistic effects
- You want to add, remove, or replace objects in an image

For generating new images from scratch, use flux_generate_image instead.

Returns:
    Task ID and edited image information including URLs.

Inputs: size (required), prompt (required), image_url (required), model, +1 more. Returns: result

flux_generate_imageAInspect

Generate AI images from a text prompt using Flux.

Flux is a family of fast, high-quality image generation models by Black Forest Labs.
Different models offer different tradeoffs between speed, quality, and capabilities.

Use this when:
- You want to create new images from a text description
- You need high-quality AI-generated artwork or photos
- You want fast image generation with good prompt following

For editing existing images, use flux_edit_image instead.

Returns:
    Task ID and generated image information including URLs.

Inputs: size (required), prompt (required), count, model, +1 more. Returns: result

flux_generate_videoBInspect

Generate text/image/video-to-video or enhance an owned temporary draft. Poll flux_get_task.

Inputs: request (required). Returns: result

flux_get_taskAInspect

Query the status and result of a Flux image or video generation task.

Use this to check if a generation is complete and retrieve the resulting
image/video URLs and metadata.

Use this when:
- You want to check if an image generation has completed
- You need to retrieve image URLs from a previous generation
- You used async callback and want to check results later
- The initial generation returned a task_id without immediate results

Returns:
    Task status and generation result including image URLs.

Inputs: task_id (required). Returns: result

flux_get_tasks_batchAInspect

Query multiple Flux image or video generation tasks at once.

Efficiently check the status of multiple tasks in a single request.
More efficient than calling flux_get_task multiple times.

Use this when:
- You have multiple pending generations to check
- You want to get status of several images at once
- You're tracking a batch of generations

Returns:
    Status and result information for all queried tasks.

Inputs: task_ids (required). Returns: result

flux_list_actionsAInspect

List all available Flux tools and their use cases.

Reference guide for what each tool does and when to use it.

Returns:
    Categorized list of all tools with descriptions.

Inputs: no named parameters. Returns: result

flux_list_modelsAInspect

List all available Flux models and their capabilities.

Reference guide for choosing the right Flux model for your use case.

Returns:
    Detailed list of all Flux models with descriptions and recommendations.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 7 tools

    Disambiguation4/5

    The core tools are clearly separated: generate vs edit vs video generation, and single-task vs batch task queries are explicitly distinguished. Minor overlap exists because flux_generate_video bundles several video workflows and flux_get_tasks_batch could be seen as an optimization of flux_get_task, but descriptions make the intended boundaries clear.

    Naming Consistency5/5

    All tools follow a consistent flux_verb_noun snake_case pattern, such as flux_generate_image, flux_edit_image, flux_get_task, and flux_list_models. The convention is predictable throughout.

    Tool Count5/5

    Seven tools is well-scoped for an image/video generation service. The set covers generation, editing, task polling, batch polling, and reference discovery without obvious padding.

    Completeness4/5

    The surface covers the main lifecycle: generate/edit media, generate video, poll tasks, batch poll, and discover models/actions. Minor gaps remain around cancellation or listing existing tasks, but core workflows appear supported.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers