loading…
Search for a command to run...
loading…
Enables MCP clients to access and read mdbook documentation, including structure, content, and search.
Enables MCP clients to access and read mdbook documentation, including structure, content, and search.
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.
SUMMARY.md and metadata from book.tomlYou can use npx to run the server without installing it globally:
npx mdbook-mcp-server
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 (where book.toml is located)MDBOOK_SERVER_NAME (optional): A friendly name for the server (defaults to "mdbook-mcp-server")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"
}
}
}
}
This server provides three tools:
list_structureGet 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
}
]
}
]
}
read_contentRead the content of a specific markdown file.
Parameters:
path (string, required): Relative path to the markdown file from the src/ directoryExample:
{
"path": "intro.md"
}
Returns:
{
"path": "intro.md",
"content": "# Introduction\n\nWelcome to...",
"metadata": {
"size": 1234,
"lastModified": "2025-11-10T12:34:56.789Z"
}
}
search_contentSearch 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:
book.toml and src/SUMMARY.mdMIT
Contributions are welcome! Please feel free to submit issues or pull requests.
Run in your terminal:
claude mcp add mdbook-mcp-server -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.