Skip to main content
Glama

Flux Cloudflare MCP

by Hzzy2O

Flux Cloudflare MCP

MCP 兼容执照TypeScript模型上下文协议

强大的模型上下文协议 (MCP) 服务器,为 AI 助手提供通过 Cloudflare Worker API 使用Black Forest Labs 的 Flux 模型生成图像的能力。

安装功能使用文档贡献


🌟 功能

  • 🖼️ 高质量图像生成:访问 Flux,一种最先进的图像生成模型
  • 🤖 无缝 AI 集成:使 Claude 等 AI 助手能够直接生成图像
  • 🎛️ 可自定义参数:控制纵横比、推理步骤等
  • 🔌 MCP 兼容:可与任何 MCP 客户端(Cursor、Claude Desktop、Cline、Zed 等)配合使用。
  • 🔒 本地处理:所有请求均通过 Cloudflare Worker 安全处理
  • 💬 聊天完成:使用相同的 API 获取文本完成

📦安装

直接使用 NPX

FLUX_API_TOKEN=your_token FLUX_API_URL=your_api_url npx -y flux-cloudflare-mcp

来自源

# Clone the repository git clone https://github.com/Hzzy2O/flux-cloudflare-mcp.git cd flux-cloudflare-mcp # Install dependencies npm install # Build the project npm run build

🚀 设置你的 Flux API

此 MCP 服务器需要 Flux API 端点才能运行。您可以通过两种方式设置 API:

选项 1:使用 snakeying/flux-api-worker 部署(推荐)

snakeying/flux-api-worker提供了一个简单高效的 Cloudflare Worker 来访问 Flux 模型:

  1. 分叉flux-api-worker 存储库
  2. 将其部署到 Cloudflare Workers:
    • 在 Cloudflare 仪表板中创建一个新的 Worker
    • 将其连接到您的分叉存储库
    • 设置所需的环境变量:
      • API_KEY :您选择的用于身份验证的 API 密钥
      • CF_ACCOUNT_ID :您的 Cloudflare 帐户 ID
      • CF_API_TOKEN :具有 Workers AI 访问权限的 Cloudflare API 令牌
      • FLUX_MODEL :要使用的 Flux 模型(默认值:“@cf/black-forest-labs/flux-1-schnell”)
  3. 部署完成后,您的 API 将在https://your-worker-name.your-subdomain.workers.dev上可用
  4. 使用此 URL 作为您的FLUX_API_URL ,并使用您选择的 API 密钥作为FLUX_API_TOKEN

选项 2:使用 aigem/cf-flux-remix 部署

如果想要通过 Web UI 实现更多功能,您可以使用aigem/cf-flux-remix

  1. 按照cf-flux-remix 存储库中的安装说明进行操作
  2. 部署完成后,您的 API 将在部署的 URL 上可用
  3. 使用此 URL 作为您的FLUX_API_URL ,并将您配置的 API 密钥用作FLUX_API_TOKEN

📚 文档

可用工具

generate_image

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

{ prompt: string; // Required: Text description of the image to generate num_inference_steps?: number; // Optional: Number of denoising steps (1-4) (default: 4) aspect_ratio?: string; // Optional: Aspect ratio (e.g., "16:9", "4:3") (default: "1:1") }

🔧 使用方法

光标集成

方法 1:使用 mcp.json
  1. 在您的项目目录中创建或编辑.cursor/mcp.json文件:
{ "mcpServers": { "flux-cloudflare-mcp": { "command": "env FLUX_API_TOKEN=YOUR_TOKEN FLUX_API_URL=YOUR_API_URL npx", "args": ["-y", "flux-cloudflare-mcp"] } } }
  1. YOUR_TOKEN替换为您的实际 Flux API 令牌,将YOUR_API_URL替换为您的 API URL
  2. 重新启动 Cursor 以应用更改
方法 2:使用光标 MCP 设置
  1. 打开 Cursor 并转到“设置”
  2. 导航到“MCP”或“模型上下文协议”部分
  3. 单击“添加服务器”或同等按钮
  4. 在相应的字段中输入以下命令:
env FLUX_API_TOKEN=YOUR_TOKEN FLUX_API_URL=YOUR_API_URL npx -y flux-cloudflare-mcp
  1. YOUR_TOKEN替换为您的实际 Flux API 令牌,将YOUR_API_URL替换为您的 API URL
  2. 保存设置并根据需要重新启动 Cursor

Claude 桌面集成

env FLUX_API_TOKEN=你的令牌 FLUX_API_URL=你的API_URL npx -y flux-cloudflare-mcp

{ "mcpServers": { "flux-cloudflare-mcp": { "command": "npx", "args": ["-y", "flux-cloudflare-mcp"], "env": { "FLUX_API_TOKEN": "YOUR_TOKEN", "FLUX_API_URL": "YOUR_API_URL" } } } }

💻 本地开发

  1. 克隆存储库:
git clone https://github.com/Hzzy2O/flux-cloudflare-mcp.git cd flux-cloudflare-mcp
  1. 安装依赖项:
npm install
  1. 构建项目:
npm run build

🛠 技术栈

  • 模型上下文协议 SDK - 核心 MCP 功能
  • Cloudflare Workers - 用于图像生成的无服务器 API
  • TypeScript - 类型安全和现代 JavaScript 功能
  • Zod - 运行时类型验证

⚙️ 配置

服务器需要以下环境变量:

  • FLUX_API_TOKEN :用于使用 Flux API 进行身份验证的 API 令牌
  • FLUX_API_URL :已部署的 Flux API 的 URL(来自 snakeying/flux-api-worker 或 aigem/cf-flux-remix)

🔍 故障排除

常见问题

身份验证错误
  • 确保你的FLUX_API_TOKEN在环境中正确设置
  • 通过直接使用 Flux API 测试来验证您的令牌是否有效
API 连接问题
  • 检查您的 Flux API(Cloudflare Worker)是否正在运行且可访问
  • 确保您的网络允许连接到 Cloudflare Workers
安全过滤器已触发
  • 该模型具有内置安全过滤器,可能会阻止某些提示
  • 尝试修改提示以避免出现潜在的问题内容

🤝 贡献

欢迎贡献代码!欢迎提交 Pull 请求。

  1. 分叉存储库
  2. 创建你的功能分支( git checkout -b feature/amazing-feature
  3. 提交您的更改( git commit -m 'Add some amazing feature'
  4. 推送到分支( git push origin feature/amazing-feature
  5. 打开拉取请求

📄 许可证

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

🔗 资源

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

MCP 服务器使 AI 助手能够通过 Cloudflare Workers 使用 Black Forest Labs 的 Flux 模型生成图像。

  1. 🌟 功能
    1. 📦安装
      1. 直接使用 NPX
      2. 来自源
    2. 🚀 设置你的 Flux API
      1. 选项 1:使用 snakeying/flux-api-worker 部署(推荐)
      2. 选项 2:使用 aigem/cf-flux-remix 部署
    3. 📚 文档
      1. 可用工具
    4. 🔧 使用方法
      1. 光标集成
      2. Claude 桌面集成
    5. 💻 本地开发
      1. 🛠 技术栈
        1. ⚙️ 配置
          1. 🔍 故障排除
            1. 常见问题
          2. 🤝 贡献
            1. 📄 许可证
              1. 🔗 资源

                Related MCP Servers

                • A
                  security
                  A
                  license
                  A
                  quality
                  Enables the generation of images using Together AI's models through an MCP server, supporting customizable parameters such as model selection, image dimensions, and output directory.
                  Last updated -
                  1
                  4
                  JavaScript
                  MIT License
                  • Apple
                  • Linux
                • -
                  security
                  A
                  license
                  -
                  quality
                  A server that integrates Flux's advanced image generation and manipulation features into AI coding assistants, enabling seamless text-to-image and image control workflows in IDEs like Cursor and Windsurf.
                  Last updated -
                  4
                  10
                  Python
                  MIT License
                • -
                  security
                  A
                  license
                  -
                  quality
                  A FastMCP server implementation that provides a standardized interface for accessing AI models hosted on Replicate's API, currently supporting image generation with customizable parameters.
                  Last updated -
                  2
                  Python
                  MIT License
                • -
                  security
                  F
                  license
                  -
                  quality
                  A demonstration project that uses Cloudflare Workers MCP to create custom AI tools that can be integrated with Claude, Cursor, and other AI assistants supporting the Model Context Protocol.
                  Last updated -
                  26
                  TypeScript

                View all related MCP servers

                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/Hzzy2O/flux-cloudfare-mcp'

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