# LLM & RAG Clean Docs / Sitemap Markdown Extractor (MCP-Ready) (`olviklabs/llm-docs-rag-extractor`) Actor

Fast, zero-auth technical documentation and sitemap crawler that strips navigation noise and outputs clean, token-counted Markdown chunks ready for RAG vector databases and AI agents (MCP).

- **URL**: https://apify.com/olviklabs/llm-docs-rag-extractor.md
- **Developed by:** [Olvik Labs](https://apify.com/olviklabs) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 page auditeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Website, Docs, Sitemap & `llms.txt` to Clean Markdown Crawler for RAG & AI Agents (MCP)

Convert any technical documentation site, `llms.txt` index, or `sitemap.xml` into **clean, noise-stripped, token-counted Markdown** ready for **RAG vector databases** (Pinecone, Qdrant, Weaviate, Supabase `pgvector`) and **MCP AI coding assistants** (Claude, Cursor, Windsurf).

***

### Why AI Engineers Use This Instead of Generic Web Crawlers

- **Zero Headless Browser Overhead:** Pure high-speed HTTP + deterministic HTML-to-Markdown parsing — 10x faster and cheaper than headless Chrome crawlers.
- **Automatic `llms.txt` & `sitemap.xml` Discovery:** Point it at a docs homepage and it automatically checks `/llms.txt` and `/sitemap.xml` to discover every doc page cleanly.
- **Boilerplate & Nav Stripping:** Removes `<nav>`, `<header>`, `<footer>`, `<aside>`, `<script>`, `<style>`, and cookie banners while preserving fenced code blocks (` ``` `), headings, links, and lists.
- **Built-In Token Counting & RAG Chunking:** Outputs `wordCount` and `estimatedTokens` on every record, with optional paragraph-aware chunk splitting (`chunkMarkdown: true`).

***

### High-ROI Use Cases

- **Keep Vector Databases Fresh:** Schedule weekly crawls in **n8n** or **LangChain** to sync external API docs into Pinecone / Qdrant / `pgvector`.
- **Custom Documentation Context for Coding Agents:** Feed up-to-date framework docs into Claude Code or Cursor via **Apify MCP** so LLMs stop hallucinating deprecated APIs.
- **Customer Support AI Knowledge Base Ingestion:** Convert help-center articles into clean Markdown chunks for RAG chatbots.

***

### Transparent Pay-Per-Event Pricing

Platform compute is **included free**:

- **`$2.00` per 1,000 extracted pages** (`$0.002` / page)
- Crawl an entire 150-page developer docs site for **$0.30**!

***

### Example Input

```json
{
  "startUrls": ["https://docs.apify.com/llms.txt"],
  "urlPrefixFilter": "",
  "maxPages": 50,
  "discoverSitemapOrLlmsTxt": true,
  "chunkMarkdown": true,
  "maxCharsPerChunk": 4000
}
```

### Sample Output Record

```json
{
  "url": "https://docs.apify.com/api/llms.txt",
  "title": "Apify API documentation | Apify Documentation",
  "chunkIndex": 1,
  "totalChunks": 1,
  "wordCount": 598,
  "estimatedTokens": 1915,
  "contentType": "markdown",
  "fetchedAt": "2026-11-25T19:32:24.356Z",
  "markdown": "# Apify API documentation..."
}
```

***

### Plug Into Claude, Cursor, n8n & Python

#### Use via MCP (`mcp.apify.com`)

```json
{
  "mcpServers": {
    "apify-docs-rag": {
      "url": "https://mcp.apify.com/?actors=olviklabs/llm-docs-rag-extractor",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_API_TOKEN"
      }
    }
  }
}
```

#### Call from Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_API_TOKEN")
run = client.actor("olviklabs/llm-docs-rag-extractor").call(
    run_input={"startUrls": ["https://docs.apify.com/llms.txt"], "maxPages": 25, "chunkMarkdown": True}
)
chunks = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(f"Loaded {len(chunks)} clean RAG chunks!")
```

***

### Support

Built and maintained by **Olvik Labs** (https://olviklabs.com) · Contact: **support@olviklabs.com**

# Actor input Schema

## `startUrls` (type: `array`):

List of documentation root URLs, specific pages, llms.txt URLs, or sitemap.xml URLs to crawl.

## `urlPrefixFilter` (type: `string`):

Restrict crawling only to URLs starting with this prefix (e.g., 'https://docs.example.com/api/'). Leave empty to stay on the same hostname.

## `maxPages` (type: `integer`):

Maximum number of unique documentation pages to fetch and convert to clean Markdown.

## `discoverSitemapOrLlmsTxt` (type: `boolean`):

Automatically check for /llms.txt and /sitemap.xml on root documentation URLs to discover all doc pages cleanly.

## `chunkMarkdown` (type: `boolean`):

Split long pages into overlapping token-sized Markdown chunks ready for vector DB embedding.

## `maxCharsPerChunk` (type: `integer`):

Maximum character length per chunk when 'Split into RAG Chunks' is enabled (~4 chars = 1 token).

## Actor input object example

```json
{
  "startUrls": [
    "https://docs.apify.com/llms.txt"
  ],
  "urlPrefixFilter": "",
  "maxPages": 20,
  "discoverSitemapOrLlmsTxt": true,
  "chunkMarkdown": false,
  "maxCharsPerChunk": 4000
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `jsonResults` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        "https://docs.apify.com/llms.txt"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("olviklabs/llm-docs-rag-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "startUrls": ["https://docs.apify.com/llms.txt"] }

# Run the Actor and wait for it to finish
run = client.actor("olviklabs/llm-docs-rag-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    "https://docs.apify.com/llms.txt"
  ]
}' |
apify call olviklabs/llm-docs-rag-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,olviklabs/llm-docs-rag-extractor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/m3xbcK4XGUo84Zl5O/builds/33e1vzJaqjqLIDAKf/openapi.json
