@yawlabs/mcp 1.0.6 → 1.0.7

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 CHANGED
@@ -4,6 +4,18 @@ All notable changes to `@yawlabs/mcp` (formerly `@yawlabs/mcph`) are documented
4
4
 
5
5
  ## Unreleased -- a fresh Yaw Mode pane names the local-scope entry it will lose
6
6
 
7
+ **Added -- a startup pre-warm of `npx -y <pkg>@latest` servers so the first `initialize` of a session does not pay the cold-cache tax**
8
+
9
+ A server entry shaped `{ command: "npx", args: ["-y", "@yawlabs/<x>-mcp@latest"] }` resolves `@latest` on every spawn. On a fresh `~/.npm/_npx/` cache -- which npm keeps per-tarball-URL hash and so flushes whenever a package publishes a new build -- the first spawn does a registry round-trip + a tar download + the child's own `initialize`. Together that is reliably >30s, which exceeds the downstream MCP client's `initialize` deadline and surfaces as the user-visible line "MCP request initialize to server mcp timed out after 30000ms". yaw-mcp's own `MCP_CONNECT_TIMEOUT` is 15s by default, so the user loses the activation AND yaw-mcp spends 15s in the attempt before giving up.
10
+
11
+ `prewarmDormantServers` (the existing startup pre-warm) does spawn each server at startup, but (a) it fires from `oninitialized`, so the FIRST activation of the session still pays the cold-cache cost -- the user only sees the win on the second server and onwards, and on the second session onwards; (b) it is gated on `YAW_MCP_PREWARM`, which a user with no pre-warm tolerance can turn off and would not want re-lit by a different knob; and (c) it spawns the full upstream, not just the npx cache prime.
12
+
13
+ A new fire-and-forget pass on `start()` runs `npx -y <pkg>@latest --version` once per unique configured npx package, in parallel, with a 30s per-package timeout (the same 30s as the client deadline -- a prime that takes longer than the budget it is trying to buy back is not earning its keep). The next real `StdioClientTransport` spawn finds a warm cache and connects in well under a second. The pass is no-op when the user has no npx servers or opts out (`YAW_MCP_AUTO_PREWARM=0`), is capped at `YAW_MCP_MAX_AUTO_PREWARM` (default 20, so a metered connection's worst case is bounded), and shares `acquireSidecarsLock` with `maybeRefreshSidecars` so a manual `sidecars install` running at startup defers this pass and vice versa.
14
+
15
+ The spawn mirrors `maybeAutoUpgrade`'s env hygiene (`stripInternalSecretsFromEnv(process.env)` so the vault passphrase never reaches an npx child's transitive pre/postinstall), `stdio: "ignore"` so a slow child cannot wedge the parent, and `shell: process.platform === "win32"` so the npx `.cmd` shim resolves. The new `auto-prewarm.ts` module is a sibling of `auto-upgrade.ts` and `sidecar-refresh.ts`; the public surface is `maybeAutoPrewarmNpxCache(deps)`, plus the pure parsers `isAutoPrewarmDisabled`, `parseAutoPrewarmMax`, `parseAutoPrewarmTimeoutMs` and the pure extractor `extractNpxPackages`, all exported for tests and `doctor`.
16
+
17
+ **The "first activation" caveat remains for the rare user who skips a pre-warm**: a user on a metered link who sets `YAW_MCP_AUTO_PREWARM=0` and then activates a never-touched-before npx server on a cold `_npx` cache still gets the >30s first-spawn tax. There is no on-demand warm without paying the same tax once, and the only way to remove that case would be a one-time payment on the user's first `activate` of the session -- which IS the cold-cache race, just hidden behind a different layer.
18
+
7
19
  **Fixed -- a fresh Yaw Mode pane warns about a local-scope Claude Code entry, and the augment Keeping line stops promising the entry goes home**
8
20
 
9
21
  In a fresh Yaw Mode pane, `install claude-code --scope local` wrote the entry into the overlay's `.claude.json` -- `projects[<dir>]` lives in `<CLAUDE_CONFIG_DIR>/.claude.json`, and a fresh pane keeps nothing of its overlay -- and said nothing about it. It now prints: ``Note: a fresh Yaw Mode pane does not keep its config dir, so the Claude Code entry in <overlay>/.claude.json goes when this pane closes. Run `yaw-mcp install claude-code --scope local --project-dir <dir>` from a normal shell to keep it.``
package/README.md CHANGED
@@ -1,12 +1,10 @@
1
1
  # @yawlabs/mcp
2
2
 
3
- [![Follow @TokenLimitNews on X](https://img.shields.io/badge/follow-%40TokenLimitNews-000000?logo=x&logoColor=white)](https://x.com/TokenLimitNews)
4
-
5
3
  **One install. Every MCP server. Managed from one place.**
6
4
 
7
5
  Yaw MCP (the `yaw-mcp` CLI) is an MCP server that fronts every other MCP server you use. Point each AI client (Claude Code, Claude Desktop, Cursor, VS Code) at it once, and your servers load lazily from a single connection instead of a hand-edited `mcpServers` block per client.
8
6
 
9
- It runs entirely on your machine. No account, no sign-in, no telemetry -- your servers live in a local `bundles.json` and your credentials in a local encrypted vault. Running as an MCP server, its only outbound calls are two background npm checks: one for its own updates (`YAW_MCP_AUTO_UPGRADE=0` to disable), and, if you have run `yaw-mcp sidecars install`, a once-a-day check that the managed sidecar packages are current (`YAW_MCP_SIDECAR_REFRESH=0` to disable). `yaw-mcp add` fetches the public server catalog on demand. Nothing else leaves your machine.
7
+ It runs entirely on your machine. No account, no sign-in, no telemetry -- your servers live in a local `bundles.json` and your credentials in a local encrypted vault. Running as an MCP server, its only outbound calls are three background npm checks: one for its own updates (`YAW_MCP_AUTO_UPGRADE=0` to disable), a once-per-startup pre-warm of `npx -y <pkg>@latest` servers so the first activation does not pay the cold-cache tax (`YAW_MCP_AUTO_PREWARM=0` to disable), and, if you have run `yaw-mcp sidecars install`, a once-a-day check that the managed sidecar packages are current (`YAW_MCP_SIDECAR_REFRESH=0` to disable). `yaw-mcp add` fetches the public server catalog on demand. Nothing else leaves your machine.
10
8
 
11
9
  It earns its keep when you hit any of these:
12
10
 
@@ -409,6 +407,9 @@ Common ones (run `yaw-mcp --help` for the full list):
409
407
  | `YAW_MCP_AUTO_UPGRADE` | `0` disables the background self-upgrade check at startup. Default on. |
410
408
  | `YAW_MCP_SIDECAR_REFRESH` | `0` disables the daily background check that keeps managed sidecars current. Only ever runs if you have run `yaw-mcp sidecars install`; explicit pins and semver ranges are never moved. Default on. |
411
409
  | `YAW_MCP_PREWARM` | `0` stops yaw-mcp spawning a server at startup just to learn its tool list. Learning is rare -- the list persists and is only re-learned once it ages out -- but the session that does it starts the upstream twice, once to read the list and once for the activate that follows, which matters if the server startup is not idempotent. Off, a server whose tools are not already known shows none of them until you activate it; `discover` still lists it. Default on. |
410
+ | `YAW_MCP_AUTO_PREWARM` | `0` disables the once-per-startup `npx -y <pkg>@latest` cache pre-warm that primes `~/.npm/_npx/<hash>/node_modules/<pkg>` for every active npx server. The pre-warm runs `npx ... --version` once per unique package in parallel, in a 30s budget per package, and resolves before the user's first `initialize` for that server lands. Without it, a fresh `_npx` cache makes a single spawn do a registry round-trip + a tar download + the child's own initialize -- reliably >30s, which exceeds the MCP client's `initialize` deadline and surfaces as "MCP request initialize to server mcp timed out after 30000ms". Default on. |
411
+ | `YAW_MCP_MAX_AUTO_PREWARM` | Upper bound on the number of npx packages the pre-warm will touch in a single startup. Default `20`. Real curated bundles use 6-10; the cap bounds worst-case download volume on a metered connection. |
412
+ | `YAW_MCP_AUTO_PREWARM_TIMEOUT` | Per-package timeout in milliseconds. Default `30000`. The whole pass runs in parallel, so the global wall-clock upper bound is the same. Lower this on a tight network; raise it for a slow registry. |
412
413
  | `OAM_BIN` | Path to the `oam` binary to use instead of the one on `PATH`. A path that does not exist is reported by `doctor` as an unusable oam (fix the variable), not as oam being absent. |
413
414
  | `OAM_MAX_HEAP_MB` | Raises the V8 heap cap oam applies to a hosted server (4 GiB by default since oam 0.9.2). Set it in that server's `env` when a hosted sidecar dies with a heap out-of-memory error, or give that server `"runtime": "node"`. |
414
415
  | `YAW_MCP_AUTO_LOAD` | `1` pre-activates the top recurring pack at startup (needs persistence). Default off. |
@@ -439,3 +440,4 @@ The source is published so you can read and audit it before running it -- `yaw-m
439
440
  - [@yawlabs/mcp-compliance](https://www.npmjs.com/package/@yawlabs/mcp-compliance) -- test your MCP servers for spec compliance
440
441
  - [CHANGELOG](./CHANGELOG.md) -- release notes
441
442
  - [GitHub](https://github.com/YawLabs/mcp) -- source and issues
443
+ - [![Follow @TokenLimitNews on X](https://img.shields.io/badge/follow-%40TokenLimitNews-000000?logo=x&logoColor=white)](https://x.com/TokenLimitNews)
@@ -9,7 +9,7 @@ import {
9
9
  readCheckMemo,
10
10
  recordAttemptAt,
11
11
  writeCheckMemo
12
- } from "./chunk-FP6ABRPZ.js";
12
+ } from "./chunk-YBL36YGY.js";
13
13
  export {
14
14
  acquireUpgradeLock,
15
15
  attemptedRecentlyAt,
@@ -4415,7 +4415,7 @@ async function oamFloorLines(probe) {
4415
4415
  }
4416
4416
  async function defaultRunningPrefix(argvPath) {
4417
4417
  if (process.env.VITEST) return null;
4418
- const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-RHEVUE4T.js");
4418
+ const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-ABZIVFE3.js");
4419
4419
  return detectRunningInstallPrefix2(argvPath);
4420
4420
  }
4421
4421
  async function defaultSpawn(cmd, args, cwd) {
@@ -4476,7 +4476,7 @@ async function runUpgrade(opts = {}) {
4476
4476
  if (method === "global-npm") {
4477
4477
  const rawPrefix = await (opts.runningPrefix ?? defaultRunningPrefix)(argvPath);
4478
4478
  if (rawPrefix !== null) {
4479
- const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-RHEVUE4T.js");
4479
+ const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-ABZIVFE3.js");
4480
4480
  const spawnForm = quoteShellArgIfNeeded2(rawPrefix, opts.platform);
4481
4481
  const displayForm = quoteArgForDisplay2(rawPrefix, opts.platform);
4482
4482
  if (spawnForm !== null && displayForm !== null) {
@@ -4593,7 +4593,7 @@ async function runUpgrade(opts = {}) {
4593
4593
  return { exitCode: 3, lines };
4594
4594
  }
4595
4595
  function readCurrentVersion() {
4596
- return true ? "1.0.6" : "dev";
4596
+ return true ? "1.0.7" : "dev";
4597
4597
  }
4598
4598
 
4599
4599
  // src/auto-upgrade.ts
@@ -4875,7 +4875,7 @@ function defaultSpawn2(cmd, args, onDone = () => {
4875
4875
  async function maybeAutoUpgrade(deps = {}) {
4876
4876
  const optOut = process.env.YAW_MCP_AUTO_UPGRADE;
4877
4877
  if (optOut === "0" || optOut?.toLowerCase() === "false") return;
4878
- const current = deps.currentVersion ?? (true ? "1.0.6" : "dev");
4878
+ const current = deps.currentVersion ?? (true ? "1.0.7" : "dev");
4879
4879
  if (current === "dev") return;
4880
4880
  const argvPath = deps.argvPath ?? process.argv[1];
4881
4881
  const method = (deps.isSeaImpl ? await deps.isSeaImpl() : await detectSea()) ? "binary" : detectInstallMethod(argvPath, realpathSync2, ["unknown", "local-node-modules"]);
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ import {
93
93
  unparseableConfigFix,
94
94
  userConfigDir,
95
95
  yawModeOverlay
96
- } from "./chunk-FP6ABRPZ.js";
96
+ } from "./chunk-YBL36YGY.js";
97
97
 
98
98
  // src/audit-cmd.ts
99
99
  import { homedir as homedir6 } from "os";
@@ -3196,7 +3196,7 @@ async function connectToUpstreamOnce(config, onDisconnect, onListChanged, bridge
3196
3196
  if (downstreamCaps?.sampling) capabilities.sampling = downstreamCaps.sampling;
3197
3197
  if (downstreamCaps?.roots) capabilities.roots = {};
3198
3198
  const client = new Client(
3199
- { name: "yaw-mcp", version: true ? "1.0.6" : "dev" },
3199
+ { name: "yaw-mcp", version: true ? "1.0.7" : "dev" },
3200
3200
  { capabilities }
3201
3201
  );
3202
3202
  if (bridge && capabilities.elicitation) {
@@ -11031,7 +11031,7 @@ function foldBundleWarnings(warnings, probe) {
11031
11031
  const prefix = `${probe.path}:`;
11032
11032
  return warnings.filter((w) => !w.startsWith(prefix));
11033
11033
  }
11034
- var VERSION = true ? "1.0.6" : "dev";
11034
+ var VERSION = true ? "1.0.7" : "dev";
11035
11035
  var DOCTOR_USAGE = `Usage: yaw-mcp doctor [--json]
11036
11036
 
11037
11037
  Print a diagnostic of your yaw-mcp setup.
@@ -15265,6 +15265,138 @@ import {
15265
15265
  ReadResourceRequestSchema
15266
15266
  } from "@modelcontextprotocol/sdk/types.js";
15267
15267
 
15268
+ // src/auto-prewarm.ts
15269
+ import { spawn as spawn4 } from "child_process";
15270
+ var DEFAULT_MAX_AUTO_PREWARM = 20;
15271
+ var DEFAULT_AUTO_PREWARM_TIMEOUT_MS = 3e4;
15272
+ var AUTO_PREWARM_DISABLE_ENV = "YAW_MCP_AUTO_PREWARM";
15273
+ var AUTO_PREWARM_MAX_ENV = "YAW_MCP_MAX_AUTO_PREWARM";
15274
+ var AUTO_PREWARM_TIMEOUT_ENV = "YAW_MCP_AUTO_PREWARM_TIMEOUT";
15275
+ var NPX_PACKAGE_PATTERN = /^@?[\w.-]+\/[\w.-]+@[\w.*+-]+$|^[\w.-]+@[\w.*+-]+$/;
15276
+ function extractNpxPackages(servers) {
15277
+ const seen = /* @__PURE__ */ new Set();
15278
+ const out = [];
15279
+ for (const server of servers) {
15280
+ if (server.type !== "local") continue;
15281
+ if (server.command !== "npx") continue;
15282
+ const args = server.args ?? [];
15283
+ if (args[0] !== "-y") continue;
15284
+ for (const arg of args.slice(1)) {
15285
+ if (typeof arg !== "string") continue;
15286
+ if (!NPX_PACKAGE_PATTERN.test(arg)) continue;
15287
+ if (seen.has(arg)) continue;
15288
+ seen.add(arg);
15289
+ out.push(arg);
15290
+ break;
15291
+ }
15292
+ }
15293
+ return out;
15294
+ }
15295
+ function isAutoPrewarmDisabled(env = process.env) {
15296
+ const raw = env[AUTO_PREWARM_DISABLE_ENV];
15297
+ if (raw === void 0) return false;
15298
+ const trimmed = raw.trim();
15299
+ if (trimmed === "") return false;
15300
+ return trimmed === "0" || trimmed.toLowerCase() === "false";
15301
+ }
15302
+ function parseAutoPrewarmMax(env = process.env, fallback = DEFAULT_MAX_AUTO_PREWARM) {
15303
+ const raw = env[AUTO_PREWARM_MAX_ENV];
15304
+ if (raw === void 0 || raw === "") return fallback;
15305
+ const n = Number.parseInt(raw, 10);
15306
+ return Number.isFinite(n) && n > 0 ? n : fallback;
15307
+ }
15308
+ function parseAutoPrewarmTimeoutMs(env = process.env, fallback = DEFAULT_AUTO_PREWARM_TIMEOUT_MS) {
15309
+ const raw = env[AUTO_PREWARM_TIMEOUT_ENV];
15310
+ if (raw === void 0 || raw === "") return fallback;
15311
+ const n = Number.parseInt(raw, 10);
15312
+ return Number.isFinite(n) && n > 0 ? n : fallback;
15313
+ }
15314
+ function defaultAcquireLockImpl() {
15315
+ if (process.env.VITEST) return () => {
15316
+ };
15317
+ return acquireSidecarsLock(sidecarsRoot());
15318
+ }
15319
+ function defaultSpawn(pkg, timeoutMs) {
15320
+ let errorFired = false;
15321
+ let done;
15322
+ const donePromise = new Promise((resolve8) => {
15323
+ done = resolve8;
15324
+ });
15325
+ const opts = {
15326
+ stdio: "ignore",
15327
+ // Mirror auto-upgrade.ts:736. npm runs every transitive pre/postinstall
15328
+ // with this env; YAW_MCP_VAULT_PASSPHRASE in particular is in process.env
15329
+ // only by operator choice and must not be forwarded to a download.
15330
+ env: stripInternalSecretsFromEnv(process.env),
15331
+ detached: false,
15332
+ shell: process.platform === "win32"
15333
+ };
15334
+ const child = spawn4("npx", ["-y", pkg, "--version"], opts);
15335
+ const finish = (reason, ok) => {
15336
+ done({ reason, ok });
15337
+ };
15338
+ child.on("close", (code) => {
15339
+ if (errorFired) return;
15340
+ finish("exit", code === 0);
15341
+ });
15342
+ child.on("error", (err) => {
15343
+ errorFired = true;
15344
+ log("warn", "auto-prewarm: npx spawn failed", { package: pkg, error: err?.message });
15345
+ finish("spawn-error", false);
15346
+ });
15347
+ const timer = setTimeout(() => {
15348
+ log("warn", "auto-prewarm: npx prime exceeded timeout; aborting", { package: pkg, timeoutMs });
15349
+ try {
15350
+ child.kill("SIGTERM");
15351
+ } catch {
15352
+ }
15353
+ finish("timeout", false);
15354
+ }, timeoutMs);
15355
+ timer.unref();
15356
+ donePromise.finally(() => clearTimeout(timer));
15357
+ return { package: pkg, child, done: donePromise };
15358
+ }
15359
+ async function maybeAutoPrewarmNpxCache(deps = {}) {
15360
+ try {
15361
+ if ((deps.isDisabled ?? (() => isAutoPrewarmDisabled()))()) return;
15362
+ const listServers = deps.listActiveServers ?? (() => []);
15363
+ const max = deps.maxPackages ?? (() => parseAutoPrewarmMax());
15364
+ const timeoutMs = deps.perPackageTimeoutMs ?? (() => parseAutoPrewarmTimeoutMs());
15365
+ const spawnOne = deps.spawnImpl ?? ((pkg) => defaultSpawn(pkg, timeoutMs()));
15366
+ const acquire = deps.acquireLockImpl ?? defaultAcquireLockImpl;
15367
+ const packages = extractNpxPackages(listServers());
15368
+ if (packages.length === 0) return;
15369
+ const capped = packages.length > max() ? packages.slice(0, max()) : packages;
15370
+ if (packages.length > capped.length) {
15371
+ log(
15372
+ "info",
15373
+ `auto-prewarm: capping at ${capped.length} of ${packages.length} npx packages (YAW_MCP_MAX_AUTO_PREWARM)`,
15374
+ { capped: capped.length, total: packages.length }
15375
+ );
15376
+ }
15377
+ const release = acquire();
15378
+ if (release === null) {
15379
+ log("info", "auto-prewarm: another process holds the sidecars lock; skipping this pass");
15380
+ return;
15381
+ }
15382
+ const start = Date.now();
15383
+ const results = await Promise.all(capped.map((pkg) => spawnOne(pkg).done));
15384
+ release();
15385
+ const okCount = results.filter((r) => r.ok).length;
15386
+ const failed = capped.length - okCount;
15387
+ const elapsedMs = Date.now() - start;
15388
+ const level = failed === 0 ? "info" : "warn";
15389
+ log(level, `auto-prewarmed ${okCount} of ${capped.length} npx packages in ${elapsedMs}ms (failed: ${failed})`, {
15390
+ ok: okCount,
15391
+ failed,
15392
+ total: capped.length,
15393
+ elapsedMs
15394
+ });
15395
+ } catch (err) {
15396
+ log("warn", "auto-prewarm: unexpected failure", { error: err?.message });
15397
+ }
15398
+ }
15399
+
15268
15400
  // src/cost-estimate.ts
15269
15401
  var BYTES_PER_TOKEN = 4;
15270
15402
  var CACHED_TOOL_SCHEMA_PAD_BYTES = 200;
@@ -17728,7 +17860,7 @@ var ConnectServer = class _ConnectServer {
17728
17860
  static SHUTDOWN_DRAIN_MS = 2e3;
17729
17861
  constructor() {
17730
17862
  this.server = new Server(
17731
- { name: "yaw-mcp", version: true ? "1.0.6" : "dev" },
17863
+ { name: "yaw-mcp", version: true ? "1.0.7" : "dev" },
17732
17864
  {
17733
17865
  capabilities: {
17734
17866
  tools: { listChanged: true },
@@ -18341,6 +18473,7 @@ var ConnectServer = class _ConnectServer {
18341
18473
  await this.server.connect(transport);
18342
18474
  maybeAutoUpgrade().catch((err) => log("warn", "Auto-upgrade check failed", { error: err?.message }));
18343
18475
  maybeRefreshSidecars().catch((err) => log("warn", "Sidecar refresh check failed", { error: err?.message }));
18476
+ maybeAutoPrewarmNpxCache().catch((err) => log("warn", "Auto-prewarm check failed", { error: err?.message }));
18344
18477
  log("info", "yaw-mcp started", {
18345
18478
  servers: this.config?.servers.length ?? 0
18346
18479
  });
@@ -21131,7 +21264,7 @@ function registerShutdownTriggers(shutdown, targets) {
21131
21264
  // src/status-cmd.ts
21132
21265
  import { existsSync as existsSync10 } from "fs";
21133
21266
  import { homedir as homedir23 } from "os";
21134
- var VERSION2 = true ? "1.0.6" : "dev";
21267
+ var VERSION2 = true ? "1.0.7" : "dev";
21135
21268
  var STATUS_SCHEMA_VERSION = 1;
21136
21269
  var STATUS_USAGE = `Usage: yaw-mcp status [--json]
21137
21270
 
@@ -21883,7 +22016,7 @@ if (subcommand === "compliance") {
21883
22016
  `);
21884
22017
  process.exitCode = 0;
21885
22018
  } else if (subcommand === "--version" || subcommand === "-V") {
21886
- process.stdout.write(`yaw-mcp ${true ? "1.0.6" : "dev"}
22019
+ process.stdout.write(`yaw-mcp ${true ? "1.0.7" : "dev"}
21887
22020
  `);
21888
22021
  process.exitCode = 0;
21889
22022
  } else if (subcommand !== void 0 && !subcommand.startsWith("-")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yawlabs/mcp",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "mcpName": "io.github.YawLabs/mcp",
5
5
  "description": "MCP gateway and orchestrator: one local install fronts every MCP server for Claude Code, Cursor, and VS Code, loading tools on demand.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",