AI integration
Make your docs accessible to AI tools
fromsrc provides built-in endpoints that make your documentation accessible to AI tools and LLMs.
llms.txt
The /llms.txt endpoint returns all your documentation content in a single file optimized for AI consumption.
This endpoint combines all pages into one text file with clear section markers.
Per-page endpoints
Access raw markdown for any page by appending .md to the URL:
This lets AI tools fetch specific pages without parsing HTML.
Use cases
RAG systems
Feed documentation into retrieval-augmented generation pipelines
AI assistants
Let chatbots answer questions using your docs
Code generation
Provide context for AI coding tools
Training data
Use docs as training material for fine-tuning
MCP endpoint
The /api/mcp endpoint supports both plain method calls and JSON-RPC 2.0 payloads.
Available methods:
initializenotifications/initializedpingsearch_docsget_pagelist_pagestools/listtools/callresources/listresources/templates/listresources/read
tools/call example:
tools/list and list_pages support optional pagination params:
resources/read example:
Resource slugs are normalized lowercase kebab-case paths (for example fromsrc://docs/getting-started).
Implementation
Route handler
Create app/llms.txt/route.ts:
Raw markdown endpoint
Use Next.js proxy to serve .md files:
Best practices
Structure content clearly
Use descriptive headings and short paragraphs. AI tools parse structure to understand context.
Include code examples
Practical examples help AI understand usage patterns and generate accurate code.
Keep pages focused
One topic per page makes retrieval more precise and reduces noise in AI responses.