replicate flux.com
replicate flux.com logo

Replicate Flux

Connects to Replicate's image generation models, enabling text-to-image creation with automatic cloud storage of results...

Created byApr 23, 2025

MCP Replicate FLUX

[![smithery badge](https://smithery.ai/badge/@andylee20014/mcp-replicate-flux)](https://smithery.ai/server/@andylee20014/mcp-replicate-flux)
A Model Context Protocol (MCP) server that generates images using Replicate's FLUX model and stores them in Cloudflare R2.
Replicate FLUX Cloudflare R2 MCP

Features

  • Generate images using Replicate's black-forest-labs/flux-schnell model
  • Store generated images in Cloudflare R2
  • Return accessible image URLs
  • Support for custom prompts and filenames
  • Replicate black-forest-labs/flux-schnell
  • Cloudflare R2

      Prerequisites

      • Node.js (v16 or higher)
      • Replicate API token
      • Cloudflare R2 bucket and credentials
      • npm or yarn
      • Node.js v16
      • Replicate API
      • Cloudflare R2
      • npm yarn

      Environment Variables

      Required environment variables in `.env` file:
      `.env`

      Local Installation

      Installing via Smithery

      To install MCP Replicate FLUX for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@andylee20014/mcp-replicate-flux):

      Installing manually

      Follow these steps to set up the project locally:
      Make sure your Cloudflare R2 bucket has appropriate CORS settings for public access to the uploaded images.

      Running Locally

      To start the MCP server locally:
      The server will start and listen for MCP protocol messages on standard input/output.

      Usage

      The server provides a `generate-image` tool that accepts two parameters:
      • `prompt`: The text prompt for image generation
      • `filename`: The desired filename for the generated image `generate-image`
      • `prompt`
      • `filename`

      Integration Example

      Here's an example of how to integrate with this MCP server using the MCP client library:
      Example response

      Testing

      A test script is provided to verify the image generation and upload functionality.

      Running the test

      The test script will:
      1. Generate an image with a sample prompt
      1. Upload the image to Cloudflare R2
      1. Return the accessible URL
        1. Cloudflare R2
        1. URL
        Example test output
        You can modify the prompt in `test.js` to test different image generation scenarios.

        Cursor MCP Configuration Cursor MCP

        There are two ways to configure the MCP server in Cursor:
        Cursor MCP

        Method 1: Complete Configuration

        Create a file at `~/.cursor/mcp.json` with all environment variables:
        `~/.cursor/mcp.json`

        Method 2: Minimal Configuration

        If you prefer to manage environment variables separately (using system environment variables or .env file), you can use a minimal configuration:
        When using the minimal configuration, make sure your environment variables are properly set up either in:
        • System environment variables
        • `.env` file in the project directory
        • Cloud platform's environment variables (for deployed servers)
          • `.env`

            Notes

            • The `description` field is optional in both methods
            • Environment variables in the configuration file take precedence over system environment variables
            • After changing the configuration, restart Cursor to apply the changes
            • `description`
              • Cursor

              Project Structure

              Troubleshooting

              Common Issues

              1. **Image generation fails**: Check your Replicate API token and quota
              1. **R2 upload fails**: Verify your R2 credentials and bucket permissions
              1. **Cannot access generated images**: Ensure your R2 bucket has proper CORS configuration
              1. ** ** Replicate API
              1. **R2 ** R2
              1. ** ** R2 CORS

              MCP Protocol

              The Model Context Protocol (MCP) is a standard for AI model interaction that enables interoperability between different AI systems. This server implements an MCP tool that can be used with any MCP-compatible client.
              For more information about MCP, visit: [https://mcp.freeaigen.com/](https://mcp.freeaigen.com/)

              References

              • [Model Context Protocol Documentation](https://mcp.freeaigen.com/)
              • [Replicate API Documentation](https://replicate.com/docs)
              • [Cloudflare R2 Documentation](https://developers.cloudflare.com/r2/)
              • [Flux AI Model](https://replicate.com/black-forest-labs/flux-schnell)

              License

              MIT