Skip to main content
Glama

FluxMCP

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

一个用于 AI 图像生成和编辑的 模型上下文协议 (MCP) 服务器,通过 AceDataCloud 平台使用 Flux

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

功能特性

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

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

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

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

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

  • Docker 就绪 - 已容器化并提供 K8s 部署清单

  • 安全 - 在 HTTP 模式下支持 Bearer 令牌认证及每请求隔离

工具参考

工具

描述

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. 点击 “Acquire” 获取您的 API 令牌

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

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

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

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

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

Claude.ai

通过 OAuth 直接在 Claude.ai 上连接 —— 无需 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 扩展,该扩展捆绑了所有 15 个 MCP 服务器,支持一键设置。

JetBrains IDEs

  1. 前往 设置 → 工具 → AI Assistant → 模型上下文协议 (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-pro-1.1

像素 (256-1440px)

更好的提示词遵循能力

flux-pro-1.1-ultra

最高

较慢

长宽比

最高质量

flux-kontext-pro

长宽比

图像编辑

flux-kontext-max

最高

较慢

长宽比

复杂编辑

使用示例

生成图像

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

编辑图像

"Add sunglasses to the person in this photo"
→ flux_edit_image(prompt="Add sunglasses", image_url="https://...", 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

Lint 与格式化

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 Hooks

git config core.hooksPath .githooks

API 参考

此 MCP 服务器使用 AceDataCloud Flux API

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

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

完整 API 文档:platform.acedata.cloud

许可证

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

链接

Install Server
A
security – no known vulnerabilities
A
license - permissive license
-
quality - not tested

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/MCPFlux'

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