Replicate Flux MCP server

Integrates with Replicate's Flux image generation model, enabling image creation capabilities within conversation interfaces through a simple API token setup and TypeScript implementation available as both an npm module and Docker container.
Back to servers
Provider
Yaroslav Boiko
Release date
Mar 17, 2025
Language
TypeScript
Package
Stats
1.1K downloads
20 stars

The Replicate Flux MCP server enables AI assistants to generate high-quality images and vector graphics by leveraging the Flux Schnell model for raster images and Recraft's V3 SVG model for vector graphics through the Replicate API.

Installation

Prerequisites

Before you begin, you'll need to:

  1. Sign up at Replicate
  2. Create an API token in your account settings

Integration Options

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:
env REPLICATE_API_TOKEN=YOUR_TOKEN npx -y replicate-flux-mcp
  1. Replace YOUR_TOKEN with your actual Replicate API token
  2. Save 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

Hosted Service Options

Smithery Integration

  1. Visit Smithery and create an account
  2. Go to the Replicate Flux MCP server page
  3. Click "Add to Workspace"
  4. Configure your MCP client to use your Smithery workspace URL

Glama.ai Integration

  1. Visit Glama.ai and create an account
  2. Go to the Replicate Flux MCP server page
  3. Click "Install Server"
  4. Configure your MCP client to use your Glama.ai workspace

Usage

Basic Image Generation

To generate an image, simply ask your AI assistant naturally:

  • "Can you generate an image of a serene mountain landscape at sunset?"
  • "Please create an image showing a peaceful mountain scene with a lake reflecting the sunset colors in the foreground"

Available Tools

Generate Image

The generate_image tool creates images based on text prompts using the Flux Schnell model.

Parameters:

  • prompt (required): Text description of the image to generate
  • seed: Random seed for reproducible generation
  • go_fast: Run faster predictions with optimized model (default: true)
  • megapixels: Image resolution ("1" or "0.25", default: "1")
  • num_outputs: Number of images to generate (1-4, default: 1)
  • aspect_ratio: Aspect ratio (e.g., "16:9", "4:3", default: "1:1")
  • output_format: Output format ("webp", "jpg", "png", default: "webp")
  • output_quality: Image quality (0-100, default: 80)
  • num_inference_steps: Number of denoising steps (1-4, default: 4)
  • disable_safety_checker: Disable safety filter (default: false)

Example:

{
  "prompt": "A moonlit forest with magical fireflies",
  "aspect_ratio": "16:9",
  "output_format": "png"
}

Generate Multiple Images

The generate_multiple_images tool creates several images from different prompts in one request.

Parameters:

  • prompts (required): Array of text descriptions (1-10 prompts)
  • Other parameters match those of generate_image

Example:

{
  "prompts": [
    "A red sports car on a mountain road", 
    "A blue sports car on a beach", 
    "A vintage sports car in a city street"
  ],
  "aspect_ratio": "16:9"
}

Generate Image Variants

The generate_image_variants tool creates multiple interpretations of the same concept.

Parameters:

  • prompt (required): Base text description
  • num_variants (required): Number of variants to generate (2-10, default: 4)
  • prompt_variations: List of modifiers to apply (e.g., ["in watercolor style", "in oil painting style"])
  • variation_mode: How to apply variations - 'append' or 'replace' (default: "append")
  • Other parameters match those of generate_image

Example with style variations:

{
  "prompt": "A character portrait",
  "prompt_variations": [
    "in anime style", 
    "in watercolor style", 
    "in oil painting style", 
    "as a 3D render"
  ]
}

Example with seed-based variations:

{
  "prompt": "A futuristic city skyline at night",
  "num_variants": 4,
  "seed": 42
}

Generate SVG

The generate_svg tool creates vector graphics using the Recraft V3 SVG model.

Parameters:

  • prompt (required): Text description of the SVG to generate
  • size: Size of the generated SVG (default: "1024x1024")
  • style: Style of the generated image (default: "any")
    • Options: "any", "engraving", "line_art", "line_circuit", "linocut"

Example:

{
  "prompt": "A simple logo with a mountain and sun",
  "style": "line_art"
}

Working with Generation History

The server provides several tools and resources for managing your generation history:

Prediction Tools

  • prediction_list: Retrieves recent predictions (parameter: limit)
  • get_prediction: Gets details about a specific prediction (parameter: predictionId)

Resources for Browsing History

  • imagelist: Browse generated raster images
  • svglist: Browse generated SVG images
  • predictionlist: Browse all Replicate predictions

Troubleshooting

Common Issues

Authentication Error

  • Ensure your REPLICATE_API_TOKEN is correctly set in the environment
  • Verify 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 complex requests, the server might timeout
  • Try simpler prompts or different parameters

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later