# Sitemap & Website to llms.txt, Markdown & RAG Dataset Builder (`duartelabs/sitemap-to-llms-txt-markdown-rag-builder`) Actor

Auto-discover XML sitemaps or internal pages from any domain, generate a ready-to-publish /llms.txt standard file, extract clean LLM Markdown, calculate token savings, and build RAG vector datasets in 6 languages (EN, ES, PT, FR, DE, IT).

- **URL**: https://apify.com/duartelabs/sitemap-to-llms-txt-markdown-rag-builder.md
- **Developed by:** [Cristian Duarte](https://apify.com/duartelabs) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 processed sitemap pages

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

## 💠 Sitemap & Website to `llms.txt`, Clean Markdown & RAG Dataset Builder

**Automatically crawl any website's `sitemap.xml` (or internal navigation), generate a ready-to-publish `/llms.txt` standard file (used by OpenAI, Anthropic Claude, and Cursor IDE), and convert core pages into clean LLM Markdown in seconds — with 6-language AI audits (`EN`, `ES`, `PT`, `FR`, `DE`, `IT`).**

Built for **AI Engineers, RAG Pipeline Builders, SEO/GEO (Generative Engine Optimization) Agencies, and n8n / Make / LangChain Developers**.

***

### 🔥 Why AI & GEO Teams Need This Actor

1. **Instant `/llms.txt` Generator:** Creates a compliant `llms.txt` index file (`# Title`, `> Summary`, and categorized Markdown links with descriptions) so ChatGPT Search, Perplexity, and Claude index your site accurately.
2. **Automatic `sitemap.xml` Discovery:** Finds `/sitemap.xml` or `/sitemap_index.xml` automatically (or falls back to internal navigation links) and extracts clean Markdown from up to 50 pages per run.
3. **Multi-Page RAG Dataset in 1 Run:** Outputs `pagesDataset` containing clean Markdown and exact LLM token counts per page.
4. **Multilingual AI Readiness Audit:** Summarizes discovered URLs, token footprint, and `llms.txt` status in **6 languages (`EN`, `ES`, `PT`, `FR`, `DE`, `IT`)**.

***

### 💻 Quick Start Code Examples (Python & Node.js)

#### Python (`apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_API_TOKEN")
run = client.actor("duartelabs/sitemap-to-llms-txt-markdown-rag-builder").call(run_input={
    "websiteUrls": [{"url": "https://apify.com"}],
    "maxPagesPerSite": 5,
    "reportLanguage": "en"
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["generatedLlmsTxt"])
```

***

### 🤖 1-Click Integration with Claude Desktop & Cursor (MCP)

```json
{
  "mcpServers": {
    "apify": {
      "command": "npx",
      "args": ["-y", "@apify/actors-mcp-server", "--actors", "duartelabs/sitemap-to-llms-txt-markdown-rag-builder"],
      "env": { "APIFY_TOKEN": "YOUR_APIFY_API_TOKEN" }
    }
  }
}
```

***

### 🛠️ Complete 6-Actor Automation Suite by `duartelabs`

- 🟢 **[B2B Lead, WhatsApp, Email & Ad-Pixel Intelligence Scraper](https://apify.com/duartelabs/b2b-lead-whatsapp-pixel-scraper)**
- 📍 **[Google Maps Local Business Email, WhatsApp & Ad-Pixel Enricher](https://apify.com/duartelabs/google-maps-business-email-whatsapp-enricher)**
- 🟠 **[Shopify Competitor Price, Stock, Discount & Best-Sellers Spy](https://apify.com/duartelabs/shopify-competitor-price-stock-spy)**
- 🟣 **[AI-Ready Website to Clean Markdown, Token Counter & RAG Chunker](https://apify.com/duartelabs/ai-website-to-markdown-rag-chunker)**
- 🔵 **[Technical SEO, Meta, Schema.org & Broken Links Auditor](https://apify.com/duartelabs/seo-meta-schema-broken-links-auditor)**

# Actor input Schema

## `websiteUrls` (type: `array`):

Enter any root website URL (e.g. https://apify.com) or direct sitemap.xml URL. The Actor auto-discovers sitemap URLs or top internal pages and builds a standard /llms.txt + clean RAG dataset.

## `maxPagesPerSite` (type: `integer`):

Maximum number of key pages from the sitemap/navigation to crawl and convert into llms.txt and clean Markdown.

## `reportLanguage` (type: `string`):

Choose the language for the automated llms.txt & AI-Readiness summary.

## Actor input object example

```json
{
  "websiteUrls": [
    {
      "url": "https://apify.com"
    },
    {
      "url": "https://fastapi.tiangolo.com"
    }
  ],
  "maxPagesPerSite": 5,
  "reportLanguage": "en"
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing generated llms.txt files and crawled Markdown pages.

# 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 = {
    "websiteUrls": [
        {
            "url": "https://apify.com"
        },
        {
            "url": "https://fastapi.tiangolo.com"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("duartelabs/sitemap-to-llms-txt-markdown-rag-builder").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 = { "websiteUrls": [
        { "url": "https://apify.com" },
        { "url": "https://fastapi.tiangolo.com" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("duartelabs/sitemap-to-llms-txt-markdown-rag-builder").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 '{
  "websiteUrls": [
    {
      "url": "https://apify.com"
    },
    {
      "url": "https://fastapi.tiangolo.com"
    }
  ]
}' |
apify call duartelabs/sitemap-to-llms-txt-markdown-rag-builder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,duartelabs/sitemap-to-llms-txt-markdown-rag-builder"
        }
    }
}
```

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/9a3CErUbmmha5qce4/builds/dc4xSQM6WpnAK1DKE/openapi.json
