Home / Reference

Replicate's MCP server

Connect tools like Claude Desktop, Claude Code, and Cursor to Replicate's HTTP API


What is MCP?

The Model Context Protocol (MCP) is an open standard developed by Anthropic that defines how applications share context with large language models (LLMs).

MCP extends the capabilities of apps like Claude Desktop, Claude Code, Cursor, or GitHub Copilot by feeding them OpenAPI schemas that describe tools or services, like Replicate’s HTTP API.

MCP lets you give natural language instructions to a language model, and it can discover and run APIs automatically on your behalf.

Here are some examples of the kinds of prompts you can use:

Search Replicate for upscaler models and compare them

Show me the latest Replicate models created by @fofr

Generate an image using black-forest-labs/flux-schnell

Upscale that image using the best upscaler model

Replicate’s MCP server

Replicate’s MCP server is published as an npm package that is automatically updated whenever we add new features or operations to Replicate’s HTTP API:

šŸ“¦ npm.im/replicate-mcp

The server supports all of the operations in Replicate’s HTTP API. Once you’ve got it wired up you can use natural language chat to do things like:

Remote vs local servers

There are two ways to use Replicate’s MCP server:

  • Remote server (recommended): This is the easiest option, and recommended for most users. You just add the hosted server URL to your apps like Claude or Cursor. After installing the server, you’ll be directed to a web-based authentication flow where you can provide a Replicate API key for the server to use on your behalf.
  • Local server: You can run the server locally on your machine. This requires you to install the server locally and configure it in your apps.

Using the remote MCP server

The easiest way to use Replicate’s MCP is to use the remote server. This is a hosted server that is automatically updated with the latest features from Replicate’s HTTP API.

To get started, go to mcp.replicate.com, where you’ll find instructions for adding the server to your apps.

Using the local MCP server

The replicate-mcp npm package is a self-contained HTTP server that you can run using the Node.js npx command, which downloads and executes npm packages by name without you having to install them first.

Use this command to start the MCP server:

npx -y replicate-mcp

ā˜ļø This command will fire up a local HTTP server, but in practice you won’t usually run it this way. Instead, you’ll add some JSON configuration to your Claude, Cursor, or VS Code settings that will quietly and automatically run these local MCP servers on your machine.

Stop your server by pressing Ctrl+c in the terminal:

^c

Then read on to learn how to configure your apps to run the MCP server automatically.

Using the local server with Claude Desktop

Claude Desktop supports local MCP servers out of the box. Note that this only works with the Claude desktop app, not the web app. If you want to use the claude.ai web app, you’ll need to use the remote server.

Here’s how to set it up:

  1. Create a Replicate API token and copy it.

  2. Open Claude Desktop.

  3. Click the Claude menu and select Settings… (not the in-app account settings).

  4. In the Settings window, click Developer in the sidebar, then click Edit Config. This will open (or create) a claude_desktop_config.json file.

  5. Add the following JSON to the file, substituting your Replicate API token for your-token-here:

    {
      "mcpServers": {
        "replicate": {
          "command": "npx",
          "args": ["-y", "replicate-mcp"],
          "env": {
            "REPLICATE_API_TOKEN": "your-token-here"
          }
        }
      }
    }
  6. Restart Claude Desktop. Click the Search and Tools icon in the input box. You should see replicate listed as a tool:

Claude Tools

Now that you’ve got the MCP server running, you can use it to search for models, run predictions, and fetch model metadata.

Try these prompts in Claude Desktop:

Search Replicate for upscaler models and compare them

Show me the latest Replicate models created by @fofr

Generate an image using black-forest-labs/flux-schnell

Upscale that image using the best upscaler model

Claude Chat

Using the local server with Cursor

Cursor supports the Model Context Protocol (MCP), allowing you to connect external tools and data sources—like Replicate’s HTTP API—directly to your code editor. With Replicate’s MCP server, you can search for models, run predictions, and fetch model metadata from within Cursor using natural language.

Start by creating a Replicate API token and copy it.

Quick setup for Cursor

As of version 1.0, Cursor lets you install MCP servers using a link. Click the button below to install the MCP server in Cursor:

Add replicate MCP server to Cursor

Manual setup for Cursor

If you’d prefer to set up Cursor manually, here’s how:

  1. In your project, create a .cursor/mcp.json file with the following content:

    {
      "mcpServers": {
        "replicate": {
          "command": "npx",
          "args": ["-y", "replicate-mcp"],
          "env": {
            "REPLICATE_API_TOKEN": "your-token-here"
          }
        }
      }
    }

    Replace your-token-here with your Replicate API token.

  2. Open Cursor. The MCP server will be started automatically when you use a tool that requires it, or you can start it manually from the MCP settings page.

  3. In Cursor, open the MCP settings (search for ā€œMCPā€ in the command palette or find it in the settings sidebar). You should see replicate listed as an available tool.

Cursor MCP

Now you can use Replicate tools in Cursor’s Composer Agent:

Search Replicate for upscaler models and compare them

Generate an image using black-forest-labs/flux-schnell

Upscale that image using the best upscaler model

You can also configure MCP servers globally by creating a ~/.cursor/mcp.json file, making Replicate’s tools available in all your Cursor workspaces.

For more details, see the Cursor MCP documentation.

Using the local server with GitHub Copilot in VS Code

You can use Replicate’s MCP server with GitHub Copilot Chat in Visual Studio Code to access Replicate’s API tools directly from chat. To set it up:

  1. Install Visual Studio Code version 1.99 or later and make sure you have access to Copilot Chat.

  2. Create a Replicate API token and copy it.

  3. In your project, create a .vscode/mcp.json file with the following content:

    {
      "servers": {
        "replicate": {
          "command": "npx",
          "args": ["-y", "replicate-mcp"],
          "env": {
            "REPLICATE_API_TOKEN": "your-token-here"
          }
        }
      }
    }

    Replace your-token-here with your Replicate API token.

  4. Open the .vscode/mcp.json file in VS Code and click the Start button that appears to launch the MCP server.

  5. Open Copilot Chat, select Agent from the chat menu, and use Replicate tools in natural language (e.g., ā€œSearch Replicate for upscaler modelsā€).

You can also configure the MCP server to run globally in VS Code by adding the configuration to your user settings.json. For instructions, see the GitHub Copilot documentation on using existing MCP configurations.

For more details and advanced configuration, see the official GitHub Copilot documentation.