An MCP Server for Web scraping and Crawling, built using Crawl4AI
A Model Context Protocol (MCP) server implementation that integrates Crawl4AI with Cursor AI, providing web scraping and crawling capabilities as tools for LLMs in Cursor Composer's agent mode.
Python 3.10 or higher installed.
Basic setup instructions also available in the Official Docs for MCP Server QuickStart.
First, let's install uv
and set up our Python project and environment:
MacOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Make sure to restart your terminal afterwards to ensure that the uv command gets picked up.
After that:
Clone the repository
Install dependencies using UV:
# Navigate to the crawl4ai-mcp directory cd crawl4ai-mcp # Install dependencies (Only first time) uv venv uv sync # Activate the venv source .venv/bin/activate # Run the server python main.py
You may need to put the full path to the uv executable in the command field. You can get this by running which uv
on MacOS/Linux or where uv
on Windows.
{ "mcpServers": { "Crawl4AI": { "command": "uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/PARENT/FOLDER/crawl4ai-mcp", "run", "main.py" ] } } }
This MCP server exposes the following tools to the LLM:
scrape_webpage(url: str)
url
(string, required): The URL of the webpage to scrape.TextContent
object with the scraped content (primarily markdown) as JSON.crawl_website(url: str, crawl_depth: int = 1, max_pages: int = 5)
url
(string, required): The starting URL to crawl.crawl_depth
(integer, optional, default: 1): The maximum depth to crawl relative to the starting URL.max_pages
(integer, optional, default: 5): The maximum number of pages to scrape during the crawl.TextContent
object with a JSON array of results for the crawled pages (including URL, success status, markdown content, or error).Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!