@icoretech/warden-mcp 0.1.9 → 0.1.12
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 +5 -5
- package/bin/warden-mcp.js +7 -7
- package/dist/bw/bwCli.js +4 -3
- package/dist/bw/bwSession.js +3 -2
- package/dist/bw/resolveBwBin.js +10 -0
- package/dist/sdk/usernameGenerator.js +25 -27
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ docker run --rm -p 3005:3005 ghcr.io/icoretech/warden-mcp
|
|
|
121
121
|
### Global install
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
|
-
npm install -g @icoretech/warden-mcp
|
|
124
|
+
npm install -g @icoretech/warden-mcp@latest
|
|
125
125
|
warden-mcp
|
|
126
126
|
```
|
|
127
127
|
|
|
@@ -130,7 +130,7 @@ warden-mcp
|
|
|
130
130
|
For local MCP hosts, stdio is the most portable option.
|
|
131
131
|
|
|
132
132
|
```bash
|
|
133
|
-
npx -y @icoretech/warden-mcp --stdio
|
|
133
|
+
npx -y @icoretech/warden-mcp@latest --stdio
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
The examples below use Bitwarden API-key auth. If you prefer username/password login, replace `BW_CLIENTID` + `BW_CLIENTSECRET` with `BW_USER`.
|
|
@@ -146,10 +146,10 @@ codex mcp add warden \
|
|
|
146
146
|
--env BW_CLIENTID=user.xxxxx \
|
|
147
147
|
--env BW_CLIENTSECRET=xxxxx \
|
|
148
148
|
--env BW_PASSWORD='your-master-password' \
|
|
149
|
-
-- npx -y @icoretech/warden-mcp --stdio
|
|
149
|
+
-- npx -y @icoretech/warden-mcp@latest --stdio
|
|
150
150
|
|
|
151
151
|
# Claude Code
|
|
152
|
-
claude mcp add-json warden '{"command":"npx","args":["-y","@icoretech/warden-mcp","--stdio"],"env":{"BW_HOST":"https://vaultwarden.example.com","BW_CLIENTID":"user.xxxxx","BW_CLIENTSECRET":"xxxxx","BW_PASSWORD":"your-master-password"}}'
|
|
152
|
+
claude mcp add-json warden '{"command":"npx","args":["-y","@icoretech/warden-mcp@latest","--stdio"],"env":{"BW_HOST":"https://vaultwarden.example.com","BW_CLIENTID":"user.xxxxx","BW_CLIENTSECRET":"xxxxx","BW_PASSWORD":"your-master-password"}}'
|
|
153
153
|
|
|
154
154
|
# Qwen Code
|
|
155
155
|
qwen mcp add warden \
|
|
@@ -157,7 +157,7 @@ qwen mcp add warden \
|
|
|
157
157
|
-e BW_CLIENTID=user.xxxxx \
|
|
158
158
|
-e BW_CLIENTSECRET=xxxxx \
|
|
159
159
|
-e BW_PASSWORD=your-master-password \
|
|
160
|
-
npx -y @icoretech/warden-mcp --stdio
|
|
160
|
+
npx -y @icoretech/warden-mcp@latest --stdio
|
|
161
161
|
```
|
|
162
162
|
|
|
163
163
|
### JSON config hosts
|
package/bin/warden-mcp.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
// bin/warden-mcp.js — CLI entry for @icoretech/warden-mcp
|
|
4
4
|
|
|
5
5
|
import { spawnSync } from 'node:child_process';
|
|
6
|
-
import { accessSync, constants, existsSync } from 'node:fs';
|
|
6
|
+
import { accessSync, constants, existsSync, readFileSync } from 'node:fs';
|
|
7
7
|
import { createRequire } from 'node:module';
|
|
8
|
-
import { dirname,
|
|
8
|
+
import { dirname, resolve } from 'node:path';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
10
|
|
|
11
11
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -14,12 +14,12 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
14
14
|
if (!process.env.BW_BIN) {
|
|
15
15
|
try {
|
|
16
16
|
const require = createRequire(import.meta.url);
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const { resolveBundledBwCandidate } = await import(
|
|
18
|
+
resolve(__dirname, '../dist/bw/resolveBwBin.js')
|
|
19
|
+
);
|
|
19
20
|
const pkgManifest = require.resolve('@bitwarden/cli/package.json');
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const candidate = join(pkgDir, 'dist', 'bw');
|
|
21
|
+
const pkgJson = JSON.parse(readFileSync(pkgManifest, 'utf8'));
|
|
22
|
+
const candidate = resolveBundledBwCandidate(pkgManifest, pkgJson.bin);
|
|
23
23
|
if (existsSync(candidate)) {
|
|
24
24
|
try {
|
|
25
25
|
accessSync(candidate, constants.X_OK);
|
package/dist/bw/bwCli.js
CHANGED
|
@@ -16,9 +16,10 @@ export async function runBw(args, opts = {}) {
|
|
|
16
16
|
const bwBin = process.env.BW_BIN ?? 'bw';
|
|
17
17
|
// Ensure the CLI never blocks waiting for a prompt (e.g. master password).
|
|
18
18
|
// This is critical for running as an MCP server / in test automation.
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const injectNoInteraction = opts.noInteraction ?? true;
|
|
20
|
+
const finalArgs = injectNoInteraction && !args.includes('--nointeraction')
|
|
21
|
+
? ['--nointeraction', ...args]
|
|
22
|
+
: args;
|
|
22
23
|
const env = { ...process.env, ...(opts.env ?? {}) };
|
|
23
24
|
const debug = (process.env.KEYCHAIN_DEBUG_BW ?? 'false').toLowerCase() === 'true';
|
|
24
25
|
const startedAt = Date.now();
|
package/dist/bw/bwSession.js
CHANGED
|
@@ -169,7 +169,7 @@ export class BwSessionManager {
|
|
|
169
169
|
});
|
|
170
170
|
const tryUnlock = async () => {
|
|
171
171
|
try {
|
|
172
|
-
const { stdout } = await runBw(['unlock', '--passwordenv', 'BW_PASSWORD', '--raw'], { env: unlockEnv, timeoutMs: 60_000 });
|
|
172
|
+
const { stdout } = await runBw(['unlock', '--passwordenv', 'BW_PASSWORD', '--raw'], { env: unlockEnv, timeoutMs: 60_000, noInteraction: false });
|
|
173
173
|
return stdout.trim();
|
|
174
174
|
}
|
|
175
175
|
catch {
|
|
@@ -186,6 +186,7 @@ export class BwSessionManager {
|
|
|
186
186
|
BW_HOST: this.env.host,
|
|
187
187
|
}),
|
|
188
188
|
timeoutMs: 60_000,
|
|
189
|
+
noInteraction: false,
|
|
189
190
|
});
|
|
190
191
|
return stdout.trim();
|
|
191
192
|
}
|
|
@@ -195,7 +196,7 @@ export class BwSessionManager {
|
|
|
195
196
|
'--passwordenv',
|
|
196
197
|
'BW_PASSWORD',
|
|
197
198
|
'--raw',
|
|
198
|
-
], { env: unlockEnv, timeoutMs: 60_000 });
|
|
199
|
+
], { env: unlockEnv, timeoutMs: 60_000, noInteraction: false });
|
|
199
200
|
return stdout.trim();
|
|
200
201
|
}
|
|
201
202
|
catch {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { dirname, join } from 'node:path';
|
|
2
|
+
export function resolveBundledBwCandidate(pkgManifestPath, pkgBin) {
|
|
3
|
+
const pkgDir = dirname(pkgManifestPath);
|
|
4
|
+
const binEntry = typeof pkgBin === 'string'
|
|
5
|
+
? pkgBin
|
|
6
|
+
: typeof pkgBin?.bw === 'string'
|
|
7
|
+
? pkgBin.bw
|
|
8
|
+
: 'dist/bw';
|
|
9
|
+
return join(pkgDir, binEntry);
|
|
10
|
+
}
|
|
@@ -63,35 +63,34 @@ const CODAS = [
|
|
|
63
63
|
'ng',
|
|
64
64
|
];
|
|
65
65
|
function titleCase(s) {
|
|
66
|
-
|
|
67
|
-
return s;
|
|
68
|
-
const first = s.charAt(0);
|
|
69
|
-
return first.toUpperCase() + s.slice(1);
|
|
66
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
70
67
|
}
|
|
71
68
|
function randomWord(opts, deps) {
|
|
72
69
|
// "Word-like" usernames without pulling a large word list dependency.
|
|
73
70
|
// Produces a pronounceable-ish token such as "cravon" or "Plenast7".
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
// With the current arrays, minimum output is 4 chars ("baba") and maximum
|
|
72
|
+
// is ~14 chars, so the length check always passes on the first iteration.
|
|
73
|
+
const syllables = 2 + deps.randInt(2); // 2-3
|
|
74
|
+
let s = '';
|
|
75
|
+
for (let j = 0; j < syllables; j++) {
|
|
76
|
+
const onset = ONSETS[deps.randInt(ONSETS.length)];
|
|
77
|
+
const vowel = VOWELS[deps.randInt(VOWELS.length)];
|
|
78
|
+
const coda = CODAS[deps.randInt(CODAS.length)];
|
|
79
|
+
s += onset;
|
|
80
|
+
s += vowel;
|
|
81
|
+
// Avoid overly long tokens by preferring empty coda on earlier syllables.
|
|
82
|
+
if (j === syllables - 1) {
|
|
83
|
+
s += coda;
|
|
84
|
+
}
|
|
85
|
+
else if (coda.length <= 1) {
|
|
86
|
+
s += coda;
|
|
83
87
|
}
|
|
84
|
-
if (s.length < 4 || s.length > 18)
|
|
85
|
-
continue;
|
|
86
|
-
if (opts.capitalize)
|
|
87
|
-
s = titleCase(s);
|
|
88
|
-
if (opts.includeNumber)
|
|
89
|
-
s += String(deps.randInt(10));
|
|
90
|
-
return s;
|
|
91
88
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
if (opts.capitalize)
|
|
90
|
+
s = titleCase(s);
|
|
91
|
+
if (opts.includeNumber)
|
|
92
|
+
s += String(deps.randInt(10));
|
|
93
|
+
return s;
|
|
95
94
|
}
|
|
96
95
|
function parseEmail(email) {
|
|
97
96
|
const trimmed = email.trim();
|
|
@@ -126,7 +125,7 @@ export function generateUsername(input = {}, deps) {
|
|
|
126
125
|
throw new Error('email is required for plus_addressed_email');
|
|
127
126
|
}
|
|
128
127
|
const { local, domain } = parseEmail(input.email);
|
|
129
|
-
const baseLocal = local.split('+')[0]
|
|
128
|
+
const baseLocal = local.split('+')[0];
|
|
130
129
|
return `${baseLocal}+${word}@${domain}`;
|
|
131
130
|
}
|
|
132
131
|
if (type === 'catch_all_email') {
|
|
@@ -136,7 +135,6 @@ export function generateUsername(input = {}, deps) {
|
|
|
136
135
|
const domain = normalizeDomain(input.domain);
|
|
137
136
|
return `${word}@${domain}`;
|
|
138
137
|
}
|
|
139
|
-
// Exhaustive check.
|
|
140
|
-
|
|
141
|
-
return _never;
|
|
138
|
+
// Exhaustive check — TypeScript errors here if a new type is added without a handler.
|
|
139
|
+
throw new Error(`Unsupported username generator type: ${type}`);
|
|
142
140
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@icoretech/warden-mcp",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.12",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Vaultwarden/Bitwarden MCP server backed by Bitwarden CLI (bw).",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"build": "tsc -p .",
|
|
38
38
|
"start": "node dist/server.js",
|
|
39
39
|
"test": "npm run build && node --test \"dist/**/*.test.js\"",
|
|
40
|
+
"test:coverage": "npm run build && node --test --experimental-test-coverage \"dist/**/*.test.js\"",
|
|
40
41
|
"test:integration": "npm run build && node --test --test-timeout=45000 \"dist/integration/**/*.test.js\"",
|
|
41
42
|
"test:session-regression": "node scripts/session-flood-regression.mjs",
|
|
42
43
|
"lint": "biome check --write --assist-enabled=true . && tsc --noEmit"
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"zod": "^4.3.6"
|
|
48
49
|
},
|
|
49
50
|
"optionalDependencies": {
|
|
50
|
-
"@bitwarden/cli": "2026.
|
|
51
|
+
"@bitwarden/cli": "2026.1.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@biomejs/biome": "^2.4.8",
|