mdbook-mcp-server
Enables MCP clients to access and read mdbook documentation, including structure, content, and search.
README
mdbook-mcp-server
A generic MCP (Model Context Protocol) server for mdbook projects. This server allows Claude Code and other MCP clients to access and read mdbook documentation programmatically.
Features
- 📖 Read mdbook structure: Get the table of contents from
SUMMARY.mdand metadata frombook.toml - 📄 Read content: Access individual markdown files within the mdbook project
- 🔒 Secure: Path traversal protection ensures files can only be accessed within the mdbook root
- 🚀 Generic: Works with any mdbook project, not just specific ones
- ⚡ Simple: Minimal configuration required - just set an environment variable
- 📦 Easy to install: Available via npm, no complex setup needed
Installation
You can use npx to run the server without installing it globally:
npx mdbook-mcp-server
Usage
With Claude Code
Add the following configuration to your Claude Code config file (~/.config/claude/config.json):
{
"mcpServers": {
"my-mdbook": {
"command": "npx",
"args": ["mdbook-mcp-server"],
"env": {
"MDBOOK_ROOT_PATH": "/absolute/path/to/your/mdbook/project",
"MDBOOK_SERVER_NAME": "my_mdbook"
}
}
}
}
Environment Variables:
MDBOOK_ROOT_PATH(required): Absolute path to your mdbook project root (wherebook.tomlis located)MDBOOK_SERVER_NAME(optional): A friendly name for the server (defaults to "mdbook-mcp-server")
Multiple mdbook Projects
You can run multiple instances of the server for different mdbook projects:
{
"mcpServers": {
"mdbook-project-a": {
"command": "npx",
"args": ["mdbook-mcp-server"],
"env": {
"MDBOOK_ROOT_PATH": "/path/to/project-a",
"MDBOOK_SERVER_NAME": "project_a"
}
},
"mdbook-project-b": {
"command": "npx",
"args": ["mdbook-mcp-server"],
"env": {
"MDBOOK_ROOT_PATH": "/path/to/project-b",
"MDBOOK_SERVER_NAME": "project_b"
}
}
}
}
MCP Tools
This server provides three tools:
1. list_structure
Get the complete structure of the mdbook project, including metadata and table of contents.
Parameters: None
Returns:
{
"title": "My Book",
"authors": ["Author Name"],
"language": "en",
"src": "src",
"chapters": [
{
"title": "Introduction",
"path": "intro.md",
"level": 0
},
{
"title": "Chapter 1",
"path": "chapter1.md",
"level": 0,
"children": [
{
"title": "Section 1.1",
"path": "chapter1/section1.md",
"level": 1
}
]
}
]
}
2. read_content
Read the content of a specific markdown file.
Parameters:
path(string, required): Relative path to the markdown file from thesrc/directory
Example:
{
"path": "intro.md"
}
Returns:
{
"path": "intro.md",
"content": "# Introduction\n\nWelcome to...",
"metadata": {
"size": 1234,
"lastModified": "2025-11-10T12:34:56.789Z"
}
}
3. search_content
Search for content within the mdbook project using fuzzy search. Supports both English and Japanese keywords.
Parameters:
query(string, required): Search querymaxResults(number, optional): Maximum number of results to return (default: 10, max: 100)
Example:
{
"query": "authentication",
"maxResults": 5
}
Returns:
{
"query": "authentication",
"totalMatches": 3,
"results": [
{
"path": "auth/intro.md",
"title": "Authentication",
"score": 0.001,
"matchCount": 2,
"matches": [
{
"snippet": "...user authentication is important...",
"position": 123
},
{
"snippet": "...authentication methods include...",
"position": 456
}
]
}
]
}
Features:
- Fuzzy search: Handles typos and spelling variations
- Japanese support: Works with hiragana, katakana, and kanji
- Smart scoring: Results are ranked by relevance (lower score = better match)
- Context snippets: Shows surrounding text for each match
Requirements
- Node.js >= 24.0.0
- A valid mdbook project with
book.tomlandsrc/SUMMARY.md
License
MIT
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Links
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。