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
Setup instructions
Provider
Yaroslav Boiko
Release date
Mar 17, 2025
Language
TypeScript
Package
Stats
2.0K downloads
36 stars

Replicate Flux MCP is a server that enables AI assistants to generate high-quality images and vector graphics using advanced AI models. It connects to Replicate's API to access the Flux Schnell model for raster images and Recraft's V3 SVG model for vector graphics, allowing your AI assistant to create visual content on demand.

Installation Options

Prerequisites

Before starting, you'll need:

  • A Replicate account and API token (sign up at Replicate)

Using NPX (Simplest Method)

The quickest way to run the MCP server is using NPX:

env REPLICATE_API_TOKEN=your_token_here npx -y replicate-flux-mcp

Replace your_token_here with your actual Replicate API token.

Cursor Integration

Using mcp.json File

  1. Create or edit .cursor/mcp.json 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

Manual Configuration

  1. Open Cursor and go to Settings
  2. Navigate to the MCP section
  3. Add a new server with the command:
env REPLICATE_API_TOKEN=YOUR_TOKEN npx -y replicate-flux-mcp

Claude Desktop Integration

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"
      }
    }
  }
}

Hosted Options

If you prefer not to run the server locally, you can use the hosted versions:

Usage Guide

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?

The assistant will use the generate_image tool to create the image.

Advanced Image Generation

You can customize image generation with parameters:

Please create a high-resolution image of a space station with a 16:9 aspect ratio

Available Tools

generate_image

Generates a single image from a text prompt:

{
  "prompt": "A cyberpunk cityscape at night with neon lights",
  "aspect_ratio": "16:9",
  "output_format": "png"
}

Parameters:

  • prompt (required): Text description of desired image
  • seed (optional): For reproducible results
  • go_fast (optional): Run faster predictions (default: true)
  • megapixels (optional): Resolution - "1" or "0.25" (default: "1")
  • num_outputs (optional): Number of images (1-4)
  • aspect_ratio (optional): Image dimensions ratio (default: "1:1")
  • output_format (optional): "webp", "jpg", or "png" (default: "webp")
  • output_quality (optional): Image quality 0-100 (default: 80)
  • num_inference_steps (optional): Denoising steps 1-4 (default: 4)
  • disable_safety_checker (optional): Disable safety filter (default: false)

generate_svg

Creates vector graphics in SVG format:

{
  "prompt": "A minimalist logo for a tech company",
  "size": "1024x1024",
  "style": "line_art"
}

Parameters:

  • prompt (required): Text description of desired SVG
  • size (optional): Size of output (default: "1024x1024")
  • style (optional): Style options - "any", "engraving", "line_art", "line_circuit", "linocut" (default: "any")

generate_multiple_images

Creates multiple images from 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"
  ],
  "aspect_ratio": "16:9"
}

generate_image_variants

Creates variations of the same concept:

{
  "prompt": "A futuristic city skyline",
  "num_variants": 4,
  "prompt_variations": [
    "in watercolor style", 
    "as an oil painting", 
    "with neon lighting",
    "during sunset"
  ]
}

Browsing Generated Images

You can access your generation history using these resources:

  • imagelist: View your history of generated raster images
  • svglist: View your history of generated SVG images
  • predictionlist: Browse all your Replicate predictions

Troubleshooting

Common Issues

  • Authentication Error: Check that your Replicate API token is correct
  • Safety Filter Blocking: Try modifying your prompt to avoid problematic content
  • Timeout Error: For complex generations, you might need to try again

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "replicate-flux-mcp" '{"command":"env REPLICATE_API_TOKEN=YOUR_TOKEN npx","args":["-y","replicate-flux-mcp"]}'

See the official Claude Code MCP documentation for more details.

For 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 > Tools & Integrations and click "New MCP Server".

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

{
    "mcpServers": {
        "replicate-flux-mcp": {
            "command": "env REPLICATE_API_TOKEN=YOUR_TOKEN npx",
            "args": [
                "-y",
                "replicate-flux-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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "replicate-flux-mcp": {
            "command": "env REPLICATE_API_TOKEN=YOUR_TOKEN npx",
            "args": [
                "-y",
                "replicate-flux-mcp"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

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