Labsco
andylee20014 logo

MCP Replicate FLUX

10

from andylee20014

Generates images using Replicate's FLUX model and stores them in Cloudflare R2.

🔥🔥🔥✓ VerifiedAccount requiredAdvanced setup

MCP Replicate FLUX

smithery badge

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

  • 返回可访问的图片链接

  • 支持自定义提示词和文件名

Environment Variables 环境变量

Required environment variables in .env file:

.env 文件中需要的环境变量:

REPLICATE_API_TOKEN=your_replicate_token
STORAGE_ENDPOINT=your_r2_endpoint
STORAGE_ACCESS_KEY=your_r2_access_key
STORAGE_SECRET_KEY=your_r2_secret_key
STORAGE_BUCKET=your_bucket_name
STORAGE_DOMAIN=your_domain

Testing 测试

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

提供了一个测试脚本,用于验证图片生成和上传功能。

Running the test 运行测试

node test.js

The test script will:

  1. Generate an image with a sample prompt
  2. Upload the image to Cloudflare R2
  3. Return the accessible URL

测试脚本将:

  1. 使用示例提示词生成图片
  2. 将图片上传到 Cloudflare R2
  3. 返回可访问的 URL

Example test output 测试输出示例:

Generating image with prompt: "a beautiful girl"
Filename: test-1234567890.jpg
Image generated and uploaded successfully!
Image URL: https://your-domain.com/test-1234567890.jpg

You can modify the prompt in test.js to test different image generation scenarios.

您可以在 test.js 中修改提示词来测试不同的图片生成场景。

Project Structure 项目结构

mcp-replicate-flux/
├── .env                  # Environment variables
├── index.js             # MCP server entry point
├── generateImage.js      # Image generation and R2 upload logic
├── test.js              # Test script
└── README.md            # Project documentation

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 参考链接