How agents read your site

AI and agents•6 min read|
|

Agents do better with clean Markdown than with scraped HTML. Every docslit build writes machine-readable files next to your HTML pages, and sites on DocsLit Cloud add a hosted MCP endpoint. You do not configure any of this.

Files in the build output

File Purpose
llms.txt Index of every page: title, description and Markdown URL, grouped by sidebar group. Follows the llmstxt.org format
llms-full.txt The full text of every page in one file, with a # Source: marker before each page. Stops at a size limit on very large sites
llms/<section>.txt Sub-indexes for one section each. Written only when llms.txt would be too large
<tab-id>/llms.txt An index for one tab. Written only on sites with tabs
{slug}.md The Markdown source of each page, with includes and compile-time variables expanded
sitemap.md Your navigation as Markdown: groups and pages as links to the .md files
changes.md Every indexable page with its last-modified date, newest first. Needs url
skill.md and .well-known/agent-skills/ A generated skill about your site, plus any skills you publish. See Publish agent skills
search-index.json The index that powers site search, also used by agents
.well-known/agent.json Discovery file that lists all of the above
mcp-server.js A standalone MCP server over stdio. See MCP server
robots.txt Allows common search and AI crawlers and points at the sitemap. Needs url

For a site with versions, each version has its own llms.txt, llms-full.txt, search-index.json and Markdown files in a folder named after the version. The root llms.txt becomes a version index.

On a site with i18n, the default language is served at the root and every other language has its own llms.txt, llms-full.txt, sitemap.md and search-index.json under /<locale>/.

Every page also carries a short agent directive, in the HTML and in the .md file. It points to llms.txt and to the page's own Markdown URL, following the Agent-Friendly Documentation Spec. The <head> of every static page has a <link rel="alternate" type="text/markdown"> that points at the page's .md file, so an agent that has the HTML can find the Markdown.

llms.txt

# DocsLit > Documentation for DocsLit - build beautiful docs with Markdown and web components > Raw Markdown for each page: append `.md` to the page URL, or request the page with `Accept: text/markdown`. Every link below already points at the Markdown. ## Getting started - [Introduction](https://docs.docslit.com/0.1/getting-started/introduction.md): DocsLit is a documentation framework that combines Markdown with interactive web components.

Write a good description in each page's frontmatter. It becomes the line after the link. The lint rule missing-description checks for it.

agent.json

.well-known/agent.json tells an agent where everything is, so it needs one request to learn the layout:

{ "name": "DocsLit", "description": "Documentation for DocsLit", "spec": "https://agentdocsspec.com/spec/", "docs": { "llms_txt": "https://docs.docslit.com/llms.txt", "llms_full_txt": "https://docs.docslit.com/0.1/llms-full.txt", "search_index": "https://docs.docslit.com/0.1/search-index.json", "markdown_pattern": "https://docs.docslit.com/{version}/{slug}.md" }, "content_negotiation": { "accept": "text/markdown", "description": "Request any page URL with Accept: text/markdown to receive raw Markdown" }, "pages": [ { "slug": "getting-started/introduction", "markdown": "https://docs.docslit.com/0.1/getting-started/introduction.md" } ], "versions": ["0.1"], "default_version": "0.1" }

The file lists every page. This example is shortened to one. Set url in docslit.json so these links are absolute.

sitemap.md and changes.md

sitemap.md lists your navigation: a ## heading per tab (when you use tabs), a heading per group, nested groups as nested bullets, and each page as a - [Title](page.md) link. Hidden and excluded pages are left out, as in llms.txt. Each version gets its own copy next to its llms.txt.

changes.md lists every indexable page with the date it last changed, taken from git history, newest first:

- 2026-12-01 [Quickstart](getting-started/quickstart.md)

The build writes changes.md only when url is set and the sitemap isn't disabled. On a versioned site it covers the default version only.

Limits for large sites

Two settings under agents.llms keep the files at a size agents can load:

{ "agents": { "llms": { "fullMaxChars": 4000000, "indexMaxChars": 100000 } } }
  • fullMaxChars (default 4000000) caps llms-full.txt. The file stops at a page boundary and ends with <!-- llms-full.txt truncated: size limit reached. Read individual pages through their .md URLs listed in llms.txt. -->. The build prints a warning with the number of pages it included. If the first page alone is over the limit, it is still included. Set 0 for no limit.
  • indexMaxChars (default 100000) caps llms.txt. When the index would be larger, the root llms.txt keeps its header and lists the sub-indexes under ## Sections, one line per section, such as - [Guides](https://docs.example.com/llms/guides.txt): 42 pages. It still ends with ## Optional. Each section's pages go in llms/<section-slug>.txt. A section that is still too large is split into llms/<slug>-1.txt, llms/<slug>-2.txt and so on. A section is a sidebar group, or a tab plus a group. Set 0 to never split.

On a site with tabs, each tab also gets its own <tab-id>/llms.txt that covers only that tab, split the same way. The root llms.txt lists these in ## Optional as "<tab label> index".

Reader mode of docslit mcp follows the sub-indexes, so its page list stays complete.

Optional section in llms.txt

llms.txt ends with an ## Optional section. It links to the site map, to recent changes (when changes.md exists), to llms-full.txt, and to skill.md when skills output is on. Agents with a small context budget can skip it.

WebMCP tools

WebMCP is an experimental browser API (document.modelContext) that lets a page offer tools to an AI agent built into the browser. Set agents.webmcp to true and every static page registers tools that read your docs:

{ "agents": { "webmcp": true } }

It works in Chrome and Edge behind a flag or origin trial. In other browsers, and in offline builds, it does nothing. The tools use the version and language the reader is viewing.

Tool Arguments Description
search_docs query, limit (1 to 20, default 8) Matching pages and sections with title, heading, URL, Markdown URL and a snippet
get_current_page none The open page's id, title, URL, Markdown URL and an outline of its h2 and h3 headings
read_page slug The page's Markdown, capped at 200,000 characters
get_site_overview none The site's llms.txt
open_page slug Navigates to a page

The read tools are marked read-only. open_page is the only tool that changes what the reader sees. For agents outside the browser, use the MCP server.

Markdown frontmatter

A page's .md copy keeps the page's own frontmatter and adds the "For AI agents" note. Set agents.markdownFrontmatter to add facts an agent would otherwise have to derive:

{ "agents": { "markdownFrontmatter": true } }
Key Value
title The authored title, or the title DocsLit derives from the first heading
description The page description, when it has one
url The absolute canonical URL. Only when url is set
updated The last change as YYYY-MM-DD, from git history with the file modification time as fallback. Left out for older versions built from other branches
tokens A rough size estimate: the character count divided by 4

Your authored title and description win. The generated url, updated and tokens replace authored keys with the same names. The option is off by default, and the output doesn't change until you turn it on.

Content negotiation

An agent can request any page URL with Accept: text/markdown and receive Markdown instead of HTML:

curl -H "Accept: text/markdown" https://docs.example.com/getting-started/quickstart

The negotiated response carries X-Robots-Tag: noindex and a Link header with rel="canonical" that points at the HTML page, so search engines index the page and not the Markdown copy.

A request gets Markdown when its Accept header ranks text/markdown at least as high as text/html, counting quality values. text/markdown, text/html;q=0.9 gets Markdown, and browsers keep getting HTML.

docslit dev does this for you locally. For a static build, docslit build writes the pieces each host needs. Cloudflare Pages and Vercel need one extra step, because they read these files only from the project root:

The build writes the middleware to dist/functions/_middleware.js and never writes into your source tree. Run docslit deploy --cloudflare once after a build to copy it to functions/ in your project. Later builds refresh that copy, but only when it carries the "generated by DocsLit" marker. The build also writes _headers so .md files are served as text/markdown.

Run docslit deploy --vercel in your project root. It writes middleware.js, which serves the page's Markdown, and a vercel.json with clean URLs, unless you already have one. Commit both and deploy the project rather than the dist/ folder alone. A vercel.json rewrite on the Accept header does not work, because Vercel applies rewrites only after the static page has matched.

Use _middleware.js from the output folder as an edge function, or reference it in netlify.toml.

GitHub Pages and plain object storage cannot negotiate content. Agents can still fetch /{slug}.md directly, and llms.txt lists those URLs.

HTTP headers and discovery

The build writes header rules to _headers (Netlify and Cloudflare Pages) and to vercel.json (Vercel). They apply only on hosts that read those files. GitHub Pages ignores them. The vercel.json that docslit deploy --vercel writes carries the same rules, including the Link and Content-Signal headers.

  • .md files are served as text/markdown; charset=utf-8 with X-Robots-Tag: noindex, which keeps the Markdown copies out of search results.
  • Every path gets a Link header that points at llms.txt with rel="describedby llms-txt". When skills output is on, the same header also points at /.well-known/agent-skills/index.json with rel="agent-skills". Both URLs include basePath when you set one.
  • When you set agents.contentSignals, every path also gets a Content-Signal header.

agent.json keys

The docs object in .well-known/agent.json can include these keys:

Key Present when
sitemap_md The build wrote sitemap.md
changes_md The build wrote changes.md
skills_index Skills output is on
skill_md Skills output is on

On a site with basePath, the URLs in llms.txt, in the .md agent note and in agent.json include the base path.

Agent-only and human-only content

Agents read the generated Markdown, so you can tune it separately from the page. Wrap content in wc-if with for="agents" and it appears only in the .md files, llms-full.txt and everything built from them, such as MCP results. Content with for="humans" appears only on the web page. The condition is evaluated at build time, so nothing is hidden with CSS.

<wc-if for="agents"> The API base URL is `https://api.example.com/v2`. Send the key in the `Authorization` header. </wc-if>

See Conditional content for the other conditions.

To replace a whole page for agents, add a docs/<id>.agent.md file next to the page. See Agent renditions.

DocsLit Cloud

Sites on DocsLit Cloud get all of this without setup, plus two extras.

Hosted MCP endpoint. Each site serves an MCP server over HTTP. It is stateless Streamable HTTP with JSON responses and no authentication:

POST https://{slug}.{base-domain}/mcp POST https://{host}/sites/{slug}/mcp GET https://{slug}.{base-domain}/.well-known/mcp.json

/.well-known/mcp.json describes the endpoint, the transport, the supported protocol versions and the tools, unless your site publishes its own file at that path. The server offers list_pages, get_page, search_docs and get_docs_overview. It negotiates protocol versions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05, accepts batches of up to 20 messages, and sets open CORS headers. A GET returns 405, except a browser navigation that asks for HTML, which falls through to your site's own /mcp page.

Here the hosted get_page takes a page argument, which accepts an id, a path or a full URL. The local reader tool takes slug instead.

Markdown negotiation. The server returns Markdown when Accept lists text/markdown with a higher quality value than text/html, or lists it first on a tie. A bare */* never counts, so browsers and plain curl keep getting HTML. Responses carry Vary: Accept, an ETag and X-Content-Type-Options: nosniff. A request for / returns index.md or llms.txt.

What to do next

  • Check your site with afdocs: npx afdocs check https://docs.example.com
  • Publish task instructions for agents with agent skills
  • Give your own agent read access with reader mode
  • Improve what agents see with the lint rules for descriptions and headings