Skip to main content
Glama

replicate-flux-mcp

createPrediction.ts872 B
import { CreatePredictionParams } from "../types/index.js"; import { pollForCompletion, replicate } from "../services/replicate.js"; import { handleError } from "../utils/error.js"; import { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import { CONFIG } from "../config/index.js"; export const registerCreatePredictionTool = async ( input: CreatePredictionParams ): Promise<CallToolResult> => { try { const prediction = await replicate.predictions.create({ model: CONFIG.imageModelId, input, }); await replicate.predictions.get(prediction.id); const completed = await pollForCompletion(prediction.id); return { content: [ { type: "text", text: JSON.stringify(completed || "Processing timed out", null, 2), }, ], }; } catch (error) { handleError(error); } };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/awkoy/replicate-flux-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server