A lightweight bridge to Replicate's Flux Schnell and Recraft V3 SVG models that lets Claude and other MCP clients generate images and vector graphics on demand. Exposes tools for single images, batch generation, and variant creation with full control over aspect ratio, output format, seed, and inference steps. Includes an escape hatch for running arbitrary Replicate models with schema introspection. Returns structured output with URLs and metadata, sends progress notifications for long batches, and surfaces five curated prompt templates for common use cases like logos and isometric diagrams. Useful when you need AI-generated visuals inline during a coding or design session without leaving your editor.
Replicate Flux MCP is an advanced Model Context Protocol (MCP) server that empowers AI assistants to generate high-quality images and vector graphics. By default it uses black-forest-labs/flux-schnell for raster images and recraft-ai/recraft-v3-svg for SVG output. You can override the curated image/SVG models through environment variables, and image tools also accept a per-call model_id override from the built-in allowlist.
Obtain a Replicate API Token
Choose Your Integration Method
Ask Your AI Assistant to Generate an Image
Explore Advanced Features
generate_svg.cursor/mcp.json file in your project directory:{
"mcpServers": {
"replicate-flux-mcp": {
"command": "env REPLICATE_API_TOKEN=YOUR_TOKEN npx",
"args": ["-y", "replicate-flux-mcp"]
}
}
}
YOUR_TOKEN with your actual Replicate API tokenenv REPLICATE_API_TOKEN=YOUR_TOKEN npx -y replicate-flux-mcp
YOUR_TOKEN with your actual Replicate API tokenmcp.json file in your configuration directory:{
"mcpServers": {
"replicate-flux-mcp": {
"command": "npx",
"args": ["-y", "replicate-flux-mcp"],
"env": {
"REPLICATE_API_TOKEN": "YOUR TOKEN"
}
}
}
}
YOUR_TOKEN with your actual Replicate API tokenThis MCP server is available as a hosted service on Smithery, allowing you to use it without setting up your own server.
For more information on using Smithery with your MCP clients, visit the Smithery documentation.
This MCP server is also available as a hosted service on Glama.ai, providing another option to use it without local setup.
For more information, visit the Glama.ai MCP servers documentation.
Add the server to ~/.codex/config.toml:
[mcp_servers.replicate]
command = "npx"
args = ["-y", "replicate-flux-mcp"]
env = { REPLICATE_API_TOKEN = "your-replicate-api-token", REPLICATE_IMAGE_MODEL_ID = "your-image-model-id", REPLICATE_SVG_MODEL_ID = "your-svg-model-id" }
startup_timeout_sec = 30_000
Replace the env values as needed. If you omit REPLICATE_IMAGE_MODEL_ID / REPLICATE_SVG_MODEL_ID, the server uses black-forest-labs/flux-schnell for images and recraft-ai/recraft-v3-svg for SVGs.
Curated tools validate model overrides against built-in allowlists:
black-forest-labs/flux-schnell, google/imagen-4, black-forest-labs/flux-kontext-pro, ideogram-ai/ideogram-v3-turbo, black-forest-labs/flux-1.1-pro, black-forest-labs/flux-devrecraft-ai/recraft-v3-svgrun_model extras: minimax/video-01, luma/reframe-video, topazlabs/video-upscale, topazlabs/image-upscale, szcho/codeformer, tencentarc/gfpganrun_replicate_model escape hatch accepts any owner/name[:version] reference, with get_model_schema introspection for the OpenAPI input schema. Optional allowlist via REPLICATE_MODEL_ALLOWLIST.generate_* tool returns machine-readable structuredContent alongside human-readable content, matching a per-tool outputSchema (URL, prompt, format, aspect ratio, per-variant seed, etc).notifications/progress for clients that opt in via progressToken, so long runs aren't black-boxed.logo, portrait, svg-icon, product-shot, isometric-diagram) surfaced in Claude Desktop's slash palette and Cursor's @-menu.readOnlyHint / destructiveHint / openWorldHint / idempotentHint set correctly so clients can reason about safety and cost.notifications/message instead of stderr.imagelist, svglist, and predictionlist resources.generate_imageGenerates an image based on a text prompt using the configured image model (allowlist only).
{
prompt: string; // Required: Text description of the image to generate
model_id?: string; // Optional: Override image model (allowlist only)
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)
support_image_mcp_response_type?: boolean; // Optional: Return embedded image content when supported (default: true)
}
generate_multiple_imagesGenerates multiple images based on an array of prompts using the configured image model (allowlist only).
{
prompts: string[]; // Required: Array of text descriptions for images to generate (1-10 prompts)
model_id?: string; // Optional: Override image model (allowlist only)
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)
support_image_mcp_response_type?: boolean; // Optional: Return embedded image content when supported (default: true)
}
generate_image_variantsGenerates multiple variants of the same image from a single prompt using the configured image model (allowlist only).
{
prompt: string; // Required: Text description for the image to generate variants of
model_id?: string; // Optional: Override image model (allowlist only)
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)
support_image_mcp_response_type?: boolean; // Optional: Return embedded image content when supported (default: true)
}
generate_svgGenerates SVG/vector output based on a text prompt using the configured SVG model (allowlist only).
{
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_listRetrieves a list of your recent predictions from Replicate.
{
limit?: number; // Optional: Maximum number of predictions to return (1-100) (default: 50)
}
get_predictionGets detailed information about a specific prediction.
{
predictionId: string; // Required: ID of the prediction to retrieve
}
run_modelRuns a whitelisted Replicate model with a raw input payload (useful for video or restoration models).
{
model_id: string; // Required: Replicate model id (allowlist only)
input?: Record<string, unknown>; // Optional: Raw input payload for the model
}
run_replicate_modelRuns 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_schemaFetches 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
}
imagelistBrowse your history of generated images created with the configured image model.
svglistBrowse your history of generated SVG outputs created with the configured SVG model.
predictionlistBrowse all your Replicate predictions history.
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 |
|---|---|---|
logo | Brand/product logo | brand, style?, palette? |
portrait | Photoreal portrait | subject, mood?, lens? |
svg-icon | Single-concept vector icon | concept, style? |
product-shot | Studio product photography | product, surface? |
isometric-diagram | Isometric technical illustration | subject, emphasis? |
Every generate_* tool returns both human-readable content (text + image blocks) and machine-readable structuredContent that matches the tool's outputSchema.
| Tool | structuredContent shape |
|---|---|
generate_image | { url, prompt, format, aspect_ratio, seed? } |
generate_svg | { url, prompt, size, style, svg? } |
generate_multiple_images | { images: [{ url, prompt }], format, aspect_ratio } |
generate_image_variants | { base_prompt, variation_mode, variants: [{ variant_index, url, prompt_used, seed? }], format, aspect_ratio } |
Clients that understand MCP structured output can consume URLs and metadata directly without parsing prose.
| Variable | Required | Purpose |
|---|---|---|
REPLICATE_API_TOKEN | yes | API token for Replicate. The server exits immediately if it's missing. |
REPLICATE_IMAGE_MODEL_ID | no | Overrides the default curated image model used by generate_image, generate_multiple_images, generate_image_variants, and create_prediction. The value must be in the built-in image allowlist. |
REPLICATE_SVG_MODEL_ID | no | Overrides the default SVG model used by generate_svg. The value must be in the built-in SVG allowlist. |
REPLICATE_MODEL_ALLOWLIST | no | Comma-separated owner/name entries that gate run_replicate_model. Unset = any model allowed. Set-but-empty = deny all (fail-closed). Evaluated once at process start, so set it in your MCP client's env block (not via a dotenv loaded later). |
git clone https://github.com/awkoy/replicate-flux-mcp.git
cd replicate-flux-mcp
npm install
npm run watch
npm run build
npm run inspector
{
"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"
}
}
}
}
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.
The server can be configured by modifying the CONFIG object in src/config/index.ts or by setting the REPLICATE_IMAGE_MODEL_ID / REPLICATE_SVG_MODEL_ID environment variables to override the defaults:
export const CONFIG = {
serverName: "replicate-flux-mcp",
serverVersion: "0.4.0",
imageModelId: process.env.REPLICATE_IMAGE_MODEL_ID ?? "black-forest-labs/flux-schnell",
svgModelId: process.env.REPLICATE_SVG_MODEL_ID ?? "recraft-ai/recraft-v3-svg",
pollingAttempts: 25,
pollingInterval: 2000, // ms
modelAllowlistConfigured: process.env.REPLICATE_MODEL_ALLOWLIST !== undefined,
modelAllowlist: (process.env.REPLICATE_MODEL_ALLOWLIST ?? "")
.split(",")
.map((s) => s.trim())
.filter(Boolean),
};
Use env vars when launching the server (works with npx, Cursor, Claude Desktop, etc.). Curated image/SVG tool overrides must be in the built-in allowlists:
# Stay on defaults:
REPLICATE_API_TOKEN=YOUR_TOKEN npx -y replicate-flux-mcp
# Switch to other allowlisted models
REPLICATE_IMAGE_MODEL_ID="google/imagen-4" \
REPLICATE_SVG_MODEL_ID="recraft-ai/recraft-v3-svg" \
REPLICATE_API_TOKEN=YOUR_TOKEN \
npx -y replicate-flux-mcp
modelAllowlist is evaluated once at process start from REPLICATE_MODEL_ALLOWLIST. Restart the server after changing it.
REPLICATE_API_TOKEN is correctly set in the environmentpollingAttempts or pollingInterval in the configurationContributions are welcome! Please follow these steps to contribute:
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)For feature requests or bug reports, please create a GitHub issue. If you like this project, consider starring the repository!
This project is licensed under the MIT License - see the LICENSE file for details.
| Multiple Prompts | Prompt Variants |
|---|---|
Here are some examples of how to use the tools:
generate_multiple_imagesCreate 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"
]
}
generate_image_variantsCreate 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
miapre/html-to-figma-design-system
ie3jp/illustrator-mcp-server
coding-solo/godot-mcp
ivanmurzak/unity-mcp
yctimlin/mcp_excalidraw
figma/mcp-server-guide