Token导航 LogoToken导航TokenDH.com
Replicate Streamable MCP Server logo
设计创作未说明官方来源来源级核验

Replicate Streamable MCP Server

MCP Server

轻量级MCP服务器,专注于使用Replicate官方模型进行AI图像生成和编辑。

工具数

0

提示词数

0

GitHub Stars

6

资源数

0
图像生成TypeScript设计

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

iceener

提供方

iceener

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

复制MCP服务器

轻量级MCP服务器,用于使用Replicate的官方模型生成和编辑AI图像。

作者 过度

概述

这是一个专门为图像生成工作流设计的专注、最小的MCP服务器。与功能齐全的Replicate MCP服务器不同,此服务器仅公开Flux、SDXL和Seedream等官方型号的图像生成和编辑所需的内容。

推荐用法:提前告诉你的助手你喜欢哪种型号以及任何具体的设置(质量、纵横比、风格)。这减少了工具调用,并更快地获得更好的结果。

系统提示添加示例:

For image generation, use black-forest-labs/flux-schnell with 16:9 aspect ratio unless I specify otherwise.

通知

此repo以两种方式工作:

  • 作为一个 节点/HONO服务器 用于本地工作流
  • 作为一个 Cloudflare工作人员 用于远程交互

特性

  • 搜索模型 --查找具有完整输入模式的图像生成模型
  • 生成图像 --运行预测并获取过期URL的结果
  • 轻量级 --只有2个工具
  • API密钥认证 --简单的Bearer令牌或X-Api-Key标头身份验证
  • 双运行时 --Node.js/Bun或Cloudflare Workers

设计原则

  • LLM友好:两个聚焦工具,而不是1:1 API镜像
  • 模式感知:搜索返回输入模式,以便代理知道确切的参数
  • 安全:复制存储为机密的API密钥,客户端使用单独的承载令牌
  • 清晰的反馈:模型参数、生成时间、降价就绪输出

______________________________________________________________________

安装

先决条件: 包子, 复制帐户.

跑步方式(选一种)

  1. 地方发展 --带有承载令牌身份验证的标准设置
  2. Cloudflare Worker(牧者开发) --本地工人测试
  3. Cloudflare Worker(部署) --远程生产

______________________________________________________________________

1.地方发展——快速起步

  1. 获取复制API令牌:

- 访问 replicate.com/account/api-tokes - 创建新的API令牌 - 复制令牌(以开头 r8_)

  1. 配置环境:
cd replicate-mcp
bun install
cp env.example .env

编辑 .env:

PORT=3000

# Generate with: openssl rand -hex 32
API_KEY=your-random-auth-token

# Replicate API Token (from replicate.com)
REPLICATE_API_TOKEN=r8_your_token_here
  1. 运行:
bun dev
# MCP: http://127.0.0.1:3000/mcp

克劳德桌面/光标:

{
  "mcpServers": {
    "replicate": {
      "command": "npx",
      "args": ["mcp-remote", "http://localhost:3000/mcp", "--transport", "http-only"],
      "env": { "NO_PROXY": "127.0.0.1,localhost" }
    }
  }
}

______________________________________________________________________

2.Cloudflare Worker(本地开发人员)

bun x wrangler dev --local | cat

创建 .dev.vars 关于地方秘密:

API_KEY=your_random_auth_token
REPLICATE_API_TOKEN=r8_your_replicate_token

端点: http://127.0.0.1:8787/mcp

______________________________________________________________________

3.Cloudflare Worker(部署)

  1. 为会话存储创建KV命名空间:
bun x wrangler kv:namespace create TOKENS

输出将显示:

Add the following to your wrangler.toml:
[[kv_namespaces]]
binding = "TOKENS"
id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  1. 更新 wrangler.toml 使用您的KV命名空间ID:
[[kv_namespaces]]
binding = "TOKENS"
id = "your-kv-namespace-id-from-step-1"
  1. 设置秘密:
# Generate a random token for client authentication
openssl rand -hex 32
bun x wrangler secret put API_KEY
# Paste the generated token when prompted

# Replicate API token
bun x wrangler secret put REPLICATE_API_TOKEN
# Paste your Replicate token when prompted
  1. 部署:
bun x wrangler deploy

端点: https://..workers.dev/mcp

______________________________________________________________________

客户端配置

爱丽丝应用程序

添加为MCP服务器:

  • 网址: https://your-worker.workers.dev/mcp
  • 类型: streamable-http
  • 头球 Authorization: Bearer

克劳德桌面/光标(本地服务器)

{
  "mcpServers": {
    "replicate": {
      "command": "npx",
      "args": ["mcp-remote", "http://localhost:3000/mcp", "--transport", "http-only"],
      "env": { "NO_PROXY": "127.0.0.1,localhost" }
    }
  }
}

克劳德桌面/光标(Cloudflare Worker)

{
  "mcpServers": {
    "replicate": {
      "command": "npx",
      "args": ["mcp-remote", "https://your-worker.workers.dev/mcp", "--transport", "http-only"]
    }
  }
}

MCP检查员(快速测试)

bunx @modelcontextprotocol/inspector
# Connect to: http://localhost:3000/mcp (local) or https://your-worker.workers.dev/mcp (remote)

______________________________________________________________________

工具

search_models

搜索模型并获取其输入模式。最多返回5个具有完整参数详细信息的模型。

// Input
{
  query: string;  // Model name, task, or keywords
}

// Output
### owner/name
Description of the model
Runs: 1,234,567

Input parameters:
  - prompt [REQUIRED]: string
  - aspect_ratio: enum: ["1:1", "16:9", "9:16"] = "1:1"
  - num_outputs: integer = 1
  ...

例子:

{ "query": "flux" }

generate_image

运行图像生成模型并等待结果。

// Input
{
  model: string;                    // "owner/name" format
  input: Record;   // Model-specific parameters
}

// Output
## Image Generated in 2.3s

Model: black-forest-labs/flux-schnell

Display the image to the user using markdown syntax:

![Generated image](https://replicate.delivery/...)

Note: URLs expire in 1 hour.

常见输入模式:

// Text-to-image
{
  "model": "black-forest-labs/flux-schnell",
  "input": {
    "prompt": "a cat on the moon",
    "aspect_ratio": "16:9"
  }
}

// Image editing
{
  "model": "black-forest-labs/flux-kontext-pro",
  "input": {
    "prompt": "change the sky to sunset",
    "image": "https://example.com/source.jpg"
  }
}

______________________________________________________________________

热门型号

型号速度最适合
black-forest-labs/flux-schnell~2s快速生成,草稿
black-forest-labs/flux-dev~10s更高质量,更详细
bytedance/seedream-4~5s多功能、多参考
black-forest-labs/flux-kontext-pro~8s使用文本编辑图像

纵横比指南

比率用例
1:1肖像、图标、个人资料图片
16:9风景、电影、桌面壁纸
9:16移动壁纸、故事、垂直内容
4:3经典照片格式
21:9超宽电影

______________________________________________________________________

HTTP端点

端点方法目的
/mcp发布MCP JSON-RPC 2.0
/healthGET健康检查

______________________________________________________________________

环境变量

Node.js(.env)

变量必填描述
REPLICATE_API_TOKEN复制API令牌(r8\_…)
API_KEYMCP客户端的认证令牌
PORT服务器端口(默认值:3000)
HOST服务器主机(默认值:127.0.0.1)

Cloudflare Workers(wrangler.toml+机密)

牧马人。汤姆瓦尔斯:

[vars]
MCP_TITLE = "Replicate MCP Server"
MCP_VERSION = "1.0.0"

秘密(通过设置 wrangler secret put):

  • API_KEY --客户端的随机身份验证令牌
  • REPLICATE_API_TOKEN -复制API令牌

KV命名空间:

[[kv_namespaces]]
binding = "TOKENS"
id = "your-kv-namespace-id"

______________________________________________________________________

发展

bun dev           # Start with hot reload
bun run typecheck # TypeScript check
bun run lint      # Lint code
bun run build     # Production build
bun start         # Run production

______________________________________________________________________

建筑

src/
├── config/
│   └── metadata.ts              # Tool descriptions
├── tools/
│   ├── search-models.tool.ts    # Search with schema enrichment
│   └── generate-image.tool.ts   # Run predictions
├── services/
│   └── api/
│       └── replicate.service.ts # Replicate API client
├── http/
│   ├── app.ts                   # Hono server
│   └── middlewares/
│       └── auth.ts              # API key validation
├── index.ts                     # Node.js entry
└── worker.ts                    # Workers entry

______________________________________________________________________

故障排除

问题解决方案
401未经授权检查 API_KEY 已设置,客户端发送 Authorization: Bearer
“REPLICATE_API_TOKEN未配置”设置机密: wrangler secret put REPLICATE_API_TOKEN
“模型格式无效”使用 owner/name 格式(例如。, black-forest-labs/flux-schnell)
“缺少必需的参数”调用 search_models 查看精确的输入模式
“超出速率限制”请稍候,然后重试
“图像URL已过期”URL将在1小时后过期--重新生成
KV命名空间错误运行 wrangler kv:namespace create TOKENS 并更新wrangler.toml

调试

MCP检验员测试:

bunx @modelcontextprotocol/inspector
# Connect to your endpoint and test tools

检查Worker日志:

wrangler tail

______________________________________________________________________

许可证

麻省理工学院

目录标签

目录标签

图像生成TypeScript设计AI图像生成本地部署轻量级服务器模型搜索API密钥认证双运行时支持

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

api-key

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明api-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP