Flux Cloudflare MCP
Flux Cloudflare MCP
Un potente servidor de Protocolo de Contexto de Modelo (MCP) que proporciona a los asistentes de IA la capacidad de generar imágenes utilizando el modelo Flux de Black Forest Labs a través de una API de Cloudflare Worker.
Instalación • Características • Uso • Documentación • Contribución
🌟 Características
🖼️ Generación de imágenes de alta calidad : acceso a Flux, un modelo de generación de imágenes de última generación
🤖 Integración perfecta con IA : permite que los asistentes de IA como Claude generen imágenes directamente
🎛️ Parámetros personalizables : controle la relación de aspecto, los pasos de inferencia y más
🔌 Compatible con MCP : funciona con cualquier cliente MCP (Cursor, Claude Desktop, Cline, Zed, etc.)
🔒 Procesamiento local : todas las solicitudes se procesan de forma segura a través de Cloudflare Worker
💬 Finalizaciones de chat : obtén finalizaciones de texto usando la misma API
Related MCP server: FLUX Image Generator MCP Server
📦 Instalación
Uso directo con NPX
FLUX_API_TOKEN=your_token FLUX_API_URL=your_api_url npx -y flux-cloudflare-mcpDe la fuente
# 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🚀 Configuración de su API de Flux
Este servidor MCP requiere un punto final de la API de Flux para funcionar. Tiene dos opciones para configurar la API:
Opción 1: Implementar usando snakeying/flux-api-worker (recomendado)
snakeying/flux-api-worker proporciona un Cloudflare Worker simple y eficiente para acceder al modelo Flux:
Bifurcar el repositorio flux-api-worker
Implementarlo en Cloudflare Workers:
Crea un nuevo trabajador en tu panel de Cloudflare
Conéctalo a tu repositorio bifurcado
Configure las variables de entorno requeridas:
API_KEY: Su clave API elegida para la autenticaciónCF_ACCOUNT_ID: ID de su cuenta de CloudflareCF_API_TOKEN: Su token de API de Cloudflare con acceso a la IA de WorkersFLUX_MODEL: El modelo Flux a utilizar (predeterminado: "@cf/black-forest-labs/flux-1-schnell")
Una vez implementada, su API estará disponible en
https://your-worker-name.your-subdomain.workers.devUtilice esta URL como su
FLUX_API_URLy su clave API elegida comoFLUX_API_TOKEN
Opción 2: Implementar usando aigem/cf-flux-remix
Para una implementación con más funciones y una interfaz de usuario web, puede utilizar aigem/cf-flux-remix :
Siga las instrucciones de instalación en el repositorio cf-flux-remix
Una vez implementada, su API estará disponible en su URL implementada
Utilice esta URL como su
FLUX_API_URLy su clave API configurada comoFLUX_API_TOKEN
📚 Documentación
Herramientas disponibles
generate_image
Genera una imagen basada en una solicitud de texto utilizando el modelo 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")
}🔧 Uso
Integración del cursor
Método 1: Usar mcp.json
Cree o edite el archivo
.cursor/mcp.jsonen el directorio de su proyecto:
{
"mcpServers": {
"flux-cloudflare-mcp": {
"command": "env FLUX_API_TOKEN=YOUR_TOKEN FLUX_API_URL=YOUR_API_URL npx",
"args": ["-y", "flux-cloudflare-mcp"]
}
}
}Reemplace
YOUR_TOKENcon su token de API de Flux real yYOUR_API_URLcon la URL de su APIReinicie el cursor para aplicar los cambios
Método 2: Uso de la configuración del cursor MCP
Abra Cursor y vaya a Configuración
Vaya a la sección "MCP" o "Protocolo de contexto de modelo"
Haga clic en "Agregar servidor" o equivalente
Introduzca el siguiente comando en el campo correspondiente:
env FLUX_API_TOKEN=YOUR_TOKEN FLUX_API_URL=YOUR_API_URL npx -y flux-cloudflare-mcpReemplace
YOUR_TOKENcon su token de API de Flux real yYOUR_API_URLcon la URL de su APIGuarde la configuración y reinicie Cursor si es necesario
Integración de escritorio de Claude
env FLUX_API_TOKEN=SU_TOKEN FLUX_API_URL=SU_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"
}
}
}
}💻 Desarrollo local
Clonar el repositorio:
git clone https://github.com/Hzzy2O/flux-cloudflare-mcp.git
cd flux-cloudflare-mcpInstalar dependencias:
npm installConstruir el proyecto:
npm run build🛠 Pila técnica
SDK del Protocolo de Contexto de Modelo: funcionalidad principal de MCP
Cloudflare Workers: API sin servidor para la generación de imágenes
TypeScript: seguridad de tipos y funciones modernas de JavaScript
Zod - Validación de tipos en tiempo de ejecución
⚙️ Configuración
El servidor requiere las siguientes variables de entorno:
FLUX_API_TOKEN: Su token de API para la autenticación con la API de FluxFLUX_API_URL: La URL de su API Flux implementada (desde snakeying/flux-api-worker o aigem/cf-flux-remix)
🔍 Solución de problemas
Problemas comunes
Error de autenticación
Asegúrese de que su
FLUX_API_TOKENesté configurado correctamente en el entornoVerifique que su token sea válido probándolo directamente con la API de Flux
Problemas de conexión de la API
Comprueba que tu API Flux (Cloudflare Worker) esté en ejecución y sea accesible
Asegúrese de que su red permita conexiones a Cloudflare Workers
Filtro de seguridad activado
El modelo tiene un filtro de seguridad incorporado que puede bloquear ciertas indicaciones.
Intente modificar su mensaje para evitar contenido potencialmente problemático
🤝 Contribuyendo
¡Agradecemos sus contribuciones! No dude en enviar una solicitud de incorporación de cambios.
Bifurcar el repositorio
Crea tu rama de funciones (
git checkout -b feature/amazing-feature)Confirme sus cambios (
git commit -m 'Add some amazing feature')Empujar a la rama (
git push origin feature/amazing-feature)Abrir una solicitud de extracción
📄 Licencia
Este proyecto está licenciado bajo la licencia MIT: consulte el archivo de LICENCIA para obtener más detalles.
🔗 Recursos
snakeying/flux-api-worker - Implementación simple de la API de Flux
aigem/cf-flux-remix : API Flux con numerosas funciones e interfaz web
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.
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
- AlicenseCqualityDmaintenanceAn 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.31MIT
- 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 npm-
- 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.14 npm1MIT