@icoretech/warden-mcp 0.2.1 → 0.2.3

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
@@ -280,6 +280,49 @@ This shared-server mode is useful when:
280
280
  - you are integrating from a custom client or agent host that can attach HTTP headers
281
281
  - you want one always-on service instead of each editor spawning its own `bw`-backed subprocess
282
282
 
283
+ #### Headerless SSE clients (`claude.ai` web, similar hosts)
284
+
285
+ Some web MCP hosts can connect to a Streamable HTTP / SSE endpoint but cannot
286
+ attach custom `X-BW-*` headers. In that case, run `warden-mcp` as a
287
+ single-tenant shared server with fixed server-side credentials and explicit env
288
+ fallback enabled:
289
+
290
+ ```bash
291
+ BW_HOST=https://vaultwarden.example.com \
292
+ BW_CLIENTID=user.xxxxx \
293
+ BW_CLIENTSECRET=xxxxx \
294
+ BW_PASSWORD='your-master-password' \
295
+ KEYCHAIN_ALLOW_ENV_FALLBACK=true \
296
+ npx -y @icoretech/warden-mcp@latest
297
+ ```
298
+
299
+ Some hosted or browser-based MCP clients expect the server URL to be available
300
+ over **HTTPS** rather than plain `http://localhost:3005/...`.
301
+
302
+ If you are running `warden-mcp` locally, that usually means putting one of
303
+ these in front of it:
304
+
305
+ - a local HTTPS reverse proxy in front of `warden-mcp`
306
+ - a temporary tunnel such as Cloudflare Tunnel, ngrok, or Tailscale Funnel
307
+
308
+ Then point the client at the HTTPS endpoint, for example:
309
+
310
+ ```text
311
+ https://warden-mcp.example.com/sse?v=2
312
+ ```
313
+
314
+ This works because headerless HTTP requests can inherit the server's own
315
+ `BW_*` configuration when `KEYCHAIN_ALLOW_ENV_FALLBACK=true`. You can use
316
+ `BW_USER` + `BW_PASSWORD` here as well; the example above shows the API-key
317
+ variant because it is the default convention used elsewhere in this README.
318
+
319
+ Important limits:
320
+
321
+ - this is single-tenant only: every headerless client gets the same vault identity
322
+ - per-request profile switching does not work in this mode
323
+ - if a client can send `X-BW-*` headers, those headers still take priority over the server env
324
+ - anyone who can reach that endpoint inherits that vault access, so keep it behind trusted network access, VPN, tunnel access policies, IP allowlists, or another private boundary
325
+
283
326
  Client examples for shared HTTP mode:
284
327
 
285
328
  ```bash
@@ -484,6 +527,8 @@ npm run dev
484
527
  Vault/session:
485
528
 
486
529
  - `keychain_status`
530
+ - `keychain_sync` (pull latest vault data from server via `bw sync`)
531
+ - `keychain_sdk_version` (returns the Bitwarden SDK version used by the CLI)
487
532
  - `keychain_encode` (base64-encode a string via `bw encode`)
488
533
  - `keychain_generate` (returns a generated secret only when `reveal: true`)
489
534
 
package/bin/warden-mcp.js CHANGED
@@ -8,24 +8,30 @@ import { fileURLToPath } from 'node:url';
8
8
 
9
9
  const __dirname = dirname(fileURLToPath(import.meta.url));
10
10
 
11
- const startupPath = resolve(__dirname, '../dist/startup/bwStartup.js');
12
- if (!existsSync(startupPath)) {
13
- console.error(
14
- '[warden-mcp] ERROR: dist/startup/bwStartup.js not found. Run `npm run build` first.',
15
- );
16
- process.exit(1);
17
- }
18
- const { prepareBwStartup } = await import(startupPath);
19
- prepareBwStartup(process.env);
11
+ async function main() {
12
+ const startupPath = resolve(__dirname, '../dist/startup/bwStartup.js');
13
+ if (!existsSync(startupPath)) {
14
+ console.error(
15
+ '[warden-mcp] ERROR: dist/startup/bwStartup.js not found. Run `npm run build` first.',
16
+ );
17
+ process.exit(1);
18
+ }
19
+ const { prepareBwStartup } = await import(startupPath);
20
+ prepareBwStartup(process.env);
21
+
22
+ // Delegate to the compiled server entry, forwarding all arguments.
23
+ const serverPath = resolve(__dirname, '../dist/server.js');
24
+ if (!existsSync(serverPath)) {
25
+ console.error(
26
+ '[warden-mcp] ERROR: dist/server.js not found. Run `npm run build` first.',
27
+ );
28
+ process.exit(1);
29
+ }
20
30
 
21
- // Delegate to the compiled server entry, forwarding all arguments.
22
- const serverPath = resolve(__dirname, '../dist/server.js');
23
- if (!existsSync(serverPath)) {
24
- console.error(
25
- '[warden-mcp] ERROR: dist/server.js not found. Run `npm run build` first.',
26
- );
27
- process.exit(1);
31
+ await import(serverPath);
28
32
  }
29
33
 
30
- // Use dynamic import to run the server module (it has top-level await).
31
- await import(serverPath);
34
+ void main().catch((error) => {
35
+ console.error(error);
36
+ process.exitCode = 1;
37
+ });
@@ -300,6 +300,23 @@ export class KeychainSdk {
300
300
  async status() {
301
301
  return this.bw.status();
302
302
  }
303
+ async sync() {
304
+ await this.bw.withSession(async (session) => {
305
+ await this.bw.runForSession(session, ['sync'], { timeoutMs: 120_000 });
306
+ });
307
+ // After sync, fetch status to get the lastSync timestamp.
308
+ const status = (await this.bw.status());
309
+ const lastSync = typeof status.lastSync === 'string' ? status.lastSync : null;
310
+ return { success: true, lastSync };
311
+ }
312
+ async sdkVersion() {
313
+ const { stdout } = await this.bw.withSession(async (session) => {
314
+ return this.bw.runForSession(session, ['--version'], {
315
+ timeoutMs: 30_000,
316
+ });
317
+ });
318
+ return { version: stdout.trim() };
319
+ }
303
320
  async encode(input) {
304
321
  // `bw encode` base64-encodes stdin.
305
322
  const { stdout } = await this.bw.withSession(async (session) => {
package/dist/server.js CHANGED
@@ -10,10 +10,11 @@ const { values } = parseArgs({
10
10
  strict: false,
11
11
  });
12
12
  const useStdio = values.stdio === true || process.env.WARDEN_MCP_STDIO === 'true';
13
- if (useStdio) {
14
- await runStdioTransport();
15
- }
16
- else {
13
+ async function main() {
14
+ if (useStdio) {
15
+ await runStdioTransport();
16
+ return;
17
+ }
17
18
  const PORT = Number.parseInt(process.env.PORT ?? '3005', 10);
18
19
  const app = createKeychainApp();
19
20
  const server = app.listen(PORT, () => {
@@ -24,3 +25,7 @@ else {
24
25
  server.once('error', reject);
25
26
  });
26
27
  }
28
+ void main().catch((error) => {
29
+ console.error(error);
30
+ process.exitCode = 1;
31
+ });
@@ -110,6 +110,41 @@ export function registerTools(server, deps) {
110
110
  content: [{ type: 'text', text: summary }],
111
111
  };
112
112
  });
113
+ registerTool(`${deps.toolPrefix}.sync`, {
114
+ title: 'Sync Vault',
115
+ description: 'Pull the latest vault data from the server (bw sync). Returns the last sync timestamp.',
116
+ annotations: { readOnlyHint: true },
117
+ inputSchema: {},
118
+ _meta: toolMeta,
119
+ }, async (_input, extra) => {
120
+ const sdk = await deps.getSdk(extra.authInfo);
121
+ const result = await sdk.sync();
122
+ return {
123
+ structuredContent: result,
124
+ content: [
125
+ {
126
+ type: 'text',
127
+ text: result.lastSync
128
+ ? `Synced. Last sync: ${result.lastSync}`
129
+ : 'Synced.',
130
+ },
131
+ ],
132
+ };
133
+ });
134
+ registerTool(`${deps.toolPrefix}.sdk_version`, {
135
+ title: 'SDK Version',
136
+ description: 'Returns the Bitwarden SDK version used by the CLI.',
137
+ annotations: { readOnlyHint: true },
138
+ inputSchema: {},
139
+ _meta: toolMeta,
140
+ }, async (_input, extra) => {
141
+ const sdk = await deps.getSdk(extra.authInfo);
142
+ const result = await sdk.sdkVersion();
143
+ return {
144
+ structuredContent: result,
145
+ content: [{ type: 'text', text: result.version }],
146
+ };
147
+ });
113
148
  registerTool(`${deps.toolPrefix}.encode`, {
114
149
  title: 'Encode',
115
150
  description: 'Base64-encode a string (bw encode).',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@icoretech/warden-mcp",
4
- "version": "0.2.1",
4
+ "version": "0.2.3",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "description": "Vaultwarden/Bitwarden MCP server backed by Bitwarden CLI (bw).",
@@ -59,13 +59,13 @@
59
59
  "@types/node": "^25.5.0",
60
60
  "playwright": "1.58.2",
61
61
  "tsx": "^4.21.0",
62
- "typescript": "^5.9.3"
62
+ "typescript": "^6.0.2"
63
63
  },
64
64
  "publishConfig": {
65
65
  "registry": "https://registry.npmjs.org",
66
66
  "access": "public"
67
67
  },
68
68
  "engines": {
69
- "node": ">=24.14.0"
69
+ "node": ">=24"
70
70
  }
71
71
  }