@yawlabs/mcp 1.0.18 → 1.0.19
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/CHANGELOG.md +62 -0
- package/dist/{auto-upgrade-PZQM472F.js → auto-upgrade-EXN56GQI.js} +5 -1
- package/dist/{chunk-KMWLFOFF.js → chunk-PUO3HCQS.js} +324 -201
- package/dist/index.js +9289 -8751
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,68 @@ All notable changes to `@yawlabs/mcp` (formerly `@yawlabs/mcph`) are documented
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
**Fixed -- `release.sh` failed a green test suite on "printed no verdict" when run from a plain terminal**
|
|
8
|
+
|
|
9
|
+
The release gates grep the captured `npm run` output for each tool's summary line. vitest colours that summary even into a pipe -- its colour library never consults isatty, so colour is on wherever `NO_COLOR` is unset and `TERM` is not `dumb` -- and turns it off only inside an AI-agent environment (std-env's `isAgent`: `AI_AGENT`, `CLAUDECODE`, `CURSOR_AGENT` and others). From a plain terminal the bytes are `ESC[2m Test Files ESC[22m ESC[1mESC[32m133 passedESC[39m...`, which `Test Files +[0-9]+ passed` cannot match; the terminal renders both forms identically, which is why a green 133-file run read as "Tests exited 0 but printed no verdict" while earlier releases, run from inside Claude Code, had passed. The same escapes blinded the failure pattern (a red suite still failed, on its exit code, but without the summary line the message is about). Every verdict grep in `run_npm_check` now reads a copy of the output with CSI escape sequences stripped (ECMA-48 parameter, intermediate and final bytes, in the C locale); the coloured text still reaches the terminal. Covered by two stubbed full-run cases that feed the gate vitest's coloured passing and failing summaries.
|
|
10
|
+
|
|
11
|
+
**Fixed -- review of the full-pass landing: two regressions it introduced, and the rest of what review found**
|
|
12
|
+
|
|
13
|
+
A 69-agent review of the full-pass merge (every finding checked by two independent verifiers; 25 of 29 survived) found two regressions in it, both fixed here. An `exec` step that the client cancelled, or that hit a yaw-mcp routing fault, was booked as a 0.0 outcome against the healthy server it targeted: the step's result was copied with an object spread, which drops the non-enumerable brands that mark a cancel or a routing fault, so the blame guard never saw them. The result now keeps its brands. And the narrowed error-tail redaction map no longer covered a literal connection string with an inline password under a non-credential name -- `DATABASE_URL=postgres://app:pw@host/db`, `REDIS_URL=redis://:pw@host` -- so a child that echoed its DSN put the password in the stderr tail, the log and the model's error text. Any literal whose value carries URL userinfo with a password is redacted again; a long literal URL without one stays readable.
|
|
14
|
+
|
|
15
|
+
Also from the review: a Codex `config.toml` with a correct `[mcp_servers.mcp]` table plus an inline legacy entry no longer refuses `install --keep-legacy` or `uninstall --keep-legacy` (only an edit that would touch the legacy entry refuses, with its by-hand fix), and `doctor` reports a lone inline legacy entry as a refused migration instead of `has "mcp" entry`. `yaw-mcp heal` names the project for each local-scope line (`(project <key>)`) instead of printing the same `~/.claude.json` line once per project, and reads `~/.claude.json` once per sweep. `doctor --json` carries `oamRuntime.bundlesUnreadable` when the bundles loader throws, as the text report already did. The `secrets set` note on an emptied legacy vault prints only when the passphrase prompt is actually shown. `yaw-mcp upgrade` under the `VITEST` test-harness guard makes no registry request, as `--help` says. The "client has no sampling" notice fires once from dispatch when it skips a tiebreak it wanted (it could never fire before). `foundry export` names an unapproved project `bundles.json` and points at `yaw-mcp trust` instead of saying none was found. Restoring a stolen `grades.json` lock can no longer backdate a lock a third process took in between. `release.sh`: a stale annotated tag that shares its name with a local branch now stops the push (`%(refname:strip=2)`, not `:short`); a prerelease `latest` on npm is ordered against rather than reported as an unreadable registry, and a `latest` that is not a version says what npm returned.
|
|
16
|
+
|
|
17
|
+
**Fixed -- a server loaded while it was being unloaded is no longer orphaned**
|
|
18
|
+
|
|
19
|
+
`disconnectFromUpstream` marks a connection "disconnected" synchronously and then awaits the SDK's staged close, which can take about four seconds. An `activate`, `dispatch` or auto-warm that landed in that window spawned a fresh child and registered it under the same namespace, and the teardown's unconditional map delete then dropped that fresh entry: a live child nothing referenced and `shutdown()` never closed, and the model's load silently undone. The pre-warm teardown had an identity check for exactly this; the idle reaper, `deactivate` and the config reload did not. All four now forget a namespace only when the entry is still the connection they tore down, and `deactivate` answers ``"<ns>" was re-loaded while it was being unloaded -- still loaded`` instead of claiming its tools left the context.
|
|
20
|
+
|
|
21
|
+
**Fixed -- `find_tool` can match one- and two-character tool-name segments, and `exec` `$ref`s read a step's output as the server sent it**
|
|
22
|
+
|
|
23
|
+
`rankTools` tokenized tool names with the prose tokenizer (three-character floor, no joined form) while the query used the one-character identifier tokenizer, so `find_tool("s3")` could not hit `s3_upload` on any server; it now tokenizes names the way `rankServers` already did, and a multi-segment namespace such as `aws_s3` earns the namespace bonus when the query spells all of its segments. `exec` bound `$ref` targets from the pruned and capped copy of a step's output, so `{"id":42,"labels":[]}` bound as `{"id":42}` and a later `$ref: "a.labels"` failed as "no property"; bindings now come from the raw content and only the echoed copy is pruned and capped. `exec` and `find_tool` no longer wait up to 20 s on a fresh install for a tool name no server being pre-warmed could provide (a mistyped namespace, an already-learned server). The `discover` memo re-renders after a mid-session change to `YAW_MCP_MIN_COMPLIANCE` or `YAW_MCP_TOOL_EXPOSURE`, auto-warm no longer ages the server it just picked by one idle tick, and the "Top candidates close -- asking LLM to pick..." progress line is not shown to a client without the sampling capability (one `info` log per process says `YAW_MCP_ROUTE_EFFORT=aggressive` and `YAW_MCP_REWARD_GRADER` are inert there). Deleting or atomically re-saving `bundles.json` mid-session keeps the running servers and warns in `discover` instead of unloading everything as "removed".
|
|
24
|
+
|
|
25
|
+
**Fixed -- every `YAW_MCP_*` opt-out reads the same way: `0` or `false`, case-insensitive, trimmed**
|
|
26
|
+
|
|
27
|
+
Seven opt-outs were documented with one "Set to 0 to disable" wording and parsed four ways. `YAW_MCP_AUTO_ACTIVATE` disabled on ANY value other than `1`/`true`, so `=yes` turned auto-warm off; `YAW_MCP_PRUNE_RESPONSES` compared untrimmed, so cmd.exe's `set VAR=0 && ...` (which delivers `0 `) did nothing; `YAW_MCP_DISABLE_PERSISTENCE` and `YAW_MCP_TRUST_PROJECT` did not trim either, so `=1 ` left them off; `YAW_MCP_INSTALL_NUDGE` accepted exactly `1`. Opt-outs now go through one helper (`0`/`false`, case-insensitive, trimmed, anything else leaves the feature on); opt-ins take `1` or case-insensitive `true`, trimmed. `--help` states the rule once under the environment table, and `trust --help` says `=1 (or =true)`. `VITEST`, which vitest exports to its workers and child processes inherit, was an undocumented production switch read in twelve places: it disabled the auto-upgrade memos and lock but not the registry probe or the `npm install -g` spawn, so a downstream test suite that spawned yaw-mcp with a stale global install ran a real, unserialized install on every start. It is now one documented test-harness guard that makes the self-upgrade and sidecar refresh a consistent no-op.
|
|
28
|
+
|
|
29
|
+
**Fixed -- `yaw-mcp upgrade --run` takes the upgrade lock; a copy under a custom npm prefix is background-upgraded**
|
|
30
|
+
|
|
31
|
+
The manual `--run` for a global-npm install spawned `npm install -g` with no lock while the background self-upgrade and the sidecar refresh serialize on one, so two reifies could run on one package directory. It now takes the same lock; when another yaw-mcp holds it, it prints `another yaw-mcp process is upgrading this install (lock: <path>)` and exits 3. A copy under `~/.npm-global` (either layout) or under `npm_config_prefix` is classified global-npm by the CLI and the background upgrade alike, and the stale-install log names the unrecognised-prefix case instead of pointing at a `--run` that would do nothing different. The sidecar lock heartbeat stops as soon as the lock file no longer carries this process's pid. `yaw-mcp sidecars install install` is refused rather than read as a plain install. The standalone-binary stale log carries the same retirement wording as `upgrade` and `doctor`.
|
|
32
|
+
|
|
33
|
+
**Fixed -- `install` refuses a blocked container before it prints what it would write; `heal` sweeps every project's local scope**
|
|
34
|
+
|
|
35
|
+
Over a `{"mcpServers": [...]}` file, `install` printed `Runtime: will run on oam ...` and the kept-root notes, then exited 1 with "refusing to overwrite it"; the refusal now returns first, beside the unspliceable one. `install --list` refuses `--repair` and `--keep-legacy` the way it refused `--force` and `--skip`; `install -x <client>` is `Unknown flag: -x` as it is for `uninstall`; the live no-op line reads `Nothing to do: <Client> (<scope>) is already configured.` in both the dry run and the real run. Relative `CLINE_MCP_SETTINGS_PATH`, `CLINE_DATA_DIR` and `CLINE_DIR` resolve against the working directory as the Codex, Continue and typed rows already did; whitespace-only `TYPED_CLI_BUNDLE`, `XDG_CONFIG_HOME`, `CONTINUE_GLOBAL_DIR` and `CODEX_HOME` count as unset. `%APPDATA%` pointing at a file is named in the read or write failure for Claude Desktop, VS Code, Zed and Cline. `heal` (and the serve-time sweep) repairs stale local-scope entries in every project recorded in `~/.claude.json`, not only the working directory's; a repair onto a project-local `node_modules` prints install's project-local note; `--dry-run` logs `Would re-point` instead of a past-tense line, and `heal --help` documents the `--json` shape. Codex: an entry with `env_vars = []` no longer reports drift on every re-run; a legacy entry in an inline or dotted spelling reads as unspliceable up front, so `doctor` warns with the by-hand step and `install` refuses before writing instead of failing mid-write.
|
|
36
|
+
|
|
37
|
+
**Fixed -- `doctor` and `audit` scrub what they print, and `try` does not pick a config its own write refuses**
|
|
38
|
+
|
|
39
|
+
`try` auto-detect could pick a client whose `mcpServers` container is a non-empty array, the one shape the write refuses, with a usable config one slot along; the gate now excludes it. `audit` printed the compliance runner's error raw after the target env held resolved vault secrets and the raw argv; the runner error, the cache error and a remote server's URL go through the scrubber now, in the debug log and in `--json` too, and the header lists every exit-2 cause. `doctor`: a bundles loader that throws exits 2 with `could not read bundles.json: ...` under WARNINGS instead of "All good" with a fresh-install hint; `--os windows` prints a `perms:` line naming the three files (`secrets.json`, `secrets-audit.log`, `trusted.json`) that rely on the DACL inherited from the home directory, since `chmod` is a no-op there; the RELIABILITY header says `(top 5 dormant, <80% success)`; a `HISTFILE` spelled `~/...` is expanded; `--platform` also governs the oam platform-mismatch check; and `doctor` no longer locks a vault key an in-process caller unlocked before it ran. `compliance`: a second Ctrl-C re-enters the teardown instead of killing the CLI with the child orphaned, and the `Target:` line is scrubbed.
|
|
40
|
+
|
|
41
|
+
**Fixed -- secrets and trust: KDF bounds, a leaf TTY reader, and consistent exit codes**
|
|
42
|
+
|
|
43
|
+
A vault file with `p=17` now fails as `invalid kdf parameters (p=17 must be between 1 and 16)` instead of a generic refusal, and `LOG_LEVEL=debug` logs one line at unlock when a vault's KDF exceeds the build default. The raw-mode TTY reader that five prompts across `secrets` and `trust` share lives in its own leaf module with its own tests of the ESC/CSI state machine, so `yaw-mcp trust` no longer loads the vault module graph. `trust --list --json` on an unusable store exits 1 like `--revoke --json`; `trust --list` and `--revoke --json` emit one compact line like every `secrets` envelope; Ctrl-C at the `trust` prompt exits 130 `Cancelled. Nothing was approved.` as every `secrets` prompt does (a typed no stays exit 1 `Aborted`). `secrets set` on a legacy vault that `remove` emptied prints `The vault at <path> is empty, so it has no passphrase: the one you enter now becomes its passphrase.` before the confirm-twice prompt. An env key literally named `__proto__` in `bundles.json` is resolved like any other key. The caller's copy of the vault key is zeroed on every exit path of `secrets` and `rotate`.
|
|
44
|
+
|
|
45
|
+
**Fixed -- upstream connections: a locked vault refuses before any download, redaction stops masking plain paths, and forged fences are caught in any case**
|
|
46
|
+
|
|
47
|
+
The local launch path resolved uv, then probed oam, then resolved the vault, so a locked vault could pay a 20 MB uv download before refusing; the vault check runs first now. The error-tail redaction map covered the entire resolved env (any value of eight or more characters), so a long literal `BASE_URL` or path rendered as `***KEY***`; it now covers vault-derived values and literals under credential-shaped names. Upstream `instructions` neutralization was case-sensitive, so `<<<end upstream server text` and `[yaw-mcp]` passed through; the three markers are matched case-insensitively. The stderr tail decodes with a `StringDecoder`, so a multi-byte character split across two chunks no longer shows as U+FFFD. Editing a server's command, args or runtime mid-session clears its oam-to-node pin (oam is tried again), and the "Connected" log no longer says `oamPinned` for an entry whose config says `runtime: "node"`. The oam-to-node respawn reuses the resolved env, so `secrets audit` records one `injected` per secret for that activation (was two). `MCP_CALL_TIMEOUT`, `MCP_CONNECT_TIMEOUT` and `MCP_LIST_TIMEOUT` are read at first use, so the "ignored" warning no longer fires when a CLI subcommand merely loads the module, and `yaw-mcp call` reads `MCP_CALL_TIMEOUT` from the env an embedding caller injects. The uv bootstrap uses `-LiteralPath` with `Expand-Archive`, so a `LOCALAPPDATA` containing `[` or `]` works; the `.sha256` and archive fetches share one `UV_FETCH_TOTAL_MS` deadline as the comment always claimed (the worst case was two). An `OAM_BIN` that names a `.cmd`/`.bat` shim on Windows gets a specific warning instead of "oam --version failed".
|
|
48
|
+
|
|
49
|
+
**Fixed -- `add`, `set`, `import` and the catalog**
|
|
50
|
+
|
|
51
|
+
`add <name> --command ...` over a catalog entry of the same name (or the reverse) replaced the launch command with no "launch command changed" note, because a custom add stamped a catalog slug; the note now fires whenever the launch differs, and a custom add's collision refusal reads `can't add server "x"` rather than naming a catalog. On Windows, `add` accepts a required variable the shell holds under a different case, as the ambient-env note already did. `set <srv> env.<key>=` with a non-identifier key (`A-B`, `A.B`, `9X`) is refused with exit 2, the rule `add --env` already enforced; `add --command/--url ... --catalog <url>` is refused instead of silently ignoring `--catalog`. `import` names a `url` it drops from an entry carrying both `command` and `url`. The catalog staleness note goes to the command's own stderr writer in `add`, `search` and `try`. A `bundles.json` header with a non-string value is reported as `(expected a string value)` rather than `(empty value)`. `ADD_USAGE` no longer says "no account needed" (there is no account mode) and says the 0600 claim is POSIX-only. `set` writes through the same in-process chain as `add` and `remove`.
|
|
52
|
+
|
|
53
|
+
**Fixed -- tab completion, `call`, `state.json` caps, trial markers**
|
|
54
|
+
|
|
55
|
+
Completion specs omitted flags the parsers accept: `--force`/`--yes` on `try-cleanup` (the only way to script it off a TTY) and `reset-learning`, and `--command`, `--url`, `--header`, `--transport`, `--description` on `add`; the parity test now checks both directions. `yaw-mcp call` in text mode prints `[structured result only -- re-run with --json to see it]` to stderr when the tool answered only in `structuredContent`. `state.json` writes cap `packHistory` to the newest 100 and `learning` to the 512 most recently used namespaces. A trial marker whose `schemaVersion` is not a number is refused by `doctor`'s scan and by `try-cleanup` instead of being swept as v1; new markers no longer carry a `name` field nothing read.
|
|
56
|
+
|
|
57
|
+
**Fixed -- client config I/O**
|
|
58
|
+
|
|
59
|
+
Facade refusals for an unspliceable entry end with the by-hand fix, as the unloadable ones did (`try` prints it verbatim). TOML remedies no longer say "replace ... with the table below" when no table is printed beneath. An uninstall that empties a `config.toml` writes zero bytes, not a lone newline. `atomicWriteFile` sweeps stale same-target `*.tmp-*` orphans older than ten minutes after a successful write (one `readdir` per write), and its header states the guarantee is kill-mid-write, not power loss. The JSONC strippers no longer treat `'` as a string delimiter, so a stray apostrophe outside a string does not swallow the rest of the file. A `Date` in a root-key comparison no longer compares equal to `{}`. The `UpsertTomlOptions.replaceLegacy` branch, reached only from tests, is gone; the removable-array-of-tables flag that no production path could honour is gone with its comment.
|
|
60
|
+
|
|
61
|
+
**Fixed -- relevance, pruning, foundry, grades cache**
|
|
62
|
+
|
|
63
|
+
`YAW_MCP_PRUNE_RESPONSES="0 "` disables pruning (see the opt-out rule above). Text blocks of 2,000,000 characters or more are no longer whitespace-pruned on the synchronous path (the JSON path already had that ceiling). Foundry redaction keeps adjacent date pairs (`2024-01-15 2024-01-16`) instead of scrubbing them as a phone number. A restored live `grades.json` lock keeps its original mtime, and `grades.json.lock.stale-*` litter older than the stale age is swept at lock take. `foundry export` with no `bundles.json` names the missing file and the paths it looked in. Any category added to the error list is error-shaped for the reward by default (the set is derived, not copied).
|
|
64
|
+
|
|
65
|
+
**Fixed -- `release.sh` gates cannot pass on silence or on a swallowed SIGPIPE, and a stale local tag cannot ride along on the push**
|
|
66
|
+
|
|
67
|
+
Six gate checks were `echo "$out" | grep -q ...` under `set -o pipefail`: when the match is early and the producer still has more than a pipe buffer to write, `grep -q` exits, the producer takes SIGPIPE and the pipeline reads as a MISS. Reproduced on this workstation with a 400,000-line producer. The CHANGELOG behaviour-change gate was the one on a trajectory to fire (the Unreleased section is already 39 KB); all six are here-strings now. A gate whose tool exited 0 without printing its verdict passed, which the oam floor verifier can do under a junction or symlinked checkout (its main-module check compares a realpath'd URL): when a done pattern is set, rc 0 now requires it, failing `exited 0 but printed no verdict -- refusing to pass a gate on silence`, and the lint pattern requires `Checked N files` with N at least 1, since biome prints `Checked 0 files` when handed only ignored paths. `git push origin main --follow-tags` pushes every annotated tag origin lacks and the pre-flight fetch never pruned local-only tags, so a stale tag left by a "bump past a dead release" recovery would have ridden into the protected-tags ruleset; a stale-tag guard before the push lists local annotated tags absent from origin and reachable from main (`git ls-remote --tags --refs origin`, under coreutils `timeout` where one is on PATH) and aborts naming any other than this run's own, failing closed when the remote cannot be read. The pre-flight `latest` for the backward-version guard was the one surviving `npm view` (a packument read Cloudflare serves up to 300 s stale, about 20 s per call here); it is now a cache-busted `curl` of the packument reading `dist-tags.latest`, and the test stub fails on any `npm view`. The OTP retry classifier was unanchored, so a bare `OTP` or `EAUTH` inside npm's integrity line could trigger three 30 s retries; it now matches npm's own `code EOTP|EAUTH` line or the phrase "one-time password". The non-tty confirm abort and the two behaviour-change-gate aborts exit 1, so a wrapper cannot read an abort as a release (an interactive decline still exits 0). `scripts/verify-oam-floor.mjs` passes `VERIFY_OAM_FLOOR_TIMEOUT_MS` to the `oam --version` read as its header claimed; `scripts/lint.mjs` runs biome's JS entry through `process.execPath` instead of a `.cmd` shim under `shell: true`, so a repo path with a space cannot be re-split; `biome.json` includes `scripts/`, so those files are linted. The banners print `[ok]` / `[x]` instead of non-ASCII glyphs, and the resume line says "resuming a prior run" since it fires on either side of the push.
|
|
68
|
+
|
|
7
69
|
**Fixed -- `release.sh` no longer dies at step 5 waiting on npm's five-minute CDN cache, so a release finishes in one run**
|
|
8
70
|
|
|
9
71
|
Recent releases, 1.0.16 included, ended with `npm does not show @yawlabs/mcp@<version> after 60s -- refusing to publish to MCP registry (it would 400)` and needed a second `./release.sh <version>` to publish `server.json`. The wait was on the wrong document. `npm view "@yawlabs/mcp@<version>"` fetches the package's whole packument, which registry.npmjs.org serves from Cloudflare's edge under `Cache-Control: public, max-age=300` -- measured 2026-09-28: `CF-Cache-Status: HIT` with `Age: 105`, and still `HIT` with `Cache-Control: no-cache` on the request (request headers cannot opt out; a fresh query string can, but `npm view` sends none, and the packument is the wrong document anyway) -- so for up to five minutes after `npm publish` returns it can keep answering from a copy that predates the publish. Ten reads six seconds apart could not outlast that, and a single read also measured about 20 s on this workstation, so the "60s" in the message was really several minutes spent on the wrong document. The MCP registry's validator never reads it: it fetches npm's per-version document, `GET /@yawlabs%2Fmcp/<version>` (registry v1.7.9, `internal/validators/registries/npm.go`), which Cloudflare serves `DYNAMIC`, never from the edge cache.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
UPGRADE_LOCK_NAME,
|
|
3
4
|
acquireUpgradeLock,
|
|
4
5
|
attemptedRecentlyAt,
|
|
5
6
|
detectRunningInstallPrefix,
|
|
@@ -8,9 +9,11 @@ import {
|
|
|
8
9
|
quoteShellArgIfNeeded,
|
|
9
10
|
readCheckMemo,
|
|
10
11
|
recordAttemptAt,
|
|
12
|
+
runsUnderNpmConfigPrefix,
|
|
11
13
|
writeCheckMemo
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PUO3HCQS.js";
|
|
13
15
|
export {
|
|
16
|
+
UPGRADE_LOCK_NAME,
|
|
14
17
|
acquireUpgradeLock,
|
|
15
18
|
attemptedRecentlyAt,
|
|
16
19
|
detectRunningInstallPrefix,
|
|
@@ -19,5 +22,6 @@ export {
|
|
|
19
22
|
quoteShellArgIfNeeded,
|
|
20
23
|
readCheckMemo,
|
|
21
24
|
recordAttemptAt,
|
|
25
|
+
runsUnderNpmConfigPrefix,
|
|
22
26
|
writeCheckMemo
|
|
23
27
|
};
|