replicate-flux-mcp
The Replicate Flux MCP server enables AI assistants to generate high-quality images and vector graphics using advanced AI models via the Model Context Protocol.
Generate Images: Create single or multiple images from text prompts using Flux Schnell model
Create Image Variants: Produce multiple interpretations of a single prompt
Generate SVG Graphics: Create vector images using Recraft V3 SVG model
Customize Generation: Control parameters including seed, aspect ratio, resolution, quality, style, and inference steps
Manage Predictions: Retrieve details of specific predictions and browse history
Batch Processing: Generate multiple images or variants in a single request
Integration: Works with MCP clients like Cursor, Claude Desktop, Smithery, and Glama.ai
Enables image generation using Replicate's API with the Black Forest Labs' Flux Schnell model, allowing customization of aspect ratio, quality, and other parameters
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., "@replicate-flux-mcpgenerate a serene mountain landscape at sunset"
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.
Replicate Flux MCP
Replicate Flux MCP is an advanced Model Context Protocol (MCP) server that empowers AI assistants to generate high-quality images and vector graphics. Leveraging Black Forest Labs' Flux Schnell model for raster images and Recraft's V3 SVG model for vector graphics via the Replicate API.
📑 Table of Contents
Related MCP server: Image Generator MCP Server
🚀 Getting Started & Integration
Setup Process
Obtain a Replicate API Token
Sign up at Replicate
Create an API token in your account settings
Choose Your Integration Method
Follow one of the integration options below based on your preferred MCP client
Ask Your AI Assistant to Generate an Image
Simply ask naturally: "Can you generate an image of a serene mountain landscape at sunset?"
Or be more specific: "Please create an image showing a peaceful mountain scene with a lake reflecting the sunset colors in the foreground"
Explore Advanced Features
Try different parameter settings for customized results
Experiment with SVG generation using
generate_svgUse batch image generation or variant generation features
Cursor Integration
Method 1: Using mcp.json
Create or edit the
.cursor/mcp.jsonfile in your project directory:
{
"mcpServers": {
"replicate-flux-mcp": {
"command": "env REPLICATE_API_TOKEN=YOUR_TOKEN npx",
"args": ["-y", "replicate-flux-mcp"]
}
}
}Replace
YOUR_TOKENwith your actual Replicate API tokenRestart Cursor to apply the changes
Method 2: Manual Mode
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 REPLICATE_API_TOKEN=YOUR_TOKEN npx -y replicate-flux-mcpReplace
YOUR_TOKENwith your actual Replicate API tokenSave the settings and restart Cursor if necessary
Claude Desktop Integration
Create or edit the
mcp.jsonfile in your configuration directory:
{
"mcpServers": {
"replicate-flux-mcp": {
"command": "npx",
"args": ["-y", "replicate-flux-mcp"],
"env": {
"REPLICATE_API_TOKEN": "YOUR TOKEN"
}
}
}
}Replace
YOUR_TOKENwith your actual Replicate API tokenRestart Claude Desktop to apply the changes
Smithery Integration
This MCP server is available as a hosted service on Smithery, allowing you to use it without setting up your own server.
Visit Smithery and create an account if you don't have one
Navigate to the Replicate Flux MCP server page
Click "Add to Workspace" to add the server to your Smithery workspace
Configure your MCP client (Cursor, Claude Desktop, etc.) to use your Smithery workspace URL
For more information on using Smithery with your MCP clients, visit the Smithery documentation.
Glama.ai Integration
This MCP server is also available as a hosted service on Glama.ai, providing another option to use it without local setup.
Visit Glama.ai and create an account if you don't have one
Go to the Replicate Flux MCP server page
Click "Install Server" to add the server to your workspace
Configure your MCP client to use your Glama.ai workspace
For more information, visit the Glama.ai MCP servers documentation.
🌟 Features
🖼️ High-Quality Image Generation — Flux Schnell raster images with full control over aspect ratio, megapixels, inference steps, output format, and seed.
🎨 Vector Graphics — Recraft V3 SVG for logos, icons, and diagrams.
📊 Batch + Variants — Generate N images from N prompts or N variants of one prompt (seed-based or prompt-modifier-based).
🧩 Arbitrary Replicate Models —
run_replicate_modelescape hatch accepts anyowner/name[:version]reference, withget_model_schemaintrospection for the OpenAPI input schema. Optional allowlist viaREPLICATE_MODEL_ALLOWLIST.📦 Structured Output — Every
generate_*tool returns machine-readablestructuredContentalongside human-readable content, matching a per-tooloutputSchema(URL, prompt, format, aspect ratio, per-variant seed, etc).⏳ Progress Notifications — Batch and variant generation emit
notifications/progressfor clients that opt in viaprogressToken, so long runs aren't black-boxed.💬 Curated Prompts — 5 ready-made prompt templates (
logo,portrait,svg-icon,product-shot,isometric-diagram) surfaced in Claude Desktop's slash palette and Cursor's@-menu.🏷️ Proper Tool Annotations —
readOnlyHint/destructiveHint/openWorldHint/idempotentHintset correctly so clients can reason about safety and cost.🪵 Structured Logging — Server-side errors travel over
notifications/messageinstead of stderr.🔌 Universal MCP Compatibility — MCP protocol 2025-11-25; works with Claude Desktop, Cursor, Cline, Zed, and any spec-compliant client.
🔍 Generation History — Browse past runs through
imagelist,svglist, andpredictionlistresources.
📚 Documentation
Available Tools
generate_image
Generates an image based on a text prompt using the Flux Schnell model.
{
prompt: string; // Required: Text description of the image to generate
seed?: number; // Optional: Random seed for reproducible generation
go_fast?: boolean; // Optional: Run faster predictions with optimized model (default: true)
megapixels?: "1" | "0.25"; // Optional: Image resolution (default: "1")
num_outputs?: number; // Optional: Number of images to generate (1-4) (default: 1)
aspect_ratio?: string; // Optional: Aspect ratio (e.g., "16:9", "4:3") (default: "1:1")
output_format?: string; // Optional: Output format ("webp", "jpg", "png") (default: "webp")
output_quality?: number; // Optional: Image quality (0-100) (default: 80)
num_inference_steps?: number; // Optional: Number of denoising steps (1-4) (default: 4)
disable_safety_checker?: boolean; // Optional: Disable safety filter (default: false)
}generate_multiple_images
Generates multiple images based on an array of prompts using the Flux Schnell model.
{
prompts: string[]; // Required: Array of text descriptions for images to generate (1-10 prompts)
seed?: number; // Optional: Random seed for reproducible generation
go_fast?: boolean; // Optional: Run faster predictions with optimized model (default: true)
megapixels?: "1" | "0.25"; // Optional: Image resolution (default: "1")
aspect_ratio?: string; // Optional: Aspect ratio (e.g., "16:9", "4:3") (default: "1:1")
output_format?: string; // Optional: Output format ("webp", "jpg", "png") (default: "webp")
output_quality?: number; // Optional: Image quality (0-100) (default: 80)
num_inference_steps?: number; // Optional: Number of denoising steps (1-4) (default: 4)
disable_safety_checker?: boolean; // Optional: Disable safety filter (default: false)
}generate_image_variants
Generates multiple variants of the same image from a single prompt.
{
prompt: string; // Required: Text description for the image to generate variants of
num_variants: number; // Required: Number of image variants to generate (2-10, default: 4)
prompt_variations?: string[]; // Optional: List of prompt modifiers to apply to variants (e.g., ["in watercolor style", "in oil painting style"])
variation_mode?: "append" | "replace"; // Optional: How to apply variations - 'append' adds to base prompt, 'replace' uses variations directly (default: "append")
seed?: number; // Optional: Base random seed. Each variant will use seed+variant_index
go_fast?: boolean; // Optional: Run faster predictions with optimized model (default: true)
megapixels?: "1" | "0.25"; // Optional: Image resolution (default: "1")
aspect_ratio?: string; // Optional: Aspect ratio (e.g., "16:9", "4:3") (default: "1:1")
output_format?: string; // Optional: Output format ("webp", "jpg", "png") (default: "webp")
output_quality?: number; // Optional: Image quality (0-100) (default: 80)
num_inference_steps?: number; // Optional: Number of denoising steps (1-4) (default: 4)
disable_safety_checker?: boolean; // Optional: Disable safety filter (default: false)
}generate_svg
Generates an SVG vector image based on a text prompt using the Recraft V3 SVG model.
{
prompt: string; // Required: Text description of the SVG to generate
size?: string; // Optional: Size of the generated SVG (default: "1024x1024")
style?: string; // Optional: Style of the generated image (default: "any")
// Options: "any", "engraving", "line_art", "line_circuit", "linocut"
}prediction_list
Retrieves a list of your recent predictions from Replicate.
{
limit?: number; // Optional: Maximum number of predictions to return (1-100) (default: 50)
}get_prediction
Gets detailed information about a specific prediction.
{
predictionId: string; // Required: ID of the prediction to retrieve
}run_replicate_model
Runs any model hosted on Replicate by its owner/name[:version] reference. Use this as an escape hatch when none of the curated tools fit. Call get_model_schema first if you don't know the input shape.
{
model: string; // Required: 'owner/name' or 'owner/name:version'
input: Record<string, unknown>; // Required: Model input parameters
prefer_wait?: number; // Optional: Seconds to block waiting for sync output (1-60, default 60)
return_as?: "url" | "base64" | "both"; // Optional: How to return file outputs (default "url")
}Set the REPLICATE_MODEL_ALLOWLIST env var (comma-separated owner/name entries) to restrict which models can be invoked. Unset = any model allowed. Set-but-empty = deny all (the server fails closed rather than silently allowing everything).
get_model_schema
Fetches the OpenAPI input schema and description for a Replicate model so you can pass the right parameters to run_replicate_model.
{
model: string; // Required: Replicate model reference in 'owner/name' form
}Available Resources
imagelist
Browse your history of generated images created with the Flux Schnell model.
svglist
Browse your history of generated SVG images created with the Recraft V3 SVG model.
predictionlist
Browse all your Replicate predictions history.
Available Prompts
Curated templates surfaced in Claude Desktop's slash menu and Cursor's @-palette. Each one fills in sensible defaults then delegates to the relevant generation tool.
Prompt | Description | Arguments |
| Brand/product logo |
|
| Photoreal portrait |
|
| Single-concept vector icon |
|
| Studio product photography |
|
| Isometric technical illustration |
|
Structured Output
Every generate_* tool returns both human-readable content (text + image blocks) and machine-readable structuredContent that matches the tool's outputSchema.
Tool |
|
|
|
|
|
|
|
|
|
Clients that understand MCP structured output can consume URLs and metadata directly without parsing prose.
Environment Variables
Variable | Required | Purpose |
| yes | API token for Replicate. The server exits immediately if it's missing. |
| no | Comma-separated |
💻 Development
Clone the repository:
git clone https://github.com/awkoy/replicate-flux-mcp.git
cd replicate-flux-mcpInstall dependencies:
npm installStart the TypeScript watcher:
npm run watchBuild the project:
npm run buildSmoke-test the server with the MCP Inspector:
npm run inspectorConnect to Client:
{
"mcpServers": {
"image-generation-mcp": {
"command": "npx",
"args": [
"/Users/{USERNAME}/{PATH_TO}/replicate-flux-mcp/build/index.js"
],
"env": {
"REPLICATE_API_TOKEN": "YOUR REPLICATE API TOKEN"
}
}
}
}Testing
This project currently has no automated test suite. Verification is done via:
npm run build— TypeScript type-checking catches most regressions.npm run inspector— drives the built binary through the official MCP Inspector for end-to-end smoke testing of tools, resources, and prompts.
Contributions adding a proper test framework (e.g. Vitest + an MCP stdio client harness) are welcome.
⚙️ Technical Details
Stack
Model Context Protocol SDK - Core MCP functionality for tool and resource management
Replicate API - Provides access to state-of-the-art AI image generation models
TypeScript - Ensures type safety and leverages modern JavaScript features
Zod - Implements runtime type validation for robust API interactions
Configuration
The server can be configured by modifying the CONFIG object in src/config/index.ts:
export const CONFIG = {
serverName: "replicate-flux-mcp",
serverVersion: "0.4.0",
imageModelId: "black-forest-labs/flux-schnell",
svgModelId: "recraft-ai/recraft-v3-svg",
pollingAttempts: 25,
pollingInterval: 2000, // ms
modelAllowlist: (process.env.REPLICATE_MODEL_ALLOWLIST ?? "")
.split(",")
.map((s) => s.trim())
.filter(Boolean),
};modelAllowlist is evaluated once at process start from REPLICATE_MODEL_ALLOWLIST. Restart the server after changing it.
🔍 Troubleshooting
Common Issues
Authentication Error
Ensure your
REPLICATE_API_TOKENis correctly set in the environmentVerify your token is valid by testing it with the Replicate API directly
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
Timeout Error
For larger images or busy servers, you might need to increase
pollingAttemptsorpollingIntervalin the configurationDefault settings should work for most use cases
🤝 Contributing
Contributions are welcome! Please follow these steps to contribute:
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
For feature requests or bug reports, please create a GitHub issue. If you like this project, consider starring the repository!
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔗 Resources
🎨 Examples
Multiple Prompts | Prompt Variants |
Here are some examples of how to use the tools:
Batch Image Generation with generate_multiple_images
Create multiple distinct images at once with different prompts:
{
"prompts": [
"A red sports car on a mountain road",
"A blue sports car on a beach",
"A vintage sports car in a city street"
]
}Image Variants with generate_image_variants
Create different interpretations of the same concept using seeds:
{
"prompt": "A futuristic city skyline at night",
"num_variants": 4,
"seed": 42
}Or explore style variations with prompt modifiers:
{
"prompt": "A character portrait",
"prompt_variations": [
"in anime style",
"in watercolor style",
"in oil painting style",
"as a 3D render"
]
}Made with ❤️ by Yaroslav Boiko
Maintenance
Latest Blog Posts
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/awkoy/replicate-flux-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server