---
title: Add llms.txt and Markdown endpoints to Fumadocs
description: Reuse a Fumadocs content collection for llms.txt and per-page Markdown. Compare native AI routes with next-ai-ready and verify the page mapping.
canonical_url: https://nextaiready.com/en/docs/guides/fumadocs-ai-ready
url: https://nextaiready.com/en/docs/guides/fumadocs-ai-ready
last_updated: 2026-11-24
updated: 2026-11-24
author: next-ai-ready team
summary: Reuse a Fumadocs content collection for llms.txt and per-page Markdown. Compare native AI routes with next-ai-ready and verify the page mapping.
topics: [fumadocs, nextjs, llms.txt, mdx]
---

# Add llms.txt and Markdown endpoints to Fumadocs

[Fumadocs](https://www.fumadocs.dev/docs) provides the documentation UI, Source API, search, and
[native AI integrations](https://www.fumadocs.dev/docs/integrations/llms). You do not need
`next-ai-ready` just to expose documentation to AI clients.

Use this guide when you want the same source files to also feed next-ai-ready's semantic graph,
structured page outputs, or optional application actions. Keep Fumadocs responsible for the UI.

Not using Fumadocs? Start with the framework-neutral
[Next.js App Router llms.txt walkthrough](./nextjs-llms-txt).

This integration targets Fumadocs on Next.js App Router with a server deployment. It does not support
a fully static `output: "export"` build because the machine-facing route handlers run at request time.

## Choose native Fumadocs or next-ai-ready

For documentation-only retrieval, start with the official Fumadocs setup:

```bash
npx @fumadocs/cli feature llms
# Optional documentation search and retrieval over MCP:
npx @fumadocs/cli feature mcp
```

Those commands belong to Fumadocs, not this SDK. Check its documentation against your installed version.

| Need                                                                                             | Smallest useful setup                                                         |
| ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- |
| Only llms.txt, page Markdown, or documentation MCP                                               | Native Fumadocs; another SDK is not required.                                 |
| One semantic graph for docs and other local MDX collections, with .ai.json and curated discovery | Consider next-ai-ready alongside the existing UI.                             |
| Agents need to invoke application functions, not just retrieve docs                              | Evaluate the optional [Action and authorization model](./actions) separately. |

Markdown and documentation MCP are not exclusive next-ai-ready features. Neither integration
guarantees indexing, ranking, or AI citations.

Pick one owner for each public discovery URL. Do not combine this wrapper with existing native
`/llms.txt`, Markdown rewrites, negotiation middleware, or `/api/mcp` without reviewing which handler
will serve each request. The steps below assume next-ai-ready owns the machine-facing routes.

The [tool-selection section](./nextjs-llms-txt#compare-the-tools-before-installing) compares these
responsibilities with native Next.js, Next SEO, and Nextra before adding another integration.

## 1. Install and initialize

From the Fumadocs Next.js application directory:

```bash
pnpm add next-ai-ready
pnpm exec next-ai-ready init
```

Keep `source.config.ts`, the generated Fumadocs source module, page layouts, and search routes intact.
The initializer adds separate AI-facing handlers and configuration. Default `init` is Knowledge-only;
it does not install MCP or callable actions. Review existing configuration rather than overwriting it.

## 2. Reuse the Fumadocs content collection

Find the directory of your existing [Fumadocs MDX collection](https://www.fumadocs.dev/docs/mdx)
in its collection definition, such as the `dir` in `source.config.ts`. Point next-ai-ready's
`content` glob at the original Markdown and MDX files in that directory. For a collection under
`content/docs`, use the following configuration:

```js
import { defineConfig } from "next-ai-ready"

export default defineConfig({
  site: {
    name: "Acme Docs",
    baseUrl: "https://docs.example.com",
    description: "Documentation for Acme developers.",
  },
  content: ["content/docs/**/*.{md,mdx}"],
})
```

If the collection lives under `src/content/docs`, change the glob to
`src/content/docs/**/*.{md,mdx}`. Existing `title`, `description`, `date`, and `author` frontmatter
are reused. Add `updatedAt` only when the date is maintained.

This is file-based reuse, not a Fumadocs Source API adapter. The SDK does not run Fumadocs-specific
plugins or reproduce its processed Markdown. Check custom MDX components and generated content
before choosing a second pipeline. After building, compare a page in `public/llms.txt` to the
URL Fumadocs serves. For example, `content/docs/getting-started.mdx` maps to `/docs/getting-started`
with the default setup. If Fumadocs uses a different `baseUrl` or custom slug, use a
[content source adapter](./mdx-content) to match the routes.

## 3. Wrap the Next.js config

For Fumadocs MDX, preserve the [existing createMDX plugin](https://www.fumadocs.dev/docs/mdx/next)
and wrap its resulting configuration in `next.config.mjs`:

```js
import { createMDX } from "fumadocs-mdx/next"
import { withAiReady } from "next-ai-ready/config"

const withMDX = createMDX()
const nextConfig = {
  // Existing Fumadocs and Next.js options stay here.
}

export default withAiReady({ agentReadable: true })(withMDX(nextConfig))
```

If another plugin already wraps the config, apply `withAiReady()` to that plugin's final result.
Retain your existing `createMDX` options. This is a configuration example, not a claim that a
complete Fumadocs application or your custom plugins have passed a production compatibility test.

## 4. Build and verify

```bash
pnpm exec next-ai-ready build
pnpm exec next-ai-ready doctor --score
pnpm build
```

After deployment:

```bash
curl -i https://docs.example.com/llms.txt
curl -i https://docs.example.com/docs/getting-started.md
curl -i -H 'Accept: text/markdown' https://docs.example.com/docs/getting-started
curl -i -H 'Accept: text/html' https://docs.example.com/docs/getting-started
pnpm exec next-ai-ready audit https://docs.example.com/docs/getting-started --version 3
```

Replace the example domain and route with a real, public page. Confirm that `/llms.txt` lists its
canonical HTML URL, both Markdown requests return `text/markdown` and the intended title and body,
and the HTML request retains the Fumadocs UI. A `200` recovery document containing
`document_status: "not_found"` is not a successful page retrieval. Check the canonical `Link` header
as well as the body; a HEAD-only check cannot prove that the correct content was served.

For a runnable first-party reference, inspect the
[Next.js production walkthrough and smoke assertions](./nextjs-llms-txt#inspect-the-implementation-evidence).
That site is not a Fumadocs compatibility fixture or an external customer case. Fumadocs-specific
production evidence remains a separate validation task.

## Keep search responsibilities separate

Keep Fumadocs UI search intact. Both [Fumadocs native MCP](https://www.fumadocs.dev/docs/headless/utils/mcp)
and next-ai-ready can serve documentation
retrieval; adding a second search index is a maintenance choice, not a prerequisite for AI access.
An application Action is a different boundary: review authorization and deployment behavior before
enabling it, rather than treating every documentation request as a callable business operation.
