How do I make my docs site work inside AI agents?
For Documentation site maintainers and developer experience teams · Based on Rachel Lee's Agentic Web Publishing Framework
// TL;DR
If you maintain a documentation site for an API, library, or developer tool, Rachel Lee's Agentic Web Publishing Framework lets you expose your docs inside AI coding agents without rebuilding. Map your guides and API reference to MCP tools, serve bulk docs via MCP Resources for context priming, and add Web MCP to your HTML pages so in-browser agents can navigate sections and retrieve examples directly. Your docs stay on your server, your site still works normally, and developers can access everything from inside the agents they already use.
Why should my documentation site support AI agents?
Developers increasingly work inside AI coding agents like Claude Desktop, GitHub Copilot, and browser-based assistants. If your docs are only accessible via a traditional website, developers must context-switch out of their workflow to look things up. Rachel Lee's Agentic Web Publishing Framework solves this by making your docs callable as MCP tools inside the agent, searchable via structured queries, and navigable by in-browser agents — all without rebuilding your documentation site.
The framework follows the principle of Meet Them Where They Are: your audience is already working inside agents, so publish your content into those surfaces rather than waiting for them to visit your website.
How do I map my documentation structure to MCP tools?
Start with an audit of your site's navigation. Most documentation sites have a predictable structure: a list of guides, an API reference with methods or endpoints, a search function, and detail pages. Each of these maps to an MCP tool:
- `list_guides` — returns a JSON array of guide titles and slugs
- `list_api_methods` — returns API methods with signatures and descriptions
- `search_docs` — takes a query string, returns matching results with snippets
- `get_guide` or `get_method` — returns full content as Markdown or as an MCP App
Keep your tool count focused. Match the navigation surface area of your site, not every internal function. Write clear natural-language descriptions for each tool so the agent knows when to call it.
For the full documentation corpus — the kind of background context an agent needs to reason about your library — use MCP Resources, not Tools. Stuffing large docs into context one tool call at a time wastes tokens. Resources let agent harnesses pre-prime context when a user enters your library's mode.
Host your MCP server at a clean endpoint like `/mcp` using HTTP transport. Developers paste one URL into their agent settings and they are connected. No JSON config editing, no command-line arguments.
How do I make my docs pages work with in-browser agents?
Add Web MCP registration to your HTML documentation pages. Use the imperative model for JavaScript-driven sites:
```javascript
if (navigator.modelContext) {
navigator.modelContext.registerTool(
'navigate_to_section',
'Jump to a specific section of this documentation page',
{ type: 'object', properties: { section_id: { type: 'string' } } },
(params) => scrollToSection(params.section_id)
);
navigator.modelContext.registerTool(
'get_code_example',
'Get the code example for this API method',
{ type: 'object', properties: { method_name: { type: 'string' } } },
(params) => getExample(params.method_name)
);
}
```
The callback functions are the same ones your UI already uses. The `if (navigator.modelContext)` check ensures graceful degradation for regular browsers.
This eliminates the need for in-browser agents to rely on screenshot-based DOM traversal or visual guessing — they call your tools directly, reducing token cost and improving reliability.
Should I build MCP Apps for documentation content?
For API reference pages with interactive elements — try-it-out panels, parameter explorers, response viewers — an MCP App delivers a far richer experience than Markdown text in a chat window. Bundle your existing design system's CSS and fonts into a single HTML file using Vite's single-file plugin. Configure CSP to allow resources from your own origin. The MCP App renders inline in the agent harness with your full visual identity.
For purely textual guides, returning Markdown from your MCP tool is usually sufficient. Match the return type to what the developer actually needs to do with the content — reading a guide is different from exploring an API schema.
Remember: the browser is an Infinite Canvas. Inside MCP Apps, you have access to Canvas for diagrams, Web Animations for interactive tutorials, and even WASM for running code examples — all at zero inference cost.
What is my next step?
Audit your documentation site's navigation today. List every action a developer takes — searching, browsing categories, reading a guide, viewing an API method. Map each to an MCP tool name and description. Stand up an HTTP MCP server at `/mcp` with your first three tools, install it in Claude Desktop, and test. You will see your docs surface inside the agent within an afternoon.
// FREQUENTLY ASKED QUESTIONS
Can I expose my full documentation as an MCP Resource even if agent harnesses don't fully support Resources yet?
Yes, implement MCP Resources now even though harness UI support is limited. When support improves, your documentation will already be available for context priming. In the meantime, your MCP Tools handle targeted retrieval (search, list, get-detail), and you avoid the anti-pattern of stuffing large doc corpora through tool calls one chunk at a time.
Do I need to change my existing documentation site to add MCP support?
No. The framework layers MCP tools and Web MCP registration onto your existing site. Your documentation pages continue to serve normal browser users exactly as before. You add an MCP server endpoint and optionally add Web MCP attributes or JavaScript registration to your HTML pages. The existing site is not rebuilt — it is extended.
How do I handle versioned documentation with MCP tools?
Include a version parameter in your MCP tool input schemas (e.g., list_api_methods accepts a version field). Default to the latest version when no version is specified. This mirrors how your site likely already handles versioned docs via URL paths or query parameters. The agent can ask for a specific version, and your tool routes to the correct content.