0.1.1 • Published 9 months ago
mcp-replicate v0.1.1
Replicate MCP Server
A Model Context Protocol server implementation for Replicate. Run Replicate models through a simple tool-based interface.
Installation
npm install -g mcp-replicateOr install from source:
git clone https://github.com/deepfates/mcp-replicate
cd mcp-replicate
npm install
npm run buildFeatures
Models
- Search models using semantic search
- Browse models and collections
- Get detailed model information and versions
Predictions
- Create predictions with text or structured input
- Track prediction status
- Cancel running predictions
- List your recent predictions
Image Handling
- View generated images in your browser
- Manage image cache for better performance
Configuration
The server needs a Replicate API token to work. Set it as an environment variable:
export REPLICATE_API_TOKEN=your_token_hereUsage
If installed globally:
mcp-replicateOr run directly with npx:
npx mcp-replicateOr if installed from source:
npm startThe server uses stdio to communicate via the MCP protocol. You'll need an MCP client to interact with it.
Available Tools
Model Tools
search_models: Find models using semantic searchlist_models: Browse available modelsget_model: Get details about a specific modellist_collections: Browse model collectionsget_collection: Get details about a specific collection
Prediction Tools
create_prediction: Run a model with your inputsget_prediction: Check a prediction's statuscancel_prediction: Stop a running predictionlist_predictions: See your recent predictions
Image Tools
view_image: Open an image in your browserclear_image_cache: Clean up cached imagesget_image_cache_stats: Check cache usage
Examples
Here are some examples using an MCP client:
Search Models
// Find text-to-image models
const results = await mcpClient.invoke("search_models", {
query: "text to image models"
});Create a Prediction
// Run a model
const prediction = await mcpClient.invoke("create_prediction", {
version: "model_version_id",
input: {
prompt: "A friendly robot making pancakes"
}
});Check Prediction Status
// Get prediction results
const status = await mcpClient.invoke("get_prediction", {
prediction_id: "prediction_id"
});Browse Collections
// List featured collections
const collections = await mcpClient.invoke("list_collections", {});Development
- Install dependencies:
npm install- Start development server (with auto-reload):
npm run dev- Check code style:
npm run lint- Format code:
npm run formatRequirements
- Node.js >= 18.0.0
- TypeScript >= 5.0.0
License
MIT