BookStack MCP Server
Provides 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.
README
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.
⚠️ DEPRECATION NOTICE: The TypeScript/mcp-framework server (
src/directory) is deprecated and no longer maintained. All development has moved to the Python FastMCP server (fastmcp_server/directory). Please migrate to the Python server for the latest features and bug fixes.
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 paginationbookstack_search— full-text search across BookStack contentbookstack_batch_operations— bulk create, update, and delete operations
Image Gallery Management
bookstack_manage_images— unified create/read/update/delete/list interface for imagesbookstack_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:
- Plain base64 strings
- Data URLs (
data:image/png;base64,...) - 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 to avoid SSRF
- 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 begalleryfor standard content images (usedrawioonly 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
- FastMCP docs: https://gofastmcp.com/
- BookStack API reference: https://www.bookstackapp.com/docs/api/
- Product requirements for the image gallery tools:
docs/PRD-Image-Gallery-Management.md
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。