BookStack MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
pip install -r fastmcp_server/requirements.txt
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "BS_URL=${BS_URL}" -e "BS_TOKEN_ID=${BS_TOKEN_ID}" -e "BS_TOKEN_SECRET=${BS_TOKEN_SECRET}" bookstack-mcp -- node "<FULL_PATH_TO_BOOKSTACK_MCP>/dist/index.js"

Replace <FULL_PATH_TO_BOOKSTACK_MCP>/dist/index.js with the actual folder you prepared in step 1.

Required:BS_URLBS_TOKEN_IDBS_TOKEN_SECRET
README.md

Comprehensive tools for managing BookStack instances

BookStack MCP Server

This repository hosts a Python FastMCP-based server that exposes consolidated tools for managing a BookStack instance. The flagship capabilities are the image gallery management workflows that power authoring experiences in downstream MCP clients.

Quick start

# Install Python dependencies for the FastMCP server
pip install -r fastmcp_server/requirements.txt

Launch the FastMCP server after exporting your BookStack credentials (see below):

cd fastmcp_server
python3 -m fastmcp_server

Required environment

Copy .env.example to .env and populate these variables before invoking any BookStack tools:

BS_URL=https://your-bookstack.example.com
BS_TOKEN_ID=...
BS_TOKEN_SECRET=...

The API token must belong to a user that can view and manage the image gallery. Local helper scripts use set -a && source .env so the values apply to ad-hoc Python snippets as well.

BookStack tools

The Python FastMCP server provides comprehensive BookStack management through consolidated tools:

Content Management

  • bookstack_content_crud — unified CRUD operations for books, bookshelves, chapters, and pages (Letta-compatible)
  • bookstack_list_content — list and filter content entities with pagination
  • bookstack_search — full-text search across BookStack content
  • bookstack_batch_operations — bulk create, update, and delete operations

Image Gallery Management

  • bookstack_manage_images — unified create/read/update/delete/list interface for images
  • bookstack_search_images — advanced discovery with extension, date, size, and usage filters

All tools are registered by fastmcp_server/bookstack/tools.py and surfaced automatically when the FastMCP server starts.

📘 Letta Compatibility: If you're using Letta as your MCP client, please read docs/LETTA_COMPATIBILITY.md for important compatibility requirements and best practices.

Image uploads from URLs

bookstack_manage_images accepts three input shapes for the image/new_image fields during create and update operations:

  1. Plain base64 strings
  2. Data URLs (data:image/png;base64,...)
  3. HTTP or HTTPS URLs

When a URL is supplied the tool:

  • Streams the remote image with a 30 second timeout and a 50 MB limit
  • Restricts schemes to HTTP/HTTPS and blocks loopback, private, link-local, reserved, and redirect-based internal targets
  • Validates the MIME type against BookStack's accepted formats (jpeg, png, gif, webp, bmp, tiff, svg+xml)
  • Infers a filename from the URL path when one is not supplied

Required BookStack parameters

BookStack's POST /api/image-gallery endpoint enforces two additional fields beyond the binary payload:

  • type — must be gallery for standard content images (use drawio only when uploading diagrams.net PNGs)
  • uploaded_to — the numeric page ID to attach the image to. BookStack rejects uploads without a real page context.

The tool surfaces these as optional inputs named image_type and uploaded_to. Default values of gallery and 0 preserve backward compatibility while allowing callers to target specific pages when required.

Manual verification against a live instance

After exporting your environment variables you can confirm an end-to-end URL upload with the following snippet (replace PAGE_ID with an existing page id):

cd /opt/stacks/bookstack-mcp/Bookstack-MCP
set -a && source .env && set +a
python3 - <<'PY'
import asyncio, json, time
from fastmcp import FastMCP
from fastmcp_server.bookstack.tools import register_bookstack_tools

TEST_IMAGE_URL = "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
PAGE_ID = 39  # replace with a page id from your BookStack instance

async def main():
    mcp = FastMCP("manual-test")
    register_bookstack_tools(mcp)
    tool = await mcp.get_tool("bookstack_manage_images")
    result = await tool.run({
        "operation": "create",
        "name": f"URL Upload Test {int(time.time())}",
        "image": TEST_IMAGE_URL,
        "uploaded_to": PAGE_ID,
    })
    print(json.dumps(json.loads(result.content[0].text), indent=2))

asyncio.run(main())
PY

You should receive a JSON payload describing the uploaded image, including thumbnails and the uploaded_to identifier. A 422 error means BookStack rejected the request (common causes: missing uploaded_to, disallowed MIME type, image exceeding the 50 MB limit). A 404 response typically indicates the API token lacks gallery permissions.

Testing

Run the Python unit tests for the BookStack tools:

cd fastmcp_server
python3 -m pytest tests/test_manage_images.py -v

The suite covers URL handling, timeout and size enforcement, invalid scheme rejection, and the forwarding of type/uploaded_to metadata.

Additional references

Tools (6)

bookstack_content_crudUnified CRUD operations for books, bookshelves, chapters, and pages.
bookstack_list_contentList and filter content entities with pagination.
bookstack_searchFull-text search across BookStack content.
bookstack_batch_operationsBulk create, update, and delete operations.
bookstack_manage_imagesUnified create/read/update/delete/list interface for images.
bookstack_search_imagesAdvanced image discovery with extension, date, size, and usage filters.

Environment Variables

BS_URLrequiredThe base URL of your BookStack instance
BS_TOKEN_IDrequiredThe API token ID for BookStack authentication
BS_TOKEN_SECRETrequiredThe API token secret for BookStack authentication

Configuration

claude_desktop_config.json
{"mcpServers": {"bookstack": {"command": "python3", "args": ["-m", "fastmcp_server"], "env": {"BS_URL": "https://your-bookstack.example.com", "BS_TOKEN_ID": "...", "BS_TOKEN_SECRET": "..."}}}}

Try it

Search for all pages related to 'API documentation' in my BookStack instance.
Create a new chapter titled 'Getting Started' in the 'Project Handbook' book.
Upload this image from https://example.com/logo.png to page ID 39.
List all books currently in the system.
Delete the page with ID 105.

Frequently Asked Questions

What are the key features of BookStack MCP Server?

Unified CRUD operations for books, bookshelves, chapters, and pages. Full-text search capabilities across all content entities. Advanced image gallery management with URL upload support. Bulk create, update, and delete operations. Letta-compatible tool definitions.

What can I use BookStack MCP Server for?

Automating documentation updates by syncing content from external sources. Bulk managing images and diagrams within technical documentation pages. Quickly searching and retrieving specific information across large knowledge bases. Programmatically organizing and restructuring book content.

How do I install BookStack MCP Server?

Install BookStack MCP Server by running: pip install -r fastmcp_server/requirements.txt

What MCP clients work with BookStack MCP Server?

BookStack MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep BookStack MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare