Home / MCP / MkDocs MCP Search Server

MkDocs MCP Search Server

Provides local search over MkDocs sites using Lunr.js for LLM-enabled exploration and retrieval.

typescript
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "mkdocs_mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@serverless-dna/mkdocs-mcp",
                "https://your-doc-site",
                "Describe what you are enabling search for to help your AI Agent"
            ]
        }
    }
}

You can run a dedicated MCP server that lets large language models search through your MkDocs-powered site using a Lunr.js index. This server returns structured, searchable results and can fetch and convert documentation pages into Markdown for easy presentation to users.

How to use

You use an MCP client to start and interact with the MkDocs MCP server. Start the server with your MkDocs site URL, then issue search requests to retrieve relevant pages, with optional versioning for multi-version docs. The server returns results with titles, URLs, previews, and context to help you present documentation summaries to end users.

To begin, install the project dependencies, build, and run the MCP server. The server runs as an MCP server over standard I/O, so you can connect it directly to your LLM workflow.

How to install

Prerequisites: you need Node and a package manager. You will also need an internet connection to install dependencies and fetch your MkDocs site.

pnpm install
```

```bash
pnpm build

Configuration and usage notes

The server supports runtime configuration via environment variables. Key options include the maximum number of results and the minimum confidence score required for a result. You can also customize where the server caches data.

You can start the server for a given MkDocs site using an explicit command, which runs the MCP server as a local process that communicates over standard input/output.

The following configuration example shows how you enable search for a MkDocs site from a client.

{
  "mcpServers": {
    "my-docs": {
      "command": "npx",
      "args": [
        "-y",
        "@serverless-dna/mkdocs-mcp",
        "https://your-doc-site",
        "Describe what you are enabling search for to help your AI Agent"
      ]
    }
  }
}

Notes on behavior and features

The server uses lunr.js to index content locally, supports versioned documentation searches, converts MkDocs Material HTML to Markdown, and preserves diagrams and code examples. It also resolves relative URLs to absolute ones and caches results for faster subsequent requests.

Available tools

searchMkDoc

Search tool that queries the MkDocs site index and returns results with titles, URLs, previews, and optional parent article context. Supports optional versioning to target specific site versions.

fetchMkDoc

Fetch documentation pages by URL and convert MkDocs Material HTML into structured JSON with Markdown content and extracted code examples.