Flux Cloudflare MCP
Flux Cloudflare MCP
强大的模型上下文协议 (MCP) 服务器,为 AI 助手提供通过 Cloudflare Worker API 使用Black Forest Labs 的 Flux 模型生成图像的能力。
🌟 功能
🖼️ 高质量图像生成:访问 Flux,一种最先进的图像生成模型
🤖 无缝 AI 集成:使 Claude 等 AI 助手能够直接生成图像
🎛️ 可自定义参数:控制纵横比、推理步骤等
🔌 MCP 兼容:可与任何 MCP 客户端(Cursor、Claude Desktop、Cline、Zed 等)配合使用。
🔒 本地处理:所有请求均通过 Cloudflare Worker 安全处理
💬 聊天完成:使用相同的 API 获取文本完成
Related MCP server: FLUX Image Generator MCP Server
📦安装
直接使用 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 模型:
将其部署到 Cloudflare Workers:
在 Cloudflare 仪表板中创建一个新的 Worker
将其连接到您的分叉存储库
设置所需的环境变量:
API_KEY:您选择的用于身份验证的 API 密钥CF_ACCOUNT_ID:您的 Cloudflare 帐户 IDCF_API_TOKEN:具有 Workers AI 访问权限的 Cloudflare API 令牌FLUX_MODEL:要使用的 Flux 模型(默认值:“@cf/black-forest-labs/flux-1-schnell”)
部署完成后,您的 API 将在
https://your-worker-name.your-subdomain.workers.dev上可用使用此 URL 作为您的
FLUX_API_URL,并使用您选择的 API 密钥作为FLUX_API_TOKEN
选项 2:使用 aigem/cf-flux-remix 部署
如果想要通过 Web UI 实现更多功能,您可以使用aigem/cf-flux-remix :
按照cf-flux-remix 存储库中的安装说明进行操作
部署完成后,您的 API 将在部署的 URL 上可用
使用此 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
在您的项目目录中创建或编辑
.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"]
}
}
}将
YOUR_TOKEN替换为您的实际 Flux API 令牌,将YOUR_API_URL替换为您的 API URL重新启动 Cursor 以应用更改
方法 2:使用光标 MCP 设置
打开 Cursor 并转到“设置”
导航到“MCP”或“模型上下文协议”部分
单击“添加服务器”或同等按钮
在相应的字段中输入以下命令:
env FLUX_API_TOKEN=YOUR_TOKEN FLUX_API_URL=YOUR_API_URL npx -y flux-cloudflare-mcp将
YOUR_TOKEN替换为您的实际 Flux API 令牌,将YOUR_API_URL替换为您的 API URL保存设置并根据需要重新启动 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"
}
}
}
}💻 本地开发
克隆存储库:
git clone https://github.com/Hzzy2O/flux-cloudflare-mcp.git
cd flux-cloudflare-mcp安装依赖项:
npm install构建项目:
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 请求。
分叉存储库
创建你的功能分支(
git checkout -b feature/amazing-feature)提交您的更改(
git commit -m 'Add some amazing feature')推送到分支(
git push origin feature/amazing-feature)打开拉取请求
📄 许可证
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
🔗 资源
snakeying/flux-api-worker - 简单的 Flux API 实现
aigem/cf-flux-remix - 功能丰富的 Flux API 和 Web UI
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- AlicenseBqualityDmaintenanceA TypeScript-based MCP server that enables text-to-image generation using Cloudflare's Flux Schnell model API.15MIT
- FlicenseCqualityDmaintenanceAn MCP server that generates images based on text prompts using Black Forest Lab's FLUX model, allowing for customized image dimensions, prompt upsampling, safety settings, and batch generation.31
- FlicenseBqualityNot gradedmaintenanceAn MCP server that enables generating and editing high-quality images with natural language using Black Forest Labs' FLUX.1 Kontext Pro model.25
- AlicenseNot gradedqualityFmaintenanceAn MCP server that enables AI assistants to generate images using Black Forest Labs API and FLUX models, with automatic polling and image URL retrieval.141MIT
Related MCP Connectors
MCP server for Flux AI image generation
An MCP server that integrates with Discord to provide AI-powered features.
MCP server for NanoBanana AI image generation and editing
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/duoduoriver/flux-cloudfare-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server