Content
# Replicate-Flux MCP Server
**English** | [中文](#replicate-flux-mcp-服务器)
A TypeScript-based MCP server for running the Flux AI image generation model on Replicate.
## Features
- Generate images using the black-forest-labs/flux-dev model through Replicate
- Simple integration with any MCP-compatible application (Claude, etc.)
- Customizable image generation parameters
## Quick Start
### Prerequisites
- Node.js 18+ installed
- Replicate API token from [https://replicate.com/account](https://replicate.com/account)
### Installation
1. Clone this repository
2. Install dependencies:
```bash
npm install
```
3. Create a `.env` file with your Replicate API token:
```
REPLICATE_API_TOKEN=your_token_here
```
4. Build the server:
```bash
npm run build
```
### Running
#### Using Node directly
Run the server directly:
```bash
node build/index.js
```
#### Using npx
After installation, you can run the server via npx:
```bash
npx Replicate-Flux
```
#### Using Docker
Build the Docker image:
```bash
docker build -t replicate-flux .
```
Run the container (passing your API token):
```bash
docker run -e REPLICATE_API_TOKEN=your_token_here replicate-flux
```
## Client Configuration
### Claude and Other MCP Clients
Most MCP clients require configuration in their settings. Here are examples:
#### Using local installation
```json
{
"mcpServers": {
"replicate-flux": {
"command": "/path/to/replicate-flux/build/index.js"
}
}
}
```
#### Using npx
```json
{
"mcpServers": {
"replicate-flux": {
"command": "npx",
"args": ["Replicate-Flux"]
}
}
}
```
#### Using Docker
```json
{
"mcpServers": {
"replicate-flux": {
"command": "docker",
"args": ["run", "--rm", "-e", "REPLICATE_API_TOKEN=your_token_here", "replicate-flux"]
}
}
}
```
Note: If you've already configured your environment variables in a `.env` file or system-wide, you can omit the `env` field in most configurations. However, for Docker, you'll still need to pass the environment variable through the container.
### Environment Variables
This project requires the following environment variables:
- `REPLICATE_API_TOKEN` - Your Replicate API token
You can set this in a `.env` file, in your system environment, or directly in your MCP client configuration.
### Security Notes
- Never commit your `.env` file or any file containing API keys to version control
- The `.gitignore` file is configured to exclude `.env` files from Git
- When deploying, set environment variables securely according to your hosting platform's instructions
## Development
For development with auto-rebuild:
```bash
npm run watch
```
### Debugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector), which is available as a package script:
```bash
npm run inspector
```
The Inspector will provide a URL to access debugging tools in your browser.
---
# Replicate-Flux MCP 服务器
[English](#replicate-flux-mcp-server) | **中文**
这是一个基于TypeScript的MCP服务器,用于在Replicate上运行Flux AI图像生成模型。
## 功能特点
- 使用Replicate上的black-forest-labs/flux-dev模型生成图像
- 与任何MCP兼容应用(如Claude等)简单集成
- 可自定义的图像生成参数
## 快速开始
### 前提条件
- 安装Node.js 18+
- 从[https://replicate.com/account](https://replicate.com/account)获取Replicate API令牌
### 安装
1. 克隆此仓库
2. 安装依赖:
```bash
npm install
```
3. 创建一个包含Replicate API令牌的`.env`文件:
```
REPLICATE_API_TOKEN=你的令牌
```
4. 构建服务器:
```bash
npm run build
```
### 运行方式
#### 直接使用Node
直接运行服务器:
```bash
node build/index.js
```
#### 使用npx
安装后,可以通过npx运行服务器:
```bash
npx Replicate-Flux
```
#### 使用Docker
构建Docker镜像:
```bash
docker build -t replicate-flux .
```
运行容器(传入你的API令牌):
```bash
docker run -e REPLICATE_API_TOKEN=你的令牌 replicate-flux
```
## 客户端配置
### Claude和其他MCP客户端
大多数MCP客户端需要在其设置中进行配置。以下是一些例子:
#### 使用本地安装
```json
{
"mcpServers": {
"replicate-flux": {
"command": "/path/to/replicate-flux/build/index.js"
}
}
}
```
#### 使用npx
```json
{
"mcpServers": {
"replicate-flux": {
"command": "npx",
"args": ["Replicate-Flux"]
}
}
}
```
#### 使用Docker
```json
{
"mcpServers": {
"replicate-flux": {
"command": "docker",
"args": ["run", "--rm", "-e", "REPLICATE_API_TOKEN=你的令牌", "replicate-flux"]
}
}
}
```
注意:如果你已经在`.env`文件或系统环境中配置了环境变量,在大多数配置中可以省略`env`字段。但对于Docker,你仍然需要通过容器传递环境变量。
### 环境变量
此项目需要以下环境变量:
- `REPLICATE_API_TOKEN` - 你的Replicate API令牌
你可以在`.env`文件中设置、在系统环境中设置,或直接在MCP客户端配置中设置。
### 安全须知
- 切勿将`.env`文件或任何包含API密钥的文件提交到版本控制系统
- `.gitignore`文件已配置为从Git中排除`.env`文件
- 部署时,根据你的托管平台的说明安全地设置环境变量
## 开发
用于开发的自动重建:
```bash
npm run watch
```
### 调试
由于MCP服务器通过标准输入输出通信,调试可能具有挑战性。我们推荐使用[MCP Inspector](https://github.com/modelcontextprotocol/inspector),可通过以下包脚本使用:
```bash
npm run inspector
```
Inspector将提供一个URL,让你在浏览器中访问调试工具。
Connection Info
You Might Also Like
semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
repomix
📦 Repomix is a powerful tool that packs your entire repository into a...
Serena
A powerful coding agent toolkit providing semantic retrieval and editing...
Blender
BlenderMCP integrates Blender with Claude AI for enhanced 3D modeling.
pydantic-ai
GenAI Agent Framework, the Pydantic way
cua
Open-source infrastructure for Computer-Use Agents. Sandboxes, SDKs, and...