Documentation MCP Server

Documentation MCP Server

Enables AI assistants to navigate and query hierarchical documentation structures, supporting markdown files with YAML metadata and OpenAPI 3.x specifications. It features intelligent full-text search, metadata filtering, and a built-in web interface for both human and AI-driven documentation access.

Category
访问服务器

README

Documentation MCP Server

A Model Context Protocol (MCP) server that enables AI assistants to navigate and query documentation through hierarchical structures, supporting markdown files with YAML frontmatter and OpenAPI 3.x specifications.

Features

  • Hierarchical Navigation: Navigate documentation organized in nested directory structures with unlimited depth
  • Markdown Support: Parse markdown files with YAML frontmatter metadata (title, tags, category, order)
  • OpenAPI Integration: Load and query OpenAPI 3.x specifications as documentation resources
  • Intelligent Search: Full-text search with metadata filtering and hierarchical context
  • Web Interface: Built-in web server provides browser-based access to documentation with the same tools available to LLMs
  • Cross-Platform: Works with Claude Desktop, VS Code/GitHub Copilot, and other MCP-compatible AI assistants
  • Security: Built-in path validation, query sanitization, and audit logging
  • Performance: Caching with TTL and automatic file change detection

Quick Start

Installation

# Install from PyPI
pip install your-docs-mcp

# Or install from source
git clone https://github.com/esola-thomas/Markdown-MCP
cd Markdown-MCP
pip install -e .

Basic Configuration

  1. Set your documentation root directory:
export DOCS_ROOT=/path/to/your/docs
  1. Start the MCP server:
your-docs-mcp

Claude Desktop Configuration

Add to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "docs": {
      "command": "your-docs-mcp",
      "env": {
        "DOCS_ROOT": "/absolute/path/to/your/docs"
      }
    }
  }
}

VS Code Configuration

Create .vscode/mcp.json in your workspace:

{
  "servers": {
    "docs": {
      "command": "your-docs-mcp",
      "env": {
        "DOCS_ROOT": "${workspaceFolder}/docs"
      }
    }
  }
}

Try the Example

This repository includes a complete example documentation structure in the example/ folder that you can use to test the MCP server or as a template for your own documentation.

Quick test:

# Point DOCS_ROOT to the example folder
export DOCS_ROOT=/path/to/Markdown-MCP/example

# Start the server
your-docs-mcp

The example includes:

  • Hierarchical documentation structure with nested categories
  • Markdown files with proper YAML frontmatter
  • Sample API documentation and guides
  • OpenAPI 3.0 specification example
  • Comprehensive README explaining the structure

See the example/README.md for detailed information about the structure and how to customize it for your project.

Web Interface

The Markdown MCP server includes a built-in web interface that allows users to browse and search documentation directly in their browser, using the same tools available to AI assistants.

Accessing the Web Interface

When you start the server, it automatically launches both the MCP server (for AI assistants) and a web server (for browser access):

export DOCS_ROOT=/path/to/your/docs
your-docs-mcp

By default, the web interface is available at: http://127.0.0.1:8123

Open this URL in your browser to access the documentation interface.

Features

The web interface provides:

  • Search Documentation: Full-text search with relevance scoring and highlighted excerpts
  • Table of Contents: Browse the complete documentation hierarchy
  • Tag-based Search: Filter documentation by metadata tags
  • Document Viewer: View full document content with formatting
  • Real-time Stats: See the number of loaded documents and categories

Configuration

You can customize the web server settings using environment variables:

# Enable/disable web server (default: true)
export MCP_DOCS_ENABLE_WEB_SERVER=true

# Web server host (default: 127.0.0.1)
export MCP_DOCS_WEB_HOST=127.0.0.1

# Web server port (default: 8123)
export MCP_DOCS_WEB_PORT=8123

API Endpoints

The web interface also exposes REST API endpoints that you can use programmatically:

  • GET /api/health - Health check and statistics
  • GET|POST /api/search - Search documentation
  • GET|POST /api/navigate - Navigate to specific URIs
  • GET|POST /api/toc - Get table of contents
  • POST /api/search-by-tags - Search by tags
  • GET|POST /api/document - Get document content

Example API usage:

# Search for documentation
curl "http://localhost:8123/api/search?query=authentication"

# Get a specific document
curl "http://localhost:8123/api/document?uri=docs://guides/quickstart/installation"

# Get table of contents
curl "http://localhost:8123/api/toc"

Usage Examples

Ask Your AI Assistant

Once configured, you can ask your AI assistant natural language questions:

  • "Show me the getting started guide"
  • "List all available documentation"
  • "What authentication methods are available?"
  • "Show me all API endpoints for user management"
  • "Search for documentation about deployment"

Supported Document Formats

Markdown Files (.md, .mdx):

---
title: Getting Started
tags: [guide, quickstart]
category: guides
order: 1
---

# Getting Started

Your documentation content here...

OpenAPI Specifications (.yaml, .json):

openapi: 3.0.3
info:
  title: My API
  version: 1.0.0
paths:
  /users:
    get:
      operationId: listUsers
      summary: List all users
      ...

Advanced Configuration

Multi-Source Setup

Create .mcp-docs.yaml in your project:

sources:
  - path: ./docs
    category: guides
    label: User Guides
    recursive: true

  - path: ./api-specs
    category: api
    label: API Reference
    format_type: openapi

cache:
  ttl: 3600
  max_memory_mb: 500

security:
  allow_hidden_files: false
  audit_logging: true

Environment Variables

See .env.example for all available configuration options:

  • DOCS_ROOT: Documentation root directory (required)
  • MCP_DOCS_CACHE_TTL: Cache TTL in seconds (default: 3600)
  • MCP_DOCS_OPENAPI_SPECS: Comma-separated OpenAPI spec paths
  • MCP_DOCS_SEARCH_LIMIT: Maximum search results (default: 10)
  • MCP_DOCS_ENABLE_WEB_SERVER: Enable/disable web server (default: true)
  • MCP_DOCS_WEB_HOST: Web server host (default: 127.0.0.1)
  • MCP_DOCS_WEB_PORT: Web server port (default: 8123)
  • LOG_LEVEL: Logging level (default: INFO)

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/esola-thomas/Markdown-MCP
cd Markdown-MCP

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run type checking
mypy docs_mcp

# Run linting
ruff check docs_mcp

Running Tests

# Run all tests
pytest

# Run specific test categories
pytest -m unit
pytest -m integration
pytest -m contract

# Run with coverage
pytest --cov=docs_mcp --cov-report=html

Architecture

docs_mcp/
├── models/          # Data models (Document, Category, OpenAPI entities)
├── handlers/        # MCP protocol handlers (tools, resources)
├── services/        # Business logic (markdown parsing, search, hierarchy)
├── security/        # Security validation (path validation, sanitization)
└── utils/           # Utilities (logging, helpers)

Security

  • Path Validation: All file paths are validated to prevent directory traversal attacks
  • Hidden Files: Hidden files (starting with .) are excluded by default
  • Query Sanitization: Search queries are sanitized to prevent injection attacks
  • Audit Logging: All file access attempts are logged for security auditing

Contributing

Contributions are welcome! Please see the contribution guidelines for more information.

License

MIT License - see LICENSE file for details

Links

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选