Provides intelligent search, retrieval, and document operations for MkDocs documentation projects, including keyword search, semantic vector search, and hybrid search capabilities across markdown files.
MkDocs MCP Plugin ๐
A comprehensive MCP (Model Context Protocol) server for MkDocs documentation that provides intelligent search, retrieval, and integration capabilities for AI agents. This plugin automatically detects MkDocs projects, launches the development server, and provides powerful tools for querying documentation.
Features
๐ Auto-Detection & Integration
Automatically detects
mkdocs.ymlormkdocs.yamlin your projectLaunches MkDocs development server alongside the MCP server
Seamless integration with existing MkDocs workflows
๐ Advanced Search Capabilities
Keyword Search: Fast, accurate text-based search using Whoosh indexing
Vector Search: Semantic search using sentence transformers (
all-MiniLM-L6-v2)Hybrid Search: Combines both keyword and semantic search for optimal results
Real-time Indexing: Automatically indexes markdown files with full-text search
๐ Document Operations
Read individual markdown files with metadata extraction
List all available documentation with titles and paths
Extract headings, titles, and content structure
Support for nested directory structures
๐ค MCP Protocol Compliance
Full MCP server implementation using FastMCP
Tools, resources, and prompts for agent interaction
Structured responses with comprehensive error handling
Support for concurrent agent connections
Installation
Using UV/UVX (Recommended)
Install and run directly with uvx:
Using pip
Development Installation
Usage
Basic Usage
Navigate to any directory containing a mkdocs.yml file and run:
The server will:
Detect your MkDocs configuration
Start the MkDocs development server (default: http://localhost:8000)
Launch the MCP server for agent interaction
Index your documentation for search
Configuration
The server automatically adapts to your MkDocs configuration:
Environment Variables
MKDOCS_PORT: Port for the MkDocs server (default: 8000)MCP_PORT: Port for the MCP server (auto-selected)
MCP Tools
Document Operations
read_document
Read a specific markdown file with metadata:
list_documents
Get a list of all available documentation:
Search Operations
search (Hybrid Search)
Combines keyword and semantic search:
keyword_search
Fast text-based search:
vector_search
Semantic similarity search:
Utility Tools
get_mkdocs_info
Get information about the current MkDocs project:
restart_mkdocs_server
Restart the MkDocs development server:
rebuild_search_index
Rebuild the search index:
MCP Resources
mkdocs://documents
Access to document metadata and structure:
MCP Prompts
mkdocs-rag-search
Generate intelligent search queries for documentation:
Advanced Features
Vector Search Dependencies
For semantic search capabilities, ensure these packages are installed:
If these packages are not available, the server will fall back to keyword-only search.
Custom Index Configuration
The server uses Whoosh for indexing with the following schema:
path: Document file pathtitle: Document title (from first H1 or filename)content: Full text content (markdown converted to plain text)headings: All heading text for structural search
Search Result Structure
All search operations return results in this format:
Integration Examples
Claude Code Configuration
Add to your Claude Code config:
Error Handling
The server provides comprehensive error handling:
Missing MkDocs: Graceful fallback to MCP-only mode
Invalid configurations: Clear error messages with suggestions
Search failures: Automatic fallback between search methods
File access errors: Detailed error reporting with context
Troubleshooting
Common Issues
MkDocs server not starting:
# Check if MkDocs is installed mkdocs --version # Install if missing pip install mkdocsVector search not working:
# Install optional dependencies pip install sentence-transformersPermission errors:
# Check file permissions ls -la mkdocs.yml
Debug Mode
Run with verbose output:
Contributing
Fork the repository
Create a feature branch:
git checkout -b feature-nameMake your changes
Run tests:
uv run pytestFormat code:
uv run black . && uv run ruff check --fix .Submit a pull request
Development Setup
License
MIT License - see LICENSE file for details.
Changelog
v0.1.0
Initial release
MkDocs auto-detection and server integration
Hybrid search with keyword and vector capabilities
Full MCP protocol compliance
UV/UVX support
Support
๐ Documentation
๐ Issue Tracker
๐ก Feature Requests
Built with โค๏ธ by dou inc.