@icoretech/warden-mcp 0.2.22 → 0.2.24
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 +2 -2
- package/dist/sdk/keychainSdk.js +25 -1
- package/dist/tools/registerTools.js +26 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -469,7 +469,7 @@ Credential resolution:
|
|
|
469
469
|
|
|
470
470
|
Mutation control:
|
|
471
471
|
|
|
472
|
-
- Set `READONLY=true` to
|
|
472
|
+
- Set `READONLY=true` to hide mutating tools from the advertised MCP catalog and reject direct write calls (create/edit/delete/move/restore/attachments).
|
|
473
473
|
- Set `NOREVEAL=true` to force all `reveal` parameters to `false` server-side. Clients can still request `reveal: true`, but the server will silently downgrade to redacted output. This prevents prompt injection from tricking an LLM agent into exfiltrating secrets.
|
|
474
474
|
- Set `KEYCHAIN_TEXT_COMPAT_MODE=structured_json` to mirror supported structured tool results into `TextContent` as serialized JSON. This is useful for text-only MCP clients that ignore `structuredContent`, but it also duplicates revealed secrets into the plain-text transcript.
|
|
475
475
|
- Tool names default to `keychain_*`. Override `TOOL_PREFIX` to change the namespace and `TOOL_SEPARATOR` to change the separator (default `_`, set `.` for legacy clients).
|
|
@@ -508,7 +508,7 @@ If you run `warden-mcp` beyond local development, review these items:
|
|
|
508
508
|
|
|
509
509
|
3. **Do not enable `KEYCHAIN_ALLOW_ENV_FALLBACK` on shared networks.** This flag makes the server's own vault credentials available to any HTTP client that omits headers. Only use it in single-tenant setups where the network is fully trusted.
|
|
510
510
|
|
|
511
|
-
4. **Enable `READONLY=true` when writes are not needed.** This
|
|
511
|
+
4. **Enable `READONLY=true` when writes are not needed.** This hides mutating tools from the advertised MCP catalog and rejects direct write calls at the MCP layer, limiting blast radius if an agent or client is compromised.
|
|
512
512
|
|
|
513
513
|
5. **Restrict filesystem access to `/data/bw-profiles`.** The `bw` CLI stores decrypted state under its HOME directory. Ensure the profile directory is not world-readable and is mounted with appropriate permissions (the Docker image runs as non-root by default).
|
|
514
514
|
|
package/dist/sdk/keychainSdk.js
CHANGED
|
@@ -436,6 +436,27 @@ export class KeychainSdk {
|
|
|
436
436
|
.filter((id) => typeof id === 'string' && id.length > 0);
|
|
437
437
|
throw new Error(`Attachment selector matched multiple attachments: ${ids.join(', ')}`);
|
|
438
438
|
}
|
|
439
|
+
attachmentSelectorNotFoundMessage(item, selector, toolNames) {
|
|
440
|
+
const attachments = this.attachmentsFromItem(item);
|
|
441
|
+
const syncTool = toolNames?.sync ?? 'keychain_sync';
|
|
442
|
+
const getItemTool = toolNames?.getItem ?? 'keychain_get_item';
|
|
443
|
+
const getAttachmentTool = toolNames?.getAttachment ?? 'keychain_get_attachment';
|
|
444
|
+
const available = attachments.length > 0
|
|
445
|
+
? attachments
|
|
446
|
+
.map((a) => {
|
|
447
|
+
const parts = [];
|
|
448
|
+
if (a.id)
|
|
449
|
+
parts.push(`id=${a.id}`);
|
|
450
|
+
if (a.fileName)
|
|
451
|
+
parts.push(`fileName=${a.fileName}`);
|
|
452
|
+
if (a.sizeName)
|
|
453
|
+
parts.push(`sizeName=${a.sizeName}`);
|
|
454
|
+
return `{${parts.join(' ')}}`;
|
|
455
|
+
})
|
|
456
|
+
.join(', ')
|
|
457
|
+
: 'none';
|
|
458
|
+
return `Attachment selector "${selector}" was not found in the current item metadata. Available attachments: ${available}. If the attachment was recently added or renamed, run ${syncTool}, re-read the item with ${getItemTool}, then retry ${getAttachmentTool} with an attachment id or exact filename from refreshed metadata.`;
|
|
459
|
+
}
|
|
439
460
|
redactPasswordHistoryForTool(history) {
|
|
440
461
|
// For secret-returning tools we avoid returning sentinel strings like "[REDACTED]"
|
|
441
462
|
// because downstream utilities might accidentally pass them through.
|
|
@@ -496,7 +517,10 @@ export class KeychainSdk {
|
|
|
496
517
|
const { stdout: itemOut } = await this.bw.runForSession(session, ['get', 'item', input.itemId], { timeoutMs: 60_000 });
|
|
497
518
|
const item = this.parseBwJson(itemOut);
|
|
498
519
|
const metadata = this.resolveAttachment(item, input.attachmentId);
|
|
499
|
-
|
|
520
|
+
if (!metadata) {
|
|
521
|
+
throw new Error(this.attachmentSelectorNotFoundMessage(item, input.attachmentId, input.toolNames));
|
|
522
|
+
}
|
|
523
|
+
const attachmentSelector = metadata.id ?? input.attachmentId;
|
|
500
524
|
const { stdout, stdoutBuffer } = await this.bw.runForSession(session, [
|
|
501
525
|
'get',
|
|
502
526
|
'attachment',
|
|
@@ -18,8 +18,23 @@ export function registerTools(server, deps) {
|
|
|
18
18
|
const publicName = name.startsWith(legacyPrefix)
|
|
19
19
|
? `${publicPrefix}${name.slice(legacyPrefix.length)}`
|
|
20
20
|
: name;
|
|
21
|
+
if (isReadOnly && isMutatingToolRegistration(args)) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
21
24
|
return rawRegisterTool(publicName, ...args);
|
|
22
25
|
});
|
|
26
|
+
function isRecord(value) {
|
|
27
|
+
return typeof value === 'object' && value !== null;
|
|
28
|
+
}
|
|
29
|
+
function isMutatingToolRegistration(args) {
|
|
30
|
+
const options = args[0];
|
|
31
|
+
if (!isRecord(options))
|
|
32
|
+
return false;
|
|
33
|
+
const annotations = options.annotations;
|
|
34
|
+
if (!isRecord(annotations))
|
|
35
|
+
return false;
|
|
36
|
+
return annotations.readOnlyHint === false;
|
|
37
|
+
}
|
|
23
38
|
function parseBoolEnv(...names) {
|
|
24
39
|
for (const name of names) {
|
|
25
40
|
const v = process.env[name];
|
|
@@ -165,6 +180,7 @@ export function registerTools(server, deps) {
|
|
|
165
180
|
.filter((attachment) => attachment !== null);
|
|
166
181
|
if (attachments.length > 0) {
|
|
167
182
|
parts.push(`attachments=${quoteText(attachments.join(', '))}`);
|
|
183
|
+
parts.push(`attachmentDownload=${quoteText(`${publicPrefix}get_attachment with this item id plus an attachment id or exact filename; if an expected file is missing, run ${publicPrefix}sync and ${publicPrefix}get_item again first`)}`);
|
|
168
184
|
}
|
|
169
185
|
}
|
|
170
186
|
if (typeof rec.favorite === 'boolean')
|
|
@@ -970,7 +986,7 @@ export function registerTools(server, deps) {
|
|
|
970
986
|
});
|
|
971
987
|
registerTool(`${deps.toolPrefix}.get_item`, {
|
|
972
988
|
title: 'Get Item',
|
|
973
|
-
description:
|
|
989
|
+
description: `Get the full vault item by stable item id. Secret fields and signed attachment URLs are redacted by default; pass reveal=true only when the caller is allowed to receive secrets. When attachments are present, use ${publicPrefix}get_attachment with this item id plus the listed attachment id or filename to download file bytes. If an expected recently-added attachment is missing, run ${publicPrefix}sync and call ${publicPrefix}get_item again before retrying.`,
|
|
974
990
|
annotations: { readOnlyHint: true },
|
|
975
991
|
inputSchema: {
|
|
976
992
|
id: stableObjectIdSchema,
|
|
@@ -1237,7 +1253,7 @@ export function registerTools(server, deps) {
|
|
|
1237
1253
|
});
|
|
1238
1254
|
registerTool(`${deps.toolPrefix}.get_attachment`, {
|
|
1239
1255
|
title: 'Get Attachment',
|
|
1240
|
-
description:
|
|
1256
|
+
description: `Download an attachment from a parent item and return raw bytes as contentBase64. Pass itemId plus an attachment id, or an unambiguous filename selector resolved from the item metadata before calling bw get attachment. The response includes filename, byte count, and base64 content for local decoding. If the expected attachment filename is missing from ${publicPrefix}get_item metadata, run ${publicPrefix}sync and ${publicPrefix}get_item again before retrying.`,
|
|
1241
1257
|
annotations: { readOnlyHint: true },
|
|
1242
1258
|
inputSchema: {
|
|
1243
1259
|
itemId: itemIdSchema,
|
|
@@ -1246,7 +1262,14 @@ export function registerTools(server, deps) {
|
|
|
1246
1262
|
_meta: toolMeta,
|
|
1247
1263
|
}, async (input, extra) => {
|
|
1248
1264
|
const sdk = await deps.getSdk(extra.authInfo);
|
|
1249
|
-
const attachment = await sdk.getAttachment(
|
|
1265
|
+
const attachment = await sdk.getAttachment({
|
|
1266
|
+
...input,
|
|
1267
|
+
toolNames: {
|
|
1268
|
+
sync: `${publicPrefix}sync`,
|
|
1269
|
+
getItem: `${publicPrefix}get_item`,
|
|
1270
|
+
getAttachment: `${publicPrefix}get_attachment`,
|
|
1271
|
+
},
|
|
1272
|
+
});
|
|
1250
1273
|
const structuredContent = { attachment };
|
|
1251
1274
|
return {
|
|
1252
1275
|
structuredContent,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@icoretech/warden-mcp",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.24",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Vaultwarden/Bitwarden MCP server backed by Bitwarden CLI (bw).",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@bitwarden/cli": "2026.5.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@biomejs/biome": "^2.
|
|
55
|
+
"@biomejs/biome": "^2.5.0",
|
|
56
56
|
"@types/express": "^5.0.6",
|
|
57
|
-
"@types/node": "^25.9.
|
|
57
|
+
"@types/node": "^25.9.3",
|
|
58
58
|
"playwright": "1.60.0",
|
|
59
59
|
"tsx": "^4.22.4",
|
|
60
60
|
"typescript": "^6.0.3"
|