Apify Actor MCP server

Integrates with Apify and Crawlee to enable scalable web scraping and automation for data extraction tasks.
Back to servers
Setup instructions
Provider
Apify
Release date
Jan 03, 2025
Language
TypeScript
Stats
242 stars

The Apify Model Context Protocol (MCP) Server enables AI assistants to utilize Apify Actors as tools for specific tasks like web scraping, data extraction, and search. It works as both an HTTP server using Server-Sent Events (SSE) and a local server via standard input/output (stdio).

Installation

Using the MCP Server Actor (HTTP/SSE)

To use the pre-configured server on the Apify platform:

  1. Access the server with your Apify API token:

    https://actors-mcp-server.apify.actor?token=<APIFY_TOKEN>
    
  2. For custom Actor configuration, create an Apify task and specify your Actor selection:

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

Running Locally

Prerequisites

  • MacOS or Windows
  • Node.js v18 or higher
  • Apify API Token

Installation Steps

  1. Clone the repository:

    git clone [email protected]:apify/actor-mcp-server.git
    
  2. Install dependencies:

    cd actor-mcp-server
    npm install
    
  3. Build the project:

    npm run build
    

Claude Desktop Setup

  1. Download and install Claude Desktop

  2. Enable Developer Mode from the menu bar

  3. Open Settings > Developer Option > Edit Config

  4. Edit the configuration file:

    {
      "mcpServers": {
        "actors-mcp-server": {
          "command": "npx",
          "args": ["-y", "@apify/actors-mcp-server"],
          "env": {
             "APIFY_TOKEN": "your-apify-token"
          }
        }
      }
    }
    

    Alternatively, specify specific Actors:

    {
      "mcpServers": {
        "actors-mcp-server": {
          "command": "npx",
          "args": [
            "-y", "@apify/actors-mcp-server",
            "--actors", "lukaskrivka/google-maps-with-contact-details,apify/instagram-scraper"
          ],
          "env": {
             "APIFY_TOKEN": "your-apify-token"
          }
        }
      }
    }
    
  5. Restart Claude Desktop

  6. Check for the 🔌 icon to confirm connection

Smithery Installation

You can also use Smithery for automatic installation:

smithery install @apify/actors-mcp-server

Usage

Interacting with the Server

Using MCP Clients

Connect to the server using MCP clients like:

  • Claude Desktop (stdio support only)
  • LibreChat (stdio and SSE support)
  • Apify Tester MCP Client (full SSE support)

When using SSE clients, provide this server configuration:

{
    "mcpServers": {
        "apify": {
            "type": "sse",
            "url": "https://actors-mcp-server.apify.actor/sse",
            "env": {
                "APIFY_TOKEN": "your-apify-token"
            }
        }
    }
}

Manual Testing with cURL

  1. Initiate SSE connection:

    curl https://actors-mcp-server.apify.actor/sse?token=<APIFY_TOKEN>
    
  2. Send a message with the returned sessionId:

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

Available Tools

Pre-configured Actors

  • apify/instagram-scraper: Extract data from Instagram
  • apify/rag-web-browser: Web search and content extraction
  • lukaskrivka/google-maps-with-contact-details: Extract contact details from Google Maps

Helper Tools

  • get-actor-details: Get documentation and input schema for specific Actors
  • discover-actors: Search for relevant Actors by keywords
  • add-actor-as-tool: Add an Actor to the available tools
  • remove-actor-from-tool: Remove an Actor from the available tools

Example Prompts

You can ask the AI assistant connected to the MCP server:

  • "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"
  • "What Apify Actors I can use?"

Testing and Debugging

For local testing, create a .env file with:

APIFY_TOKEN=your-apify-token

The repository includes example clients:

  • clientStdio.ts: Demonstrates direct tool calling
  • clientStdioChat.ts: Provides an interactive chat interface
  • clientSse.ts: Tests SSE connections

For debugging, use the MCP Inspector:

npx @modelcontextprotocol/inspector -- npx @apify/actors-mcp-server

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "actors-mcp-server" '{"command":"npx","args":["-y","@apify/actors-mcp-server"],"env":{"APIFY_TOKEN":"your-apify-token"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "actors-mcp-server": {
            "command": "npx",
            "args": [
                "-y",
                "@apify/actors-mcp-server"
            ],
            "env": {
                "APIFY_TOKEN": "your-apify-token"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "actors-mcp-server": {
            "command": "npx",
            "args": [
                "-y",
                "@apify/actors-mcp-server"
            ],
            "env": {
                "APIFY_TOKEN": "your-apify-token"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later