Actors MCP Server avatar

Actors MCP Server

Try for free

No credit card required

Go to Store
Actors MCP Server

Actors MCP Server

apify/actors-mcp-server
Try for free

No credit card required

Connect Apify Actors to AI applications (AI Agents) using Anthropic's Model Context Protocol (MCP). This MCP server provides integration of any Apify Actor through the MCP framework.

Do you want to learn more about this Actor?

Get a demo

Apify Model Context Protocol (MCP) Server

Implementation of an MCP server for all Apify Actors. This server enables interaction with one or more Apify Actors that can be defined in the MCP Server configuration.

The server can be used in two ways:

  • 🇦 Apify MCP Server Actor: runs an HTTP server with MCP protocol via Server-Sent Events.
  • Apify MCP Server Stdio: provides support for the MCP protocol via standard input/output stdio.

🎯 What does Apify MCP server do?

The MCP Server Actor allows an AI assistant to use any Apify Actor as a tool to perform a specific task. For example it can:

To interact with the Apify MCP server, you can use MCP clients such as Claude Desktop, Superinference.ai, or LibreChat. Additionally, you can use simple example clients found in the examples directory.

When you have Actors integrated with the MCP server, you can ask:

  • "Search web and summarize recent trends about AI Agents"
  • "Find top 10 best Italian restaurants in San Francisco"
  • "Find and analyze Instagram profile of The Rock"
  • "Provide a step-by-step guide on using the Model Context Protocol with source URLs."
  • "What Apify Actors I can use?"

In the future, we plan to load Actors dynamically and provide Apify's dataset and key-value store as resources. See the Roadmap for more details.

🔄 What is the Model Context Protocol?

The Model Context Protocol (MCP) allows AI applications (and AI agents), such as Claude Desktop, to connect to external tools and data sources. MCP is an open protocol that enables secure, controlled interactions between AI applications, AI Agents, and local or remote resources.

🧱 Components

Tools

Any Apify Actor can be used as a tool. By default, the server is pre-configured with the Actors specified below, but it can be overridden by providing Actor input.

1'apify/instagram-scraper'
2'apify/rag-web-browser'
3'lukaskrivka/google-maps-with-contact-details'

The MCP server loads the Actor input schema and creates MCP tools corresponding to the Actors. See this example of input schema for the RAG Web Browser.

The tool name must always be the full Actor name, such as apify/rag-web-browser. The arguments for an MCP tool represent the input parameters of the Actor. For example, for the apify/rag-web-browser Actor, the arguments are:

1{
2  "query": "restaurants in San Francisco",
3  "maxResults": 3
4}

You don't need to specify the input parameters or which Actor to call, everything is managed by an LLM. When a tool is called, the arguments are automatically passed to the Actor by the LLM. You can refer to the specific Actor's documentation for a list of available arguments.

Prompt & Resources

The server does not provide any resources and prompts. We plan to add Apify's dataset and key-value store as resources in the future.

⚙️ Usage

The Apify MCP Server can be used in two ways: as an Apify Actor running at Apify platform or as a local server running on your machine.

🇦 MCP Server Actor

Standby web server

The Actor runs in Standby mode with an HTTP web server that receives and processes requests.

Start server with default Actors. To use the Apify MCP Server with set of default Actors, send an HTTP GET request with your Apify API token to the following URL.

https://actors-mcp-server.apify.actor?token=<APIFY_TOKEN>

It is also possible to start the MCP server with a different set of Actors. To do this, create a task and specify the list of Actors you want to use.

Then, run task in Standby mode with the selected Actors using your Apify API token.

https://actors-mcp-server-task.apify.actor?token=<APIFY_TOKEN>

You can find a list of all available Actors in the Apify Store.

💬 Interact with the MCP Server

Once the server is running, you can interact with Server-Sent Events (SSE) to send messages to the server and receive responses. You can use MCP clients such as Superinference.ai or LibreChat. (Claude Desktop does not support SSE transport yet)

In the client settings you need to provide server configuration:

1{
2    "mcpServers": {
3        "apify": {
4            "type": "sse",
5            "url": "https://actors-mcp-server.apify.actor/sse",
6            "env": {
7                "APIFY_TOKEN": "your-apify-token"
8            }
9        }
10    }
11}

Alternatively, you can use simple python client_see.py or test the server using curl </> commands.

  1. Initiate Server-Sent-Events (SSE) by sending a GET request to the following URL:

    curl https://actors-mcp-server.apify.actor/sse?token=<APIFY_TOKEN>

    The server will respond with a sessionId, which you can use to send messages to the server:

    1event: endpoint
    2data: /message?sessionId=a1b
  2. Send a message to the server by making a POST request with the sessionId:

    1curl -X POST "https://actors-mcp-server.apify.actor?token=<APIFY_TOKEN>&session_id=a1b" -H "Content-Type: application/json" -d '{
    2  "jsonrpc": "2.0",
    3  "id": 1,
    4  "method": "tools/call",
    5  "params": {
    6    "arguments": { "searchStringsArray": ["restaurants in San Francisco"], "maxCrawledPlacesPerSearch": 3 },
    7    "name": "lukaskrivka/google-maps-with-contact-details"
    8  }
    9}'

    The MCP server will start the Actor lukaskrivka/google-maps-with-contact-details with the provided arguments as input parameters. For this POST request, the server will respond with:

    Accepted
  3. Receive the response. The server will invoke the specified Actor as a tool using the provided query parameters and stream the response back to the client via SSE. The response will be returned as JSON text.

    1event: message
    2data: {"result":{"content":[{"type":"text","text":"{\"searchString\":\"restaurants in San Francisco\",\"rank\":1,\"title\":\"Gary Danko\",\"description\":\"Renowned chef Gary Danko's fixed-price menus of American cuisine ... \",\"price\":\"$100+\"...}}]}}

⾕ MCP Server at a local host

Prerequisites

  • MacOS or Windows
  • The latest version of Claude Desktop must be installed (or another MCP client)
  • Node.js (v18 or higher)
  • Apify API Token (APIFY_TOKEN)

Install

Follow the steps below to set up and run the server on your local machine: First, clone the repository using the following command:

git clone git@github.com:apify/actor-mcp-server.git

Navigate to the project directory and install the required dependencies:

1cd actor-mcp-server
2npm install

Before running the server, you need to build the project:

npm run build

Claude Desktop

Configure Claude Desktop to recognize the MCP server.

  1. Open your Claude Desktop configuration and edit the following file:

    • On macOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
    • On Windows: %APPDATA%/Claude/claude_desktop_config.json
    1"mcpServers": {
    2  "apify": {
    3    "command": "npx",
    4    "args": [
    5      "/path/to/actor-mcp-server/dist/index.js"
    6    ]
    7    "env": {
    8       "APIFY_TOKEN": "your-apify-token"
    9    }
    10  }
    11}

    Alternatively, you can use the following command to select one or more Apify Actors:

    1"mcpServers": {
    2  "apify-mcp-server": {
    3    "command": "npx",
    4    "args": [
    5      "/path/to/actor-mcp-server/dist/index.js",
    6      "--actors",
    7      "lukaskrivka/google-maps-with-contact-details,apify/instagram-scraper"
    8    ]
    9    "env": {
    10       "APIFY_TOKEN": "your-apify-token"
    11    }
    12  }
    13}
  2. Restart Claude Desktop

    • Fully quit Claude Desktop (ensure it’s not just minimized or closed).
    • Restart Claude Desktop.
    • Look for the 🔌 icon to confirm that the Exa server is connected.
  3. Examples

    You can ask Claude to perform web searches, such as:

    1Find and analyze recent research papers about LLMs.
    2Find top 10 best Italian restaurants in San Francisco.
    3Find and analyze instagram profile of the Rock.

Stdio clients

Create environment file .env with the following content:

1APIFY_TOKEN=your-apify-token
2# ANTHROPIC_API_KEY is only required when you want to run examples/clientStdioChat.js
3ANTHROPIC_API_KEY=your-anthropic-api-token

In the examples directory, you can find two clients that interact with the server via standard input/output (stdio):

  1. clientStdio.ts This client script starts the MCP server with two specified Actors. It then calls the apify/rag-web-browser tool with a query and prints the result. It demonstrates how to connect to the MCP server, list available tools, and call a specific tool using stdio transport.

    node dist/examples/clientStdio.js
  2. clientStdioChat.ts This client script also starts the MCP server but provides an interactive command-line chat interface. It prompts the user to interact with the server, allowing for dynamic tool calls and responses. This example is useful for testing and debugging interactions with the MCP server in conversational manner.

    node dist/examples/clientStdioChat.js

👷🏼 Development

Prerequisites

  • Node.js (v18 or higher)
  • Python 3.6 or higher

Create environment file .env with the following content:

1APIFY_TOKEN=your-apify-token
2# ANTHROPIC_API_KEY is only required when you want to run examples/clientStdioChat.js
3ANTHROPIC_API_KEY=your-anthropic-api-token

Local client (SSE)

To test the server with the SSE transport, you can use python script examples/client_sse.py: Currently, the node.js client does not support to establish a connection to remote server witch custom headers. You need to change URL to your local server URL in the script.

python src/examples/client_sse.py

Debugging

Since MCP servers operate over standard input/output (stdio), debugging can be challenging. For the best debugging experience, use the MCP Inspector.

Build the actor-mcp-server package:

npm run build

You can launch the MCP Inspector via npm with this command:

npx @modelcontextprotocol/inspector node /path/to/actor-mcp-server/dist/index.js --env APIFY_TOKEN=your-apify-token

Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.

🚀 Roadmap (January 2025)

  • Document examples for Superinference.ai and LibreChat.
  • Provide tools to search for Actors and load them as needed.
  • Add Apify's dataset and key-value store as resources.
  • Add tools such as Actor logs and Actor runs for debugging.
  • Prune Actors input schema to reduce context size.
Developer
Maintained by Apify

Actor Metrics

  • 1 monthly user

  • 1 star

  • 20% runs succeeded

  • Created in Jan 2025

  • Modified 19 hours ago