Published · 8 min read
How to create an llms.txt file for your docs
Learn how to create llms.txt for your documentation: what goes in it, how to write or generate one, and how to keep it accurate after each release.
Published · 8 min read
Learn what an MCP server for documentation does, what to expose to AI tools like Claude and Cursor, and how to keep answers accurate after every merge.

When a developer asks Claude or Cursor how to authenticate against your API, where does the answer come from? If it comes from stale training data or a half-parsed HTML page, you already know how that ends. An MCP server for documentation gives AI tools a direct, structured way to query your current docs at the moment the question is asked. This guide covers what that server does, what to expose through it, and how to set one up without creating a second copy of your content to maintain.
The Model Context Protocol is an open standard that enables developers to build secure, two-way connections between their data sources and AI-powered tools. The architecture is simple: you either expose data through an MCP server, or you build an AI application, called an MCP client, that connects to those servers.
Before MCP, every new data source required its own custom implementation, which made connected systems hard to scale. Now a docs team can build against one protocol instead of maintaining a connector per assistant.
An MCP server can offer three kinds of things to a client, according to the protocol's architecture overview:
For docs, tools do most of the work. A client lists the available tools, provides them to the model, and executes the ones the model calls. So when a developer asks a question, the model can call a search tool, get matching pages, fetch the one it needs, and answer from that text.
The exchange runs on a JSON-RPC 2.0 based protocol. The server can sit on the public web next to your docs. Microsoft's Learn MCP Server, for example, is a remote MCP server that uses streamable HTTP.
The standard also looks durable. In December 2025, Anthropic donated MCP to the Agentic AI Foundation, a directed fund under the Linux Foundation, co-founded with Block and OpenAI, and there is now an official, community-driven Registry for discovering available MCP servers.
Your readers are already asking assistants about your product. In the Stack Overflow 2025 Developer Survey, 84% of respondents said they use or plan to use AI tools in their development process. Trust is the weak spot: 46% of developers said they don't trust the accuracy of the output from AI tools, up from 31% the previous year.
Documentation is where that accuracy has to come from. The same survey lists technical documentation as the top resource for learning to code, at 68%. Developers still depend on your docs, but more and more often an assistant reads them on the developer's behalf.
Without a structured endpoint, the assistant has two bad ways to read them:
The second option matters more than it sounds. The llms.txt proposal notes that a coding agent fetches a library's documentation to get an API call right, and that context windows are still too small for most websites in their entirety, with every wasted token costing time and money.
An MCP server fixes both problems. The assistant asks a narrow question, gets a small, clean answer from your current published docs, and moves on. Any client that speaks the protocol can use the same server, so you are not building one integration per tool.

Do not expose everything. A few well-described tools serve a model better than a long menu it has to guess at. Start with three layers.
Expose clean Markdown, not rendered HTML. The minimum useful set is:
This is the same pattern most public docs MCP servers follow, and it covers the majority of "how do I" questions.
Reference content is where assistants make the costliest mistakes: a wrong parameter name, a missing required field, an endpoint that was renamed. Expose that content as structured data rather than prose so the model does not have to parse a table. That includes:
Can the assistant, and the developer reading its answer, tell where a claim came from? Attach provenance to what you return:
Evidence lets a model prefer the current page over an archived one, and it gives the developer a link to verify. Given how many developers distrust AI output, that link matters.
MCP and llms.txt complement each other. The MCP server handles queries, and llms.txt is a static index any agent can read without a client connection. The file can sit at the site root or at any path within it, covering the pages under that path. OpenAI (developers.openai.com/llms.txt), Anthropic (platform.claude.com/llms.txt), and Gemini (ai.google.dev/gemini-api/docs/llms.txt) publish llms.txt files for their own developer docs.
The most common mistake is treating the MCP server as a separate project with its own content. If you do that, you have two things to keep current. Derive the site, the Markdown, the JSON, and the MCP responses from the same files.
That approach also answers a question teams ask a lot: how do you publish machine-consumable docs without forcing writers into a complicated workflow? Writers keep authoring in Markdown or MDX, in Git, with pull request review, and the machine outputs are build artifacts.
A workable sequence:
Two protocol details matter here. Clients should call list tools each time they initialize the server, because the list and the tools may change over time. So keep tool names stable and avoid breaking changes. Also build against the current revision of the spec. Roots and sampling, which are client features, and protocol logging, a server feature, are deprecated as of protocol version 2026-07-28.
On governance, keep the first version read-only. Search and fetch carry little risk. Editing through an assistant is a separate decision with separate review requirements.

An MCP server returns whatever your docs say, right or wrong. If a merged pull request renamed a flag and the docs did not follow, the assistant will give the old flag with full confidence and cite your page as proof.
So the server is only half the work. The rest is closing the gap between code changes and doc changes. Practical steps:
GitHub Actions can cover most of this: regenerating references, reminding authors, dispatching merged changes to a docs repository, drafting docs pull requests, and gating docs quality. If you would rather not assemble it yourself, Thally traces each merged pull request to the docs, website, and help center pages it affects and opens an evidence-backed update PR, and nothing publishes without a person approving it.
The measure of success is simple. As one platform guide puts it, the real question is whether your setup keeps documentation accurate after launch, not just whether it makes the first draft look polished. Use one source, generate the outputs from it, and review every change before it ships.
Published under the Thally editorial policy. Technical conformance is defined in the agent-readiness methodology.
Create a managed site, or use the open-source engine to run Thally yourself.