Replicate MCP Server
Provides tools for searching models and generating images using Replicate's API, enabling AI agents to interact with image generation and editing models.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Replicate MCP Servergenerate an image of a cat playing piano using flux-schnell"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Replicate MCP Server
Lightweight MCP server for AI image generation and editing using Replicate's official models.
Release status (2026-07-27): this repository pins
@modelcontextprotocol/serverand the test-only@modelcontextprotocol/clientto2.0.0-beta.5, with Zod 4 and the candidate2026-07-28protocol. The dated protocol and stable v2 SDK are not final at this commit; do not claim final conformance until the release gate is verified.
The Bun and Cloudflare Workers entry points share one fetch-native handler per deployment and create a fresh MCP server for every request. Modern HTTP is stateless; compatibility with 2025-era clients uses the SDK's stateless fallback and does not create MCP sessions.
Author: overment
Overview
This is a focused, minimal MCP server designed specifically for image generation workflows. Unlike full-featured Replicate MCP Servers, this server exposes only what's needed for image generation and editing with official models like Flux, SDXL, and Seedream.
Recommended usage: Tell your assistant upfront which model you prefer and any specific settings (quality, aspect ratio, style). This reduces tool calls and gets better results faster.
Example system prompt addition:
For image generation, use black-forest-labs/flux-schnell with 16:9 aspect ratio unless I specify otherwise.Related MCP server: FLUX MCP Server
Notice
This repo works in two ways:
As a fetch-native Bun server for local workflows
As a fetch-native Cloudflare Worker for remote interactions
Features
Search Models — Find image generation models with full input schemas
Generate Images — Run predictions and get results with expiring URLs
Lightweight — Only 2 tools
API Key Auth — Simple Bearer token or X-Api-Key header authentication
Dual Runtime — Node.js/Bun or Cloudflare Workers
Design Principles
LLM-friendly: Two focused tools, not 1:1 API mirrors
Schema-aware: Search returns input schemas so agent knows exact parameters
Secure: Replicate API key stored as secret, clients use separate bearer token
Clear feedback: Model parameters, generation time, markdown-ready output
Installation
Prerequisites: Bun, Replicate Account.
Ways to Run (Pick One)
Local Development — Standard setup with bearer token auth
Cloudflare Worker (wrangler dev) — Local Worker testing
Cloudflare Worker (deploy) — Remote production
1. Local Development — Quick Start
Get Replicate API token:
Create a new API token
Copy the token (starts with
r8_)
Configure environment:
cd replicate-mcp
bun install
cp env.example .envEdit .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_hereRun:
bun dev
# MCP: http://127.0.0.1:3000/mcpClaude Desktop / Cursor:
{
"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 (Local Dev)
bun x wrangler dev --local | catCreate .dev.vars for local secrets:
API_KEY=your_random_auth_token
REPLICATE_API_TOKEN=r8_your_replicate_tokenEndpoint: http://127.0.0.1:8787/mcp
3. Cloudflare Worker (Deploy)
Update
wrangler.jsoncfor the production URL and exact Host/Origin allowlists. The checked-in values are local-safe defaults.Set secrets:
# 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 promptedValidate generated types and deploy:
bun run types:worker
bun run types:worker:check
bun run build:worker
bun run deployEndpoint: https://<worker-name>.<account>.workers.dev/mcp
Client Configuration
Alice App
Add as MCP server with:
URL:
https://your-worker.workers.dev/mcpType:
streamable-httpHeader:
Authorization: Bearer <your-API_KEY>
Claude Desktop / Cursor (Local Server)
{
"mcpServers": {
"replicate": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:3000/mcp", "--transport", "http-only"],
"env": { "NO_PROXY": "127.0.0.1,localhost" }
}
}
}Claude Desktop / Cursor (Cloudflare Worker)
{
"mcpServers": {
"replicate": {
"command": "npx",
"args": ["mcp-remote", "https://your-worker.workers.dev/mcp", "--transport", "http-only"]
}
}
}MCP Inspector (Quick Test)
bunx @modelcontextprotocol/inspector
# Connect to: http://localhost:3000/mcp (local) or https://your-worker.workers.dev/mcp (remote)Tools
search_models
Search for models and get their input schemas. Returns up to 5 models with full parameter details.
// 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
...Example:
{ "query": "flux" }generate_image
Run an image generation model and wait for the result.
// Input
{
model: string; // "owner/name" format
input: Record<string, unknown>; // Model-specific parameters
}
// Output
## Image Generated in 2.3s
Model: black-forest-labs/flux-schnell
Display the image to the user using markdown syntax:

Note: URLs expire in 1 hour.Common input patterns:
// 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"
}
}Popular Models
Model | Speed | Best For |
| ~2s | Quick generations, drafts |
| ~10s | Higher quality, detailed |
| ~5s | Versatile, multi-reference |
| ~8s | Image editing with text |
Aspect Ratio Guide
Ratio | Use Case |
| Portraits, icons, profile pictures |
| Landscapes, cinematic, desktop wallpapers |
| Mobile wallpapers, stories, vertical content |
| Classic photo format |
| Ultra-wide cinematic |
HTTP Endpoints
Endpoint | Method | Purpose |
| POST | MCP JSON-RPC 2.0 |
| GET | Health check |
Environment Variables
Node.js (.env)
Variable | Required | Description |
| ✓ | Replicate API token (r8_...) |
| ✓ | Auth token for MCP clients |
| Server port (default: 3000) | |
| Server host (default: 127.0.0.1) |
Cloudflare Workers (wrangler.jsonc + secrets)
Relevant wrangler.jsonc vars:
"vars": {
"MCP_TITLE": "Replicate",
"MCP_VERSION": "1.0.0"
}Secrets (set via wrangler secret put):
API_KEY— Random auth token for clientsREPLICATE_API_TOKEN— Replicate API token
No KV namespace or MCP session store is required by the v2 serving shell.
Development
bun dev # Start with hot reload
bun run typecheck # TypeScript check
bun run lint # Lint code
bun run build # Bun production build
bun run build:worker
bun run types:worker:check
bun test # Modern, legacy, security, and provider-mock tests
bun start # Run Bun production entry pointArchitecture
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 # Fetch-native HTTP shell
│ ├── auth.ts # MCP API-key boundary
│ ├── body.ts # Bounded request bodies
│ └── security.ts # Host, Origin, and strict CORS
├── core/
│ ├── mcp.ts # Fresh server factory
│ └── runtime.ts # Deployment-scoped v2 handler
├── index.ts # Bun entry
└── worker.ts # Workers isolate entryTroubleshooting
Issue | Solution |
401 Unauthorized | Check |
"REPLICATE_API_TOKEN not configured" | Set secret: |
"Invalid model format" | Use |
"Missing required parameters" | Call |
"Rate limit exceeded" | Wait a moment and retry |
"Image URL expired" | URLs expire after 1 hour — generate again |
Debugging
Test with MCP Inspector:
bunx @modelcontextprotocol/inspector
# Connect to your endpoint and test toolsCheck Worker logs:
wrangler tailLicense
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate images, videos, music & lip sync with 200+ AI models (Flux, Veo 3, Kling, Suno)
1Generate, edit, and explore AI images. Flux, Imagen, LoRA identity swap, upscale, and more.
- AITOPIAOAuthai.aitopia
Generate and edit images, video and audio: 300+ AI models, video tools, voice cloning, transcripts.
- Flux AIOAuthart.fluxaipro
Generate images, videos and music with model discovery, cost estimates and asynchronous results.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides image generation capabilities using the Flux Schnell model on Replicate, allowing users to create images from text prompts.2MIT
- AlicenseBqualityDmaintenanceExposes Replicate's FLUX image generation models to Claude, enabling text-to-image generation, image variations, inpainting, and edge-guided creation with 6 different FLUX models.21MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables high-quality image generation with advanced text rendering and contextual understanding using FLUX.1 Kontext Max through the Replicate API. Supports text-to-image generation, image editing, multiple aspect ratios, and automatically downloads generated images locally.1-
- AlicenseBqualityNot gradedmaintenanceEnables AI-powered image generation using the Ideogram V3 Balanced model via Replicate. Supports text-to-image generation, inpainting, style transfer with 60+ presets, custom resolutions, and reproducible outputs with local image storage.2-