diff --git a/README.md b/README.md
index 1967092..f64b201 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@
# Replicate Flux MCP
+[English](README.md) | [中文](README.zh.md)
+



@@ -14,7 +16,7 @@
-**Replicate Flux MCP** is an advanced Model Context Protocol (MCP) server that empowers AI assistants to generate high-quality images and vector graphics. Leveraging [Black Forest Labs' Flux Schnell model](https://replicate.com/black-forest-labs/flux-schnell) for raster images and [Recraft's V3 SVG model](https://replicate.com/recraft-ai/recraft-v3-svg) for vector graphics via the Replicate API.
+**Replicate Flux MCP** is an advanced Model Context Protocol (MCP) server that empowers AI assistants to generate high-quality images and vector graphics. By default it uses the free-tier models from Replicate’s **Try for Free** collection — [black-forest-labs/flux-1.1-pro](https://replicate.com/black-forest-labs/flux-1.1-pro) for raster images and [luma/reframe-video](https://replicate.com/luma/reframe-video) for SVG/video placeholder output. You can switch to higher-end models (e.g., [black-forest-labs/flux-schnell](https://replicate.com/black-forest-labs/flux-schnell) or [recraft-ai/recraft-v3-svg](https://replicate.com/recraft-ai/recraft-v3-svg)) via environment variables without code changes.
## 📑 Table of Contents
@@ -23,7 +25,8 @@
- [Cursor Integration](#cursor-integration)
- [Claude Desktop Integration](#claude-desktop-integration)
- [Smithery Integration](#smithery-integration)
- - [Glama.ai Integration](#glamaai-integration)
+- [Glama.ai Integration](#glamaai-integration)
+- [Codex Integration](#codex-integration)
- [Features](#-features)
- [Documentation](#-documentation)
- [Available Tools](#available-tools)
@@ -133,6 +136,22 @@ This MCP server is also available as a hosted service on Glama.ai, providing ano
For more information, visit the [Glama.ai MCP servers documentation](https://glama.ai/mcp/servers).
+### Codex Integration
+
+Add the server to `~/.codex/config.toml`:
+
+```toml
+[mcp_servers.replicate]
+command = "npx"
+args = ["-y", "replicate-flux-mcp"]
+env = { REPLICATE_API_TOKEN = "your-replicate-api-token", REPLICATE_IMAGE_MODEL_ID = "your-image-model-id", REPLICATE_SVG_MODEL_ID = "your-svg-model-id" }
+startup_timeout_sec = 30_000
+```
+
+Replace the env values as needed. If you omit `REPLICATE_IMAGE_MODEL_ID` / `REPLICATE_SVG_MODEL_ID`, the defaults fall back to the Try for Free models so Codex can start the MCP server without paid credits.
+
+You can browse currently free, trial-eligible models at Replicate's **Try for Free** collection: https://replicate.com/collections/try-for-free — pick any model IDs from there and drop them into the env vars above for quick experiments.
+
## 🌟 Features
- **🖼️ High-Quality Image Generation** - Create stunning images using Flux Schnell, a state-of-the-art AI model
@@ -311,19 +330,43 @@ npm run build
### Configuration
-The server can be configured by modifying the `CONFIG` object in `src/config/index.ts`:
+The server can be configured by modifying the `CONFIG` object in `src/config/index.ts` or by setting the `REPLICATE_IMAGE_MODEL_ID` / `REPLICATE_SVG_MODEL_ID` environment variables to override the defaults:
```javascript
const CONFIG = {
serverName: "replicate-flux-mcp",
serverVersion: "0.1.2",
- imageModelId: "black-forest-labs/flux-schnell",
- svgModelId: "recraft-ai/recraft-v3-svg",
+ // Defaults are free-tier models so npx works out of the box
+ imageModelId: process.env.REPLICATE_IMAGE_MODEL_ID ?? "black-forest-labs/flux-1.1-pro",
+ svgModelId: process.env.REPLICATE_SVG_MODEL_ID ?? "luma/reframe-video",
pollingAttempts: 25,
pollingInterval: 2000, // ms
};
```
+#### Switching models (no code changes)
+
+Use env vars when launching the server (works with `npx`, Cursor, Claude Desktop, etc.):
+
+```bash
+# Flux Schnell + Recraft SVG (paid models)
+REPLICATE_IMAGE_MODEL_ID="black-forest-labs/flux-schnell" \
+REPLICATE_SVG_MODEL_ID="recraft-ai/recraft-v3-svg" \
+REPLICATE_API_TOKEN=YOUR_TOKEN \
+npx -y replicate-flux-mcp
+
+# Stay on Try-for-Free defaults (already default):
+REPLICATE_API_TOKEN=YOUR_TOKEN npx -y replicate-flux-mcp
+
+# Pick any other Replicate model id
+REPLICATE_IMAGE_MODEL_ID="google/imagen-4" \
+REPLICATE_SVG_MODEL_ID="black-forest-labs/flux-kontext-pro" \
+REPLICATE_API_TOKEN=YOUR_TOKEN \
+npx -y replicate-flux-mcp
+```
+
+> TIP:只需设置环境变量即可切换模型,无需修改代码或重新发布。
+
## 🔍 Troubleshooting
### Common Issues
@@ -419,4 +462,3 @@ Or explore style variations with prompt modifiers:
---
Made with ❤️ by Yaroslav Boiko
-
diff --git a/README.zh.md b/README.zh.md
new file mode 100644
index 0000000..98b96a0
--- /dev/null
+++ b/README.zh.md
@@ -0,0 +1,77 @@
+# Replicate Flux MCP
+
+[English](README.md) | **中文**
+
+本项目是一个 Model Context Protocol (MCP) 服务器,默认使用 Replicate “Try for Free” 集合中的免费模型:`black-forest-labs/flux-1.1-pro`(图片)和 `luma/reframe-video`(SVG/视频占位)。你可以通过环境变量切换到任意模型(如 `black-forest-labs/flux-schnell`、`recraft-ai/recraft-v3-svg`)。
+
+> 免费模型列表:
+
+## 目录
+- [快速开始](#快速开始)
+- [集成方式](#集成方式)
+ - [Cursor](#cursor)
+ - [Claude Desktop](#claude-desktop)
+ - [Smithery](#smithery)
+ - [Glama.ai](#glamaai)
+ - [Codex](#codex)
+- [模型配置](#模型配置)
+- [故障排查](#故障排查)
+
+## 快速开始
+1. 在 Replicate 获取 `REPLICATE_API_TOKEN`。
+2. 任选集成方式运行 `npx -y replicate-flux-mcp`(记得传入 api token)。
+3. 通过环境变量可即时切换模型:
+ ```bash
+ REPLICATE_IMAGE_MODEL_ID="black-forest-labs/flux-schnell" \
+ REPLICATE_SVG_MODEL_ID="recraft-ai/recraft-v3-svg" \
+ REPLICATE_API_TOKEN=你的token \
+ npx -y replicate-flux-mcp
+ ```
+
+## 集成方式
+
+### Cursor
+`.cursor/mcp.json` 示例:
+```json
+{
+ "mcpServers": {
+ "replicate-flux-mcp": {
+ "command": "env",
+ "args": [
+ "REPLICATE_API_TOKEN=你的token",
+ "REPLICATE_IMAGE_MODEL_ID=可选",
+ "REPLICATE_SVG_MODEL_ID=可选",
+ "npx", "-y", "replicate-flux-mcp"
+ ]
+ }
+ }
+}
+```
+
+### Claude Desktop
+`mcp.json` 示例略,与 README.md 相同,注意设置环境变量。
+
+### Smithery / Glama.ai
+可直接在各自的服务器市场添加 `replicate-flux-mcp`,无需本地部署。
+
+### Codex
+`~/.codex/config.toml` 示例:
+```toml
+[mcp_servers.replicate]
+command = "npx"
+args = ["-y", "replicate-flux-mcp"]
+env = { REPLICATE_API_TOKEN = "your-replicate-api-token", REPLICATE_IMAGE_MODEL_ID = "your-image-model-id", REPLICATE_SVG_MODEL_ID = "your-svg-model-id" }
+startup_timeout_sec = 30_000
+```
+不填 `REPLICATE_IMAGE_MODEL_ID` / `REPLICATE_SVG_MODEL_ID` 时会使用免费默认模型,启动即可使用。
+
+## 模型配置
+- 默认:图片 `black-forest-labs/flux-1.1-pro`,SVG `luma/reframe-video`(均在 Try for Free)。
+- 覆盖:通过环境变量 `REPLICATE_IMAGE_MODEL_ID` / `REPLICATE_SVG_MODEL_ID` 设置任意 Replicate 模型。
+- 免费模型列表:
+
+## 故障排查
+- 认证错误:确认 `REPLICATE_API_TOKEN` 有效。
+- 超时:增大 `pollingAttempts` 或 `pollingInterval`(见 `src/config/index.ts`)。
+- 模型不可用:确认所选模型在你的账户下可用或在 Try for Free 配额内。
+
diff --git a/package-lock.json b/package-lock.json
index e26d73a..d59ca45 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "replicate-flux-mcp",
- "version": "0.0.9",
+ "version": "0.1.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "replicate-flux-mcp",
- "version": "0.0.9",
+ "version": "0.1.2",
"license": "MIT",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.7.0",
diff --git a/src/config/index.ts b/src/config/index.ts
index 5415058..82eddf6 100644
--- a/src/config/index.ts
+++ b/src/config/index.ts
@@ -1,9 +1,12 @@
// Configuration
+const imageModelId = (process.env.REPLICATE_IMAGE_MODEL_ID ?? "black-forest-labs/flux-1.1-pro") as `${string}/${string}`;
+const svgModelId = (process.env.REPLICATE_SVG_MODEL_ID ?? "luma/reframe-video") as `${string}/${string}`;
+
export const CONFIG = {
- serverName: "replicate-flux-mcp",
- serverVersion: "0.1.2",
- imageModelId: "black-forest-labs/flux-schnell" as `${string}/${string}`,
- svgModelId: "recraft-ai/recraft-v3-svg" as `${string}/${string}`,
- pollingAttempts: 25,
- pollingInterval: 2000, // ms
-};
+ serverName: "replicate-flux-mcp",
+ serverVersion: "0.1.2",
+ imageModelId,
+ svgModelId,
+ pollingAttempts: 25,
+ pollingInterval: 2000, // ms
+}