Skip to main content

A Model Context Protocol (MCP) server for Crawl4AI

Project description

Web Crawler MCP

Crawl4AI MCP Banner

A powerful web crawling tool that integrates with AI assistants via the MCP (Model Context Protocol). This project allows AI assistants to crawl websites, extract dynamic content, navigate through links, and save structured Markdown files directly.

📋 Features

  • Native integration with AI assistants via MCP
  • Return scraped Markdown content directly to the AI
  • Extracts and surfaces internal/external links for AI navigation
  • Website crawling with configurable depth
  • Detailed crawl result statistics
  • Error and not found page handling
  • Advanced Scraping Capabilities:
    • Magic Mode: Bypass anti-bots (like Cloudflare) and simulate real browser behavior
    • Targeted Extraction: Fetch only what you need using CSS selectors
    • Custom JavaScript: Execute code before extraction (clicks, scrolls, form fills)
    • Persistent Sessions: Keep cookies and state across requests for authenticated sites
    • SPA Support: Wait for dynamic CSS selectors or set explicit pre-extraction delays

🚀 MCP Configuration

The simplest and recommended way to use this tool is via uvx, which automatically fetches and runs the latest published version from PyPI.

Prerequisites

  • uv installed on your system.

Setup for AI Assistants (e.g., Claude Desktop, Cline)

Add the following to your AI Assistant's MCP configuration file (e.g., cline_mcp_settings.json or claude_desktop_config.json):

Note for Windows Users: It is highly recommended to specify --python 3.13 to avoid compilation issues with certain dependencies.

{
  "mcpServers": {
    "crawl": {
      "command": "uvx",
      "args": [
        "--python",
        "3.13",
        "crawl4ai-mcp-llm"
      ],
      "disabled": false,
      "autoApprove": [],
      "timeout": 600
    }
  }
}

Important: Browser Installation

The crawler uses Playwright to handle dynamic content. You must install the required browsers after setting up the tool:

uv run playwright install chromium

🖥️ Usage

Once configured, you can use the crawler by asking your AI assistant to perform a crawl.

Usage Examples with Claude/Cline

  • Simple Crawl: "Can you crawl the site example.com and give me a summary?"
  • Crawl with Options: "Can you crawl https://example.com with a depth of 3 and include external links?"
  • Dynamic Content: "Crawl this React app and wait for the .main-content selector to load."
  • Bypass Protections: "Crawl example.com but use 'magic mode' to bypass the anti-bot protection."
  • Targeted Extraction: "Crawl the docs site but only extract content matching the h1, p.lead CSS selector."

🛠️ Available Parameters (MCP Tool)

The crawl tool accepts the following parameters:

Parameter Type Description Default Value
url string URL to crawl (required) -
max_depth integer Maximum crawling depth 2
include_external boolean Include external links false
verbose boolean Enable detailed output true
wait_for_selector string CSS selector to wait for before extracting content. Useful for single-page applications. None
return_content boolean Whether to return the extracted content directly in the MCP response (truncated to 50k chars if necessary). true
output_file string Output file path automatically generated
magic boolean Enable magic mode to bypass anti-bots and simulate a real browser false
css_selector string Specific CSS selector to extract only targeted elements from the page None
js_code string Custom JavaScript code to execute on the page before extraction None
session_id string Persistent session identifier to keep cookies and browser state across requests None
delay_before_return_html number Delay in seconds to wait before extracting HTML (useful for heavy JS pages) None

📄 License

This project is licensed under the MIT License.


🏠 Source code & documentation: github.com/laurentvv/crawl4ai-mcp-llm

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crawl4ai_mcp_llm-0.1.1.tar.gz (893.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crawl4ai_mcp_llm-0.1.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file crawl4ai_mcp_llm-0.1.1.tar.gz.

File metadata

  • Download URL: crawl4ai_mcp_llm-0.1.1.tar.gz
  • Upload date:
  • Size: 893.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for crawl4ai_mcp_llm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 58f16d7c82881a17751b35045b58f2f9c5e09b5f774a19c8a3b1b4cf1e378da3
MD5 800c5bd9178c21d0db8be85dca2a2930
BLAKE2b-256 cbdd9c2c88c0c9dc68bdfae8942c11dcd266b5f23801d6526644112a3f69d4ff

See more details on using hashes here.

File details

Details for the file crawl4ai_mcp_llm-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: crawl4ai_mcp_llm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for crawl4ai_mcp_llm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 abeadc66ec455c663fb0844e2f6e96ff3a095b7b6c5d78ea558d4b2cf3d68db8
MD5 321fa175feffa9e011033327a5a4f872
BLAKE2b-256 b84007c6be666fb58b6d0e1b12ae5d6dd1db03aa31289d704074fd9c1527bba4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page