<!--
Sitemap:
- [What is Vocs](/guide/what-is-vocs): Learn what Vocs provides for documentation sites
- [Getting Started](/guide/getting-started): Install Vocs and create your first documentation site
- [Writing Docs with AI](/guide/writing-docs-with-ai): Use an AI agent to create and maintain Vocs documentation
- [Project Structure](/guide/structure): Overview of the structure of a Vocs project
- [Markdown Extensions](/guide/markdown-extensions): Features and syntax of Markdown in Vocs
- [Code & Syntax Highlighting](/guide/syntax-highlighting): Rich markup and annotations for code
- [Code Snippets](/guide/code-snippets): Include and reuse code in Markdown
- [Markdown Snippets](/guide/markdown-snippets): Include other Markdown files in MDX
- [Asset Handling](/guide/asset-handling): Manage images, fonts, icons, and other docs assets
- [Frontmatter](/guide/frontmatter): Configure page metadata, layouts, search, and UI visibility
- [Using React in Markdown](/guide/react): Compose MDX pages with React components
- [Twoslash](/guide/twoslash): Add type-aware annotations to code examples
- [Sidebar & Top Navigation](/guide/navigation): Keep docs navigation synced with routes
- [Theming](/guide/theming): Customize colors, typography, spacing, logos, and code themes
- [Tailwind CSS](/guide/tailwind): Use Tailwind utilities in Vocs pages and components
- [Layouts](/guide/layouts): Choose and customize page shells for your docs
- [Dynamic OG Images](/guide/dynamic-og-images): Generate social preview images from page metadata
- [Feedback](/guide/feedback): Collect page-level feedback from readers
- [Changelog Generation](/guide/changelog-generation): Fetch release notes and render a changelog page
- [MCP Server](/guide/mcp-server): Expose your docs and source code to AI assistants
- [AI Support](/guide/ai-support): Make your documentation easier for AI assistants to read
- [Site Configuration](/reference/site-config): Reference for options accepted by defineConfig
- [Components](/reference/components): Reference for the public React components exported from Vocs
- [Hooks](/reference/hooks): Reference for the React hooks exported from Vocs
- [Changelog](/guide/changelog): Release history for Vocs
-->

# AI Support \[Make your documentation easier for AI assistants to read]

Vocs includes built-in features that make your documentation easier for LLMs and AI assistants to consume.

## llms.txt

Vocs automatically generates [`llms.txt`](https://llmstxt.org/) files for LLM consumption:

* `/llms.txt`: A concise index of all pages with titles and descriptions
* `/llms-full.txt`: Complete documentation content in a single file

These files are generated at build time and served at the root of your site. No configuration required.

### Example Output

```txt
# Vocs

Vocs is a library for creating documentation websites.

- [What is Vocs?](/guide/what-is-vocs): Learn about Vocs and its features
- [Getting Started](/guide/getting-started): Quick start guide
- [AI Support](/guide/ai-support): Documentation features for AI agents
```

## Markdown Rendering for AI Agents

Vocs automatically detects AI user agents and serves them raw Markdown instead of rendered HTML. This provides better token efficiency and easier parsing for LLMs.

### Supported AI Agents

The following user agents are automatically detected:

* **OpenAI**: `GPTBot`, `OAI-SearchBot`, `ChatGPT-User`
* **Anthropic**: `anthropic-ai`, `ClaudeBot`, `claude-web`
* **Google**: `Google-Extended`, `GoogleAgent-Mariner`
* **Perplexity**: `PerplexityBot`, `Perplexity-User`
* **Mistral**: `MistralAI-User`
* **Cohere**: `cohere-ai`
* **Others**: `FacebookBot`, `meta-externalagent`, `Bytespider`, `AI2Bot`, and more

Search engine crawlers such as `Googlebot`, `Bingbot`, `Amazonbot`, and `Applebot` continue to receive rendered HTML so standard indexing behavior is preserved.

### Manual Markdown Access

Most pages can be accessed as Markdown by appending `.md` to the URL:

```
https://docs.example.com/getting-started.md
```

For the home page, use:

```
https://docs.example.com/index.md
```

This is useful for copying documentation into AI conversations or for custom integrations.

## Ask AI Component

Vocs includes a built-in "Ask AI" menu (`⌘I` / `Ctrl+I`) that provides:

* **Open in ChatGPT/Claude**: Opens the current page context in popular AI assistants
* **Copy page for AI**: Copies the page content as Markdown to your clipboard
* **View as Markdown**: Opens the raw Markdown version of the current page
* **Copy MCP URL**: Copies the MCP server URL (when MCP is enabled)

If needed, you can hide the menu for a page with `showAskAi: false` in frontmatter.

## MCP Server

Vocs includes a built-in [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that allows AI assistants to navigate your documentation and source code programmatically.

Enable it in your Vocs config:

```ts twoslash
import { defineConfig } from 'vocs/config'

export default defineConfig({
  mcp: {
    enabled: true,
  },
})
```

When enabled, the MCP endpoint is available at `/api/mcp`.

Most users will want to point their MCP client at a deployed URL such as:

```json
{
  "mcpServers": {
    "docs": {
      "url": "https://docs.example.com/api/mcp"
    }
  }
}
```

The dedicated [MCP Server](/guide/mcp-server) guide covers:

* The docs tools Vocs exposes by default
* How to connect local and deployed MCP clients
* How to expose GitHub repositories and custom source adapters
* Security, rate limit, and search behavior considerations

## Best Practices

### Optimize for LLMs

1. **Write descriptive titles**: Use clear, descriptive page titles that help LLMs understand content
2. **Add descriptions**: Include `description` in frontmatter for better llms.txt output
3. **Structure content**: Use headings, lists, and code blocks for easy parsing
4. **Keep pages focused**: Single-topic pages are easier for LLMs to retrieve and reference

### MCP Security

* The MCP server only exposes documentation content and configured source repositories
* Source code navigation is read-only
* Consider using authentication for private documentation
* Use `GITHUB_TOKEN` for higher API rate limits when using the GitHub adapter
