Announcing CIMD support for MCP Client registration
Learn more

Replicate MCP vs API for AI Agent Integrations

Vinayak Ravi
Head of Marketing

Replicate's MCP server maps its HTTP API almost one to one, so the usual coverage gap is missing. What differs is control: async prediction handling, webhook delivery, output persistence and retries are things your code has to own, and an MCP tool call is a poor place to own them. Both paths also run on the same credential, an API token that spends the account's credit. This guide compares what each path lets an agent do, who holds the token on each, and how to run a generation pipeline for many customers in production.

TL;DR

  • Replicate's MCP server maps the HTTP API almost one to one: the local replicate-mcp package lists 35 per-endpoint tools across predictions, models, versions, deployments, trainings, files, collections, hardware, account, and webhooks. The gap is not coverage. It is control: async prediction handling, webhook delivery, output persistence, and retry behavior are things your code has to own, and an MCP tool call is a poor place to own them.
  • Both paths run on the same credential: a Replicate API token. The hosted server at mcp.replicate.com wraps it in a browser flow and stores it on Replicate's side; the local server reads REPLICATE_API_TOKEN; the HTTP API takes Authorization: Bearer. There is no OAuth grant to Replicate itself and Replicate's API reference documents no token scopes.
  • A Replicate token is a billing credential. Whoever holds it can create predictions, deployments, and trainings that spend the account's credit. In a multi-tenant agent, that makes per-user credential isolation a cost-control problem as much as a security one, on either path.
  • MCP is the faster path for interactive model exploration in Claude, Cursor, or VS Code. The API is the right path for production generation pipelines that need Prefer: wait tuning, signed webhooks, the 600 per minute prediction limit, and output capture before Replicate deletes API prediction data after one hour.
  • Scalekit's Replicate connector stores each user's Replicate token in the token vault and exposes 33 prebuilt tools against it, so the MCP vs API decision doesn't change your auth infrastructure.

The decision your Replicate agent forces first

Your agent needs to run models: generate an image, transcribe a file, upscale a frame, fine-tune on a customer's data. Replicate hosts those models behind one HTTP API, and it also ships a Model Context Protocol (MCP) server that exposes the same API as tools. From a demo, they look identical. In production they diverge on how async work is handled, who stores the token, and how much spend one leaked credential can authorize. Here's how to pick.

What Replicate MCP and Replicate API actually are

Replicate MCP

Replicate publishes two MCP servers built on its OpenAPI spec with Stainless. The local server is the replicate-mcp npm package, released in July 2025 and started with npx -y replicate-mcp. It reads REPLICATE_API_TOKEN from the client config and runs over stdio. The remote server at https://mcp.replicate.com launched on August 10, 2025. It runs on Cloudflare Workers, uses Cloudflare's OAuth Provider Framework for the client handshake, and asks the user to paste a Replicate API token into a web page; the token is stored in Cloudflare KV and never exposed to the AI tool. Replicate recommends the remote server for most users.

Large JSON responses are trimmed with a WebAssembly build of jq, and the model writes the filter expression. An experimental code mode (--tools=code) replaces the endpoint tools with a docs search tool and a TypeScript executor that runs the Replicate SDK in a local Deno sandbox. Since February 10, 2026, the server is discoverable through the official MCP Registry via /.well-known/mcp/server.json. Docs: Replicate MCP reference and the remote MCP launch post.

Replicate API

The HTTP API at https://api.replicate.com/v1 covers predictions (create, get, list, cancel), models (including search, readme, examples, and official-model predictions), model versions, collections, deployments and deployment predictions, trainings, hardware, account, files, the beta search endpoint, and the default webhook signing secret. Auth is a single header, Authorization: Bearer <token>, using a token from replicate.com/account/api-tokens. Docs: Replicate HTTP API reference.

Comparing them where it matters for agents

What your agent can actually do

Capability
Replicate MCP
Replicate API
Find a model by what it does
Yes: Remote server covers the beta search endpoint
Yes
Read a model's input schema and README
Yes
Yes
Run a model and get output
Limited: Returns whatever is ready; long runs need the model to poll in a loop
Yes: Wait up to 60 seconds, plus polling or webhooks
Run an official model by name
Yes
Yes
Receive completion via signed webhooks
No: An MCP client has no endpoint to receive the POST
Yes: Webhook fields on create, HMAC-SHA256 signed
Fetch the webhook signing secret
Yes
Yes
Create and scale deployments
Yes
Yes
Fine-tune with trainings
Yes
Yes
Upload input files
Yes
Yes: Files endpoints; the Scalekit connector reads, lists and deletes files but does not upload
Persist outputs beyond one hour
No: Output URLs are returned; nothing stores them
Limited: API prediction data is removed after one hour, so your code must copy outputs first
Restrict which operations the agent sees
Yes: Tool, resource and read-only flags on the local server
Limited: No token scopes; restriction lives in your tool layer

The pattern here is different from most MCP comparisons. Replicate's MCP server is generated from the same OpenAPI spec as the API, so the endpoint coverage is close to identical. What MCP cannot give you is the asynchronous plumbing around a prediction: webhooks need a receiving endpoint, outputs need to be copied somewhere durable, and retries need state. Those live in your code, not in a tool call.

What the MCP server makes easier

The model gets every endpoint with a schema it already understands, and code mode lets it chain calls in TypeScript instead of round-tripping through the context window. For exploration, that is a real advantage: "find an image upscaler, read its inputs, and run it on this file" works without writing a single tool definition.

On the API side, you write that layer. Every Replicate model has its own input schema under openapi_schema.components.schemas.Input on its version object, and an agent needs a tool description good enough to tell the model to read that schema first. Writing the schema is the hard part. Not the API call.

The auth path each one puts you on

On the remote MCP path, the MCP client completes a handshake with the Cloudflare Workers OAuth provider at mcp.replicate.com, and the user pastes a Replicate API token into a web page during that flow. The token is stored in Cloudflare KV, and the server calls Replicate with it. The OAuth layer authenticates the client to Replicate's MCP server; it does not issue a scoped, user-consented grant against Replicate's API. Underneath, it is still the full API token.

On the local MCP path, the token sits in REPLICATE_API_TOKEN inside a JSON config file on the machine running the client. That is fine on a developer laptop. It is not an option for a product serving many users.

On the direct API path, your code sends Authorization: Bearer <token> on every request. Replicate's HTTP reference documents no token scopes, and tokens belong to a user or an organization. A token that can run a prediction can also create a deployment with min_instances above zero, start a training, or delete a model.

That last point is what changes the blast radius. A Replicate token is a spend credential. Replicate's own rate-limit docs tie throttling to credit balance, which tells you where the risk sits: a leaked token is not just data exposure, it is compute billed to your customer. What the user can't do, the agent can't do; on Replicate, what the token can do is everything the account can pay for.

Both paths still need per-user isolation

In a multi-tenant B2B agent, MCP's flow gives you a token per user. Direct API calls give you a credential per user. In neither case does the path itself solve storage, rotation, or revocation; those are infrastructure problems regardless of which path you choose.

Replicate adds a specific wrinkle: the token determines who pays. If your agent runs predictions on a customer's behalf with your own platform token, you have merged every customer's spend into one account and lost the ability to attribute it. If you run with each customer's token, you need to bind each one to exactly one user or organization, because replicate_get_account will happily tell you whose token it is only after you have already used it.

Recommended reading: OAuth vs API keys for AI agents

What you own in production

On the MCP path, Replicate owns the tool schemas, the jq filtering, and keeping the remote server current with the API. You still own the token store for every user, the reconnect experience when a user revokes a token, and the cost of long-running predictions blocking a chat turn while the model polls. Tool names come from the generator (create_predictions, get_models_versions), and Replicate notes the hosted server is "automatically updated," so the tool surface can shift without a release on your side.

On the API path, you own everything. The published limits are 600 requests per minute for creating predictions and 3,000 requests per minute for every other endpoint, with short bursts allowed. Throttled calls return 429 with a message such as "Request was throttled. Your rate limit resets in ~30s." Accounts with granted credit and no payment method are capped at 1 request per second and 6 per minute, a limit that surprises teams testing with trial credit.

Prefer: wait=n holds the request open for up to 60 seconds. If the model is slower, you get the prediction back in starting or processing and must poll predictions.get or rely on a webhook. Predictions and trainings lists page at 100 records with next and previous cursors. Output files are served from replicate.delivery and require the Authorization header to download, and for API-created predictions, inputs, outputs, and logs are deleted after one hour, leaving output as null and data_removed as true.

Webhooks are signed with HMAC-SHA256 using webhook-id, webhook-timestamp, and webhook-signature headers over ${webhook_id}.${webhook_timestamp}.${body}. The signing secret comes from GET /v1/webhooks/default/secret and is per user or per organization. In a multi-tenant system, that means a verification key per connected account, not one global secret.

When to use MCP, when to use the API

Use Replicate MCP when:

  • A developer in Claude Code, Cursor, or VS Code wants to search Replicate for "a fast background removal model," read its README, and run it on a sample image without writing tool definitions.
  • Your agent is exploratory and short-lived: a creative assistant where the user waits in chat while a black-forest-labs/flux-schnell prediction finishes in a few seconds.
  • You want code mode to chain several Replicate calls in one TypeScript execution, such as generating variants and comparing their metrics, without spending context on each response.
  • You are prototyping which Replicate models fit a feature before committing to schemas for a small, fixed set of them.

Use the Replicate API when:

  • The agent runs headless: a background job that transcribes every uploaded call recording or generates product images for a catalog import, with no browser and no chat turn to block.
  • You need signed webhooks with webhook_events_filter so completions drive the next step of a deterministic pipeline instead of a model polling in a loop.
  • Outputs must outlive Replicate's one-hour retention, so your code downloads each file from replicate.delivery and writes it to your own storage on completion.
  • Volume matters: you need to stay under 600 prediction creates per minute, back off on 429, and route steady traffic through a deployment with controlled min_instances and max_instances.

The credential problem that exists on both paths

Both paths hand you a credential per user. Neither hands you a vault. In a multi-tenant agent, 50 customers with 4 Replicate users each is 200 API tokens. Each one must be stored encrypted, bound to its user and the Replicate account it bills, replaced when a user rotates it at replicate.com/account/api-tokens, and removed when an employee leaves or a customer churns.

The token type does not even change between paths: it is a Replicate API token whether it sits in Cloudflare KV behind mcp.replicate.com, in an .env file, or in your database. What changes is who holds it. With the hosted MCP server, Replicate holds it per MCP client session, which you do not control from a multi-tenant backend. With the API, you hold it, and every token is a key to someone's compute budget.

Scalekit's Replicate connector stores each user's Replicate token in the token vault and sends it with every call, so the MCP vs API decision doesn't change your auth infrastructure. Your agent passes an identifier; the token never enters the agent runtime or the LLM context.

Recommended reading: why a token vault matters for AI agent workflows

How to connect a Replicate agent with Scalekit

Scalekit's replicate connector is an API-path connector with 33 tools (19 read, 10 write, 4 destructive). It authenticates with an access token: each user enters their own Replicate API token once through a Scalekit-hosted page, and Scalekit stores it as that user's connected account credential.

Prerequisites and the connection name

Create a Replicate connection in AgentKit > Connections in the Scalekit dashboard. The name you give it is the connection_name your code passes, and the string must match the dashboard exactly. This is the most common integration error. Copy SCALEKIT_ENVIRONMENT_URL, SCALEKIT_CLIENT_ID, and SCALEKIT_CLIENT_SECRET from Developers > API Credentials into .env.

pip install scalekit-sdk-python python-dotenv langchain-openai

Authorize each user once

get_or_create_connected_account returns the user's connected account. If it is not ACTIVE, get_authorization_link returns a link to the page where the user enters their Replicate API token. The agent never sees the token.

import os from dotenv import load_dotenv from scalekit import ScalekitClient load_dotenv() scalekit_client = ScalekitClient( env_url=os.environ["SCALEKIT_ENVIRONMENT_URL"], client_id=os.environ["SCALEKIT_CLIENT_ID"], client_secret=os.environ["SCALEKIT_CLIENT_SECRET"], ) actions = scalekit_client.actions CONNECTION_NAME = "replicate" # must match the connection name in AgentKit > Connections identifier = "user_123" # your app's stable ID for this user account = actions.get_or_create_connected_account( connection_name=CONNECTION_NAME, identifier=identifier, ) if account.connected_account.status != "ACTIVE": link = actions.get_authorization_link( connection_name=CONNECTION_NAME, identifier=identifier, ) print("Connect Replicate:", link.link) input("Press Enter after connecting your Replicate API token...") account = actions.get_or_create_connected_account( connection_name=CONNECTION_NAME, identifier=identifier, ) if account.connected_account.status != "ACTIVE": raise RuntimeError(f"Replicate is {account.connected_account.status}, not ACTIVE")

Retrieve the Replicate tools this user can call

This is not a catalog load. The agent asks for the tools this user's connected account is authorized to call, and narrows them to the five a generation agent needs. Loading all 33 Replicate tools would put replicate_create_deployment, replicate_create_training, and replicate_delete_model in front of a model that should only be running predictions, and each of those can spend money or destroy work.

tools = actions.langchain.get_tools( identifier=identifier, connection_names=[CONNECTION_NAME], tool_names=[ "replicate_search", "replicate_get_model", "replicate_get_model_version", "replicate_create_model_prediction", "replicate_get_prediction", ], page_size=100, ) tool_map = {t.name: t for t in tools} print(sorted(tool_map))

Run the agent loop

The loop runs until the model stops requesting tools. Every call executes with this user's Replicate token, so every prediction bills to their account.

from langchain_core.messages import HumanMessage, ToolMessage from langchain_openai import ChatOpenAI llm = ChatOpenAI(model="gpt-4o").bind_tools(tools) messages = [ HumanMessage( "Find a fast text-to-image model, check its inputs, and generate " "a product shot of a ceramic coffee mug on a walnut desk. " "If the prediction is still running, poll until it finishes and return the output URL." ) ] while True: response = llm.invoke(messages) messages.append(response) if not response.tool_calls: print(response.content) break for tc in response.tool_calls: tool = tool_map.get(tc["name"]) if tool: result = tool.invoke(tc["args"]) else: result = f"Unknown tool: {tc['name']}" messages.append(ToolMessage(content=str(result), tool_call_id=tc["id"]))

Deterministic calls with execute_tool

For pipelines, skip the model. execute_tool runs one tool with a fixed input and returns data plus an execution_id you can log. Pass a webhook so completion drives your pipeline instead of polling, and verify the signature on receipt.

result = actions.execute_tool( tool_name="replicate_create_model_prediction", tool_input={ "model_owner": "black-forest-labs", "model_name": "flux-schnell", "input": {"prompt": "A ceramic coffee mug on a walnut desk, studio lighting"}, "wait_seconds": 30, "webhook": "https://api.example.com/hooks/replicate", "webhook_events_filter": ["completed"], }, connection_name=CONNECTION_NAME, identifier=identifier, ) print(result.execution_id, result.data) status = actions.execute_tool( tool_name="replicate_get_prediction", tool_input={"prediction_id": result.data["id"]}, connection_name=CONNECTION_NAME, identifier=identifier, ) print(status.execution_id, status.data["status"])

Copy outputs to your own storage when the prediction reaches succeeded. Replicate deletes API prediction data after one hour.

Scalekit does not ship a connector for Replicate's MCP endpoint, and the prebuilt tools do not cover file uploads or the webhook signing secret. If you need those endpoints, register a custom connector and make proxied calls through actions.request(), keeping the same connected account and vault model.

Multi-tool, multi-tenant Replicate agents on a virtual MCP server

The replicate connector has 33 tools. At roughly 200 tokens per tool definition, that is about 6,600 tokens of context before the agent does any work, and the model is choosing from a decision space that includes deployment scaling, training, and deletion. The fix is not better prompting. It is surface reduction. A Scalekit virtual MCP server declares exactly which tools an agent role can see, and session tokens keep each run bound to one user's connected accounts. Docs: set up a virtual MCP server.

Create the server once per agent role

from scalekit.actions.models.mcp_config import McpConfigConnectionToolMapping vmcp = actions.mcp.create_config( name="replicate-image-gen-to-slack", description="Runs Replicate image models and posts results to Slack", connection_tool_mappings=[ McpConfigConnectionToolMapping( connection_name="replicate", tools=[ "replicate_create_model_prediction", "replicate_get_prediction", ], ), McpConfigConnectionToolMapping( connection_name="slack", tools=["slack_send_message"], ), ], ) print(vmcp.config.id, vmcp.config.mcp_server_url)

Mint a session token per user, per run

One server definition serves every user. Before each run, check that the user's accounts are active and mint a short-lived session token scoped to them. Any MCP client that speaks streamable HTTP can connect; this example uses langchain-mcp-adapters (pip install langchain-mcp-adapters) and passes the token as a Bearer header.

import asyncio from datetime import timedelta from langchain_mcp_adapters.client import MultiServerMCPClient config_id = vmcp.config.id mcp_server_url = vmcp.config.mcp_server_url user_id = "user_123" accounts = actions.mcp.list_mcp_connected_accounts( config_id=config_id, identifier=user_id, include_auth_link=True, ) not_ready = [ a for a in accounts.connected_accounts if str(a.connected_account_status).upper() != "ACTIVE" ] for a in not_ready: print(f"{a.connection_name} is {a.connected_account_status}: {a.authentication_link}") if not_ready: raise RuntimeError("Connect the accounts above before starting this run") session_token = actions.mcp.create_session_token( mcp_config_id=config_id, identifier=user_id, expiry=timedelta(minutes=30), ).token async def load_tools(): client = MultiServerMCPClient( { "scalekit": { "transport": "streamable_http", "url": mcp_server_url, "headers": {"Authorization": f"Bearer {session_token}"}, } } ) return await client.get_tools() mcp_tools = asyncio.run(load_tools()) print([t.name for t in mcp_tools])

The agent sees three tools. It can run a model and report the result; it cannot scale a deployment or start a training. The endpoint is static; the identity is per-user.

Observability: every Replicate run tied to a user

Every execute_tool call returns an execution_id, and every execution is attributed to a connected account, which maps to one of your users and one customer tenant. When a customer asks why their Replicate bill doubled last Tuesday, or which agent run created a deployment that never scaled to zero, the answer is a lookup, not an investigation.

A shared platform token breaks this. Replicate sees one account making every prediction, and your side of the audit trail can only prove that the platform token did it. Shared credentials are a single-user solution. They do not survive a second user.

Recommended reading: audit trails for agent auth

Which one to build against

If your agent is an interactive assistant in Claude, Cursor, or VS Code where a user explores models, reads their inputs, and runs quick predictions while they wait, use Replicate MCP. The generated tools and code mode cover the whole API with no schema work. If your agent runs headless, depends on webhooks, must persist outputs past the one-hour window, or needs to stay predictable against the 600 per minute prediction limit, use the API directly.

Either way, the credential problem is the same, and that's what needs production-grade infrastructure. On Replicate, the stakes are sharper than usual: there are no scopes to narrow a token, so the only least-privilege controls you have are which user's token runs the call and which tools the agent can see. Get both right before the first customer connects.

FAQs

Does Replicate have an official MCP server?

Yes, two, both generated from its OpenAPI spec. The local server is an npm package started with one command that reads the API token from the client config. The remote server launched in August 2025, runs on Cloudflare Workers, and asks the user to paste a Replicate API token into a web page during the client handshake; Replicate recommends it for most users. An experimental code mode replaces endpoint tools with a TypeScript executor.

What is the difference between Replicate MCP and the Replicate API?

Coverage is close to identical, 35 per-endpoint tools against the same predictions, models, deployments, trainings, files and webhook endpoints. The difference is the asynchronous plumbing: webhooks need a receiving endpoint an MCP client does not have, outputs need to be copied to durable storage before Replicate deletes them, and retries need state. Those live in your code, not in a tool call.

Does a Replicate API token have scopes?

No. Replicate's HTTP reference documents no token scopes, and tokens belong to a user or an organization. A token that can run a prediction can also create a deployment with minimum instances above zero, start a training, or delete a model, and everything it does is billed to the account. The only least-privilege controls are which user's token runs the call and which tools the agent can see.

How long does Replicate keep prediction data?

For predictions created through the API, inputs, outputs and logs are deleted after one hour, leaving the output empty and a flag showing the data was removed. Output files are served from Replicate's delivery domain and require the authorization header to download. A production pipeline copies each output to its own storage as soon as the prediction succeeds.

When should an agent use the Replicate API instead of MCP?

When it runs headless, such as a background job that transcribes every uploaded recording or generates product images for a catalog import; when signed webhooks should drive the next step instead of a model polling in a loop; when outputs must outlive the one-hour window; or when it must stay under 600 prediction creates per minute and route steady traffic through a deployment with controlled instance counts.

How does Scalekit connect an AI agent to Replicate?

The Replicate connector exposes 33 tools over the HTTP API. Each user enters their own Replicate token once through a hosted page, Scalekit stores it in the token vault and sends it with every call, a virtual MCP server narrows a generation agent to running predictions so it cannot scale a deployment or start a training, and every execution is attributed to the user whose account it bills.

Build your Replicate agent with Scalekit

Browse the Scalekit Replicate connector and the Replicate connector docs with the full tool list. See Scalekit pricing, or talk to us.

No items found.
On this page
Share this article
Scalekit
Find us on ProductHunt

Acquire enterprise customers with
‍zero upfront cost.

Every feature unlocked. No hidden fees.