@icoretech/warden-mcp 0.2.21 → 0.2.23
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 +56 -3
- package/dist/tools/registerTools.js +15 -0
- 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
|
@@ -115,6 +115,30 @@ function isSshKeyItem(item) {
|
|
|
115
115
|
.filter((n) => typeof n === 'string'));
|
|
116
116
|
return names.has('public_key') && names.has('private_key');
|
|
117
117
|
}
|
|
118
|
+
function stringValueMatches(value, needle) {
|
|
119
|
+
return typeof value === 'string' && value.toLowerCase().includes(needle);
|
|
120
|
+
}
|
|
121
|
+
function itemMatchesSearchText(item, term) {
|
|
122
|
+
const needle = term.trim().toLowerCase();
|
|
123
|
+
if (needle.length === 0)
|
|
124
|
+
return true;
|
|
125
|
+
if (stringValueMatches(item.name, needle))
|
|
126
|
+
return true;
|
|
127
|
+
const login = item.login;
|
|
128
|
+
if (!login || typeof login !== 'object')
|
|
129
|
+
return false;
|
|
130
|
+
const loginRec = login;
|
|
131
|
+
if (stringValueMatches(loginRec.username, needle))
|
|
132
|
+
return true;
|
|
133
|
+
const uris = loginRec.uris;
|
|
134
|
+
if (!Array.isArray(uris))
|
|
135
|
+
return false;
|
|
136
|
+
return uris.some((rawUri) => {
|
|
137
|
+
if (!rawUri || typeof rawUri !== 'object')
|
|
138
|
+
return false;
|
|
139
|
+
return stringValueMatches(rawUri.uri, needle);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
118
142
|
export class AmbiguousLoginLookupError extends Error {
|
|
119
143
|
candidates;
|
|
120
144
|
constructor(message, candidates) {
|
|
@@ -711,7 +735,11 @@ export class KeychainSdk {
|
|
|
711
735
|
// NOTE: bw's `--search` does not treat "a | b" as "a OR b". If callers pass
|
|
712
736
|
// a pipe-delimited string (common when combining name + username), we split
|
|
713
737
|
// and union the results.
|
|
714
|
-
const terms =
|
|
738
|
+
const terms = input.url
|
|
739
|
+
? [undefined]
|
|
740
|
+
: tokens.length
|
|
741
|
+
? tokens
|
|
742
|
+
: [undefined];
|
|
715
743
|
const byId = new Map();
|
|
716
744
|
for (const term of terms) {
|
|
717
745
|
const args = [...baseArgs];
|
|
@@ -731,7 +759,17 @@ export class KeychainSdk {
|
|
|
731
759
|
}
|
|
732
760
|
return [...byId.values()];
|
|
733
761
|
});
|
|
734
|
-
const
|
|
762
|
+
const textFiltered = input.url
|
|
763
|
+
? items.filter((raw) => {
|
|
764
|
+
if (tokens.length === 0)
|
|
765
|
+
return true;
|
|
766
|
+
if (!raw || typeof raw !== 'object')
|
|
767
|
+
return false;
|
|
768
|
+
const item = raw;
|
|
769
|
+
return tokens.some((term) => itemMatchesSearchText(item, term));
|
|
770
|
+
})
|
|
771
|
+
: items;
|
|
772
|
+
const orgFiltered = textFiltered.filter((raw) => {
|
|
735
773
|
if (!raw || typeof raw !== 'object')
|
|
736
774
|
return false;
|
|
737
775
|
const item = raw;
|
|
@@ -741,6 +779,9 @@ export class KeychainSdk {
|
|
|
741
779
|
if (orgFilter === 'notnull') {
|
|
742
780
|
return typeof item.organizationId === 'string' && item.organizationId;
|
|
743
781
|
}
|
|
782
|
+
if (typeof orgId === 'string') {
|
|
783
|
+
return item.organizationId === orgId;
|
|
784
|
+
}
|
|
744
785
|
return true;
|
|
745
786
|
});
|
|
746
787
|
const folderFiltered = orgFiltered.filter((raw) => {
|
|
@@ -753,9 +794,21 @@ export class KeychainSdk {
|
|
|
753
794
|
if (folderFilter === 'notnull') {
|
|
754
795
|
return typeof item.folderId === 'string' && item.folderId;
|
|
755
796
|
}
|
|
797
|
+
if (typeof folderId === 'string') {
|
|
798
|
+
return item.folderId === folderId;
|
|
799
|
+
}
|
|
756
800
|
return true;
|
|
757
801
|
});
|
|
758
|
-
const
|
|
802
|
+
const collectionFiltered = folderFiltered.filter((raw) => {
|
|
803
|
+
if (!input.collectionId)
|
|
804
|
+
return true;
|
|
805
|
+
if (!raw || typeof raw !== 'object')
|
|
806
|
+
return false;
|
|
807
|
+
const item = raw;
|
|
808
|
+
return (Array.isArray(item.collectionIds) &&
|
|
809
|
+
item.collectionIds.includes(input.collectionId));
|
|
810
|
+
});
|
|
811
|
+
const filtered = collectionFiltered.filter((raw) => {
|
|
759
812
|
if (!raw || typeof raw !== 'object')
|
|
760
813
|
return false;
|
|
761
814
|
const item = raw;
|
|
@@ -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];
|
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.23",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Vaultwarden/Bitwarden MCP server backed by Bitwarden CLI (bw).",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@biomejs/biome": "^2.4.16",
|
|
56
56
|
"@types/express": "^5.0.6",
|
|
57
|
-
"@types/node": "^25.9.
|
|
57
|
+
"@types/node": "^25.9.2",
|
|
58
58
|
"playwright": "1.60.0",
|
|
59
|
-
"tsx": "^4.22.
|
|
59
|
+
"tsx": "^4.22.4",
|
|
60
60
|
"typescript": "^6.0.3"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|