The Crawl4AI MCP Server is a powerful intelligent information retrieval service built on the Model Context Protocol. It equips AI assistant systems with robust search capabilities and LLM-optimized web content understanding features, efficiently transforming web content into formats that are ideal for language models to process.
Ensure your system meets these requirements:
Clone the repository:
git clone https://github.com/yourusername/crawl4ai-mcp-server.git
cd crawl4ai-mcp-server
Create and activate a virtual environment:
python -m venv crawl4ai_env
source crawl4ai_env/bin/activate # Linux/Mac
# or
.\crawl4ai_env\Scripts\activate # Windows
Install dependencies:
pip install -r requirements.txt
Install Playwright browsers:
playwright install
Install and configure the Crawl4AI MCP service to your local Claude desktop:
npx -y @smithery/cli install @weidwonder/crawl4ai-mcp-server --client claude
The server provides the following tools:
The search tool supports multiple search engines:
Parameters:
query
: Your search query stringnum_results
: Number of results to return (default: 10)engine
: Search engine selection
Examples:
# DuckDuckGo search (default)
{
"query": "python programming",
"num_results": 5
}
# Using all available engines
{
"query": "python programming",
"num_results": 5,
"engine": "all"
}
The read_url tool provides LLM-optimized web content extraction:
markdown_with_citations
: Markdown with inline citations (default)fit_markdown
: LLM-optimized content with redundancies removedraw_markdown
: Basic HTML-to-Markdown conversionreferences_markdown
: Separate references/citations sectionfit_html
: Filtered HTML that generates fit_markdownmarkdown
: Default Markdown formatExample:
{
"url": "https://example.com",
"format": "markdown_with_citations"
}
Copy the configuration example file:
cp config_demo.json config.json
To use Google search, configure API keys in config.json:
{
"google": {
"api_key": "your-google-api-key",
"cse_id": "your-google-cse-id"
}
}
The server employs several content optimization strategies for LLMs:
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.
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"
]
}
}
}
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.
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.