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.
Clone the repository:
git clone https://github.com/BjornMelin/crawl4ai-mcp-server.git
cd crawl4ai-mcp-server
Install dependencies:
npm install
Create a CloudFlare KV namespace:
wrangler kv:namespace create CRAWL_DATA
Update the wrangler.toml
configuration with your KV namespace ID:
kv_namespaces = [
{ binding = "CRAWL_DATA", id = "your-namespace-id" }
]
Start the development server with:
npm run dev
The server will be available at http://localhost:8787
Create your environment variables file:
cp .env.example .env
# Edit .env file with your API key
Start the Docker development environment:
docker-compose up -d
Access the services:
Deploy your server to CloudFlare Workers:
npm run deploy
Your server will be available at the CloudFlare Workers URL assigned to your deployment.
The server supports two authentication methods:
The MCP server provides these key features:
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 authenticationOAUTH_CLIENT_SECRET
: OAuth client secret for authenticationThe server provides these primary tools:
crawl
: Crawl web pages from a starting URLgetCrawl
: Retrieve crawl data by IDlistCrawls
: List all crawls or filter by domainsearch
: Search indexed documents by queryextract
: Extract structured content from a URLRun 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
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.
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 > 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"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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