Crawl4AI MCP server

Provides web scraping and crawling capabilities for extracting content from single pages, conducting multi-page research, discovering URLs, and monitoring crawl status through a Cloudflare Worker-based server.
Back to servers
Setup instructions
Provider
Bjorn Melin
Release date
May 05, 2025
Language
JavaScript
Stats
6 stars

Crawl4AI MCP Server enables AI assistants to access powerful web scraping, crawling, and research capabilities through the Model Context Protocol. It serves as a high-performance alternative to FireCrawl, allowing tools like Claude to efficiently gather and analyze web content.

Installation

Prerequisites

  • Node.js v18 or higher
  • npm
  • Wrangler (CloudFlare Workers CLI)
  • CloudFlare account

Setup Process

  1. Clone the repository:

    git clone https://github.com/BjornMelin/crawl4ai-mcp-server.git
    cd crawl4ai-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Create a CloudFlare KV namespace:

    wrangler kv:namespace create CRAWL_DATA
    
  4. Update the wrangler.toml configuration with your KV namespace ID:

    kv_namespaces = [
      { binding = "CRAWL_DATA", id = "your-namespace-id" }
    ]
    

Local Development Options

Using npm:

Start the development server with:

npm run dev

The server will be available at http://localhost:8787

Using Docker:

  1. Create your environment variables file:

    cp .env.example .env
    # Edit .env file with your API key
    
  2. Start the Docker development environment:

    docker-compose up -d
    
  3. Access the services:

Usage

Deployment

Deploy your server to CloudFlare Workers:

npm run deploy

Your server will be available at the CloudFlare Workers URL assigned to your deployment.

Authentication Methods

The server supports two authentication methods:

  • OAuth authentication
  • API key authentication using Bearer tokens

Connecting to MCP Clients

  1. Use the CloudFlare Workers URL from your deployment
  2. In Claude Desktop or other MCP clients, add this URL as a tool source

Available Tools

The MCP server provides these key features:

Web Data Acquisition

  • Single Webpage Scraping: Extract content from individual webpages
  • Web Crawling: Crawl websites with configurable depth and page limits
  • URL Discovery: Map and discover URLs from a starting point
  • Asynchronous Crawling: Crawl entire websites efficiently

Content Processing

  • Deep Research: Conduct comprehensive research across multiple pages
  • Structured Data Extraction: Extract specific data using CSS selectors or LLM-based extraction
  • Content Search: Search through previously crawled content

Configuration Options

Configure the server by modifying environment variables in wrangler.toml:

  • MAX_CRAWL_DEPTH: Maximum depth for web crawling (default: 3)
  • MAX_CRAWL_PAGES: Maximum pages to crawl (default: 100)
  • API_VERSION: API version string (default: "v1")
  • OAUTH_CLIENT_ID: OAuth client ID for authentication
  • OAUTH_CLIENT_SECRET: OAuth client secret for authentication

Tool Examples

The server provides these primary tools:

  • crawl: Crawl web pages from a starting URL
  • getCrawl: Retrieve crawl data by ID
  • listCrawls: List all crawls or filter by domain
  • search: Search indexed documents by query
  • extract: Extract structured content from a URL

Testing

Run the test suite using one of these commands:

# Run all tests
npm test

# Run tests with watch mode during development
npm run test:watch

# Run tests with coverage report
npm run test:coverage

# Run only unit tests
npm run test:unit

# Run only integration tests
npm run test:integration

When using Docker:

docker-compose exec mcp-server npm test

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 "crawl4ai" '{"command":"npx","args":["-y","crawl4ai-mcp-server"]}'

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": {
        "crawl4ai": {
            "command": "npx",
            "args": [
                "-y",
                "crawl4ai-mcp-server"
            ]
        }
    }
}

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": {
        "crawl4ai": {
            "command": "npx",
            "args": [
                "-y",
                "crawl4ai-mcp-server"
            ]
        }
    }
}

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