Crawl4AI RAG MCP server

Integrates web crawling with RAG functionality to enable website content retrieval, storage in vector databases, and semantic searching over crawled data for enhanced knowledge access
Back to servers
Provider
Cole Medin
Release date
May 04, 2025
Language
JavaScript
Stats
469 stars

The Crawl4AI RAG MCP Server provides web crawling and Retrieval-Augmented Generation (RAG) capabilities for AI agents and coding assistants. You can easily scrape web content and use it for knowledge-based searches, making your AI tools more informed and capable.

Installation Options

Using Docker (Recommended)

  1. Clone the repository:

    git clone https://github.com/coleam00/mcp-crawl4ai-rag.git
    cd mcp-crawl4ai-rag
    
  2. Build the Docker image:

    docker build -t mcp/crawl4ai-rag --build-arg PORT=8051 .
    
  3. Create a .env file with your configuration settings (see Configuration section)

Using Python Directly

  1. Clone the repository:

    git clone https://github.com/coleam00/mcp-crawl4ai-rag.git
    cd mcp-crawl4ai-rag
    
  2. Install uv:

    pip install uv
    
  3. Create and activate a virtual environment:

    uv venv
    .venv\Scripts\activate
    # on Mac/Linux: source .venv/bin/activate
    
  4. Install dependencies:

    uv pip install -e .
    crawl4ai-setup
    
  5. Create a .env file with your configuration settings

Database Setup

  1. Create a Supabase project if you don't have one
  2. Go to the SQL Editor in your Supabase dashboard
  3. Create a new query and paste the contents of crawled_pages.sql from the repository
  4. Run the query to create the necessary tables and functions

Configuration

Create a .env file in the project root with the following variables:

# MCP Server Configuration
HOST=0.0.0.0
PORT=8051
TRANSPORT=sse

# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key

# Supabase Configuration
SUPABASE_URL=your_supabase_project_url
SUPABASE_SERVICE_KEY=your_supabase_service_key

Running the Server

With Docker

docker run --env-file .env -p 8051:8051 mcp/crawl4ai-rag

With Python

uv run src/crawl4ai_mcp.py

Connecting with MCP Clients

SSE Configuration

For clients that support SSE transport, use this configuration:

{
  "mcpServers": {
    "crawl4ai-rag": {
      "transport": "sse",
      "url": "http://localhost:8051/sse"
    }
  }
}

Windsurf Configuration

For Windsurf users, use serverUrl instead of url:

{
  "mcpServers": {
    "crawl4ai-rag": {
      "transport": "sse",
      "serverUrl": "http://localhost:8051/sse"
    }
  }
}

Stdio Configuration

For Claude Desktop, Windsurf, or other MCP clients supporting stdio:

{
  "mcpServers": {
    "crawl4ai-rag": {
      "command": "python",
      "args": ["path/to/crawl4ai-mcp/src/crawl4ai_mcp.py"],
      "env": {
        "TRANSPORT": "stdio",
        "OPENAI_API_KEY": "your_openai_api_key",
        "SUPABASE_URL": "your_supabase_url",
        "SUPABASE_SERVICE_KEY": "your_supabase_service_key"
      }
    }
  }
}

Docker with Stdio

{
  "mcpServers": {
    "crawl4ai-rag": {
      "command": "docker",
      "args": ["run", "--rm", "-i", 
               "-e", "TRANSPORT", 
               "-e", "OPENAI_API_KEY", 
               "-e", "SUPABASE_URL", 
               "-e", "SUPABASE_SERVICE_KEY", 
               "mcp/crawl4ai"],
      "env": {
        "TRANSPORT": "stdio",
        "OPENAI_API_KEY": "your_openai_api_key",
        "SUPABASE_URL": "your_supabase_url",
        "SUPABASE_SERVICE_KEY": "your_supabase_service_key"
      }
    }
  }
}

Available Tools

The MCP server provides four primary tools:

crawl_single_page

Crawls a single web page and stores its content in the vector database.

smart_crawl_url

Intelligently crawls a website based on the URL type:

  • Sitemap URLs
  • Text files (like llms-full.txt)
  • Regular webpages (with recursive crawling)

get_available_sources

Returns a list of all available sources (domains) in the database, useful for filtering RAG queries.

perform_rag_query

Performs semantic search on the crawled content with optional source filtering.

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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