MCP Replicate FLUX
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Manages environment variables for the MCP server including API tokens and storage credentials
Stores generated images in Cloudflare R2 storage and returns accessible image URLs, requiring R2 bucket configuration and credentials
Used for version control and project installation from the repository
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:
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.
确保您的 Cloudflare R2 存储桶具有适当的 CORS 设置,以允许公共访问上传的图片。
Running Locally 本地运行
To start the MCP server locally:
在本地启动 MCP 服务器:
The server will start and listen for MCP protocol messages on standard input/output.
服务器将启动并通过标准输入/输出监听 MCP 协议消息。
Usage 使用方法
The server provides a generate-image
tool that accepts two parameters:
prompt
: The text prompt for image generationfilename
: 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:
以下是使用 MCP 客户端库与此 MCP 服务器集成的示例:
Example response 示例响应:
Testing 测试
A test script is provided to verify the image generation and upload functionality.
提供了一个测试脚本,用于验证图片生成和上传功能。
Running the test 运行测试
The test script will:
- Generate an image with a sample prompt
- Upload the image to Cloudflare R2
- Return the accessible URL
测试脚本将:
- 使用示例提示词生成图片
- 将图片上传到 Cloudflare R2
- 返回可访问的 URL
Example test output 测试输出示例:
You can modify the prompt in test.js
to test different image generation scenarios.
您可以在 test.js
中修改提示词来测试不同的图片生成场景。
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:
如果你想单独管理环境变量(使用系统环境变量或.env文件),可以使用最小配置:
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 常见问题
- Image generation fails: Check your Replicate API token and quota
- R2 upload fails: Verify your R2 credentials and bucket permissions
- Cannot access generated images: Ensure your R2 bucket has proper CORS configuration
- 图片生成失败:检查您的 Replicate API 令牌和配额
- R2 上传失败:验证您的 R2 凭证和存储桶权限
- 无法访问生成的图片:确保您的 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.
模型上下文协议(MCP)是一种 AI 模型交互标准,可实现不同 AI 系统之间的互操作性。此服务器实现了一个 MCP 工具,可与任何兼容 MCP 的客户端一起使用。
For more information about MCP, visit: https://mcp.freeaigen.com/
References 参考链接
- Model Context Protocol Documentation
- Replicate API Documentation
- Cloudflare R2 Documentation
- Flux AI Model
License 许可证
MIT
This server cannot be installed
A Model Context Protocol server that generates images using Replicate's FLUX model and stores them in Cloudflare R2, allowing users to create images through simple prompts and retrieve accessible URLs.
- Features 功能特点
- Prerequisites 前置要求
- Environment Variables 环境变量
- Local Installation 本地安装
- Running Locally 本地运行
- Usage 使用方法
- Testing 测试
- Cursor MCP Configuration Cursor MCP配置
- Project Structure 项目结构
- Troubleshooting 故障排除
- MCP Protocol 协议说明
- References 参考链接
- License 许可证