0xcapi/flux-cloudfare-mcp
Built by Metorial, the integration platform for agentic AI.
0xcapi/flux-cloudfare-mcp
Server Summary
Generate high-quality images
Integrate with applications
Customize image generation parameters
Secure processing with Cloudflare Workers
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
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
This MCP server requires a Flux API endpoint to function. You have two options for setting up the API:
snakeying/flux-api-worker provides a simple and efficient Cloudflare Worker for accessing the Flux model:
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")https://your-worker-name.your-subdomain.workers.dev
FLUX_API_URL
and your chosen API key as FLUX_API_TOKEN
For a more feature-rich implementation with a web UI, you can use aigem/cf-flux-remix:
FLUX_API_URL
and your configured API key as FLUX_API_TOKEN
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")
}
.cursor/mcp.json
file 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"]
}
}
}
YOUR_TOKEN
with your actual Flux API token and YOUR_API_URL
with your API URLenv FLUX_API_TOKEN=YOUR_TOKEN FLUX_API_URL=YOUR_API_URL npx -y flux-cloudflare-mcp
YOUR_TOKEN
with your actual Flux API token and YOUR_API_URL
with your API URLenv 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"
}
}
}
}
git clone https://github.com/Hzzy2O/flux-cloudflare-mcp.git
cd flux-cloudflare-mcp
npm install
npm run build
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)FLUX_API_TOKEN
is correctly set in the environmentContributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.