papermoon-mkdocs-mcp
Enables searching, reading, and navigating MkDocs documentation sites through MCP tools for keyword, semantic, or hybrid search, document browsing, and project metadata.
README
papermoon-mkdocs-mcp
A lightweight MCP server for MkDocs documentation sites. Reads markdown files directly from disk, provides full-text and optional semantic search, and exposes project structure through the Model Context Protocol.
Features
- 5 MCP tools -- search, read_document, list_documents, get_project_info, get_document_outline
- SQLite FTS5 keyword search with BM25 ranking (zero external dependencies)
- Optional semantic vector search via sentence-transformers
- Hybrid search combining keyword + vector results with Reciprocal Rank Fusion
- Incremental indexing -- fast updates when files change
- Persistent SQLite index that survives server restarts
- Navigation-aware -- parses
mkdocs.ymland.nav.yml - Security-first -- path traversal prevention, read-only search connections
- Minimal dependencies -- 3 required, 2 optional
Installation
pip install papermoon-mkdocs-mcp
To enable vector search:
pip install papermoon-mkdocs-mcp[vector]
Quick Start
Run from the root of any MkDocs project (where mkdocs.yml lives):
cd /path/to/your/mkdocs-project
papermoon-mkdocs-mcp
Or point to a specific config file:
papermoon-mkdocs-mcp --config /path/to/mkdocs.yml
The server auto-detects mkdocs.yml in the current directory when --config
is omitted.
Transport Options
By default the server uses stdio transport. You can switch to a network transport for remote or multi-client setups:
# Streamable HTTP (recommended for network access)
mkdocs-mcp --transport streamable-http --host 0.0.0.0 --port 9000
# SSE (legacy client compatibility)
mkdocs-mcp --transport sse --port 8080
| Flag | Default | Description |
|---|---|---|
--transport |
stdio |
stdio, sse, or streamable-http |
--host |
127.0.0.1 |
Bind address (network transports only) |
--port |
8000 |
Bind port (network transports only) |
Security note: When binding to a non-loopback address, place the server behind a reverse proxy (e.g. nginx, Caddy) that terminates TLS.
MCP Client Configuration
Claude Desktop
Add to your Claude Desktop configuration file:
{
"mcpServers": {
"mkdocs": {
"command": "papermoon-mkdocs-mcp",
"args": ["--config", "/path/to/mkdocs.yml"]
}
}
}
Note: If Claude Desktop can't find the command (Failed to spawn process: No such file or directory), use the full path to the executable instead of just mkdocs-mcp:
{
"mcpServers": {
"mkdocs": {
"command": "/path/to/.venv/bin/mkdocs-mcp",
"args": ["--config", "/path/to/mkdocs.yml"]
}
}
}
This is common when the package is installed in a virtual environment whose bin/ directory isn't in Claude Desktop's PATH.
Claude Code / VS Code
Add to .mcp.json in your project root:
{
"mcpServers": {
"mkdocs": {
"command": "papermoon-mkdocs-mcp",
"args": ["--config", "/path/to/mkdocs.yml"]
}
}
}
Available Tools
search
Search documentation using keyword, semantic, or hybrid search.
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
str | (required) | The search query string |
search_type |
str | "hybrid" |
"keyword", "vector", or "hybrid" |
max_results |
int | 10 |
Maximum results to return (1--100) |
Returns ranked results with path, title, relevance score (normalized 0.0--1.0), and text snippet.
read_document
Read a documentation file by its relative path.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
str | (required) | Relative path from docs dir (e.g. guide/setup.md) |
Returns the markdown body (frontmatter stripped), parsed frontmatter as a separate field, heading structure, and file metadata.
list_documents
List all documentation files, optionally filtered by section.
| Parameter | Type | Default | Description |
|---|---|---|---|
section |
str or null | null |
Directory prefix to filter by (e.g. guide) |
Returns document metadata (path, title, description, categories, size, mtime).
get_project_info
Get MkDocs project metadata. Takes no parameters.
Returns site name, site URL, docs directory, theme, navigation tree, document count, and index status.
get_document_outline
Get the heading structure (table of contents) for a document.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
str | (required) | Relative path from docs dir (e.g. guide/setup.md) |
Returns the document title and a list of headings with level, text, and anchor.
Architecture
src/mkdocs_mcp/
config.py -- MkDocs config detection and nav parsing
repository.py -- SQLite schema and CRUD operations
indexer.py -- Index orchestration with incremental updates
searcher.py -- Keyword, vector, and hybrid search
server.py -- FastMCP server with 5 tool definitions
utils.py -- Path validation, frontmatter parsing, text extraction
models.py -- Pydantic response models
At startup the server reads mkdocs.yml, scans the docs directory, and
builds (or incrementally updates) a SQLite FTS5 index. Search queries hit the
index directly; vector search embeds the query with all-MiniLM-L6-v2 and
compares against stored document embeddings. Hybrid mode fuses both result
lists using Reciprocal Rank Fusion.
Development
git clone https://github.com/aspect-build/mkdocs-mcp.git
cd mkdocs-mcp
pip install -e ".[dev]"
pytest
Linting and type checking:
ruff check .
mypy src/
Requirements
- Python >= 3.10
- Required: fastmcp (>=3.0, <4), pydantic (>=2.0, <3), pyyaml (>=6.0), markdown (>=3.4)
- Optional (vector search): sentence-transformers (>=3.0), numpy (>=1.24)
License
See LICENSE for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。