BookStack MCP Server
Provides tools for managing BookStack content, including creating, reading, updating, and deleting pages, books, and shelves, as well as searching across all content types.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@BookStack MCP Server search for 'MCP protocol' in all content"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
š BookStack MCP Server
A professional-grade Model Context Protocol (MCP) server that seamlessly bridges AI assistants with BookStack knowledge management systems. Transform your documentation workflows with intelligent automation.
Created by Derron Knox | Showcasing enterprise-level software architecture and best practices
š Overview
This TypeScript-based MCP server provides a robust, production-ready interface for AI assistants to interact with BookStack instances. Designed with enterprise scalability, security, and maintainability in mind, it demonstrates advanced software engineering principles and modern development practices.
⨠Key Features
š”ļø Enterprise Security: Token-based authentication with secure credential management
šļø Modular Architecture: Clean separation of concerns with TypeScript interfaces
š Comprehensive CRUD Operations: Full lifecycle management of BookStack content
š³ Container-Ready: Production-optimized Docker setup with multi-stage builds
ā” High Performance: Optimized API calls with proper error handling and timeouts
š Type Safety: Full TypeScript implementation with strict type checking
š Smart Search: Advanced content discovery and filtering capabilities
š Intelligent Resolution: Name-to-ID resolution for user-friendly operations
Related MCP server: BookStack MCP Server
š ļø Available Tools
Page Management
create_page- Create new pages with HTML/Markdown contentget_page_content- Retrieve page content by ID or nameupdate_page- Modify existing pages (content, location, metadata)delete_page- Remove pages from BookStack
Content Discovery
search_items- Search across shelves, books, chapters, and pageslist_books- Enumerate books with filtering and paginationlist_shelves- Browse shelf collections with advanced options
Book Management
read_book- Get details of a specific book by ID or namecreate_book- Create a new bookupdate_book- Modify existing books (content, metadata)delete_book- Remove books from BookStack
Advanced Features
Flexible Targeting: Use either IDs or names for all operations
Context-Aware Resolution: Automatic name-to-ID conversion
Hierarchical Navigation: Support for book/chapter/page relationships
Metadata Management: Tags, priorities, and organizational features
šāāļø Quick Start
Prerequisites
Node.js 20+
Docker & Docker Compose (for containerized deployment)
BookStack instance with API access
BookStack API tokens (Token ID & Secret)
1. Environment Setup
# Clone and configure
git clone <repository-url>
cd bookstack/
cp .env.example .env
# Configure your BookStack credentials
cat > .env << EOF
BOOKSTACK_URL="https://your-bookstack-instance.com"
BOOKSTACK_API_TOKEN_ID="your_token_id_here"
BOOKSTACK_API_TOKEN_SECRET="your_token_secret_here"
EOF2. Installation Options
Option A: Docker Deployment (Recommended)
# Production-ready containerized deployment
docker-compose up --build -d
# Monitor logs
docker-compose logs -f bookstack-mcp-serverOption B: Local Development
# Install dependencies
npm install
# Development with hot reload
npm run watch
# Production build
npm run build
npm start3. Integration with Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"bookstack-mcp-server": {
"command": "node",
"args": ["/path/to/bookstack/build/index.js"],
"env": {
"BOOKSTACK_URL": "https://your-bookstack-instance.com",
"BOOKSTACK_API_TOKEN_ID": "your_token_id",
"BOOKSTACK_API_TOKEN_SECRET": "your_token_secret"
}
}
}
}šļø Architecture & Best Practices
Project Structure
bookstack/
āāā src/
ā āāā types.ts # TypeScript interface definitions
ā āāā utils/
ā ā āāā validation.ts # Input validation & sanitization
ā ā āāā api.ts # API utilities & helper functions
ā āāā tools/
ā ā āāā definitions.ts # Tool schema definitions
ā ā āāā handlers.ts # Business logic implementations
ā āāā index.ts # Main server & orchestration
āāā build/ # Compiled JavaScript output
āāā Dockerfile # Multi-stage container build
āāā docker-compose.yml # Production deployment config
āāā package.json # Dependencies & scriptsEngineering Principles Demonstrated
šÆ Clean Architecture
Separation of Concerns: Distinct layers for validation, business logic, and API interaction
Dependency Injection: Modular design with clear interfaces
Single Responsibility: Each module has one well-defined purpose
š Security First
Environment Variable Management: Secure credential handling
Input Validation: Comprehensive argument sanitization
Error Boundaries: Proper exception handling without information leakage
š Production Readiness
Container Optimization: Multi-stage Docker builds for minimal image size
Health Checks: Built-in container health monitoring
Graceful Shutdown: Proper signal handling for clean termination
Comprehensive Logging: Structured error reporting and debugging
š Code Quality
TypeScript Strict Mode: Full type safety with comprehensive interfaces
Modular Design: Reusable components with clear APIs
Error Handling: Robust exception management with user-friendly messages
š§ Configuration Options
Environment Variables
Variable | Description | Required | Example |
| BookStack instance URL | ā |
|
| API Token ID from BookStack | ā |
|
| API Token Secret from BookStack | ā |
|
Docker Configuration
Health Checks: 30-second intervals with 3 retry attempts
Log Rotation: 10MB max file size, 5 file retention
Security: Non-root user execution
Resource Optimization: Multi-stage builds for production efficiency
š Usage Examples
Creating Content
// Create a page in a specific book
await createPage({
name: "API Documentation",
markdown: "# API Guide\n\nComprehensive API documentation...",
book_name: "Development Guides",
tags: [
{ name: "category", value: "api" },
{ name: "priority", value: "high" }
]
});Content Discovery
// Search across all content types
await searchItems({
query: "kubernetes deployment",
count: 20
});
// Find pages by context
await getPageContent({
page_name: "Deployment Guide",
book_name: "Infrastructure Documentation"
});Content Management
// Update page with new content
await updatePage({
page_name: "Getting Started",
book_name: "User Manual",
markdown: "# Updated Getting Started Guide\n...",
tags: [{ name: "status", value: "updated" }]
});š Deployment Options
Production Deployment
Docker Swarm
# Scale across multiple nodes
docker stack deploy -c docker-compose.yml bookstack-mcpKubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: bookstack-mcp-server
spec:
replicas: 3
selector:
matchLabels:
app: bookstack-mcp-server
template:
metadata:
labels:
app: bookstack-mcp-server
spec:
containers:
- name: bookstack-mcp-server
image: bookstack-mcp-server:latest
env:
- name: BOOKSTACK_URL
valueFrom:
secretKeyRef:
name: bookstack-credentials
key: urlDevelopment Workflow
# Development with auto-reload
npm run watch
# Type checking
npx tsc --noEmit
# Debug with MCP Inspector
npm run inspectorš Debugging & Troubleshooting
MCP Inspector
# Launch debugging interface
npm run inspector
# Access via browser at provided URLCommon Issues
Connection Problems
# Verify BookStack accessibility
curl -H "Authorization: Token $BOOKSTACK_API_TOKEN_ID:$BOOKSTACK_API_TOKEN_SECRET" \
"$BOOKSTACK_URL/api/books"Container Issues
# Check container health
docker-compose ps
docker-compose logs bookstack-mcp-server
# Restart with fresh build
docker-compose down && docker-compose up --buildš Dependencies
Production Dependencies
@modelcontextprotocol/sdk: ^0.6.0 - MCP protocol implementation
axios: ^1.9.0 - HTTP client for BookStack API
Development Dependencies
typescript: ^5.3.3 - Type-safe JavaScript development
@types/node: ^20.11.24 - Node.js type definitions
System Requirements
Node.js: 20+ (LTS recommended)
Memory: 256MB minimum, 512MB recommended
Storage: 100MB for application, additional for logs
šÆ Professional Showcase
This project demonstrates expertise in:
Backend Development
RESTful API integration and design
Microservices architecture patterns
Error handling and resilience patterns
DevOps & Infrastructure
Containerization with Docker
Production deployment strategies
Configuration management
Health monitoring and observability
Software Engineering
Clean code principles
Design patterns (Strategy, Factory, Dependency Injection)
Test-driven development mindset
Documentation and maintainability
Modern JavaScript/TypeScript
Advanced TypeScript features
Async/await patterns
ES2022+ modern syntax
Node.js best practices
š¤ Contributing
This project welcomes contributions! Areas for enhancement:
Unit test coverage expansion
Additional BookStack API endpoints
Performance optimizations
Enhanced error recovery
š Contact
Derron Knox - Software Engineer & Solutions Architect
This project exemplifies enterprise-grade software development practices, demonstrating proficiency in modern web technologies, cloud-native development, and scalable system architecture.
Available Tools
24 toolscreate_bookB
Create a new book in BookStack.
Inputs: name (required), description, description_html, tags, +2 more.
create_chapterC
Create a new chapter in BookStack.
Inputs: name (required), book_id, book_name, description, +4 more.
create_pageC
Create a new page in BookStack.
Inputs: name (required), html, markdown, book_id, +5 more.
create_shelfC
Create a new shelf in BookStack.
Inputs: name (required), description, description_html, books, +2 more.
delete_bookB
Delete a book from BookStack.
Inputs: book_id, name.
delete_chapterC
Delete a chapter from BookStack.
Inputs: chapter_id, name, book_id_context, book_name_context.
delete_pageC
Delete a page.
Inputs: page_id, page_name, book_id_context, book_name_context.
delete_shelfB
Delete a shelf from BookStack.
Inputs: shelf_id, name.
export_chapter_htmlB
Export a chapter as a contained HTML file.
Inputs: chapter_id, name, book_id_context, book_name_context.
export_chapter_markdownB
Export a chapter as a markdown file.
Inputs: chapter_id, name, book_id_context, book_name_context.
export_chapter_pdfC
Export a chapter as a PDF file.
Inputs: chapter_id, name, book_id_context, book_name_context.
export_chapter_plaintextB
Export a chapter as a plain text file.
Inputs: chapter_id, name, book_id_context, book_name_context.
get_page_contentC
Get the content of a specific page.
Inputs: page_id, page_name, book_id, book_name.
list_booksC
List all books.
Inputs: count, offset, sort, filter.
list_chaptersC
List all chapters.
Inputs: count, offset, sort, filter.
list_shelvesB
List all shelves.
Inputs: count, offset, sort, filter.
read_bookB
Get details of a specific book by ID or name.
Inputs: book_id, name.
read_chapterB
Get details of a specific chapter by ID or name.
Inputs: chapter_id, name, book_id_context, book_name_context.
read_shelfA
Get details of a specific shelf by ID or name.
Inputs: shelf_id, name.
search_itemsA
Search for items (shelves, books, chapters, pages) in BookStack.
Inputs: query (required), page, count.
update_bookB
Update an existing book in BookStack.
Inputs: book_id, name, description, description_html, +3 more.
update_chapterC
Update an existing chapter in BookStack.
Inputs: chapter_id, name, book_id_context, book_name_context, +6 more.
update_pageC
Update an existing page.
Inputs: page_id, page_name, book_id_context, book_name_context, +7 more.
update_shelfC
Update an existing shelf in BookStack.
Inputs: shelf_id, name, description, description_html, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 24 tools
Each tool has a clear, distinct purpose targeting a specific resource (book, chapter, page, shelf) and action (create, delete, read, update, export, etc.). No two tools appear to perform the same function, making selection unambiguous for an agent.
All tool names follow a consistent verb_noun pattern (e.g., create_book, list_books, export_chapter_pdf) using lowercase and underscores. The pattern is predictable across the entire set, aiding agent comprehension.
With 24 tools, the count is on the high side for a documentation server. While it covers multiple resource types and operations, the absence of a list_pages tool suggests some redundancy or incompleteness that could be streamlined.
The server provides CRUD for shelves, books, and chapters, but pages lack a list_pages tool (only get_page_content exists) and export options are limited to chapters only. These gaps may require agents to work around missing operations.
Maintenance
Related MCP Connectors
Find, write, publish and check pages and API references in your DeveloperHub docs from an AI client
Read and write KukGit repositories, files, issues and pull requests from an AI assistant.
Publish, list, update and delete shareable Markdown/HTML pages from your AI assistant.
Governed, auditable knowledge your team curates for its AI assistants, self-hostable
Related MCP Servers
- AlicenseBqualityAmaintenanceEnables interaction with BookStack knowledge management systems through the BookStack API. Supports searching, reading, creating, and updating documentation content with secure authentication and dual transport modes for flexible deployment.17512 npm53MIT
- AlicenseBqualityDmaintenanceEnables AI models to interact with BookStack wiki instances through a comprehensive API interface. Supports content management (books, chapters, pages), user administration, search functionality, and content export in multiple formats.4113 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage BookStack documentation through natural language, supporting content browsing, search, and CRUD operations for books, chapters, and pages.-
- AlicenseBqualityBmaintenanceConnects BookStack knowledge bases to Claude through 47+ tools covering complete CRUD operations for books, pages, chapters, shelves, users, search, attachments, and permissions. Enables full management of BookStack content and configuration through natural language.56394 npm104MIT