Docs Scraper MCP server

Scrapes web-based documentation through multiple crawling strategies like sitemap traversal and menu navigation, enabling structured content extraction with rate limiting and robots.txt compliance
Back to servers
Provider
felores
Release date
Mar 25, 2025
Language
Python
Stats
1 star

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.

Installation

Follow these steps to set up the Crawl4AI Documentation Scraper:

  1. Clone the repository:

    git clone https://github.com/felores/crawl4ai_docs_scraper.git
    cd crawl4ai_docs_scraper
    
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    

Usage Options

Single URL Crawler

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.

Multi URL Crawler

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:

  • Without prefix: domain_path_docs_content_timestamp.md
  • With prefix: custom_prefix_docs_content_timestamp.md

Sitemap Crawler

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 include

Menu Crawler

Extract all menu links from documentation:

python menu_crawler.py https://docs.example.com

Optional:

  • --selectors: Custom menu selectors

The 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"
    ]
}

Directory Structure

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

Error Handling

All crawlers include comprehensive error handling with color-coded terminal output:

  • 🟢 Green: Success messages
  • 🔵 Cyan: Processing status
  • 🟡 Yellow: Warnings
  • 🔴 Red: Error messages

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later