Replicate MCP Server
by deepfates
Replicate MCP Server
A Model Context Protocol server implementation for Replicate. This server provides access to Replicate's models and predictions through a simple tool-based interface.
Features
Model Management
- Search models by query
- List models with optional owner filter
- Get model details and versions
Prediction Handling
- Create predictions with string or object input
- Check prediction status
- Cancel running predictions
- List recent predictions
Image Tools
- View images in system browser
- Save images to local filesystem
Examples
Search Models
Copy
const results = await client.callTool("search_models", {
query: "text to image models"
});
Create Prediction
Copy
const prediction = await client.callTool("create_prediction", {
version: "model_version_id",
input: "Your text prompt here" // Automatically wrapped in {text: string}
});
Check Prediction Status
Copy
const status = await client.callTool("get_prediction", {
prediction_id: "prediction_id"
});
Installation
Copy
npm install
Configuration
The server requires a Replicate API token. You can set it in one of two ways:
- Environment variable:
Copy
export REPLICATE_API_TOKEN=your_token_here
- Pass it directly when creating the client:
Copy
const client = new ReplicateClient("your_token_here");
Usage
- Build the TypeScript code:
Copy
npm run build
- Start the server:
Copy
npm start
The server communicates via stdio using the MCP protocol. You can use any MCP client to interact with it.
Development
- Install dependencies:
Copy
npm install
- Start the development server (with auto-reload):
Copy
npm run dev
- Lint the code:
Copy
npm run lint
- Format the code:
Copy
npm run format
Available Tools
Model Tools
search_models
: Search for models using semantic searchlist_models
: List available models with optional filteringget_model
: Get details of a specific model including versions
Prediction Tools
create_prediction
: Create a new prediction using a model versioncancel_prediction
: Cancel a running predictionget_prediction
: Get details about a specific predictionlist_predictions
: List recent predictions
Image Tools
view_image
: Display an image in the system's default web browsersave_image
: Save an image to the local filesystem
Requirements
- Node.js >= 18.0.0
- TypeScript >= 5.0.0
License
MIT
You must be authenticated.
Enables users to access and manage Replicate's AI models and predictions via the Model Context Protocol, offering tools for creating, canceling, and retrieving model predictions and parameters.