这是一个提供从BookStack搜索页面工具的模型上下文协议(MCP)服务器。该服务器与BookStack API交互,并提供经过干净HTML到文本转换的结构化数据。
要通过Smithery自动安装mcp-bookstack用于Claude桌面应用:
npx -y @smithery/cli install @yellowgg2/mcp-bookstack --client claude
git clone https://github.com/yellowgg2/mcp-bookstack.git
cd mcp-bookstack
npm install
创建一个.env文件,其中包含您的BookStack API凭证,或在MCP设置配置文件中提供它们:
BOOKSTACK_API_TOKEN=your_token
BOOKSTACK_API_URL=your_bookstack_url
BOOKSTACK_API_KEY=your_api_key
npm run build
对于VSCode Claude扩展:
{
"mcpServers": {
"bookstack": {
"command": "node",
"args": ["/path/to/mcp-bookstack/build/app.js"],
"env": {
"BOOKSTACK_API_URL": "your_bookstack_url",
"BOOKSTACK_API_TOKEN": "your_token",
"BOOKSTACK_API_KEY": "your_api_key"
}
}
}
}
该服务器提供了一个名为search_pages的工具,可用于搜索BookStack中的页面。
参数:
query (字符串):用于搜索页面的查询
page (数字):要返回的页数
count (数字):要返回的页面数量
示例用法:
使用_mcp_tool:
server_name: "bookstack"
tool_name: "search_pages"
参数: {
"query": "知识库",
"page": 1,
"count": 5
}
示例输出:
# 页面标题
页面内容以纯文本格式呈现...
来源:https://your-bookstack-url/page-url
要使用此MCP服务器与Claude集成,您需要:
对于Claude桌面应用、VSCode Claude扩展和Cursor,添加服务器配置到:
// ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
// %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"bookstack": {
"command": "node",
"args": ["/path/to/mcp-bookstack/build/app.js"],
"env": {
"BOOKSTACK_API_URL": "your_bookstack_url",
"BOOKSTACK_API_TOKEN": "your_token",
"BOOKSTACK_API_KEY": "your_api_key"
}
}
}
}
一旦配置完成,您可以使用自然语言与Claude互动以搜索BookStack页面。示例:
Claude将自动使用适当的参数来搜索您想要的页面。
每个页面响应包括:
HTML到文本转换处理:
服务器构建使用:
要修改服务器:
src/app.tsnpm run build
服务器包括强大的错误处理机制,针对:
错误以适当的错误代码和描述性消息返回。
欢迎贡献!请随意提交Pull Request。
MIT许可 - 欢迎在自己的项目中使用。