bookstack-mcp 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -3
- package/dist/bookstack-client.js +13 -6
- package/dist/index.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,8 +51,11 @@ BOOKSTACK_BASE_URL=https://your-bookstack.com # Required
|
|
|
51
51
|
BOOKSTACK_TOKEN_ID=your-token-id # Required
|
|
52
52
|
BOOKSTACK_TOKEN_SECRET=your-token-secret # Required
|
|
53
53
|
BOOKSTACK_ENABLE_WRITE=false # Optional, default false
|
|
54
|
+
BOOKSTACK_INSECURE_SKIP_TLS_VERIFY=false # Optional, default false
|
|
54
55
|
```
|
|
55
56
|
|
|
57
|
+
> **Security warning:** `BOOKSTACK_INSECURE_SKIP_TLS_VERIFY=true` disables TLS certificate verification for outgoing requests to BookStack. Use only for self-signed certs on a trusted LAN — connections become vulnerable to MITM attacks. The server logs a `WARNING` line at startup whenever this is enabled.
|
|
58
|
+
|
|
56
59
|
## Client Configuration
|
|
57
60
|
|
|
58
61
|
### Claude Desktop
|
|
@@ -132,16 +135,65 @@ When binding to `0.0.0.0` (e.g. inside a container reachable from other services
|
|
|
132
135
|
|
|
133
136
|
Restart LibreChat after config changes.
|
|
134
137
|
|
|
135
|
-
### Claude Code (
|
|
138
|
+
### Claude Code (CLI)
|
|
136
139
|
|
|
137
|
-
|
|
140
|
+
The recommended path is the `ttpears/claude-plugins` marketplace, which ships this repo's plugin manifest (`.claude-plugin/plugin.json`):
|
|
138
141
|
|
|
139
142
|
```
|
|
140
143
|
/plugin marketplace add ttpears/claude-plugins
|
|
141
144
|
/plugin install bookstack-mcp@ttpears-plugins
|
|
142
145
|
```
|
|
143
146
|
|
|
144
|
-
Then set the `BOOKSTACK_*` environment variables in your shell so the plugin's MCP server can authenticate
|
|
147
|
+
Then set the `BOOKSTACK_*` environment variables in your shell so the plugin's MCP server can authenticate:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
export BOOKSTACK_BASE_URL=https://your-bookstack.com
|
|
151
|
+
export BOOKSTACK_TOKEN_ID=your-token-id
|
|
152
|
+
export BOOKSTACK_TOKEN_SECRET=your-token-secret
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### Manual install (alternative)
|
|
156
|
+
|
|
157
|
+
If you'd rather not use the marketplace, register the server directly with `claude mcp add`. Repeat `--env` for each variable, put all flags **before** the server name, and use `--` to mark the start of the command Claude Code will spawn:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
claude mcp add bookstack \
|
|
161
|
+
--transport stdio \
|
|
162
|
+
--scope user \
|
|
163
|
+
--env BOOKSTACK_BASE_URL=https://your-bookstack.com \
|
|
164
|
+
--env BOOKSTACK_TOKEN_ID=your-token-id \
|
|
165
|
+
--env BOOKSTACK_TOKEN_SECRET=your-token-secret \
|
|
166
|
+
-- npx -y bookstack-mcp
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Scope picks where the entry is written:
|
|
170
|
+
|
|
171
|
+
| Scope | Where it lives | Shared via git | Use it when |
|
|
172
|
+
|-------|----------------|----------------|-------------|
|
|
173
|
+
| `local` (default) | `~/.claude.json`, scoped to the current project | No | Trying it out in one repo |
|
|
174
|
+
| `user` | `~/.claude.json`, available in every project | No | You want bookstack everywhere |
|
|
175
|
+
| `project` | `.mcp.json` at the repo root | Yes | The whole team should get it |
|
|
176
|
+
|
|
177
|
+
The resulting config entry looks like this (in `.mcp.json` for project scope, or `~/.claude.json` otherwise):
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"mcpServers": {
|
|
182
|
+
"bookstack": {
|
|
183
|
+
"type": "stdio",
|
|
184
|
+
"command": "npx",
|
|
185
|
+
"args": ["-y", "bookstack-mcp"],
|
|
186
|
+
"env": {
|
|
187
|
+
"BOOKSTACK_BASE_URL": "https://your-bookstack.com",
|
|
188
|
+
"BOOKSTACK_TOKEN_ID": "your-token-id",
|
|
189
|
+
"BOOKSTACK_TOKEN_SECRET": "your-token-secret"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
> **Tip for committed `.mcp.json`:** Claude Code expands `${VAR}` and `${VAR:-default}` references in `.mcp.json` from the surrounding shell. Use that to keep secrets out of git: set `"BOOKSTACK_TOKEN_SECRET": "${BOOKSTACK_TOKEN_SECRET}"` in the file and have each developer export the variable in their shell.
|
|
145
197
|
|
|
146
198
|
## MCP Resources
|
|
147
199
|
|
package/dist/bookstack-client.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import https from 'https';
|
|
2
3
|
export class BookStackClient {
|
|
3
4
|
client;
|
|
4
5
|
enableWrite;
|
|
@@ -12,7 +13,10 @@ export class BookStackClient {
|
|
|
12
13
|
headers: {
|
|
13
14
|
'Authorization': `Token ${config.tokenId}:${config.tokenSecret}`,
|
|
14
15
|
'Content-Type': 'application/json'
|
|
15
|
-
}
|
|
16
|
+
},
|
|
17
|
+
httpsAgent: config.insecureSkipTlsVerify
|
|
18
|
+
? new https.Agent({ rejectUnauthorized: false })
|
|
19
|
+
: undefined
|
|
16
20
|
});
|
|
17
21
|
}
|
|
18
22
|
applyFilters(params, filter) {
|
|
@@ -88,8 +92,11 @@ export class BookStackClient {
|
|
|
88
92
|
const slice = fullContent.substring(offset, offset + limit);
|
|
89
93
|
const nextOffset = offset + slice.length;
|
|
90
94
|
const truncated = nextOffset < totalChars;
|
|
91
|
-
// Strip duplicate large fields from the base page object
|
|
92
|
-
|
|
95
|
+
// Strip duplicate large fields from the base page object. raw_html is the
|
|
96
|
+
// unprocessed editor source BookStack returns alongside html/markdown/text;
|
|
97
|
+
// leaving it in would bypass the limit/offset pagination and can blow past
|
|
98
|
+
// MCP token caps for large pages.
|
|
99
|
+
const { html: _h, markdown: _m, text: _t, raw_html: _r, ...pageMeta } = page;
|
|
93
100
|
return {
|
|
94
101
|
...pageMeta,
|
|
95
102
|
url,
|
|
@@ -261,9 +268,9 @@ export class BookStackClient {
|
|
|
261
268
|
const preview = page.text
|
|
262
269
|
? `${page.text.substring(0, 200)}${page.text.length > 200 ? '...' : ''}`
|
|
263
270
|
: 'No content preview available';
|
|
264
|
-
// List responses from BookStack don't include html/markdown/text, but strip
|
|
265
|
-
// and never embed full content here — use get_page for that.
|
|
266
|
-
const { html: _h, markdown: _m, text: _t, ...pageMeta } = page;
|
|
271
|
+
// List responses from BookStack don't include html/markdown/text/raw_html, but strip
|
|
272
|
+
// defensively and never embed full content here — use get_page for that.
|
|
273
|
+
const { html: _h, markdown: _m, text: _t, raw_html: _r, ...pageMeta } = page;
|
|
267
274
|
return {
|
|
268
275
|
...pageMeta,
|
|
269
276
|
url,
|
package/dist/index.js
CHANGED
|
@@ -974,11 +974,15 @@ async function main() {
|
|
|
974
974
|
baseUrl: getRequiredEnvVar('BOOKSTACK_BASE_URL'),
|
|
975
975
|
tokenId: getRequiredEnvVar('BOOKSTACK_TOKEN_ID'),
|
|
976
976
|
tokenSecret: getRequiredEnvVar('BOOKSTACK_TOKEN_SECRET'),
|
|
977
|
-
enableWrite: process.env.BOOKSTACK_ENABLE_WRITE?.toLowerCase() === 'true'
|
|
977
|
+
enableWrite: process.env.BOOKSTACK_ENABLE_WRITE?.toLowerCase() === 'true',
|
|
978
|
+
insecureSkipTlsVerify: process.env.BOOKSTACK_INSECURE_SKIP_TLS_VERIFY?.toLowerCase() === 'true'
|
|
978
979
|
};
|
|
979
980
|
console.error('Initializing BookStack MCP Server...');
|
|
980
981
|
console.error(`BookStack URL: ${config.baseUrl}`);
|
|
981
982
|
console.error(`Write operations: ${config.enableWrite ? 'ENABLED' : 'DISABLED'}`);
|
|
983
|
+
if (config.insecureSkipTlsVerify) {
|
|
984
|
+
console.error('WARNING: TLS certificate verification is DISABLED (BOOKSTACK_INSECURE_SKIP_TLS_VERIFY=true). Connections to BookStack are vulnerable to MITM attacks. Use only with trusted self-signed certs on a trusted network.');
|
|
985
|
+
}
|
|
982
986
|
const transportMode = (process.env.MCP_TRANSPORT ?? "stdio").toLowerCase();
|
|
983
987
|
if (transportMode === "http" || transportMode === "sse") {
|
|
984
988
|
await startHttp(config);
|