@icoretech/warden-mcp 0.2.7 → 0.2.9

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 CHANGED
@@ -403,9 +403,11 @@ The server executes `bw` commands on your behalf:
403
403
 
404
404
  - In HTTP mode, Bitwarden/Vaultwarden connection + credentials are provided via **HTTP headers** per request. Env-var fallback is disabled by default; set `KEYCHAIN_ALLOW_ENV_FALLBACK=true` to enable it for single-tenant HTTP deployments.
405
405
  - In stdio mode, Bitwarden/Vaultwarden credentials are loaded once from `BW_*` env vars at startup.
406
- - The server maintains per-profile `bw` state under `KEYCHAIN_BW_HOME_ROOT` to avoid session/config clashes.
406
+ - The server maintains per-profile `bw` state under `KEYCHAIN_BW_HOME_ROOT` and pins `BITWARDENCLI_APPDATA_DIR` inside that profile so the Bitwarden CLI keeps a stable local device/app identity across restarts instead of looking like a fresh client every time.
407
407
  - Writes can optionally call `bw sync` (internal; not exposed as an MCP tool).
408
408
 
409
+ Timeout handling is also process-tree aware: if a `bw` command hangs, `warden-mcp` kills the full spawned process group rather than only the direct parent process. That prevents timed-out auth attempts from leaving orphaned `bw`/shell child processes behind.
410
+
409
411
  ### Required Headers
410
412
 
411
413
  - `X-BW-Host` (must be an HTTPS origin, for example `https://vaultwarden.example.com`)
@@ -430,6 +432,7 @@ Mutation control:
430
432
 
431
433
  - Set `READONLY=true` to block all write operations (create/edit/delete/move/restore/attachments).
432
434
  - 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.
435
+ - Set `KEYCHAIN_TEXT_COMPAT_MODE=structured_json` to mirror any structured `OK` tool result 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.
433
436
  - Tool names default to `keychain_*`. Override `TOOL_PREFIX` to change the namespace and `TOOL_SEPARATOR` to change the separator (default `_`, set `.` for legacy clients).
434
437
  - Session guardrails:
435
438
  - `KEYCHAIN_SESSION_MAX_COUNT` (default `32`)
@@ -439,6 +442,7 @@ Mutation control:
439
442
  - `KEYCHAIN_METRICS_LOG_INTERVAL_MS` (default `0`, disabled)
440
443
  - `NOREVEAL` / `KEYCHAIN_NOREVEAL` (default `false`; force all reveals to false)
441
444
  - `KEYCHAIN_ALLOW_ENV_FALLBACK` (default `false`; HTTP env-var credential fallback)
445
+ - `KEYCHAIN_TEXT_COMPAT_MODE` (default unset; set to `structured_json` to copy structured `OK` results into `TextContent`)
442
446
 
443
447
  Redaction defaults (item reads):
444
448
 
@@ -475,6 +479,8 @@ If you run `warden-mcp` beyond local development, review these items:
475
479
 
476
480
  8. **Monitor `/metricsz`.** The endpoint is intentionally unauthenticated (for scraper compatibility) but exposes session counts, heap usage, and rejection counters. If this data is sensitive in your environment, restrict access at the network level.
477
481
 
482
+ 9. **Only enable `KEYCHAIN_TEXT_COMPAT_MODE=structured_json` for text-only clients you trust.** It improves compatibility with clients that ignore `structuredContent`, but any revealed secret will also appear in plain-text `TextContent`, making transcript leakage easier.
483
+
478
484
  ## Quick Start
479
485
 
480
486
  ### Minimal local run
package/dist/bw/bwCli.js CHANGED
@@ -52,9 +52,11 @@ export async function runBw(args, opts = {}) {
52
52
  const rendered = safeRenderedArgs(finalArgs);
53
53
  console.log(`[bw] start: ${bwBin} ${rendered}`);
54
54
  }
55
+ const detached = process.platform !== 'win32';
55
56
  const child = spawn(bwBin, finalArgs, {
56
57
  env,
57
58
  stdio: ['pipe', 'pipe', 'pipe'],
59
+ detached,
58
60
  });
59
61
  const stdoutChunks = [];
60
62
  const stderrChunks = [];
@@ -64,54 +66,75 @@ export async function runBw(args, opts = {}) {
64
66
  child.stdin.write(opts.stdin);
65
67
  }
66
68
  child.stdin.end();
67
- let timeout;
68
69
  const timeoutMs = opts.timeoutMs ?? 60_000;
69
- const timedOut = new Promise((_resolve, reject) => {
70
- timeout = setTimeout(() => {
70
+ const killChildProcessTree = () => {
71
+ if (typeof child.pid === 'number' && detached) {
71
72
  try {
72
- child.kill('SIGKILL');
73
+ process.kill(-child.pid, 'SIGKILL');
74
+ return;
73
75
  }
74
76
  catch {
75
- // ignore
77
+ // Fallback to direct child kill below.
76
78
  }
79
+ }
80
+ try {
81
+ child.kill('SIGKILL');
82
+ }
83
+ catch {
84
+ // ignore
85
+ }
86
+ };
87
+ return new Promise((resolve, reject) => {
88
+ let settled = false;
89
+ const settle = (fn) => {
90
+ if (settled)
91
+ return;
92
+ settled = true;
93
+ if (timeout)
94
+ clearTimeout(timeout);
95
+ fn();
96
+ };
97
+ const timeout = setTimeout(() => {
98
+ killChildProcessTree();
77
99
  if (debug) {
78
100
  console.log(`[bw] timeout after ${timeoutMs}ms`);
79
101
  }
80
- reject(new Error(`bw command timed out after ${timeoutMs}ms`));
102
+ settle(() => {
103
+ reject(new Error(`bw command timed out after ${timeoutMs}ms`));
104
+ });
81
105
  }, timeoutMs);
82
- });
83
- const completed = new Promise((resolve, reject) => {
84
106
  child.on('error', (error) => {
85
- const safeCmd = `${bwBin} ${safeRenderedArgs(finalArgs)}`;
86
- if (error.code === 'ENOENT') {
87
- reject(new Error(`bw CLI not available for ${safeCmd}. Install @bitwarden/cli or set BW_BIN to a valid bw binary.`));
88
- return;
89
- }
90
- reject(new Error(`Failed to start ${safeCmd}: ${error.message}`));
107
+ settle(() => {
108
+ const safeCmd = `${bwBin} ${safeRenderedArgs(finalArgs)}`;
109
+ if (error.code === 'ENOENT') {
110
+ reject(new Error(`bw CLI not available for ${safeCmd}. Install @bitwarden/cli or set BW_BIN to a valid bw binary.`));
111
+ return;
112
+ }
113
+ reject(new Error(`Failed to start ${safeCmd}: ${error.message}`));
114
+ });
91
115
  });
92
116
  child.on('close', (code) => {
93
- if (timeout)
94
- clearTimeout(timeout);
95
- const stdout = Buffer.concat(stdoutChunks).toString('utf8');
96
- const stderr = Buffer.concat(stderrChunks).toString('utf8');
97
- const exitCode = code ?? 1;
98
- if (exitCode !== 0) {
117
+ settle(() => {
118
+ const stdout = Buffer.concat(stdoutChunks).toString('utf8');
119
+ const stderr = Buffer.concat(stderrChunks).toString('utf8');
120
+ const exitCode = code ?? 1;
121
+ if (exitCode !== 0) {
122
+ if (debug) {
123
+ console.log(`[bw] fail: exit=${exitCode} ms=${Date.now() - startedAt}`);
124
+ }
125
+ const safeCmd = `${bwBin} ${safeRenderedArgs(finalArgs)}`;
126
+ reject(new BwCliError(`${safeCmd} failed with exit code ${exitCode}`, {
127
+ exitCode,
128
+ stdout,
129
+ stderr,
130
+ }));
131
+ return;
132
+ }
99
133
  if (debug) {
100
- console.log(`[bw] fail: exit=${exitCode} ms=${Date.now() - startedAt}`);
134
+ console.log(`[bw] ok: ms=${Date.now() - startedAt}`);
101
135
  }
102
- const safeCmd = `${bwBin} ${safeRenderedArgs(finalArgs)}`;
103
- reject(new BwCliError(`${safeCmd} failed with exit code ${exitCode}`, {
104
- exitCode,
105
- stdout,
106
- stderr,
107
- }));
108
- return;
109
- }
110
- if (debug) {
111
- console.log(`[bw] ok: ms=${Date.now() - startedAt}`);
112
- }
113
- resolve({ stdout, stderr });
136
+ resolve({ stdout, stderr });
137
+ });
114
138
  });
115
139
  });
116
- return Promise.race([completed, timedOut]);
117
140
  }
@@ -50,12 +50,18 @@ export class BwSessionManager {
50
50
  keepaliveTimer = null;
51
51
  configuredHost = null;
52
52
  homeDir;
53
+ appDataDir;
53
54
  constructor(env) {
54
55
  this.env = env;
55
56
  this.homeDir = env.homeDir ?? process.env.HOME ?? '/data';
57
+ this.appDataDir = join(this.homeDir, '.bitwarden-cli');
56
58
  }
57
59
  baseEnv(extra) {
58
- return { HOME: this.homeDir, ...(extra ?? {}) };
60
+ return {
61
+ HOME: this.homeDir,
62
+ BITWARDENCLI_APPDATA_DIR: this.appDataDir,
63
+ ...(extra ?? {}),
64
+ };
59
65
  }
60
66
  // Must be called while holding `this.lock` (i.e. from within `withSession`).
61
67
  async getTemplateItemLocked(session) {
@@ -157,6 +163,7 @@ export class BwSessionManager {
157
163
  await runBw(['logout'], { env: this.baseEnv(), timeoutMs: 30_000 }).catch(() => { });
158
164
  const home = this.homeDir;
159
165
  const cliStateDirs = [
166
+ this.appDataDir,
160
167
  join(home, '.config', 'Bitwarden CLI'),
161
168
  join(home, 'Library', 'Application Support', 'Bitwarden CLI'),
162
169
  join(home, 'AppData', 'Roaming', 'Bitwarden CLI'),
@@ -35,6 +35,7 @@ export function registerTools(server, deps) {
35
35
  }
36
36
  const isReadOnly = parseBoolEnv('READONLY', 'KEYCHAIN_READONLY');
37
37
  const isNoReveal = parseBoolEnv('NOREVEAL', 'KEYCHAIN_NOREVEAL');
38
+ const textCompatMode = process.env.KEYCHAIN_TEXT_COMPAT_MODE?.trim().toLowerCase();
38
39
  function readonlyBlocked() {
39
40
  return {
40
41
  structuredContent: { ok: false, error: 'READONLY' },
@@ -55,6 +56,12 @@ export function registerTools(server, deps) {
55
56
  function toolResult(kind, value, revealed, extra) {
56
57
  return { result: { kind, value, revealed, ...(extra ?? {}) } };
57
58
  }
59
+ function toolTextContent(structuredContent, fallbackText) {
60
+ const text = textCompatMode === 'structured_json'
61
+ ? JSON.stringify(structuredContent)
62
+ : fallbackText;
63
+ return [{ type: 'text', text }];
64
+ }
58
65
  const uriMatchSchema = z.enum([
59
66
  'domain',
60
67
  'host',
@@ -166,7 +173,7 @@ export function registerTools(server, deps) {
166
173
  const encoded = await sdk.encode(input);
167
174
  return {
168
175
  structuredContent: encoded,
169
- content: [{ type: 'text', text: 'OK' }],
176
+ content: toolTextContent(encoded, 'OK'),
170
177
  };
171
178
  });
172
179
  registerTool(`${deps.toolPrefix}.generate`, {
@@ -193,9 +200,10 @@ export function registerTools(server, deps) {
193
200
  }, async (input, extra) => {
194
201
  const sdk = await deps.getSdk(extra.authInfo);
195
202
  const result = await sdk.generate(clampReveal(input));
203
+ const structuredContent = toolResult('generated', result.value, result.revealed);
196
204
  return {
197
- structuredContent: toolResult('generated', result.value, result.revealed),
198
- content: [{ type: 'text', text: 'OK' }],
205
+ structuredContent,
206
+ content: toolTextContent(structuredContent, 'OK'),
199
207
  };
200
208
  });
201
209
  registerTool(`${deps.toolPrefix}.generate_username`, {
@@ -221,9 +229,10 @@ export function registerTools(server, deps) {
221
229
  }, async (input, extra) => {
222
230
  const sdk = await deps.getSdk(extra.authInfo);
223
231
  const result = await sdk.generateUsername(clampReveal(input));
232
+ const structuredContent = toolResult('generated', result.value, result.revealed);
224
233
  return {
225
- structuredContent: toolResult('generated', result.value, result.revealed),
226
- content: [{ type: 'text', text: 'OK' }],
234
+ structuredContent,
235
+ content: toolTextContent(structuredContent, 'OK'),
227
236
  };
228
237
  });
229
238
  registerTool(`${deps.toolPrefix}.list_folders`, {
@@ -509,9 +518,10 @@ export function registerTools(server, deps) {
509
518
  const item = await sdk.getItem(input.id, {
510
519
  reveal: effectiveReveal(input),
511
520
  });
521
+ const structuredContent = { item };
512
522
  return {
513
- structuredContent: { item },
514
- content: [{ type: 'text', text: 'OK' }],
523
+ structuredContent,
524
+ content: toolTextContent(structuredContent, 'OK'),
515
525
  };
516
526
  });
517
527
  registerTool(`${deps.toolPrefix}.get_uri`, {
@@ -525,9 +535,10 @@ export function registerTools(server, deps) {
525
535
  }, async (input, extra) => {
526
536
  const sdk = await deps.getSdk(extra.authInfo);
527
537
  const uri = await sdk.getUri(input);
538
+ const structuredContent = toolResult('uri', uri.value, uri.revealed);
528
539
  return {
529
- structuredContent: toolResult('uri', uri.value, uri.revealed),
530
- content: [{ type: 'text', text: 'OK' }],
540
+ structuredContent,
541
+ content: toolTextContent(structuredContent, 'OK'),
531
542
  };
532
543
  });
533
544
  registerTool(`${deps.toolPrefix}.get_notes`, {
@@ -542,9 +553,10 @@ export function registerTools(server, deps) {
542
553
  }, async (input, extra) => {
543
554
  const sdk = await deps.getSdk(extra.authInfo);
544
555
  const notes = await sdk.getNotes({ term: input.term }, { reveal: effectiveReveal(input) });
556
+ const structuredContent = toolResult('notes', notes.value, notes.revealed);
545
557
  return {
546
- structuredContent: toolResult('notes', notes.value, notes.revealed),
547
- content: [{ type: 'text', text: 'OK' }],
558
+ structuredContent,
559
+ content: toolTextContent(structuredContent, 'OK'),
548
560
  };
549
561
  });
550
562
  registerTool(`${deps.toolPrefix}.get_exposed`, {
@@ -558,9 +570,10 @@ export function registerTools(server, deps) {
558
570
  }, async (input, extra) => {
559
571
  const sdk = await deps.getSdk(extra.authInfo);
560
572
  const exposed = await sdk.getExposed(input);
573
+ const structuredContent = toolResult('exposed', exposed.value, exposed.revealed);
561
574
  return {
562
- structuredContent: toolResult('exposed', exposed.value, exposed.revealed),
563
- content: [{ type: 'text', text: 'OK' }],
575
+ structuredContent,
576
+ content: toolTextContent(structuredContent, 'OK'),
564
577
  };
565
578
  });
566
579
  registerTool(`${deps.toolPrefix}.get_folder`, {
@@ -574,9 +587,10 @@ export function registerTools(server, deps) {
574
587
  }, async (input, extra) => {
575
588
  const sdk = await deps.getSdk(extra.authInfo);
576
589
  const folder = await sdk.getFolder(input);
590
+ const structuredContent = { folder };
577
591
  return {
578
- structuredContent: { folder },
579
- content: [{ type: 'text', text: 'OK' }],
592
+ structuredContent,
593
+ content: toolTextContent(structuredContent, 'OK'),
580
594
  };
581
595
  });
582
596
  registerTool(`${deps.toolPrefix}.get_collection`, {
@@ -591,9 +605,10 @@ export function registerTools(server, deps) {
591
605
  }, async (input, extra) => {
592
606
  const sdk = await deps.getSdk(extra.authInfo);
593
607
  const collection = await sdk.getCollection(input);
608
+ const structuredContent = { collection };
594
609
  return {
595
- structuredContent: { collection },
596
- content: [{ type: 'text', text: 'OK' }],
610
+ structuredContent,
611
+ content: toolTextContent(structuredContent, 'OK'),
597
612
  };
598
613
  });
599
614
  registerTool(`${deps.toolPrefix}.get_organization`, {
@@ -607,9 +622,10 @@ export function registerTools(server, deps) {
607
622
  }, async (input, extra) => {
608
623
  const sdk = await deps.getSdk(extra.authInfo);
609
624
  const organization = await sdk.getOrganization(input);
625
+ const structuredContent = { organization };
610
626
  return {
611
- structuredContent: { organization },
612
- content: [{ type: 'text', text: 'OK' }],
627
+ structuredContent,
628
+ content: toolTextContent(structuredContent, 'OK'),
613
629
  };
614
630
  });
615
631
  registerTool(`${deps.toolPrefix}.get_org_collection`, {
@@ -624,9 +640,10 @@ export function registerTools(server, deps) {
624
640
  }, async (input, extra) => {
625
641
  const sdk = await deps.getSdk(extra.authInfo);
626
642
  const collection = await sdk.getOrgCollection(input);
643
+ const structuredContent = { collection };
627
644
  return {
628
- structuredContent: { collection },
629
- content: [{ type: 'text', text: 'OK' }],
645
+ structuredContent,
646
+ content: toolTextContent(structuredContent, 'OK'),
630
647
  };
631
648
  });
632
649
  registerTool(`${deps.toolPrefix}.delete_item`, {
@@ -741,9 +758,10 @@ export function registerTools(server, deps) {
741
758
  }, async (input, extra) => {
742
759
  const sdk = await deps.getSdk(extra.authInfo);
743
760
  const attachment = await sdk.getAttachment(input);
761
+ const structuredContent = { attachment };
744
762
  return {
745
- structuredContent: { attachment },
746
- content: [{ type: 'text', text: 'OK' }],
763
+ structuredContent,
764
+ content: toolTextContent(structuredContent, 'OK'),
747
765
  };
748
766
  });
749
767
  registerTool(`${deps.toolPrefix}.send_list`, {
@@ -755,9 +773,10 @@ export function registerTools(server, deps) {
755
773
  }, async (_input, extra) => {
756
774
  const sdk = await deps.getSdk(extra.authInfo);
757
775
  const sends = await sdk.sendList();
776
+ const structuredContent = { sends };
758
777
  return {
759
- structuredContent: { sends },
760
- content: [{ type: 'text', text: 'OK' }],
778
+ structuredContent,
779
+ content: toolTextContent(structuredContent, 'OK'),
761
780
  };
762
781
  });
763
782
  registerTool(`${deps.toolPrefix}.send_template`, {
@@ -771,9 +790,10 @@ export function registerTools(server, deps) {
771
790
  }, async (input, extra) => {
772
791
  const sdk = await deps.getSdk(extra.authInfo);
773
792
  const template = await sdk.sendTemplate(input);
793
+ const structuredContent = { template };
774
794
  return {
775
- structuredContent: { template },
776
- content: [{ type: 'text', text: 'OK' }],
795
+ structuredContent,
796
+ content: toolTextContent(structuredContent, 'OK'),
777
797
  };
778
798
  });
779
799
  registerTool(`${deps.toolPrefix}.send_get`, {
@@ -789,9 +809,10 @@ export function registerTools(server, deps) {
789
809
  }, async (input, extra) => {
790
810
  const sdk = await deps.getSdk(extra.authInfo);
791
811
  const result = await sdk.sendGet(input);
812
+ const structuredContent = { result };
792
813
  return {
793
- structuredContent: { result },
794
- content: [{ type: 'text', text: 'OK' }],
814
+ structuredContent,
815
+ content: toolTextContent(structuredContent, 'OK'),
795
816
  };
796
817
  });
797
818
  registerTool(`${deps.toolPrefix}.send_create`, {
@@ -821,9 +842,10 @@ export function registerTools(server, deps) {
821
842
  return readonlyBlocked();
822
843
  const sdk = await deps.getSdk(extra.authInfo);
823
844
  const send = await sdk.sendCreate(input);
845
+ const structuredContent = { send };
824
846
  return {
825
- structuredContent: { send },
826
- content: [{ type: 'text', text: 'OK' }],
847
+ structuredContent,
848
+ content: toolTextContent(structuredContent, 'OK'),
827
849
  };
828
850
  });
829
851
  registerTool(`${deps.toolPrefix}.send_create_encoded`, {
@@ -852,9 +874,10 @@ export function registerTools(server, deps) {
852
874
  return readonlyBlocked();
853
875
  const sdk = await deps.getSdk(extra.authInfo);
854
876
  const send = await sdk.sendCreateEncoded(input);
877
+ const structuredContent = { send };
855
878
  return {
856
- structuredContent: { send },
857
- content: [{ type: 'text', text: 'OK' }],
879
+ structuredContent,
880
+ content: toolTextContent(structuredContent, 'OK'),
858
881
  };
859
882
  });
860
883
  registerTool(`${deps.toolPrefix}.send_edit`, {
@@ -876,9 +899,10 @@ export function registerTools(server, deps) {
876
899
  return readonlyBlocked();
877
900
  const sdk = await deps.getSdk(extra.authInfo);
878
901
  const send = await sdk.sendEdit(input);
902
+ const structuredContent = { send };
879
903
  return {
880
- structuredContent: { send },
881
- content: [{ type: 'text', text: 'OK' }],
904
+ structuredContent,
905
+ content: toolTextContent(structuredContent, 'OK'),
882
906
  };
883
907
  });
884
908
  registerTool(`${deps.toolPrefix}.send_remove_password`, {
@@ -898,9 +922,10 @@ export function registerTools(server, deps) {
898
922
  return readonlyBlocked();
899
923
  const sdk = await deps.getSdk(extra.authInfo);
900
924
  const result = await sdk.sendRemovePassword(input);
925
+ const structuredContent = { result };
901
926
  return {
902
- structuredContent: { result },
903
- content: [{ type: 'text', text: 'OK' }],
927
+ structuredContent,
928
+ content: toolTextContent(structuredContent, 'OK'),
904
929
  };
905
930
  });
906
931
  registerTool(`${deps.toolPrefix}.send_delete`, {
@@ -920,9 +945,10 @@ export function registerTools(server, deps) {
920
945
  return readonlyBlocked();
921
946
  const sdk = await deps.getSdk(extra.authInfo);
922
947
  const result = await sdk.sendDelete(input);
948
+ const structuredContent = { result };
923
949
  return {
924
- structuredContent: { result },
925
- content: [{ type: 'text', text: 'OK' }],
950
+ structuredContent,
951
+ content: toolTextContent(structuredContent, 'OK'),
926
952
  };
927
953
  });
928
954
  registerTool(`${deps.toolPrefix}.receive`, {
@@ -939,9 +965,10 @@ export function registerTools(server, deps) {
939
965
  }, async (input, extra) => {
940
966
  const sdk = await deps.getSdk(extra.authInfo);
941
967
  const result = await sdk.receive(input);
968
+ const structuredContent = { result };
942
969
  return {
943
- structuredContent: { result },
944
- content: [{ type: 'text', text: 'OK' }],
970
+ structuredContent,
971
+ content: toolTextContent(structuredContent, 'OK'),
945
972
  };
946
973
  });
947
974
  registerTool(`${deps.toolPrefix}.get_username`, {
@@ -955,9 +982,10 @@ export function registerTools(server, deps) {
955
982
  }, async (input, extra) => {
956
983
  const sdk = await deps.getSdk(extra.authInfo);
957
984
  const username = await sdk.getUsername(input);
985
+ const structuredContent = toolResult('username', username.value, username.revealed);
958
986
  return {
959
- structuredContent: toolResult('username', username.value, username.revealed),
960
- content: [{ type: 'text', text: 'OK' }],
987
+ structuredContent,
988
+ content: toolTextContent(structuredContent, 'OK'),
961
989
  };
962
990
  });
963
991
  registerTool(`${deps.toolPrefix}.get_password`, {
@@ -972,9 +1000,10 @@ export function registerTools(server, deps) {
972
1000
  }, async (input, extra) => {
973
1001
  const sdk = await deps.getSdk(extra.authInfo);
974
1002
  const password = await sdk.getPassword({ term: input.term }, { reveal: effectiveReveal(input) });
1003
+ const structuredContent = toolResult('password', password.value, password.revealed);
975
1004
  return {
976
- structuredContent: toolResult('password', password.value, password.revealed),
977
- content: [{ type: 'text', text: 'OK' }],
1005
+ structuredContent,
1006
+ content: toolTextContent(structuredContent, 'OK'),
978
1007
  };
979
1008
  });
980
1009
  registerTool(`${deps.toolPrefix}.get_totp`, {
@@ -989,12 +1018,13 @@ export function registerTools(server, deps) {
989
1018
  }, async (input, extra) => {
990
1019
  const sdk = await deps.getSdk(extra.authInfo);
991
1020
  const totp = await sdk.getTotp({ term: input.term }, { reveal: effectiveReveal(input) });
1021
+ const structuredContent = toolResult('totp', totp.value, totp.revealed, {
1022
+ period: totp.period,
1023
+ timeLeft: totp.timeLeft,
1024
+ });
992
1025
  return {
993
- structuredContent: toolResult('totp', totp.value, totp.revealed, {
994
- period: totp.period,
995
- timeLeft: totp.timeLeft,
996
- }),
997
- content: [{ type: 'text', text: 'OK' }],
1026
+ structuredContent,
1027
+ content: toolTextContent(structuredContent, 'OK'),
998
1028
  };
999
1029
  });
1000
1030
  registerTool(`${deps.toolPrefix}.get_password_history`, {
@@ -1011,9 +1041,10 @@ export function registerTools(server, deps) {
1011
1041
  const history = await sdk.getPasswordHistory(input.id, {
1012
1042
  reveal: effectiveReveal(input),
1013
1043
  });
1044
+ const structuredContent = toolResult('password_history', history.value, history.revealed);
1014
1045
  return {
1015
- structuredContent: toolResult('password_history', history.value, history.revealed),
1016
- content: [{ type: 'text', text: 'OK' }],
1046
+ structuredContent,
1047
+ content: toolTextContent(structuredContent, 'OK'),
1017
1048
  };
1018
1049
  });
1019
1050
  registerTool(`${deps.toolPrefix}.create_login`, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@icoretech/warden-mcp",
4
- "version": "0.2.7",
4
+ "version": "0.2.9",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "description": "Vaultwarden/Bitwarden MCP server backed by Bitwarden CLI (bw).",
@@ -52,12 +52,12 @@
52
52
  "@bitwarden/cli": "2026.3.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@biomejs/biome": "^2.4.10",
55
+ "@biomejs/biome": "^2.4.12",
56
56
  "@types/express": "^5.0.6",
57
- "@types/node": "^25.5.2",
57
+ "@types/node": "^25.6.0",
58
58
  "playwright": "1.59.1",
59
59
  "tsx": "^4.21.0",
60
- "typescript": "^6.0.2"
60
+ "typescript": "^6.0.3"
61
61
  },
62
62
  "publishConfig": {
63
63
  "registry": "https://registry.npmjs.org",