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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.