Flux Cloudflare MCP
Leverages Cloudflare Workers to securely process image generation requests through Black Forest Labs' Flux model
Provides access to Black Forest Labs' Flux model for high-quality image generation based on text prompts
Utilizes TypeScript 4.9+ for type safety and modern JavaScript features in the MCP implementation
Implements runtime type validation for request parameters and API responses
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Flux Cloudflare MCPgenerate a serene mountain landscape at sunset with a lake reflection"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Flux Cloudflare MCP
A powerful Model Context Protocol (MCP) server that provides AI assistants with the ability to generate images using Black Forest Labs' Flux model via a Cloudflare Worker API.
Installation • Features • Usage • Documentation • Contributing
🌟 Features
🖼️ High-Quality Image Generation: Access to Flux, a state-of-the-art image generation model
🤖 Seamless AI Integration: Enable AI assistants like Claude to generate images directly
🎛️ Customizable Parameters: Control aspect ratio, inference steps, and more
🔌 MCP Compatible: Works with any MCP client (Cursor, Claude Desktop, Cline, Zed, etc.)
🔒 Local Processing: All requests are processed securely through the Cloudflare Worker
💬 Chat Completions: Get text completions using the same API
Related MCP server: FLUX Image Generator MCP Server
📦 Installation
Direct Usage with NPX
FLUX_API_TOKEN=your_token FLUX_API_URL=your_api_url npx -y flux-cloudflare-mcpFrom Source
# 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🚀 Setting Up Your Flux API
This MCP server requires a Flux API endpoint to function. You have two options for setting up the API:
Option 1: Deploy using snakeying/flux-api-worker (Recommended)
snakeying/flux-api-worker provides a simple and efficient Cloudflare Worker for accessing the Flux model:
Fork the flux-api-worker repository
Deploy it to Cloudflare Workers:
Create a new Worker in your Cloudflare dashboard
Connect it to your forked repository
Set up the required environment variables:
API_KEY: Your chosen API key for authenticationCF_ACCOUNT_ID: Your Cloudflare account IDCF_API_TOKEN: Your Cloudflare API token with Workers AI accessFLUX_MODEL: The Flux model to use (default: "@cf/black-forest-labs/flux-1-schnell")
Once deployed, your API will be available at
https://your-worker-name.your-subdomain.workers.devUse this URL as your
FLUX_API_URLand your chosen API key asFLUX_API_TOKEN
Option 2: Deploy using aigem/cf-flux-remix
For a more feature-rich implementation with a web UI, you can use aigem/cf-flux-remix:
Follow the installation instructions in the cf-flux-remix repository
Once deployed, your API will be available at your deployed URL
Use this URL as your
FLUX_API_URLand your configured API key asFLUX_API_TOKEN
📚 Documentation
Available Tools
generate_image
Generates an image based on a text prompt using the Flux model.
{
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")
}🔧 Usage
Cursor Integration
Method 1: Using mcp.json
Create or edit the
.cursor/mcp.jsonfile in your project directory:
{
"mcpServers": {
"flux-cloudflare-mcp": {
"command": "env FLUX_API_TOKEN=YOUR_TOKEN FLUX_API_URL=YOUR_API_URL npx",
"args": ["-y", "flux-cloudflare-mcp"]
}
}
}Replace
YOUR_TOKENwith your actual Flux API token andYOUR_API_URLwith your API URLRestart Cursor to apply the changes
Method 2: Using Cursor MCP Settings
Open Cursor and go to Settings
Navigate to the "MCP" or "Model Context Protocol" section
Click "Add Server" or equivalent
Enter the following command in the appropriate field:
env FLUX_API_TOKEN=YOUR_TOKEN FLUX_API_URL=YOUR_API_URL npx -y flux-cloudflare-mcpReplace
YOUR_TOKENwith your actual Flux API token andYOUR_API_URLwith your API URLSave the settings and restart Cursor if necessary
Claude Desktop Integration
env FLUX_API_TOKEN=YOUR_TOKEN FLUX_API_URL=YOUR_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"
}
}
}
}💻 Local Development
Clone the repository:
git clone https://github.com/Hzzy2O/flux-cloudflare-mcp.git
cd flux-cloudflare-mcpInstall dependencies:
npm installBuild the project:
npm run build🛠 Technical Stack
Model Context Protocol SDK - Core MCP functionality
Cloudflare Workers - Serverless API for image generation
TypeScript - Type safety and modern JavaScript features
Zod - Runtime type validation
⚙️ Configuration
The server requires the following environment variables:
FLUX_API_TOKEN: Your API token for authentication with the Flux APIFLUX_API_URL: The URL of your deployed Flux API (from snakeying/flux-api-worker or aigem/cf-flux-remix)
🔍 Troubleshooting
Common Issues
Authentication Error
Ensure your
FLUX_API_TOKENis correctly set in the environmentVerify your token is valid by testing it with the Flux API directly
API Connection Issues
Check that your Flux API (Cloudflare Worker) is running and accessible
Ensure your network allows connections to Cloudflare Workers
Safety Filter Triggered
The model has a built-in safety filter that may block certain prompts
Try modifying your prompt to avoid potentially problematic content
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔗 Resources
snakeying/flux-api-worker - Simple Flux API implementation
aigem/cf-flux-remix - Feature-rich Flux API with web UI
Available Tools
1 toolgenerate_imageC
Generate an image from a text prompt using Flux model
| Name | Required | Description | Default |
|---|---|---|---|
| aspect_ratio | No | Aspect ratio for the generated image | 1:1 |
| file_name | No | Name of the file to save the image | |
| height | No | Height of the generated image | |
| num_inference_steps | No | Number of denoising steps. 4 is recommended, and lower number of steps produce lower quality outputs, faster. | |
| prompt | Yes | Prompt for generated image | |
| save_folder | No | Folder path to save the image | ./output |
| width | No | Width of the generated image |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the model ('Flux') but doesn't cover important traits like rate limits, authentication needs, quality expectations, error handling, or what happens after generation (e.g., file saving behavior). The description is minimal and leaves critical operational details unspecified.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with zero wasted words. It's appropriately sized and front-loaded with the core functionality. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex image generation tool with 7 parameters and no output schema, the description is inadequate. It lacks information about return values (e.g., file path, success indicators), error conditions, model limitations, or usage examples. With no annotations and rich parameter schema, the description should provide more context to guide effective use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema fully documents all 7 parameters. The description adds no parameter-specific information beyond what's in the schema (e.g., it doesn't explain prompt best practices or aspect ratio implications). Baseline 3 is appropriate when schema does all the work.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Generate') and resource ('image') with the method ('from a text prompt using Flux model'). It's specific about the action and technology used. However, without sibling tools, we can't assess differentiation, so it can't achieve a perfect 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or constraints. It simply states what the tool does without context for decision-making. No sibling tools exist, but general usage context is missing.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- First observed
generate_image
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools, as there are no other tools to compare it against. The single tool's purpose is clearly defined and distinct by default.
Since there is only one tool, naming consistency is inherently perfect as there are no other names to compare it with. The tool name 'generate_image' follows a clear verb_noun pattern, but consistency cannot be assessed across multiple tools.
A single tool is generally too few for a server's purpose, as it limits functionality and suggests an incomplete or narrow scope. For a domain like image generation, one tool may be insufficient for comprehensive coverage, such as lacking variations, edits, or management operations.
The server appears focused on image generation, but with only a single tool for generating images from text prompts, there are significant gaps. Missing operations might include editing images, managing generated content, or handling different models, which could lead to agent failures in broader workflows.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for Flux AI image generation
Official FLUX MCP server. Generate, edit, vary, and browse images from Black Forest Labs.
Cloudflare Workers MCP server: ai-agent-scratchpad
An MCP server that integrates with Discord to provide AI-powered features.
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.131MIT