mkdocs-mcp-plugin


Namemkdocs-mcp-plugin JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryMCP server for MkDocs documentation with intelligent search and retrieval capabilities
upload_time2025-08-07 07:06:27
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT
keywords ai documentation mcp mkdocs rag search
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.yml` or `mkdocs.yaml` in your project
- Launches 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:

```bash
# Install and run in one command
uvx mkdocs-mcp-plugin

# Or install globally
uv tool install mkdocs-mcp-plugin

# Then run from any MkDocs project
mkdocs-mcp
```

### Using pip

```bash
# Install from source
pip install git+https://github.com/douinc/mkdocs-mcp-plugin.git

# Or clone and install locally
git clone https://github.com/douinc/mkdocs-mcp-plugin.git
cd mkdocs-mcp-plugin
pip install -e .
```

### Development Installation

```bash
git clone https://github.com/douinc/mkdocs-mcp-plugin.git
cd mkdocs-mcp-plugin

# Install with UV (recommended)
uv sync --all-extras

# Or with pip
pip install -e ".[dev]"
```

## Usage

### Basic Usage

Navigate to any directory containing a `mkdocs.yml` file and run:

```bash
mkdocs-mcp
```

The server will:
1. Detect your MkDocs configuration
2. Start the MkDocs development server (default: http://localhost:8000)
3. Launch the MCP server for agent interaction
4. Index your documentation for search

### Configuration

The server automatically adapts to your MkDocs configuration:

```yaml
# mkdocs.yml
site_name: My Documentation
docs_dir: docs  # Custom docs directory
site_url: https://mydocs.example.com
theme:
  name: material
plugins:
  - search
```

### 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:

```python
{
  "file_path": "getting-started.md",
  "docs_dir": "docs"  # Optional, auto-detected
}
```

#### `list_documents`
Get a list of all available documentation:

```python
{
  "docs_dir": "docs"  # Optional, auto-detected
}
```

### Search Operations

#### `search` (Hybrid Search)
Combines keyword and semantic search:

```python
{
  "query": "authentication setup",
  "search_type": "hybrid",  # "keyword", "vector", or "hybrid"
  "max_results": 10
}
```

#### `keyword_search`
Fast text-based search:

```python
{
  "query": "configuration options",
  "max_results": 10
}
```

#### `vector_search`
Semantic similarity search:

```python
{
  "query": "how to deploy",
  "max_results": 10
}
```

### Utility Tools

#### `get_mkdocs_info`
Get information about the current MkDocs project:

```python
{}  # No parameters required
```

#### `restart_mkdocs_server`
Restart the MkDocs development server:

```python
{
  "port": 8001  # Optional, defaults to 8000
}
```

#### `rebuild_search_index`
Rebuild the search index:

```python
{
  "docs_dir": "docs"  # Optional, auto-detected
}
```

## MCP Resources

### `mkdocs://documents`
Access to document metadata and structure:

```json
{
  "document_count": 25,
  "docs_dir": "/path/to/docs",
  "documents": [
    {
      "path": "index.md",
      "title": "Welcome",
      "size": 1024
    }
  ]
}
```

## MCP Prompts

### `mkdocs-rag-search`
Generate intelligent search queries for documentation:

```python
{
  "topic": "authentication"  # Search topic
}
```

## Advanced Features

### Vector Search Dependencies

For semantic search capabilities, ensure these packages are installed:

```bash
# Included in default installation
pip install sentence-transformers scikit-learn numpy
```

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 path
- `title`: 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:

```json
{
  "success": true,
  "query": "your search query",
  "result_count": 5,
  "results": [
    {
      "path": "docs/api/authentication.md",
      "title": "Authentication Guide",
      "score": 0.95,
      "snippet": "...highlighted excerpt...",
      "search_methods": ["keyword", "vector"]
    }
  ]
}
```

## Integration Examples

### Claude Code Configuration

Add to your Claude Code config:

```json
{
  "mcpServers": {
    "mkdocs-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/douinc/mkdocs-mcp-plugin",
        "--with",
        "mkdocs-material",
        "--with",
        "mkdocs-git-revision-date-localized-plugin",
        "--with",
        "mkdocs-minify-plugin",
        "--with",
        "mkdocs-mermaid2-plugin",
        "--with",
        "mkdocs-print-site-plugin",
        "mkdocs-mcp"
      ],
      "env": {
        "MKDOCS_PORT": "8000"
      }
    }
  }
}
```

## 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

1. **MkDocs server not starting**:
   ```bash
   # Check if MkDocs is installed
   mkdocs --version
   
   # Install if missing
   pip install mkdocs
   ```

2. **Vector search not working**:
   ```bash
   # Install optional dependencies
   pip install sentence-transformers
   ```

3. **Permission errors**:
   ```bash
   # Check file permissions
   ls -la mkdocs.yml
   ```

### Debug Mode

Run with verbose output:

```bash
# Set environment variable for debug output
MKDOCS_DEBUG=1 mkdocs-mcp
```

## Contributing

1. Fork the repository
2. Create a feature branch: `git checkout -b feature-name`
3. Make your changes
4. Run tests: `uv run pytest`
5. Format code: `uv run black . && uv run ruff check --fix .`
6. Submit a pull request

### Development Setup

```bash
git clone https://github.com/douinc/mkdocs-mcp-plugin.git
cd mkdocs-mcp-plugin

# Install with all dependencies
uv sync --all-extras

# Run tests
uv run pytest

# Run linting
uv run ruff check
uv run black --check .
```

## License

MIT License - see [LICENSE](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](https://github.com/douinc/mkdocs-mcp-plugin#readme)
- 🐛 [Issue Tracker](https://github.com/douinc/mkdocs-mcp-plugin/issues)
- 💡 [Feature Requests](https://github.com/douinc/mkdocs-mcp-plugin/discussions)

---

Built with ❤️ by [dou inc.](https://github.com/douinc)
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mkdocs-mcp-plugin",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "ai, documentation, mcp, mkdocs, rag, search",
    "author": null,
    "author_email": "Dongook Son <d@dou.so>",
    "download_url": "https://files.pythonhosted.org/packages/a3/cb/5240d8bdca27b1836080d745eb8a5201c61002892eb53b9b9490403b5422/mkdocs_mcp_plugin-0.3.0.tar.gz",
    "platform": null,
    "description": "# MkDocs MCP Plugin \ud83d\udd0d\n\nA 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.\n\n## Features\n\n### \ud83d\ude80 Auto-Detection & Integration\n- Automatically detects `mkdocs.yml` or `mkdocs.yaml` in your project\n- Launches MkDocs development server alongside the MCP server\n- Seamless integration with existing MkDocs workflows\n\n### \ud83d\udd0e Advanced Search Capabilities\n- **Keyword Search**: Fast, accurate text-based search using Whoosh indexing\n- **Vector Search**: Semantic search using sentence transformers (`all-MiniLM-L6-v2`)\n- **Hybrid Search**: Combines both keyword and semantic search for optimal results\n- **Real-time Indexing**: Automatically indexes markdown files with full-text search\n\n### \ud83d\udcc4 Document Operations\n- Read individual markdown files with metadata extraction\n- List all available documentation with titles and paths\n- Extract headings, titles, and content structure\n- Support for nested directory structures\n\n### \ud83e\udd16 MCP Protocol Compliance\n- Full MCP server implementation using FastMCP\n- Tools, resources, and prompts for agent interaction\n- Structured responses with comprehensive error handling\n- Support for concurrent agent connections\n\n## Installation\n\n### Using UV/UVX (Recommended)\n\nInstall and run directly with uvx:\n\n```bash\n# Install and run in one command\nuvx mkdocs-mcp-plugin\n\n# Or install globally\nuv tool install mkdocs-mcp-plugin\n\n# Then run from any MkDocs project\nmkdocs-mcp\n```\n\n### Using pip\n\n```bash\n# Install from source\npip install git+https://github.com/douinc/mkdocs-mcp-plugin.git\n\n# Or clone and install locally\ngit clone https://github.com/douinc/mkdocs-mcp-plugin.git\ncd mkdocs-mcp-plugin\npip install -e .\n```\n\n### Development Installation\n\n```bash\ngit clone https://github.com/douinc/mkdocs-mcp-plugin.git\ncd mkdocs-mcp-plugin\n\n# Install with UV (recommended)\nuv sync --all-extras\n\n# Or with pip\npip install -e \".[dev]\"\n```\n\n## Usage\n\n### Basic Usage\n\nNavigate to any directory containing a `mkdocs.yml` file and run:\n\n```bash\nmkdocs-mcp\n```\n\nThe server will:\n1. Detect your MkDocs configuration\n2. Start the MkDocs development server (default: http://localhost:8000)\n3. Launch the MCP server for agent interaction\n4. Index your documentation for search\n\n### Configuration\n\nThe server automatically adapts to your MkDocs configuration:\n\n```yaml\n# mkdocs.yml\nsite_name: My Documentation\ndocs_dir: docs  # Custom docs directory\nsite_url: https://mydocs.example.com\ntheme:\n  name: material\nplugins:\n  - search\n```\n\n### Environment Variables\n\n- `MKDOCS_PORT`: Port for the MkDocs server (default: 8000)\n- `MCP_PORT`: Port for the MCP server (auto-selected)\n\n## MCP Tools\n\n### Document Operations\n\n#### `read_document`\nRead a specific markdown file with metadata:\n\n```python\n{\n  \"file_path\": \"getting-started.md\",\n  \"docs_dir\": \"docs\"  # Optional, auto-detected\n}\n```\n\n#### `list_documents`\nGet a list of all available documentation:\n\n```python\n{\n  \"docs_dir\": \"docs\"  # Optional, auto-detected\n}\n```\n\n### Search Operations\n\n#### `search` (Hybrid Search)\nCombines keyword and semantic search:\n\n```python\n{\n  \"query\": \"authentication setup\",\n  \"search_type\": \"hybrid\",  # \"keyword\", \"vector\", or \"hybrid\"\n  \"max_results\": 10\n}\n```\n\n#### `keyword_search`\nFast text-based search:\n\n```python\n{\n  \"query\": \"configuration options\",\n  \"max_results\": 10\n}\n```\n\n#### `vector_search`\nSemantic similarity search:\n\n```python\n{\n  \"query\": \"how to deploy\",\n  \"max_results\": 10\n}\n```\n\n### Utility Tools\n\n#### `get_mkdocs_info`\nGet information about the current MkDocs project:\n\n```python\n{}  # No parameters required\n```\n\n#### `restart_mkdocs_server`\nRestart the MkDocs development server:\n\n```python\n{\n  \"port\": 8001  # Optional, defaults to 8000\n}\n```\n\n#### `rebuild_search_index`\nRebuild the search index:\n\n```python\n{\n  \"docs_dir\": \"docs\"  # Optional, auto-detected\n}\n```\n\n## MCP Resources\n\n### `mkdocs://documents`\nAccess to document metadata and structure:\n\n```json\n{\n  \"document_count\": 25,\n  \"docs_dir\": \"/path/to/docs\",\n  \"documents\": [\n    {\n      \"path\": \"index.md\",\n      \"title\": \"Welcome\",\n      \"size\": 1024\n    }\n  ]\n}\n```\n\n## MCP Prompts\n\n### `mkdocs-rag-search`\nGenerate intelligent search queries for documentation:\n\n```python\n{\n  \"topic\": \"authentication\"  # Search topic\n}\n```\n\n## Advanced Features\n\n### Vector Search Dependencies\n\nFor semantic search capabilities, ensure these packages are installed:\n\n```bash\n# Included in default installation\npip install sentence-transformers scikit-learn numpy\n```\n\nIf these packages are not available, the server will fall back to keyword-only search.\n\n### Custom Index Configuration\n\nThe server uses Whoosh for indexing with the following schema:\n- `path`: Document file path\n- `title`: Document title (from first H1 or filename)\n- `content`: Full text content (markdown converted to plain text)\n- `headings`: All heading text for structural search\n\n### Search Result Structure\n\nAll search operations return results in this format:\n\n```json\n{\n  \"success\": true,\n  \"query\": \"your search query\",\n  \"result_count\": 5,\n  \"results\": [\n    {\n      \"path\": \"docs/api/authentication.md\",\n      \"title\": \"Authentication Guide\",\n      \"score\": 0.95,\n      \"snippet\": \"...highlighted excerpt...\",\n      \"search_methods\": [\"keyword\", \"vector\"]\n    }\n  ]\n}\n```\n\n## Integration Examples\n\n### Claude Code Configuration\n\nAdd to your Claude Code config:\n\n```json\n{\n  \"mcpServers\": {\n    \"mkdocs-mcp\": {\n      \"command\": \"uvx\",\n      \"args\": [\n        \"--from\",\n        \"git+https://github.com/douinc/mkdocs-mcp-plugin\",\n        \"--with\",\n        \"mkdocs-material\",\n        \"--with\",\n        \"mkdocs-git-revision-date-localized-plugin\",\n        \"--with\",\n        \"mkdocs-minify-plugin\",\n        \"--with\",\n        \"mkdocs-mermaid2-plugin\",\n        \"--with\",\n        \"mkdocs-print-site-plugin\",\n        \"mkdocs-mcp\"\n      ],\n      \"env\": {\n        \"MKDOCS_PORT\": \"8000\"\n      }\n    }\n  }\n}\n```\n\n## Error Handling\n\nThe server provides comprehensive error handling:\n\n- **Missing MkDocs**: Graceful fallback to MCP-only mode\n- **Invalid configurations**: Clear error messages with suggestions\n- **Search failures**: Automatic fallback between search methods\n- **File access errors**: Detailed error reporting with context\n\n## Troubleshooting\n\n### Common Issues\n\n1. **MkDocs server not starting**:\n   ```bash\n   # Check if MkDocs is installed\n   mkdocs --version\n   \n   # Install if missing\n   pip install mkdocs\n   ```\n\n2. **Vector search not working**:\n   ```bash\n   # Install optional dependencies\n   pip install sentence-transformers\n   ```\n\n3. **Permission errors**:\n   ```bash\n   # Check file permissions\n   ls -la mkdocs.yml\n   ```\n\n### Debug Mode\n\nRun with verbose output:\n\n```bash\n# Set environment variable for debug output\nMKDOCS_DEBUG=1 mkdocs-mcp\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature-name`\n3. Make your changes\n4. Run tests: `uv run pytest`\n5. Format code: `uv run black . && uv run ruff check --fix .`\n6. Submit a pull request\n\n### Development Setup\n\n```bash\ngit clone https://github.com/douinc/mkdocs-mcp-plugin.git\ncd mkdocs-mcp-plugin\n\n# Install with all dependencies\nuv sync --all-extras\n\n# Run tests\nuv run pytest\n\n# Run linting\nuv run ruff check\nuv run black --check .\n```\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Changelog\n\n### v0.1.0\n- Initial release\n- MkDocs auto-detection and server integration\n- Hybrid search with keyword and vector capabilities\n- Full MCP protocol compliance\n- UV/UVX support\n\n## Support\n\n- \ud83d\udcda [Documentation](https://github.com/douinc/mkdocs-mcp-plugin#readme)\n- \ud83d\udc1b [Issue Tracker](https://github.com/douinc/mkdocs-mcp-plugin/issues)\n- \ud83d\udca1 [Feature Requests](https://github.com/douinc/mkdocs-mcp-plugin/discussions)\n\n---\n\nBuilt with \u2764\ufe0f by [dou inc.](https://github.com/douinc)",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "MCP server for MkDocs documentation with intelligent search and retrieval capabilities",
    "version": "0.3.0",
    "project_urls": {
        "Documentation": "https://github.com/dongookson/mkdocs-mcp-plugin#readme",
        "Homepage": "https://github.com/dongookson/mkdocs-mcp-plugin",
        "Issues": "https://github.com/dongookson/mkdocs-mcp-plugin/issues",
        "Repository": "https://github.com/dongookson/mkdocs-mcp-plugin.git"
    },
    "split_keywords": [
        "ai",
        " documentation",
        " mcp",
        " mkdocs",
        " rag",
        " search"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ec2beb91c46cc16b7a3a15d1ff5fa75d524c266fee701261cdd054ea4791ff7c",
                "md5": "87c7a0f9bdc87df407205e60f744e72d",
                "sha256": "9530589d3045d30ff3106dc36ee1840c9de9e4796a7881d3072a9634dcd03730"
            },
            "downloads": -1,
            "filename": "mkdocs_mcp_plugin-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "87c7a0f9bdc87df407205e60f744e72d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 175694,
            "upload_time": "2025-08-07T07:06:26",
            "upload_time_iso_8601": "2025-08-07T07:06:26.024196Z",
            "url": "https://files.pythonhosted.org/packages/ec/2b/eb91c46cc16b7a3a15d1ff5fa75d524c266fee701261cdd054ea4791ff7c/mkdocs_mcp_plugin-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a3cb5240d8bdca27b1836080d745eb8a5201c61002892eb53b9b9490403b5422",
                "md5": "0e9acd5b798ba290bc2fe767b0e4d230",
                "sha256": "658cd955ec4785c5e141ca0ac03f15d02314cac7d753034b3821d4837f0ccc4f"
            },
            "downloads": -1,
            "filename": "mkdocs_mcp_plugin-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0e9acd5b798ba290bc2fe767b0e4d230",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 161676,
            "upload_time": "2025-08-07T07:06:27",
            "upload_time_iso_8601": "2025-08-07T07:06:27.554983Z",
            "url": "https://files.pythonhosted.org/packages/a3/cb/5240d8bdca27b1836080d745eb8a5201c61002892eb53b9b9490403b5422/mkdocs_mcp_plugin-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-07 07:06:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dongookson",
    "github_project": "mkdocs-mcp-plugin#readme",
    "github_not_found": true,
    "lcname": "mkdocs-mcp-plugin"
}
        
Elapsed time: 3.20002s