README.md.refactored•3.05 kB
# MkDocs MCP Search Server
A Model Context Protocol (MCP) server that provides search functionality for any [MkDocs](https://squidfunk.github.io/mkdocs-material/) powered site. This server relies on the existing MkDocs search implementation using the [Lunr.Js](https://lunrjs.com/) search engine.
## Claude Desktop Quickstart
To install and use this MCP server with Claude Desktop, please follow the [Model Context Protocol Quickstart For Claude Desktop users](https://modelcontextprotocol.io/quickstart/user#mac-os-linux). You will need to add a section to the MCP configuration file as follows:
```json
{
"mcpServers": {
"my-docs": {
"command": "npx",
"args": [
"-y",
"@serverless-dna/mkdocs-mcp",
"https://your-doc-site"
]
}
}
}
```
## Overview
This project implements an MCP server that enables Large Language Models (LLMs) to search through any published MkDocs documentation site. It uses lunr.js for efficient local search capabilities and provides results that can be summarized and presented to users.
## Features
- MCP-compliant server for integration with LLMs
- Local search using lunr.js indexes
- Version-specific documentation search capability
- Markdown conversion of documentation pages
## Installation
```bash
# Install dependencies
pnpm install
# Build the project
pnpm build
```
## Usage
The server can be run as an MCP server that communicates over stdio:
```bash
npx -y @serverless-dna/mkdocs-mcp https://your-doc-site.com
```
### Search Tool
The server provides a `search` tool with the following parameters:
- `search`: The search query string
- `version`: Optional version string (defaults to 'latest')
### Fetch Tool
The server provides a `fetch` tool with the following parameters:
- `url`: The URL of the documentation page to fetch
## Development
### Building
```bash
pnpm build
```
### Testing
```bash
pnpm test
```
### Claude Desktop MCP Configuration
During development you can run the MCP Server with Claude Desktop using the following configuration.
The configuration below shows running in Windows Claude desktop while developing using the Windows Subsystem for Linux (WSL). Mac or Linux environments you can run in a similar way.
The output is a bundled file which enables Node installed in Windows to run the MCP server since all dependencies are bundled.
```json
{
"mcpServers": {
"mkdocs": {
"command": "node",
"args": [
"\\\\wsl$\\Ubuntu\\home\\walmsles\\dev\\serverless-dna\\mkdocs-mcp\\dist\\index.js",
"https://your-doc-site.com"
]
}
}
}
```
## How It Works
1. The server loads pre-built lunr.js indexes for each supported version
2. When a search request is received, it:
- Loads the appropriate index based on version
- Performs the search using lunr.js
- Returns the search results as JSON
3. The LLM can then use these results to find relevant documentation pages
4. The fetch tool can be used to retrieve the full content of a documentation page
## License
MIT