Blog

llms.txt: Stop Letting Coding Agents Invent Last Year's API

Johannes Hayer
Johannes Hayer
·2 min read·en

You ask the agent to wire up a library. It writes code that looks right. Types check in its head. Then you run it — and the method doesn't exist. Or it exists under a new name. Or the import path moved six months ago.

Nobody calls that a hallucination in the dramatic sense. It feels worse: confident outdatedness. The model isn't inventing fantasy APIs from thin air. It's completing from a world that no longer matches your docs.

That's the problem llms.txt is aimed at. A small convention with a big job: point agents at current documentation for a project, then pull that context on demand instead of improvising from training memory.

In the video#

  • 00:00 — What is llms.txt?
  • 00:51 — Reading FastMCP's llms.txt
  • 01:30 — Introduction to mcpdoc (langchain-ai/mcpdoc)
  • 01:58 — Configuring mcpdoc for Cline in VS Code
  • 03:16 — Live: FastMCP with up-to-date information

Resources:

What llms.txt actually is#

Not a magic prompt. Not a new model feature.

It's a curated index of documentation meant for LLMs — a project publishes an llms.txt that tells agents where the fresh docs live. Think of it as a map, not the whole library. The agent (or an MCP server like mcpdoc) follows the map when the task needs that library.

If the project doesn't ship one, you're back to pasting docs by hand — or hoping the cutoff is recent enough. Hope is not a context strategy.

mcpdoc turns the map into a tool#

In the video I wire mcpdoc so a coding agent in VS Code (Cline) can fetch those docs through MCP instead of through your clipboard.

Example shape:

bash
uvx --from mcpdoc mcpdoc \
  --urls "LangGraph:https://langchain-ai.github.io/langgraph/llms.txt" \
         "LangChain:https://python.langchain.com/llms.txt" \
  --transport sse \
  --port 8082 \
  --host localhost

That's the pattern: point mcpdoc at one or more llms.txt URLs, expose it as an MCP server, let the agent call it when it's about to invent an API.

Why this beats "just paste the docs"#

Pasting works once. It doesn't survive the next session. It doesn't scale across LangGraph + LangChain + FastMCP + whatever you touch this week. And it still depends on you remembering to paste.

llms.txt + mcpdoc move freshness into the tool layer. Same idea as Context7: the agent should look up, not remember.

Takeaway#

If you maintain a library, ship an llms.txt. If you consume libraries that already do, wire mcpdoc (or equivalent) into your coding agent before the next "why doesn't this method exist" afternoon.

Context freshness beats clever prompting when the ground truth changed last Tuesday.

AI engineering, weekly.

Join developers getting practical AI engineering in their inbox.