API Reference
Complete reference for the `crawl` tool parameters.
The CRAWL4AI_MCP server exposes a single, powerful tool to your AI assistant: crawl.
Here is the complete list of parameters that your AI can use when calling this tool.
| Parameter | Type | Default | Description |
|---|
url | string | (Required) | The fully qualified URL to crawl. |
max_depth | integer | 2 | Maximum crawling depth. Defines how many links deep the crawler should go. |
include_external | boolean | false | Whether to include external links in the crawl. |
return_content | boolean | true | If true, returns the extracted content directly in the MCP response text. |
| Parameter | Type | Default | Description |
|---|
magic | boolean | false | Enable magic mode to bypass anti-bots (e.g., Cloudflare) and simulate a real browser. |
wait_for_selector | string | null | CSS selector to wait for before extracting content. Crucial for SPA and React/Vue apps. |
delay_before_return_html | number | null | Delay in seconds to wait before extracting HTML (useful for heavy JS pages with slow animations). |
| Parameter | Type | Default | Description |
|---|
css_selector | string | null | Specific CSS selector to extract only targeted elements from the page (e.g., main .article). |
js_code | string | null | Custom JavaScript code to execute on the page before extraction. (Requires server env var CRAWL4AI_MCP_ALLOW_JS_ENV=true) |
| Parameter | Type | Default | Description |
|---|
session_id | string | null | Persistent session identifier to keep cookies and browser state across multiple requests (great for authenticated sites). |
| Parameter | Type | Default | Description |
|---|
verbose | boolean | true | Enable verbose logging output on the server side. |
output_file | string | null | Custom path to the output Markdown file. If not provided, it generates a unique name in the crawl_results folder. |
When Claude or Cline uses this tool, it sends a JSON payload similar to this:
{
"url": "https://example.com/dashboard",
"magic": true,
"wait_for_selector": ".dashboard-loaded",
"session_id": "auth-session-xyz123"
}