The Crawl4AI Documentation Scraper is a powerful toolkit for extracting clean, focused documentation from framework or library websites. It creates documentation that's both human-readable and optimized for AI consumption, providing clean Markdown output without the bloat of navigation elements, ads, or irrelevant sections.
Follow these steps to set up the Crawl4AI Documentation Scraper:
Clone the repository:
git clone https://github.com/felores/crawl4ai_docs_scraper.git
cd crawl4ai_docs_scraper
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
Extract content from a single documentation page:
python single_url_crawler.py https://docs.example.com/page
The output will be in Markdown format, preserving the original structure including lists, links, tables, and code blocks.
Process multiple URLs in parallel:
# Using a text file with URLs (one URL per line)
python multi_url_crawler.py urls.txt
# Using JSON output from menu crawler
python multi_url_crawler.py menu_links.json
# Using custom output prefix
python multi_url_crawler.py menu_links.json --output-prefix custom_name
The crawler outputs individual Markdown files for each page with filenames in the format:
domain_path_docs_content_timestamp.md
custom_prefix_docs_content_timestamp.md
Automatically discover and crawl a website's sitemap:
python sitemap_crawler.py https://docs.example.com/sitemap.xml
Additional options:
--max-depth
: Maximum sitemap recursion depth--patterns
: URL patterns to includeExtract all menu links from documentation:
python menu_crawler.py https://docs.example.com
Optional:
--selectors
: Custom menu selectorsThe menu crawler saves output to the input_files
directory in JSON format, ready for use with the multi-url crawler:
{
"start_url": "https://docs.example.com/",
"total_links_found": 42,
"menu_links": [
"https://docs.example.com/page1",
"https://docs.example.com/page2"
]
}
The toolkit organizes files in the following structure:
crawl4ai_docs_scraper/
├── input_files/ # Input files for URL processing
│ ├── urls.txt # Text file with URLs
│ └── menu_links.json # JSON output from menu crawler
├── scraped_docs/ # Output directory for markdown files
│ └── docs_timestamp.md # Generated documentation
├── multi_url_crawler.py
├── menu_crawler.py
└── requirements.txt
All crawlers include comprehensive error handling with color-coded terminal output:
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.