BookStack MCP Server
The BookStack MCP Server connects BookStack knowledge bases to AI assistants via the Model Context Protocol, providing complete CRUD access to all BookStack content and features through 47+ tools.
📚 Books – List, create, read, update, delete, and export in HTML, PDF, plain text, or Markdown
📄 Pages – Full CRUD with HTML or Markdown content; move pages between books/chapters; export in multiple formats
📑 Chapters – Full CRUD; organize pages within books; export content
📚 Shelves – Full CRUD; group books into collections
👥 Users – Manage accounts, roles, passwords, external auth IDs, and migrate content ownership on deletion
🔐 Roles – Full CRUD; configure permissions, MFA enforcement, and display names
🔍 Search – Advanced search across all content types using BookStack's search syntax (phrases, field filters, tags, boolean operators)
📎 Attachments – Manage file attachments or external URL links on pages (with base64 encoding support)
🖼️ Images – List, upload, update, and delete images in the gallery
🔒 Permissions – Read and update granular access control for books, chapters, pages, and shelves by user or role
🗑️ Recycle Bin – List, restore, or permanently delete items
📊 Audit Log – Browse and filter system activity by event type, user, date range, and entity
⚙️ System Info – Retrieve instance health and server information
🤖 LLM Helpers – Access tool categories, workflow examples, error guides, and an interactive help system for AI assistants
The server supports both HTTP (stateless with per-request auth override) and Stdio transport modes, and includes rate limiting, validation, and error handling for production use.
Provides complete access to BookStack knowledge base with 47+ tools covering all API endpoints, including CRUD operations for books, pages, chapters, shelves, user management, search, attachments, permissions, recycle bin, audit logs, and content export in multiple formats.
Click on "Install 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 Servercreate a new page in the 'API Documentation' book with the title 'Getting Started'"
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
Connect BookStack to Claude and other AI assistants through the Model Context Protocol (MCP). This server exposes 56 tools and 11 resources covering the supported subset of the BookStack API — books, pages, chapters, shelves, search, users, roles, permissions, attachments, images, the recycle bin, the audit log and system info.
This server supports two transport modes: Streamable HTTP (default) and Stdio.
Streamable HTTP (default): A stateless HTTP transport. Authentication parameters can be overridden per-request using HTTP headers (
x-bookstack-urlandx-bookstack-token).Stdio Mode: Standard input/output for local integration (e.g., with Claude Desktop). Set
MCP_TRANSPORT=stdioto enable.
⚠️ Looking for the HTTP endpoint? The MCP endpoint is
POST /message— not/. See Transports and HTTP endpoints below.
✨ What You Get
BookStack Integration - Access your books, pages, chapters, and content
56 MCP Tools & 11 Resources - CRUD, search and export across the supported endpoint families
Search & Export - Find content and export in multiple formats
User Management - Handle users, roles, and permissions
Production Ready - Rate limiting, validation, error handling, and logging
Related MCP server: BookStack MCP Server
🚀 Quick Start
⚠️ Requires Bun 1.1.0 or newer. Node.js is not supported. This package ships TypeScript source rather than a compiled bundle, and its executable starts with
#!/usr/bin/env bun— Bun must be installed on the machine that runs it.npx/npm install -gwill not work.
Configure first — the default HTTP transport refuses to start until both tokens below are set:
# 1. Configure
export BOOKSTACK_BASE_URL="https://your-bookstack.com/api"
export BOOKSTACK_API_TOKEN="token_id:token_secret" # OUTBOUND: the credential this server spends
export MCP_AUTH_TOKEN="$(openssl rand -hex 32)" # INBOUND: who may make it spend that credential
# 2. Run without installing (starts the HTTP server on port 3000)
bunx bookstack-mcp-server
# Or install globally, then run it by name
bun add -g bookstack-mcp-server
bookstack-mcp-serverThe two tokens are not interchangeable and must not be set to the same value:
BOOKSTACK_API_TOKEN is what the server presents to BookStack; MCP_AUTH_TOKEN is
what callers must present to POST /message, which dispatches all 56 tools with the
authority of the BookStack account behind BOOKSTACK_API_TOKEN. Skip MCP_AUTH_TOKEN
only for stdio, which has no network surface and ignores it.
Check it started:
curl http://localhost:3000/ # => {"status":"running", ...}
curl -i http://localhost:3000/health # => 200 healthy, or 503 if BookStack is unreachableAdd to Claude
To use with Claude Desktop (requires Stdio mode):
# For Claude Code
claude mcp add bookstack bunx bookstack-mcp-server \
--env BOOKSTACK_BASE_URL=https://your-bookstack.com/api \
--env BOOKSTACK_API_TOKEN=token_id:token_secret \
--env MCP_TRANSPORT=stdioConfiguration
Set these environment variables:
export BOOKSTACK_BASE_URL="https://your-bookstack.com/api"
export BOOKSTACK_API_TOKEN="token_id:token_secret"
# Required for the HTTP transport (the default); ignored by stdio.
export MCP_AUTH_TOKEN="$(openssl rand -hex 32)"
# Optional: transport mode — "http" (default) or "stdio"
export MCP_TRANSPORT="http"💡 Token Format: Combine your BookStack Token ID and Token Secret as
token_id:token_secret
Environment variables
Variable | Default | Description |
|
| Transport mode. Only the exact value |
| (none — required for HTTP) | Inbound secret callers must present as |
|
| Full URL to the BookStack API. Must be a valid URL and include the |
| (none — required) | Outbound BookStack API token as |
|
| BookStack request timeout in milliseconds. |
|
| Port the HTTP transport listens on. Ignored in stdio mode. |
|
| Maximum accepted |
|
| Server name reported over MCP and by |
| the package's own version | Version reported over MCP |
|
| Outbound rate limit toward BookStack. |
|
| Outbound burst allowance toward BookStack. |
|
| Input validation. Set to |
|
| Reject invalid tool params at the boundary. Set to |
|
| One of |
|
| One of |
|
| One of |
|
| Set to |
💡 Need detailed setup? See the complete Setup Guide
🔌 Transports
The transport is chosen at startup from MCP_TRANSPORT:
| Result |
unset (default) | Streamable HTTP server on |
| Same as unset |
| Stdio transport — reads MCP messages from stdin |
Stdio is opt-in. If you do not set MCP_TRANSPORT=stdio, you get the HTTP server.
HTTP endpoints
When running in HTTP mode the server exposes exactly three endpoints. Any other
path returns a JSON 404 listing the valid ones.
Method & path | Purpose | Status codes |
| Server info JSON (name, version, |
|
| Health check — verifies live connectivity to BookStack |
|
| The MCP endpoint. Send JSON-RPC MCP messages here |
|
GET / and GET /health are unauthenticated. POST /message requires an inbound
Authorization: Bearer <secret> header — it dispatches every tool, including
permanent-delete and user/role operations, so the HTTP transport refuses to start
without a secret configured. The startup error names the exact variable to set; the
stdio transport has no network surface and needs none.
Check the server is up:
curl http://localhost:3000/{
"name": "bookstack-mcp-server",
"version": "1.0.0",
"status": "running",
"mcp": true,
"endpoints": {
"health": "/health",
"message": "/message (POST, requires an Authorization: Bearer header)"
},
"documentation": "Send MCP protocol messages to POST /message"
}Check health:
curl -i http://localhost:3000/health/health verifies live connectivity to BookStack, so a wrong token returns 503
with the failing check named:
{
"status": "unhealthy",
"checks": [
{ "name": "bookstack_connection", "healthy": false, "message": "BookStack API connection" },
{ "name": "tools_loaded", "healthy": true, "message": "56 tools loaded" },
{ "name": "resources_loaded", "healthy": true, "message": "11 resources loaded" }
]
}⚠️ A missing
BOOKSTACK_API_TOKENbehaves differently: config validation rejects an empty token at startup, so the process exits withConfiguration validation failed: bookstack.apiToken: BookStack API token is requiredbefore Express ever listens. There is no/healthto call —curlgets a connection refused, and under Docker the container restart-loops. A503therefore always means the token is present but not working; a dead port means it is absent.
Call the MCP endpoint — an initialize handshake. Both the Content-Type
and Accept headers are required by the Streamable HTTP transport, and
Authorization carries the same MCP_AUTH_TOKEN you exported in the quick start:
# Fail fast rather than sending an empty bearer header and puzzling over a 401.
: "${MCP_AUTH_TOKEN:?export MCP_AUTH_TOKEN first — the inbound secret this server was started with}"
curl -X POST http://localhost:3000/message \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer $MCP_AUTH_TOKEN" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": { "name": "curl", "version": "1.0.0" }
}
}'Per-request credential overrides are supported on POST /message via the
x-bookstack-url and x-bookstack-token headers; both fall back to the
BOOKSTACK_BASE_URL / BOOKSTACK_API_TOKEN environment variables.
Using with n8n
Point n8n's MCP client at the /message path — not the root URL:
http://<host>:3000/messageUse the host as n8n sees it: http://localhost:3000/message when n8n runs on
the same machine, or the container/service name (e.g. http://mcp:3000/message)
when both run in Docker on a shared network.
Running stdio in Docker
A stdio MCP server reads requests from stdin — so docker run without -i
gives it no stdin, stdin hits EOF immediately, and the container exits on
startup. Pass -i to keep stdin attached:
docker run -i --rm \
-e MCP_TRANSPORT=stdio \
-e BOOKSTACK_BASE_URL=https://your-bookstack.com/api \
-e BOOKSTACK_API_TOKEN=token_id:token_secret \
bookstack-mcp-serverUse -i alone, not -it: allocating a TTY breaks the JSON-RPC stream that
MCP clients pipe over stdin/stdout. For stdio you also don't need -p 3000:3000
— nothing listens on a port in stdio mode.
If your container "starts then dies immediately" with
MCP_TRANSPORT=stdio, a missing-iis almost always the cause.
🛠️ Available Tools
56 tools across 13 categories:
📚 Books (6) - Create, read, update, delete, and export books
📄 Pages (6) - Manage pages with HTML/Markdown content
📑 Chapters (6) - Organize pages within books
📚 Shelves (5) - Group books into collections
🔍 Search (1) - Search across content types
👥 Users (5) - User account management
🎭 Roles (5) - Roles and their permissions
⚙️ System (2) - Instance info and the audit log
🔐 Permissions (2) - Content access control
🗑️ Recycle Bin (3) - Deleted item recovery
📎 Attachments (5) - File attachments
🖼️ Images (5) - Image gallery
🧭 Meta (5) - Ask the server about its own tools and conventions
Not exposed (no tools): comments, imports, tag-name listings, the image-gallery
data endpoints, and zip export.
📖 See the complete Tools Overview for detailed documentation
📚 Documentation
Find comprehensive guides in the docs/ folder:
Setup Guide - Complete installation and configuration
API Reference - Supported tools/endpoints with examples
Tools Overview - Every tool explained
Resources Guide - Resource access patterns
Examples & Workflows - Real-world usage
Integration Testing - Running the live suite against a real BookStack
Releasing - How versions are cut and published
⚡ Quick Examples
List all books:
bookstack_books_list({ count: 10, sort: "updated_at" })Create a new page:
bookstack_pages_create({
name: "Getting Started",
book_id: 1,
markdown: "# Welcome\nYour content here..."
})Search for content:
bookstack_search({ query: "API documentation", count: 20 })🛠️ Development
This project is Bun-native — Bun runs the TypeScript source directly, so there is no compile step.
git clone <repository-url>
cd bookstack-mcp-server
bun install
bun run dev # hot reload; equivalent to: bun --watch src/server.tsbun run src/server.ts # start the server
bun test # run tests
bun run typecheck # tsc --noEmit
bun run lint # biome check .🔧 See the Setup Guide for development, Docker, and production deployment
🐳 Local testing with Docker Compose
The included docker-compose.yml spins up a full local stack — MariaDB, a real
BookStack instance, and this MCP server (built from the Bun Dockerfile).
Start the backing services:
docker compose up -d db bookstackWait for BookStack to finish first-boot migrations, then open http://localhost:6875. Default linuxserver credentials:
Email:
admin@admin.comPassword:
password
Create an API token in the UI (Edit Profile → API Tokens → Create Token). Combine the Token ID and Token Secret as
token_id:token_secretand put it in a.envfile next todocker-compose.yml, together with an inbound secret of your own:echo "BOOKSTACK_API_TOKEN=token_id:token_secret" > .env echo "MCP_AUTH_TOKEN=$(openssl rand -hex 32)" >> .envThe token can only be created after BookStack is running, so it cannot be baked into the image — this manual step is required once.
Both entries are required.
docker-compose.ymlpassesMCP_AUTH_TOKENthrough to themcpservice, and the HTTP transport refuses to start without it, so a.envcarrying onlyBOOKSTACK_API_TOKENleaves the container in a restart loop.Start the MCP server (it reads both tokens from
.env):docker compose up -d mcpCheck health — returns
200with{"status":"healthy"}once the server can reach BookStack with your token:curl http://localhost:3000/health
Until a valid BOOKSTACK_API_TOKEN is supplied the mcp container reports
unhealthy, because /health verifies live connectivity to BookStack. If either token is
missing entirely the container does not get that far and restart-loops instead of
answering 503 — check docker compose logs mcp for Configuration validation failed
(no BOOKSTACK_API_TOKEN) or MCP_AUTH_TOKEN is not set (no inbound secret).
The compose file pins BookStack to lscr.io/linuxserver/bookstack:version-v26.05.2 — the
release this repo's tool contract was verified against — and ships a throwaway dev
APP_KEY. Generate your own for anything beyond local testing, using the same pinned tag:
docker run --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:version-v26.05.2 appkeyIt prints one base64:… line to paste into APP_KEY. The --entrypoint override is
required: without it the image runs its normal init first, which halts with
The application key is missing, halting init! — the very key you are trying to
generate — and never reaches the appkey script.
📝 License
MIT License - see LICENSE file for details.
🌟 Community
This project is part of the BookStack ecosystem! Check out other API-based tools and scripts in the BookStack API Scripts repository.
🆘 Support
📚 Documentation: Complete guides in the docs/ folder
🐛 Issues: GitHub Issues
💬 Discussions: GitHub Discussions
Built with ❤️ for the BookStack community
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- 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.Last updated4128MIT
- Flicense-qualityDmaintenanceEnables AI assistants to manage BookStack documentation through natural language, supporting content browsing, search, and CRUD operations for books, chapters, and pages.Last updated
- FlicenseCqualityDmaintenanceEnables searching and retrieving content from BookStack knowledge bases via the BookStack API. It provides structured page data with clean HTML-to-text conversion for seamless integration with AI models.Last updated19
- Alicense-qualityFmaintenanceProvides comprehensive tools for managing BookStack instances, including full CRUD operations for books, chapters, and pages. It features advanced image gallery management with URL upload support and full-text search capabilities across all content entities.Last updated027ISC
Related MCP Connectors
Connect your team's living knowledge base — docs, data, issues, CRM — to Claude and ChatGPT.
Live SEO workflow tools for Claude Code, Codex, and AI agents.
Connect Claude to Fathom meeting recordings, transcripts, and summaries
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pnocera/bookstack-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server