MCPcopy Index your code
hub / github.com/awkoy/replicate-flux-mcp

github.com/awkoy/replicate-flux-mcp @v0.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.0 ↗ · + Follow
34 symbols 98 edges 23 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

MseeP.ai Security Assessment Badge

Replicate Flux MCP

MCP Compatible License TypeScript Model Context Protocol smithery badge NPM Downloads Stars

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

🚀 Getting Started & Integration

Setup Process

  1. Obtain a Replicate API Token
  2. Sign up at Replicate
  3. Create an API token in your account settings

  4. Choose Your Integration Method

  5. Follow one of the integration options below based on your preferred MCP client

  6. Ask Your AI Assistant to Generate an Image

  7. Simply ask naturally: "Can you generate an image of a serene mountain landscape at sunset?"
  8. Or be more specific: "Please create an image showing a peaceful mountain scene with a lake reflecting the sunset colors in the foreground"

  9. Explore Advanced Features

  10. Try different parameter settings for customized results
  11. Experiment with SVG generation using generate_svg
  12. Use batch image generation or variant generation features

Cursor Integration

Method 1: Using mcp.json

  1. Create or edit the .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"]
    }
  }
}
  1. Replace YOUR_TOKEN with your actual Replicate API token
  2. Restart Cursor to apply the changes

Method 2: Manual Mode

  1. Open Cursor and go to Settings
  2. Navigate to the "MCP" or "Model Context Protocol" section
  3. Click "Add Server" or equivalent
  4. Enter the following command in the appropriate field:
env REPLICATE_API_TOKEN=YOUR_TOKEN npx -y replicate-flux-mcp
  1. Replace YOUR_TOKEN with your actual Replicate API token
  2. Save the settings and restart Cursor if necessary

Claude Desktop Integration

  1. Create or edit the mcp.json file in your configuration directory:
{
  "mcpServers": {
    "replicate-flux-mcp": {
      "command": "npx",
      "args": ["-y", "replicate-flux-mcp"],
      "env": {
        "REPLICATE_API_TOKEN": "YOUR TOKEN"
      }
    }
  }
}
  1. Replace YOUR_TOKEN with your actual Replicate API token
  2. Restart 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.

  1. Visit Smithery and create an account if you don't have one
  2. Navigate to the Replicate Flux MCP server page
  3. Click "Add to Workspace" to add the server to your Smithery workspace
  4. 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.

  1. Visit Glama.ai and create an account if you don't have one
  2. Go to the Replicate Flux MCP server page
  3. Click "Install Server" to add the server to your workspace
  4. 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 Modelsrun_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.
  • 📦 Structured Output — Every generate_* tool returns machine-readable structuredContent alongside human-readable content, matching a per-tool outputSchema (URL, prompt, format, aspect ratio, per-variant seed, etc).
  • ⏳ Progress Notifications — Batch and variant generation emit notifications/progress for clients that opt in via progressToken, 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 AnnotationsreadOnlyHint / destructiveHint / openWorldHint / idempotentHint set correctly so clients can reason about safety and cost.
  • 🪵 Structured Logging — Server-side errors travel over notifications/message instead 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, and predictionlist resources.

📚 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
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?

Structured Output

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_

Core symbols most depended-on inside this repo

handleError
called by 9
src/utils/error.ts
userMessage
called by 5
src/prompts/index.ts
outputToBase64
called by 4
src/utils/image.ts
mimeFor
called by 3
src/utils/image.ts
fetchAllPredictions
called by 3
src/resources/fetchPredictions.ts
notify
called by 2
src/tools/generateMultipleImages.ts
notify
called by 2
src/tools/generateImageVariants.ts
fetchWithAuth
called by 2
src/utils/image.ts

Shape

Function 34

Languages

TypeScript100%

Modules by API surface

src/utils/image.ts5 symbols
src/tools/runReplicateModel.ts4 symbols
src/tools/generateMultipleImages.ts2 symbols
src/tools/generateImageVariants.ts2 symbols
src/services/replicate.ts2 symbols
src/resources/svgList.ts2 symbols
src/resources/predictionList.ts2 symbols
src/resources/imageList.ts2 symbols
src/prompts/index.ts2 symbols
src/utils/error.ts1 symbols
src/tools/predictionList.ts1 symbols
src/tools/index.ts1 symbols

For agents

$ claude mcp add replicate-flux-mcp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact