@yawlabs/mcp 0.71.0 → 0.73.0

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.
Files changed (2) hide show
  1. package/dist/index.js +148 -37
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1421,7 +1421,9 @@ function renderList(print) {
1421
1421
  function renderMatch(match, installed, print) {
1422
1422
  const installedList = installed.length === 0 ? "(none)" : installed.slice().sort().join(", ");
1423
1423
  const serverWord = installed.length === 1 ? "server" : "servers";
1424
- print(`Checked ${CURATED_BUNDLES.length} bundles against ${installed.length} enabled ${serverWord}: ${installedList}`);
1424
+ print(
1425
+ `Checked ${CURATED_BUNDLES.length} bundles against ${installed.length} enabled ${serverWord}: ${installedList}`
1426
+ );
1425
1427
  print("");
1426
1428
  if (match.ready.length === 0 && match.partial.length === 0) {
1427
1429
  print("No curated bundles match your current config.");
@@ -1522,7 +1524,7 @@ var SUBCOMMAND_SPEC = [
1522
1524
  name: "secrets",
1523
1525
  description: "Manage stored secrets",
1524
1526
  positional: [["set", "get", "list", "remove", "lock", "rotate", "audit"], ["<name>"]],
1525
- flags: ["--value", "--stdin", "--secret", "--server", "--json", "--help"]
1527
+ flags: ["--value", "--stdin", "--force", "--secret", "--server", "--json", "--help"]
1526
1528
  },
1527
1529
  // Other.
1528
1530
  { name: "audit", description: "Run a full-pass audit of loaded servers", flags: ["--json", "--help"] },
@@ -1711,7 +1713,7 @@ function renderPowershell() {
1711
1713
  const caseBranches = SUBCOMMAND_SPEC.map((spec) => {
1712
1714
  const flags = spec.flags.map((f) => `'${f}'`).join(", ");
1713
1715
  const positionalLines = realPositionals(spec).map(
1714
- ({ candidates, index }) => ` if ($tokens.Count -eq ${index + 2}) { $completions += @(${candidates.map((c) => `'${c}'`).join(", ")}) }`
1716
+ ({ candidates, index }) => ` if ($argIndex -eq ${index}) { $completions += @(${candidates.map((c) => `'${c}'`).join(", ")}) }`
1715
1717
  ).join("\n");
1716
1718
  const positionalBlock = positionalLines ? `${positionalLines}
1717
1719
  ` : "";
@@ -1723,9 +1725,17 @@ ${positionalBlock} $completions += @(${flags})
1723
1725
  # Install: append this script to your profile ($PROFILE) and reload.
1724
1726
  Register-ArgumentCompleter -CommandName yaw-mcp -ScriptBlock {
1725
1727
  param($wordToComplete, $commandAst, $cursorPosition)
1726
- $tokens = $commandAst.CommandElements | ForEach-Object { $_.ToString() }
1728
+ $tokens = @($commandAst.CommandElements | ForEach-Object { $_.ToString() })
1727
1729
  $completions = @()
1728
- if ($tokens.Count -le 2) {
1730
+ # $argIndex is the normalized index of the positional being completed: 0 is
1731
+ # the first argument AFTER the subcommand. $tokens[0] is "yaw-mcp" and
1732
+ # $tokens[1] is the subcommand, hence -2. A partially typed word is already
1733
+ # one of $tokens, so back off one more when $wordToComplete is non-empty --
1734
+ # that keeps "install <TAB>" and "install cl<TAB>" both on slot 0. Negative
1735
+ # means the user is still on the subcommand itself.
1736
+ $argIndex = $tokens.Count - 2
1737
+ if ($wordToComplete -ne '') { $argIndex-- }
1738
+ if ($argIndex -lt 0) {
1729
1739
  $completions = @(${subcommandNames}, '--help', '-h', '--version', '-V')
1730
1740
  } else {
1731
1741
  switch ($tokens[1]) {
@@ -1807,6 +1817,20 @@ function quoteForShell(arg, platform) {
1807
1817
  if (arg.includes("'")) return null;
1808
1818
  return `'${arg}'`;
1809
1819
  }
1820
+ function unquotableCharsFor(platform) {
1821
+ return platform === "win32" ? "double quotes, percent signs, newlines or NUL bytes" : "single quotes, newlines or NUL bytes";
1822
+ }
1823
+ function formatLaunchFailure(npxArgs, platform = process.platform) {
1824
+ const offender = npxArgs.find((a) => quoteForShell(a, platform) === null);
1825
+ const detail = offender === void 0 ? "and the target arguments cannot be safely quoted for a shell fallback.\n" : (
1826
+ // JSON.stringify so a newline / NUL in the argument is shown escaped
1827
+ // instead of mangling the diagnostic it appears in.
1828
+ `and this argument cannot be safely quoted for a shell fallback: ${JSON.stringify(offender)}
1829
+ `
1830
+ );
1831
+ return "\nFailed to launch mcp-compliance: npm's npx-cli.js was not found next to this node binary,\n" + detail + `Install npm, or pass a target without ${unquotableCharsFor(platform)}.
1832
+ `;
1833
+ }
1810
1834
  function resolveNpxLaunch(npxArgs, opts = {}) {
1811
1835
  const execPath = opts.execPath ?? process.execPath;
1812
1836
  const platform = opts.platform ?? process.platform;
@@ -1866,9 +1890,7 @@ function runTest(args, err) {
1866
1890
  const npxArgs = ["-y", "@yawlabs/mcp-compliance", "test", "--format", "json", ...args];
1867
1891
  const launch = resolveNpxLaunch(npxArgs);
1868
1892
  if (!launch) {
1869
- fail(
1870
- "\nFailed to launch mcp-compliance: npm's npx-cli.js was not found next to this node binary,\nand the target arguments cannot be safely quoted for a shell fallback. Install npm, or pass\na target without quotes / newlines.\n"
1871
- );
1893
+ fail(formatLaunchFailure(npxArgs));
1872
1894
  return;
1873
1895
  }
1874
1896
  let child;
@@ -4528,7 +4550,7 @@ async function runUpgrade(opts = {}) {
4528
4550
  return { exitCode: 3, lines };
4529
4551
  }
4530
4552
  function readCurrentVersion() {
4531
- return true ? "0.71.0" : "dev";
4553
+ return true ? "0.73.0" : "dev";
4532
4554
  }
4533
4555
 
4534
4556
  // src/learning.ts
@@ -4730,7 +4752,7 @@ function selectFlakyNamespaces(entries, limit) {
4730
4752
  }
4731
4753
 
4732
4754
  // src/doctor-cmd.ts
4733
- var VERSION = true ? "0.71.0" : "dev";
4755
+ var VERSION = true ? "0.73.0" : "dev";
4734
4756
  function isPersistenceDisabled(env) {
4735
4757
  const raw = env.YAW_MCP_DISABLE_PERSISTENCE;
4736
4758
  return raw !== void 0 && raw !== "" && (raw === "1" || raw.toLowerCase() === "true");
@@ -6639,14 +6661,19 @@ var SECRETS_USAGE = `Usage: yaw-mcp secrets <action> [args]
6639
6661
  Actions:
6640
6662
  set <name> Store a secret. Reads value from stdin (one
6641
6663
  line, no echo). Override with --value <v> or
6642
- --stdin (raw, multi-line) for scripting.
6664
+ --stdin (raw, multi-line) for scripting. Setting
6665
+ a name that already exists REPLACES it (confirmed
6666
+ first on a TTY; scripted runs proceed and say
6667
+ "Replaced" instead of "Stored").
6643
6668
  get <name> Decrypt and print one secret value to stdout.
6644
6669
  NOTE: this prints the secret in CLEARTEXT (with
6645
6670
  or without --json). Redirect to a file or pipe
6646
6671
  to a consumer; avoid running it interactively so
6647
6672
  the value does not land in terminal scrollback.
6648
6673
  list Show vault entry names (values stay encrypted).
6649
- remove <name> Delete an entry.
6674
+ remove <name> Delete an entry. Unrecoverable, so it asks you
6675
+ to confirm on a TTY (bare Enter = no) and refuses
6676
+ without --force when there is no TTY to ask on.
6650
6677
  lock Forget the passphrase cached in THIS process's
6651
6678
  memory. The cache never outlives the process, so
6652
6679
  for a one-shot CLI run this is close to a no-op --
@@ -6671,6 +6698,11 @@ Flags:
6671
6698
  --value <v> Inline secret value (set only). Beware shell
6672
6699
  history -- prefer the default stdin prompt.
6673
6700
  --stdin Read the secret from raw stdin (set only).
6701
+ --force Skip the destructive-action confirmation
6702
+ (remove, and a set that overwrites an existing
6703
+ name). Required for remove when stdin or stdout
6704
+ is not a TTY (both ends are needed to ask). NEVER
6705
+ skips the passphrase.
6674
6706
  --secret <name> (audit only) Filter to one secret name.
6675
6707
  --server <ns> (audit only) Filter to one server namespace.
6676
6708
 
@@ -6694,6 +6726,10 @@ function parseSecretsArgs(argv) {
6694
6726
  opts.fromStdin = true;
6695
6727
  continue;
6696
6728
  }
6729
+ if (a === "--force") {
6730
+ opts.force = true;
6731
+ continue;
6732
+ }
6697
6733
  if (a === "--value") {
6698
6734
  const v = argv[++i];
6699
6735
  if (v === void 0 || v.startsWith("-")) {
@@ -6755,6 +6791,14 @@ ${SECRETS_USAGE}` };
6755
6791
 
6756
6792
  ${SECRETS_USAGE}` };
6757
6793
  }
6794
+ if (opts.action === "set" && opts.name !== void 0 && !SECRET_NAME_RE.test(opts.name)) {
6795
+ return {
6796
+ ok: false,
6797
+ error: `yaw-mcp secrets set: invalid secret name "${opts.name}" -- use letters, digits, "_", "." or "-" only; other characters can never be referenced as \${secret:NAME}
6798
+
6799
+ ${SECRETS_USAGE}`
6800
+ };
6801
+ }
6758
6802
  return { ok: true, options: opts };
6759
6803
  }
6760
6804
  async function safeLoadVault(path7, io, json, action) {
@@ -6781,6 +6825,39 @@ function cancelledResult(io, json) {
6781
6825
  `);
6782
6826
  return { exitCode: 130 };
6783
6827
  }
6828
+ function abortedResult(io, json, action) {
6829
+ const msg = "Aborted.";
6830
+ if (json) io.err(`${JSON.stringify({ ok: false, error: msg, aborted: true })}
6831
+ `);
6832
+ else io.err(`yaw-mcp secrets ${action}: ${msg}
6833
+ `);
6834
+ return { exitCode: 1 };
6835
+ }
6836
+ function ttyEnds(opts) {
6837
+ const stdin = opts.io?.stdin ?? process.stdin;
6838
+ const stdout = opts.io?.stdout ?? process.stdout;
6839
+ return {
6840
+ stdin: stdin.isTTY === true,
6841
+ stdout: stdout.isTTY === true
6842
+ };
6843
+ }
6844
+ function isInteractiveTTY(opts) {
6845
+ const ends = ttyEnds(opts);
6846
+ return ends.stdin && ends.stdout;
6847
+ }
6848
+ function nonTTYEnds(opts) {
6849
+ const ends = ttyEnds(opts);
6850
+ if (!ends.stdin && !ends.stdout) return "neither stdin nor stdout is a TTY";
6851
+ return ends.stdin ? "stdout is not a TTY" : "stdin is not a TTY";
6852
+ }
6853
+ async function promptYesNo(opts, question) {
6854
+ const stdin = opts.io?.stdin ?? process.stdin;
6855
+ const stdout = opts.io?.stdout ?? process.stdout;
6856
+ const answer = await readLineFromTTY(stdin, stdout, `${question} [y/N] `, true);
6857
+ if (answer === CANCELLED) return CANCELLED;
6858
+ const a = answer.trim().toLowerCase();
6859
+ return a === "y" || a === "yes";
6860
+ }
6784
6861
  async function resolvePassphrase(opts) {
6785
6862
  if (opts.passphrase !== void 0) return opts.passphrase.length > 0 ? opts.passphrase : null;
6786
6863
  const fromEnv = process.env.YAW_MCP_VAULT_PASSPHRASE;
@@ -6796,10 +6873,9 @@ async function resolvePassphrase(opts) {
6796
6873
  }
6797
6874
  const stdin = opts.io?.stdin ?? process.stdin;
6798
6875
  const stdout = opts.io?.stdout ?? process.stdout;
6799
- const isTTY = stdin.isTTY === true && stdout.isTTY === true;
6800
- if (!isTTY) return null;
6876
+ if (!isInteractiveTTY(opts)) return null;
6801
6877
  for (let attempt = 0; attempt < MAX_PASSPHRASE_PROMPTS; attempt++) {
6802
- const entered = await readPassphraseFromTTY(stdin, stdout);
6878
+ const entered = await readLineFromTTY(stdin, stdout);
6803
6879
  if (entered === CANCELLED) return CANCELLED;
6804
6880
  if (entered.length > 0) return entered;
6805
6881
  stdout.write("Passphrase cannot be empty.\n");
@@ -6821,16 +6897,15 @@ async function resolveNewPassphrase(opts) {
6821
6897
  }
6822
6898
  const stdin = opts.io?.stdin ?? process.stdin;
6823
6899
  const stdout = opts.io?.stdout ?? process.stdout;
6824
- const isTTY = stdin.isTTY === true && stdout.isTTY === true;
6825
- if (!isTTY) return null;
6900
+ if (!isInteractiveTTY(opts)) return null;
6826
6901
  for (let attempt = 0; attempt < MAX_PASSPHRASE_PROMPTS; attempt++) {
6827
- const first = await readPassphraseFromTTY(stdin, stdout, "New vault passphrase: ");
6902
+ const first = await readLineFromTTY(stdin, stdout, "New vault passphrase: ");
6828
6903
  if (first === CANCELLED) return CANCELLED;
6829
6904
  if (first.length === 0) {
6830
6905
  stdout.write("Passphrase cannot be empty.\n");
6831
6906
  continue;
6832
6907
  }
6833
- const second = await readPassphraseFromTTY(stdin, stdout, "Confirm new passphrase: ");
6908
+ const second = await readLineFromTTY(stdin, stdout, "Confirm new passphrase: ");
6834
6909
  if (second === CANCELLED) return CANCELLED;
6835
6910
  if (first === second) return first;
6836
6911
  stdout.write("Passphrases did not match. Try again.\n");
@@ -6842,7 +6917,7 @@ var MIN_PASSPHRASE_WARN_LEN = 12;
6842
6917
  var CTRL_C = "";
6843
6918
  var CTRL_D = "";
6844
6919
  var DEL = "\x7F";
6845
- function readPassphraseFromTTY(stdin, stdout, prompt = "Vault passphrase: ") {
6920
+ function readLineFromTTY(stdin, stdout, prompt = "Vault passphrase: ", echo = false) {
6846
6921
  stdout.write(prompt);
6847
6922
  return new Promise((resolve7) => {
6848
6923
  const chunks = [];
@@ -6878,10 +6953,15 @@ function readPassphraseFromTTY(stdin, stdout, prompt = "Vault passphrase: ") {
6878
6953
  return;
6879
6954
  }
6880
6955
  if (ch === "\b" || ch === DEL) {
6881
- if (chunks.length > 0) chunks.pop();
6956
+ if (chunks.length > 0) {
6957
+ chunks.pop();
6958
+ if (echo) stdout.write("\b \b");
6959
+ }
6882
6960
  continue;
6883
6961
  }
6962
+ if (ch < " ") continue;
6884
6963
  chunks.push(ch);
6964
+ if (echo) stdout.write(ch);
6885
6965
  }
6886
6966
  }
6887
6967
  stdin.on("data", onData);
@@ -6892,8 +6972,7 @@ async function readStdinValue(io, forceRaw) {
6892
6972
  const stdout = io?.stdout ?? process.stdout;
6893
6973
  const isTTY = stdin.isTTY === true;
6894
6974
  if (isTTY && !forceRaw) {
6895
- stdout.write("Secret value: ");
6896
- return readPassphraseFromTTY(stdin, stdout);
6975
+ return readLineFromTTY(stdin, stdout, "Secret value: ");
6897
6976
  }
6898
6977
  const chunks = [];
6899
6978
  stdin.setEncoding("utf8");
@@ -6951,6 +7030,31 @@ async function runSecrets(opts, io = {
6951
7030
  return { exitCode: 1 };
6952
7031
  }
6953
7032
  }
7033
+ const replacing = opts.action === "set" && loaded.vault !== null && Object.hasOwn(loaded.vault.entries, opts.name);
7034
+ if (opts.action === "remove" && !opts.force) {
7035
+ if (isInteractiveTTY(opts)) {
7036
+ const confirmed = await promptYesNo(opts, `Permanently delete secret "${opts.name}"? This cannot be undone.`);
7037
+ if (confirmed === CANCELLED) return cancelledResult(io, opts.json);
7038
+ if (!confirmed) return abortedResult(io, opts.json, "remove");
7039
+ } else {
7040
+ const msg = `refusing to delete "${opts.name}" without confirmation and ${nonTTYEnds(opts)}.`;
7041
+ const hint = "Re-run with --force to delete it. This cannot be undone.";
7042
+ if (opts.json) io.err(`${JSON.stringify({ ok: false, error: `${msg} ${hint}` })}
7043
+ `);
7044
+ else io.err(`yaw-mcp secrets remove: ${msg}
7045
+ ${hint}
7046
+ `);
7047
+ return { exitCode: 2 };
7048
+ }
7049
+ }
7050
+ if (replacing && !opts.force && isInteractiveTTY(opts)) {
7051
+ const confirmed = await promptYesNo(
7052
+ opts,
7053
+ `Secret "${opts.name}" already exists. Replace it? The stored value is overwritten.`
7054
+ );
7055
+ if (confirmed === CANCELLED) return cancelledResult(io, opts.json);
7056
+ if (!confirmed) return abortedResult(io, opts.json, "set");
7057
+ }
6954
7058
  let vault = loaded.vault ?? newVault();
6955
7059
  const isFresh = !existsSync8(path7);
6956
7060
  const passphrase = await resolvePassphrase(opts);
@@ -7002,7 +7106,9 @@ async function runSecrets(opts, io = {
7002
7106
  return { exitCode: 1 };
7003
7107
  }
7004
7108
  await saveVault(path7, vault);
7005
- if (opts.json) io.out(`${JSON.stringify({ ok: true, name, fresh_vault: isFresh })}
7109
+ if (opts.json) io.out(`${JSON.stringify({ ok: true, name, fresh_vault: isFresh, replaced: replacing })}
7110
+ `);
7111
+ else if (replacing) io.out(`Replaced secret "${name}".
7006
7112
  `);
7007
7113
  else io.out(`${isFresh ? "Created vault and " : ""}Stored secret "${name}".
7008
7114
  `);
@@ -7291,7 +7397,7 @@ function defaultSpawn2(cmd, args) {
7291
7397
  async function maybeAutoUpgrade(deps = {}) {
7292
7398
  const optOut = process.env.YAW_MCP_AUTO_UPGRADE;
7293
7399
  if (optOut === "0" || optOut?.toLowerCase() === "false") return;
7294
- const current = deps.currentVersion ?? (true ? "0.71.0" : "dev");
7400
+ const current = deps.currentVersion ?? (true ? "0.73.0" : "dev");
7295
7401
  if (current === "dev") return;
7296
7402
  const method = (deps.isSeaImpl ? await deps.isSeaImpl() : await detectSea()) ? "binary" : detectInstallMethod(deps.argvPath ?? process.argv[1]);
7297
7403
  const latest = await (deps.fetchLatestImpl ?? fetchLatestVersion2)();
@@ -9952,14 +10058,14 @@ async function resolveServerEnv(env, namespace) {
9952
10058
  return resolved;
9953
10059
  }
9954
10060
  async function recordResolveAudit(namespace, env, missing) {
9955
- const missingSet = new Set(missing);
9956
- const referenced = collectSecretNames(env);
9957
- for (const name of referenced) {
9958
- if (missingSet.has(name)) continue;
9959
- await appendAuditEvent({ server: namespace, secret: name, event: "injected" });
10061
+ if (missing.length > 0) {
10062
+ for (const name of new Set(missing)) {
10063
+ await appendAuditEvent({ server: namespace, secret: name, event: "missing" });
10064
+ }
10065
+ return;
9960
10066
  }
9961
- for (const name of missingSet) {
9962
- await appendAuditEvent({ server: namespace, secret: name, event: "missing" });
10067
+ for (const name of collectSecretNames(env)) {
10068
+ await appendAuditEvent({ server: namespace, secret: name, event: "injected" });
9963
10069
  }
9964
10070
  }
9965
10071
  function collectSecretNames(env) {
@@ -10035,7 +10141,7 @@ async function connectToUpstream(config, onDisconnect, onListChanged) {
10035
10141
  }
10036
10142
  async function connectToUpstreamOnce(config, onDisconnect, onListChanged, attempt, disableOamRewrite) {
10037
10143
  const client = new Client(
10038
- { name: "yaw-mcp", version: true ? "0.71.0" : "dev" },
10144
+ { name: "yaw-mcp", version: true ? "0.73.0" : "dev" },
10039
10145
  { capabilities: {} }
10040
10146
  );
10041
10147
  let transport;
@@ -10403,7 +10509,7 @@ var ConnectServer = class _ConnectServer {
10403
10509
  this.apiUrl = apiUrl5;
10404
10510
  this.token = token5;
10405
10511
  this.server = new Server(
10406
- { name: "yaw-mcp", version: true ? "0.71.0" : "dev" },
10512
+ { name: "yaw-mcp", version: true ? "0.73.0" : "dev" },
10407
10513
  {
10408
10514
  capabilities: {
10409
10515
  tools: { listChanged: true },
@@ -13080,7 +13186,7 @@ function suggestFlag(input, limit = 2) {
13080
13186
  const q = input.toLowerCase();
13081
13187
  const hits = [];
13082
13188
  for (const alias of FLAG_ALIASES) {
13083
- if (alias.toLowerCase() === q) continue;
13189
+ if (alias === input) continue;
13084
13190
  const d = levenshtein(q, alias.toLowerCase());
13085
13191
  if (d <= 2) hits.push({ name: alias, d });
13086
13192
  }
@@ -13420,7 +13526,7 @@ if (subcommand === "compliance") {
13420
13526
  `);
13421
13527
  process.exitCode = 0;
13422
13528
  } else if (subcommand === "--version" || subcommand === "-V") {
13423
- process.stdout.write(`yaw-mcp ${true ? "0.71.0" : "dev"}
13529
+ process.stdout.write(`yaw-mcp ${true ? "0.73.0" : "dev"}
13424
13530
  `);
13425
13531
  process.exitCode = 0;
13426
13532
  } else if (subcommand && !subcommand.startsWith("-")) {
@@ -13436,7 +13542,12 @@ if (subcommand === "compliance") {
13436
13542
  `);
13437
13543
  process.exit(2);
13438
13544
  } else {
13439
- runServer();
13545
+ runServer().catch((err) => {
13546
+ const msg = err instanceof Error ? err.message : String(err);
13547
+ process.stderr.write(`yaw-mcp: ${msg}
13548
+ `);
13549
+ process.exitCode = 1;
13550
+ });
13440
13551
  }
13441
13552
  }
13442
13553
  async function runServer() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yawlabs/mcp",
3
- "version": "0.71.0",
3
+ "version": "0.73.0",
4
4
  "mcpName": "io.github.YawLabs/mcp",
5
5
  "description": "Yaw MCP -- MCP servers, managed. Free to run locally; Yaw Team adds cross-machine sync.",
6
6
  "license": "UNLICENSED",
@@ -38,7 +38,7 @@
38
38
  "esbuild": "^0.28.1"
39
39
  },
40
40
  "devDependencies": {
41
- "@biomejs/biome": "^2.5.0",
41
+ "@biomejs/biome": "2.4.16",
42
42
  "@types/node": "^26.0.0",
43
43
  "esbuild": "^0.28.1",
44
44
  "tsup": "^8.4.0",