MkDocs Search logo

MkDocs Search

Organization
serverless-dna

A Model Context Protocol (MCP) server that provides search functionality for any MkDocs powered site. This server relies on the existing MkDocs search implementation using the Lunr.Js search engine.

Publisherserverless-dna
Repositorymkdocs-mcp
LanguageTypeScript
Forks
5
Stars
21
Available tools
2
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    MkDocs Search exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 2 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    21 stars and 5 forks from the linked repository.

MkDocs MCP Search Server

A Model Context Protocol (MCP) server that provides search functionality for any MkDocs powered site. This server relies on the existing MkDocs search implementation using the Lunr.Js search engine.

Claude Desktop Quickstart

Follow the installation instructions please follow the Model Context Protocol Quickstart For Claude Desktop users. You will need to add a section tothe MCP configuration file as follows:

json
{
  "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"
      ]
    }
  }
}

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
  • MkDocs Material HTML to Markdown conversion with structured JSON responses
  • Code example extraction with language detection and context
  • Tab view support for multi-language documentation
  • Mermaid diagram preservation
  • Automatic URL resolution (relative to absolute)
  • Intelligent caching for both search indexes and converted documentation

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

Available Tools

Search Tool

The server provides a searchMkDoc tool with the following parameters:

  • search: The search query string
  • version: Optional version string (only for versioned sites)

Sample Response:

json
{
  "query": "logger",
  "version": "latest",
  "total": 3,
  "results": [
    {
      "title": "Logger",
      "url": "https://docs.example.com/latest/core/logger/",
      "score": 1.2,
      "preview": "Logger utility for structured logging...",
      "location": "core/logger/"
    },
    {
      "title": "Configuration",
      "url": "https://docs.example.com/latest/core/logger/#config",
      "score": 0.8,
      "preview": "Configure the logger with custom settings...",
      "location": "core/logger/#config",
      "parentArticle": {
        "title": "Logger",
        "location": "core/logger/",
        "url": "https://docs.example.com/latest/core/logger/"
      }
    }
  ]
}

Features:

  • Confidence-based filtering (configurable threshold)
  • Advanced scoring with title matching and boosting
  • Parent article context for section results
  • Limited to top results (configurable, default: 10)

Fetch Documentation Tool

The server provides a fetchMkDoc tool that retrieves and converts documentation pages:

  • url: The URL of the documentation page to fetch

Sample Response:

json
{
  "title": "Getting Started",
  "markdown": "# Getting Started\n\nThis guide will help you...\n\n## Installation\n\n```bash\nnpm install example\n```",
  "code_examples": [
    {
      "title": "Installation",
      "description": "Install the package using npm",
      "code": "```bash\nnpm install example\n```"
    },
    {
      "title": "Basic Usage",
      "description": "Import and initialize the library",
      "code": "```python\nfrom example import Client\nclient = Client()\n```"
    }
  ],
  "url": "https://docs.example.com/getting-started/"
}

Configuration

The server can be configured using environment variables:

  • SEARCH_CONFIDENCE_THRESHOLD: Minimum confidence score for search results (default: 0.1)
  • SEARCH_MAX_RESULTS: Maximum number of search results to return (default: 10)
  • CACHE_BASE_PATH: Base directory for cache storage (default: <system-tmp>/mkdocs-mcp-cache)

Example:

bash
SEARCH_MAX_RESULTS=20 SEARCH_CONFIDENCE_THRESHOLD=0.2 npx @serverless-dna/mkdocs-mcp https://your-doc-site.com

Cache Location: By default, the server caches search indexes and converted documentation in the system's temporary directory:

  • macOS/Linux: /tmp/mkdocs-mcp-cache (or $TMPDIR)
  • Windows: %TEMP%\mkdocs-mcp-cache

You can override this with the CACHE_BASE_PATH environment variable.

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": {
    "powertools": {
	"command": "node",
	"args": [
	  "\\\\wsl$\\Ubuntu\\home\\walmsles\\dev\\serverless-dna\\mkdocs-mcp\\dist\\index.js",
    "Search online documentation"
	]
    }
  }
}

How It Works

Search Functionality

  1. The server loads pre-built lunr.js indexes for each supported runtime
  2. When a search request is received, it:
    • Loads the appropriate index based on version (currently fixed to latest)
    • 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

Documentation Fetching

  1. When a fetch request is received with a URL:
    • Fetches the HTML content (with caching)
    • Parses the MkDocs Material HTML structure using Cheerio
    • Removes navigation, headers, footers, and other UI elements
    • Processes tab views into sequential sections
    • Extracts code blocks with language detection and context
    • Resolves all relative URLs to absolute URLs
    • Converts the cleaned HTML to markdown
    • Returns a structured JSON response with title, markdown, and code examples
  2. Results are cached to improve performance on subsequent requests

License

MIT

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "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"
      ]
    }
  }
}

Available Tools

  • searchMkDoc

    Search MkDocs documentation for Describe what you are enabling search for to help your AI Agent. Results are filtered by confidence threshold for relevance.

  • fetchMkDoc

    Fetch MkDocs page content. Fetches and converts documentation pages to markdown format.

Use MkDocs Search MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MkDocs Search is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MkDocs Search as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MkDocs Search MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "mkdocs-search": {
      "command": "npx",
      "args": [
        "-y",
        "@serverless-dna/mkdocs-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MkDocs Search MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MkDocs Search MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MkDocs Search to help me with this task?
MkDocs Search
Sure. I read it.
Here is what I found using MkDocs Search.

Frequently asked questions

What is the MkDocs Search MCP server used for?

MkDocs Search is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MkDocs Search MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MkDocs Search with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MkDocs Search MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MkDocs Search connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MkDocs Search MCP to TypingMind?

MkDocs Search runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does MkDocs Search MCP provide in TypingMind?

MkDocs Search exposes 2 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MkDocs Search MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MkDocs Search requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇