What is llms.txt?
Watch the full setup demonstration →
llms.txt works like a sitemap for websites, but designed for AI systems. It provides large language models with a structured overview of concepts and links to detailed information, allowing the AI to make targeted fetch calls when it needs more specific details.
How It Works
Using the FastMCP project as an example, their llms.txt file contains:
- Overview of all key concepts
- Links to detailed documentation
- Structured format that LLMs can easily parse
When an LLM needs more information, it can fetch specific URLs from the llms.txt file rather than guessing or hallucinating.
Setting Up MCP Doc Server
The LangChain team created MCP Doc - an MCP server that serves llms.txt files to AI systems. Here's the detailed setup process:
Step 1: Start the MCP Doc Server
The correct command to start the mcpdoc server is:
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
Command Breakdown:
- uvx: Python package runner (similar to npx for Node.js)
- --urls: Specify multiple llms.txt sources with labels
- --transport sse: Server-Sent Events transport method
- --port 8082: Local port for the MCP server
- --host localhost: Server host configuration
Step 2: Configure in VS Code/Cline
In VS Code with Cline, navigate to the server configuration:
- Click the server symbol in Cline
- Select "Install"
- Click "Configure MCP servers"
Step 3: Add MCP Server Configuration
Add this configuration to connect to your running mcpdoc server:
{
"mcpServers": {
"docs": {
"command": "uvx",
"args": [
"--from", "mcpdoc", "mcpdoc",
"--urls", "FastMCP:https://gofastmcp.com/llms.txt",
"--transport", "sse",
"--port", "8082",
"--host", "localhost"
]
}
}
}
Configuration Details:
-
Multiple sources: Add as many
"Label:URL"
pairs as needed - Port matching: Ensure port matches your running server
- Labels: Use descriptive names for each documentation source
Step 4: Restart and Verify
After configuration:
- Restart your MCP servers
- Verify the "docs MCP" server appears in your available tools
- Test with a query that requires current documentation
Real-World Demo: Dynamic Documentation Fetching
Here's what actually happens when you ask for help with MCP development:
The Query
"Help with dynamic resources in MCP use"
The AI's Process
-
Lists available sources: Uses
list_doc_sources
to see what llms.txt files are available -
Fetches overview: Makes
fetch_docs
call to get the complete llms.txt content - Identifies specific needs: Recognizes it needs more detail on "resources"
- Makes targeted fetch: Calls the specific resources documentation URL
- Provides accurate answer: Uses the fetched information for correct implementation
The Result
No hallucination. Perfect implementation with current best practices.
Multiple Source Configuration Example
You can configure multiple llms.txt sources for comprehensive coverage:
uvx --from mcpdoc mcpdoc \
--urls \
"LangGraph:https://langchain-ai.github.io/langgraph/llms.txt" \
"LangChain:https://python.langchain.com/llms.txt" \
"FastMCP:https://gofastmcp.com/llms.txt" \
"YourProject:https://yourproject.com/llms.txt" \
--transport sse \
--port 8082 \
--host localhost
This gives your AI assistant access to documentation from multiple projects simultaneously.
Why This Approach Works Better
Traditional AI Development Issues
- Outdated training data
- Deprecated API references
- Hallucinated implementation details
With llms.txt + MCP Doc
- Current information: Always references latest documentation
- Targeted fetching: Gets exactly the information needed
- No guesswork: AI works with actual current docs, not assumptions
Key Benefits
- Free: Unlike some context tools, this approach costs nothing
- Multiple sources: Can integrate multiple llms.txt files simultaneously
- Current information: Always references the latest documentation
- Structured approach: Systematic rather than guessing
- IDE integration: Works seamlessly with VS Code, Cursor, Windsurf
Use Cases
Perfect for:
- MCP server development (as demonstrated)
- Framework-specific development where APIs change frequently
- Multi-project development requiring different documentation sources
- Team environments where everyone needs access to current docs
Thanks for reading ! Have a question? Reach out to me or comment below
🔗 CONNECT:
Substack: https://substack.com/@jhayer93
Discord Community: https://discord.gg/2wSR6GPgB5
LinkedIn: https://www.linkedin.com/in/johannes-hayer-b8253a294/
Top comments (0)