@icoretech/warden-mcp 0.2.23 → 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.
@@ -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
- const attachmentSelector = metadata?.id ?? input.attachmentId;
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',
@@ -180,6 +180,7 @@ export function registerTools(server, deps) {
180
180
  .filter((attachment) => attachment !== null);
181
181
  if (attachments.length > 0) {
182
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`)}`);
183
184
  }
184
185
  }
185
186
  if (typeof rec.favorite === 'boolean')
@@ -985,7 +986,7 @@ export function registerTools(server, deps) {
985
986
  });
986
987
  registerTool(`${deps.toolPrefix}.get_item`, {
987
988
  title: 'Get Item',
988
- 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.',
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.`,
989
990
  annotations: { readOnlyHint: true },
990
991
  inputSchema: {
991
992
  id: stableObjectIdSchema,
@@ -1252,7 +1253,7 @@ export function registerTools(server, deps) {
1252
1253
  });
1253
1254
  registerTool(`${deps.toolPrefix}.get_attachment`, {
1254
1255
  title: 'Get Attachment',
1255
- 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.',
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.`,
1256
1257
  annotations: { readOnlyHint: true },
1257
1258
  inputSchema: {
1258
1259
  itemId: itemIdSchema,
@@ -1261,7 +1262,14 @@ export function registerTools(server, deps) {
1261
1262
  _meta: toolMeta,
1262
1263
  }, async (input, extra) => {
1263
1264
  const sdk = await deps.getSdk(extra.authInfo);
1264
- const attachment = await sdk.getAttachment(input);
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
+ });
1265
1273
  const structuredContent = { attachment };
1266
1274
  return {
1267
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.23",
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.4.16",
55
+ "@biomejs/biome": "^2.5.0",
56
56
  "@types/express": "^5.0.6",
57
- "@types/node": "^25.9.2",
57
+ "@types/node": "^25.9.3",
58
58
  "playwright": "1.60.0",
59
59
  "tsx": "^4.22.4",
60
60
  "typescript": "^6.0.3"