@yawlabs/mcp 1.0.12 → 1.0.13

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
@@ -2,6 +2,32 @@
2
2
 
3
3
  All notable changes to `@yawlabs/mcp` (formerly `@yawlabs/mcph`) are documented here. This project uses [semantic versioning](https://semver.org) and a script-gated release flow: `./release.sh <version>` runs lint + typecheck + tests + build, bumps, tags, publishes to npm, and publishes `server.json` to the MCP registry.
4
4
 
5
+ ## 1.0.13 -- Codex CLI works again: `install codex-cli` under smol-toml 1.9.0, and Codex can call the tools it loads
6
+
7
+ Published 2026-09-24, the day after 1.0.12. Five entries below, all measured against real Codex 0.144.0 and 0.156.1. `mcp_connect_exec` reaches a cached tool from the first call of a session. On a fresh install, `find_tool` and `exec` wait for the startup pre-warm. Codex, which never re-lists tools, is told to call loaded tools through `mcp_connect_exec` (#172). The TOML codec accepts smol-toml 1.9.0's null-prototype tables, which had broken `install codex-cli`, `doctor`, `install --list` and `heal` for every Codex config. It also refuses a doubled BOM the way Codex does, and pins the parser to 1.9 patch releases (#171).
8
+
9
+ **Fixed -- `mcp_connect_exec` reaches a cached tool from the first call of a session**
10
+
11
+ `start()` hydrated the persisted tool cache but never built the routing table from it. The later rebuilds all wait on an activation, a config change, auto-load, or a pre-warm that learns something new, so on a machine whose servers were all already cached the table stayed empty. exec looks its steps up there, so the documented "a cached-but-unloaded server is loaded on first use" answered `Unknown tool: <name>. Use mcp_connect_discover ...` instead, until an unrelated activation rebuilt it. The table is now built once `start()` has the config, the cache and the grades. exec is the only way a client that never re-lists tools reaches an upstream tool, and typed's lite `find_tool` -> `exec` flow hit the same wall.
12
+
13
+ **Fixed -- on a fresh install, `find_tool` and `exec` wait for the startup pre-warm instead of answering "nothing"**
14
+
15
+ With no `state.json`, the pre-warm that runs after `initialize` is what learns each server's tools, and nothing waited for it. A first `find_tool` said `No configured server has a tool matching ...` about a configured server's tool, and a first `exec` said `Unknown tool`. Both were measured 1.7 to 5 seconds into a session on real Codex 0.144.0. When the answer would otherwise be "none" and the pre-warm is still running, both now wait for it, for at most 20 seconds, then answer from what it learned. exec waits only after the refusals it decides from the pipeline's shape alone (a meta-tool step, a blocked tool, a bad `$ref`), stops waiting when the call is cancelled, and runs nothing then. The pre-warm rebuilds routes only when its whole sweep ends, so when the bound lapses first, exec rebuilds them from the servers already learned: one slow server no longer keeps a fast one out of reach.
16
+
17
+ **Fixed -- Codex is told to call loaded tools through `mcp_connect_exec`**
18
+
19
+ Codex (`clientInfo.name` `codex-mcp-client`; the CLI, its IDE extension and the ChatGPT desktop app's Codex mode) reads `tools/list` once and only logs `notifications/tools/list_changed`: `logging_client_handler.rs` in both rust-v0.144.0 and rust-v0.156.1. A tool that `mcp_connect_activate` or `mcp_connect_dispatch` loaded mid-session therefore never reached the model. The reply listed it as loaded, and the model's direct call failed inside Codex with `unsupported call: mcp__mcp<tool>`. Both were measured against real Codex 0.144.0 and 0.156.1. For a client in the new `NO_RELIST_CLIENTS` set, the replies of activate and dispatch, and discover's auto-load banner, now carry one line that says so, with an exec call. The call is for one of the tools just loaded, e.g. `{"steps":[{"tool":"memory_read_graph","args":{}}]}`. It names a tool that needs no arguments, a read-only one first, so the call runs as written. When every tool needs arguments, the line says to fill them in and points at `mcp_connect_read_tool`. Continue's IDE extension (`continue-client`) is in the set too. Its source registers no notification handler and lists tools only while connecting. That was read from source, not measured against a running Continue. Every other client's replies are unchanged.
20
+
21
+ **Fixed -- Codex CLI works again under smol-toml 1.9.0: `install codex-cli` writes the file, and `doctor`, `install --list` and `heal` stop calling a valid config.toml malformed**
22
+
23
+ smol-toml 1.9.0, published 2026-09-22, returns every table it parses with a null prototype (its release notes: "the objects returned by the library now have a _null prototype_"). The check that decides whether a parsed TOML value is a table accepted `Object.prototype` only, so under 1.9.0 every table read as "a object, not a table" -- the document root included. On a `config.toml` that Codex itself loads, `doctor` reported ``Codex CLI (user): exists but TOML is malformed -- install refuses to overwrite it; fix the TOML by hand, or move the file aside, then run `yaw-mcp install codex-cli` `` and ended on `Warnings above need attention.` (the "Warnings need attention." in Yaw Terminal's MCP panel), `install --list` showed the row as `malformed`, and `heal` listed the file under `could not be checked`, so a dead entry in it was never re-pointed. Moving the file aside, as the warning said, did not help: `install codex-cli` refused to write even a new file -- `failed to splice the "mcp" entry into ...config.toml (...config.toml could not be created (the edit left "" as a object, not a table)). Refusing to overwrite.`, exit 1.
24
+
25
+ The dependency range was `^1.8.0`, so every install resolved after 2026-09-22 got 1.9.0 -- `npx -y @yawlabs/mcp@latest`, a fresh `npm i -g`, and the copy Yaw Terminal 2.1.7 bundles -- while this repo's lockfile kept the suite on 1.8.0, where it passed. Run against 1.9.0, 170 of the 267 tests in the TOML codec, Codex CLI and heal suites fail. The check now accepts either plain-object prototype (arrays and `TomlDate` still fail it), and a test pins both prototypes directly instead of through whichever version the lockfile resolves. The range moves to `~1.9.0`: the suite runs on the parser users get -- 1.9.0 also carries the fix for GHSA-r4xh-jqrq-34v2 -- and a future minor release cannot reach users untested the way 1.9.0 did. JSON and JSONC clients were never affected: their files go through jsonc-parser. Yaw Terminal users get the fix when the app bundles this release; until then `npx -y @yawlabs/mcp@latest install codex-cli` works once this version is published.
26
+
27
+ **Fixed -- a `config.toml` opened by two byte-order marks reads as malformed, as Codex reads it**
28
+
29
+ smol-toml 1.9.0 also strips one leading BOM itself. This codec already strips one before parsing, so a file opening with two BOMs -- which an editor or a PowerShell 5.1 re-encode can leave -- began to parse, while Codex 0.144.0 refuses it (`failed to load configuration`). `doctor` and `install --list` called that file healthy, and `install` wrote into a config Codex will not load. The parse now refuses a second BOM with `a second byte-order mark (U+FEFF) opens the file; Codex refuses it -- delete it`. One BOM, which Notepad writes by default, reads as before.
30
+
5
31
  ## 1.0.12 -- `yaw-mcp secrets reset` is the way out of a forgotten vault passphrase, and `doctor` says whether the passphrase it sees unlocks the vault
6
32
 
7
33
  Published 2026-09-23, two days after 1.0.11. Three entries below: the new `secrets reset` verb (#167), which moves the vault aside, lists its entry names and starts a new one under a new passphrase, and refuses when the passphrase it is given already opens the vault; the SECRET VAULT passphrase line in `doctor` gains its unlocks / does-not-unlock / marker-corrupt states; and under `--json` the two stderr warnings that were still prose become JSON lines.
package/README.md CHANGED
@@ -356,8 +356,9 @@ Headers are resolved through the same fail-closed path: a missing or malformed r
356
356
  **Where the passphrase comes from.** Three ways, in the order you'll meet them:
357
357
 
358
358
  1. **`YAW_MCP_VAULT_PASSPHRASE` in yaw-mcp's own env** -- the `env` block of the *yaw-mcp* entry in your MCP client config, not the upstream server's (yaw-mcp strips its own secrets from the env of every child it starts: every server it spawns, the npm runs behind its self-upgrade and the daily sidecar refresh, and the compliance suite). This is the only option for a spawn, which happens over stdio with no terminal to prompt on.
359
- 2. **An in-session prompt.** If your client supports MCP [elicitation](https://modelcontextprotocol.io/specification/server/elicitation), a locked vault asks for the passphrase and retries the server. The passphrase is never typed into your client's dialog: it goes into a masked field on a one-shot page yaw-mcp serves on `127.0.0.1`. A client with URL-mode elicitation opens that page from its own prompt. A client with form mode only (Claude Code, for one) asks whether to open it, and on yes yaw-mcp opens it in your default browser; with no browser to open (no graphical session), the call fails and names the env var instead. The page takes one submission and expires after 3 minutes. A mistyped passphrase gets one more try per session; a decline stops the asking. It's held in memory for that session only -- never written to disk, and never handed to the server being started.
360
- 3. **The CLI prompt**, for `yaw-mcp secrets` runs: no-echo on a real TTY. If the terminal will not switch echo off, the prompt refuses rather than show what you type. Note that Git Bash/MSYS can't offer one (Node sees pipes, not a TTY) -- use PowerShell, `winpty`, or the env var there.
359
+ 2. **An in-session prompt for the vault.** If your client supports MCP [elicitation](https://modelcontextprotocol.io/specification/server/elicitation), a locked vault asks for the passphrase and retries the server. The passphrase is never typed into your client's dialog: it goes into a masked field on a one-shot page yaw-mcp serves on `127.0.0.1`. A client with URL-mode elicitation opens that page from its own prompt. A client with form mode only (Claude Code, for one) asks whether to open it, and on yes yaw-mcp opens it in your default browser; with no browser to open (no graphical session), the call fails and names the env var instead. The page takes one submission and expires after 3 minutes. A mistyped passphrase gets one more try per session; a decline stops the asking. It's held in memory for that session only -- never written to disk, and never handed to the server being started.
360
+ 3. **An in-session prompt for a child's own missing credential.** The same masked page (and the same URL / form mode rules above) is used when a child server's stderr names a key yaw-mcp does not have: a `GITHUB_TOKEN is required` line, an `AWS_ACCESS_KEY_ID is required` line, and the like. One masked field per missing key, the same URL-mode completion notification, the same page hardening (no CORS, no script, `Cache-Control: no-store`, 256-bit random token, Host header check, 3-minute TTL). The value lands in the child's env for the session -- not the vault slot, and not any other server. A decline ends the asking for the session; a no-page or no-browser is a wall that latches the same way; an expired page keeps the budget since the user may simply have been away.
361
+ 4. **The CLI prompt**, for `yaw-mcp secrets` runs: no-echo on a real TTY. If the terminal will not switch echo off, the prompt refuses rather than show what you type. Note that Git Bash/MSYS can't offer one (Node sees pipes, not a TTY) -- use PowerShell, `winpty`, or the env var there.
361
362
 
362
363
  `yaw-mcp doctor` has a **SECRET VAULT** section showing what's stored, which servers reference it, and whether the passphrase it can see is set and unlocks the vault -- start there when a server won't load. It reports names and a yes/no, never a value.
363
364
 
@@ -448,4 +449,4 @@ The source is published so you can read and audit it before running it -- `yaw-m
448
449
  - [@yawlabs/mcp-compliance](https://www.npmjs.com/package/@yawlabs/mcp-compliance) -- test your MCP servers for spec compliance
449
450
  - [CHANGELOG](./CHANGELOG.md) -- release notes
450
451
  - [GitHub](https://github.com/YawLabs/mcp) -- source and issues
451
- - [![Follow @TokenLimitNews on X](https://img.shields.io/badge/follow-%40TokenLimitNews-000000?logo=x&logoColor=white)](https://x.com/TokenLimitNews)
452
+ - [![Follow @YawLabs on X](https://img.shields.io/badge/follow-%40YawLabs-000000?logo=x&logoColor=white)](https://x.com/YawLabs)
@@ -9,7 +9,7 @@ import {
9
9
  readCheckMemo,
10
10
  recordAttemptAt,
11
11
  writeCheckMemo
12
- } from "./chunk-HRHGAT5G.js";
12
+ } from "./chunk-JSNVFUDY.js";
13
13
  export {
14
14
  acquireUpgradeLock,
15
15
  attemptedRecentlyAt,
@@ -1476,8 +1476,12 @@ function stripBom2(raw) {
1476
1476
  return raw.slice(bomOffset(raw));
1477
1477
  }
1478
1478
  function parseTomlConfig(raw) {
1479
+ const text = stripBom2(raw);
1480
+ if (text.charCodeAt(0) === 65279) {
1481
+ return raiseParse("a second byte-order mark (U+FEFF) opens the file; Codex refuses it -- delete it", 1, 1);
1482
+ }
1479
1483
  try {
1480
- return parseTomlText(stripBom2(raw), PARSE_OPTIONS);
1484
+ return parseTomlText(text, PARSE_OPTIONS);
1481
1485
  } catch (e) {
1482
1486
  if (e instanceof TomlError) {
1483
1487
  const reason = e.message.split("\n")[0].replace(/^Invalid TOML document:\s*/, "");
@@ -1490,7 +1494,9 @@ function raiseParse(reason, line, column) {
1490
1494
  throw new TomlConfigError(reason, typeof line === "number" ? line : 0, typeof column === "number" ? column : 0);
1491
1495
  }
1492
1496
  function isTomlTable(value) {
1493
- return typeof value === "object" && value !== null && Object.getPrototypeOf(value) === Object.prototype;
1497
+ if (typeof value !== "object" || value === null) return false;
1498
+ const proto = Object.getPrototypeOf(value);
1499
+ return proto === Object.prototype || proto === null;
1494
1500
  }
1495
1501
  function describeTomlShape(value) {
1496
1502
  if (value === null) return "null";
@@ -4557,7 +4563,7 @@ async function oamFloorLines(probe) {
4557
4563
  }
4558
4564
  async function defaultRunningPrefix(argvPath) {
4559
4565
  if (process.env.VITEST) return null;
4560
- const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-XYB4P44U.js");
4566
+ const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-H5NMT5BV.js");
4561
4567
  return detectRunningInstallPrefix2(argvPath);
4562
4568
  }
4563
4569
  async function defaultSpawn(cmd, args, cwd) {
@@ -4618,7 +4624,7 @@ async function runUpgrade(opts = {}) {
4618
4624
  if (method === "global-npm") {
4619
4625
  const rawPrefix = await (opts.runningPrefix ?? defaultRunningPrefix)(argvPath);
4620
4626
  if (rawPrefix !== null) {
4621
- const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-XYB4P44U.js");
4627
+ const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-H5NMT5BV.js");
4622
4628
  const spawnForm = quoteShellArgIfNeeded2(rawPrefix, opts.platform);
4623
4629
  const displayForm = quoteArgForDisplay2(rawPrefix, opts.platform);
4624
4630
  if (spawnForm !== null && displayForm !== null) {
@@ -4735,7 +4741,7 @@ async function runUpgrade(opts = {}) {
4735
4741
  return { exitCode: 3, lines };
4736
4742
  }
4737
4743
  function readCurrentVersion() {
4738
- return true ? "1.0.12" : "dev";
4744
+ return true ? "1.0.13" : "dev";
4739
4745
  }
4740
4746
 
4741
4747
  // src/auto-upgrade.ts
@@ -5016,7 +5022,7 @@ function defaultSpawn2(cmd, args, onDone = () => {
5016
5022
  }
5017
5023
  async function maybeAutoUpgrade(deps = {}) {
5018
5024
  if (isFeatureDisabled("YAW_MCP_AUTO_UPGRADE")) return;
5019
- const current = deps.currentVersion ?? (true ? "1.0.12" : "dev");
5025
+ const current = deps.currentVersion ?? (true ? "1.0.13" : "dev");
5020
5026
  if (current === "dev") return;
5021
5027
  const argvPath = deps.argvPath ?? process.argv[1];
5022
5028
  const method = (deps.isSeaImpl ? await deps.isSeaImpl() : await detectSea()) ? "binary" : detectInstallMethod(argvPath, realpathSync3, ["unknown", "local-node-modules"]);
package/dist/index.js CHANGED
@@ -101,7 +101,7 @@ import {
101
101
  unparseableConfigFix,
102
102
  userConfigDir,
103
103
  yawModeOverlay
104
- } from "./chunk-HRHGAT5G.js";
104
+ } from "./chunk-JSNVFUDY.js";
105
105
 
106
106
  // src/audit-cmd.ts
107
107
  import { homedir as homedir6 } from "os";
@@ -3230,7 +3230,7 @@ async function connectToUpstreamOnce(config, onDisconnect, onListChanged, bridge
3230
3230
  if (downstreamCaps?.sampling) capabilities.sampling = downstreamCaps.sampling;
3231
3231
  if (downstreamCaps?.roots) capabilities.roots = {};
3232
3232
  const client = new Client(
3233
- { name: "yaw-mcp", version: true ? "1.0.12" : "dev" },
3233
+ { name: "yaw-mcp", version: true ? "1.0.13" : "dev" },
3234
3234
  { capabilities }
3235
3235
  );
3236
3236
  if (bridge && capabilities.elicitation) {
@@ -11436,7 +11436,7 @@ function foldBundleWarnings(warnings, probe) {
11436
11436
  const prefix = `${probe.path}:`;
11437
11437
  return warnings.filter((w) => !w.startsWith(prefix));
11438
11438
  }
11439
- var VERSION = true ? "1.0.12" : "dev";
11439
+ var VERSION = true ? "1.0.13" : "dev";
11440
11440
  var DOCTOR_USAGE = `Usage: yaw-mcp doctor [--json]
11441
11441
 
11442
11442
  Print a diagnostic of your yaw-mcp setup.
@@ -18401,6 +18401,10 @@ function isPrewarmEnabled() {
18401
18401
  }
18402
18402
  var exposureWarnedFor = null;
18403
18403
  var LITE_BY_DEFAULT_CLIENTS = /* @__PURE__ */ new Set(["typed-cli"]);
18404
+ var NO_RELIST_CLIENTS = /* @__PURE__ */ new Set(["codex-mcp-client", "continue-client"]);
18405
+ function clientRelistsTools(clientInfo) {
18406
+ return !(clientInfo?.name !== void 0 && NO_RELIST_CLIENTS.has(clientInfo.name));
18407
+ }
18404
18408
  function resolveToolExposure(clientInfo) {
18405
18409
  const fallback = clientInfo?.name !== void 0 && LITE_BY_DEFAULT_CLIENTS.has(clientInfo.name) ? "lite" : "gateway";
18406
18410
  const raw = process.env.YAW_MCP_TOOL_EXPOSURE?.trim().toLowerCase();
@@ -18576,6 +18580,14 @@ var ConnectServer = class _ConnectServer {
18576
18580
  * would see an unchanged file and skip the reconcile that never finished,
18577
18581
  * leaving a connection running on config the user has already replaced. */
18578
18582
  bundlesReconcilePending = false;
18583
+ /** The startup pre-warm while it is still running, else null. find_tool
18584
+ * and exec read only LEARNED tool lists, and on a fresh install the
18585
+ * pre-warm is what learns them -- fire-and-forget from `oninitialized`,
18586
+ * so a first call can land before it: find_tool said "No configured
18587
+ * server has a tool matching" a configured server's tool, and exec said
18588
+ * "Unknown tool". Both now wait for this (bounded, STARTUP_PREWARM_WAIT_MS)
18589
+ * when the answer would otherwise be "nothing". */
18590
+ startupPrewarm = null;
18579
18591
  toolRoutes = /* @__PURE__ */ new Map();
18580
18592
  resourceRoutes = /* @__PURE__ */ new Map();
18581
18593
  promptRoutes = /* @__PURE__ */ new Map();
@@ -18689,6 +18701,22 @@ var ConnectServer = class _ConnectServer {
18689
18701
  // the child's own secrets. Bounds the re-ask that replaced the old
18690
18702
  // "already elicited, never ask again" latch -- see MAX_CREDENTIAL_PROMPTS.
18691
18703
  credentialPrompts = /* @__PURE__ */ new Map();
18704
+ // Latch: namespaces whose prompt has ended the asking for the session,
18705
+ // keyed by the REASON so a follow-up activate can surface the right
18706
+ // refusal. The vault uses a single boolean (`vaultPassphraseElicited`)
18707
+ // and the same shaped message regardless of why; here, "decline" and
18708
+ // "empty submission" are user decisions (return the raw spawn error,
18709
+ // the user knows what they did) while "no-page" / "no-browser" are
18710
+ // wall-shaped failures a follow-up activate would hit identically, and
18711
+ // the user still needs the bundles.json hint on every attempt.
18712
+ //
18713
+ // Follow-up: the vault has `clearSessionVaultPassphrase` for an external
18714
+ // caller (the `yaw-mcp secrets reset` CLI verb) to clear the latch
18715
+ // WITHOUT a process restart. There is no equivalent here today -- a
18716
+ // namespace that latches a no-browser stays latched until shutdown.
18717
+ // Not worth building until a verb that needs it (e.g. a per-server
18718
+ // "forget I asked") actually lands.
18719
+ credentialElicited = /* @__PURE__ */ new Map();
18692
18720
  // In-flight activation promises, keyed by namespace. Dedupes
18693
18721
  // concurrent activation attempts for the same namespace so that two
18694
18722
  // tool calls landing on a disconnected upstream don't each spawn
@@ -18798,7 +18826,7 @@ var ConnectServer = class _ConnectServer {
18798
18826
  static SHUTDOWN_DRAIN_MS = 2e3;
18799
18827
  constructor() {
18800
18828
  this.server = new Server(
18801
- { name: "yaw-mcp", version: true ? "1.0.12" : "dev" },
18829
+ { name: "yaw-mcp", version: true ? "1.0.13" : "dev" },
18802
18830
  {
18803
18831
  capabilities: {
18804
18832
  tools: { listChanged: true },
@@ -18924,6 +18952,63 @@ var ConnectServer = class _ConnectServer {
18924
18952
  });
18925
18953
  });
18926
18954
  };
18955
+ /** Wait for the startup pre-warm, if it is still running, for at most
18956
+ * STARTUP_PREWARM_WAIT_MS, or until `signal` aborts. Resolves either way:
18957
+ * past the bound the caller answers from what is known, exactly as it did
18958
+ * before this existed, and on an abort the caller checks the signal. */
18959
+ async settleStartupPrewarm(signal) {
18960
+ const pending2 = this.startupPrewarm;
18961
+ if (!pending2 || signal?.aborted) return;
18962
+ let timer;
18963
+ let onAbort;
18964
+ const bound = new Promise((resolve8) => {
18965
+ timer = setTimeout(resolve8, _ConnectServer.STARTUP_PREWARM_WAIT_MS);
18966
+ timer.unref?.();
18967
+ onAbort = () => resolve8();
18968
+ signal?.addEventListener("abort", onAbort, { once: true });
18969
+ });
18970
+ try {
18971
+ await Promise.race([pending2, bound]);
18972
+ } finally {
18973
+ clearTimeout(timer);
18974
+ if (onAbort) signal?.removeEventListener("abort", onAbort);
18975
+ }
18976
+ }
18977
+ /** How long find_tool / exec wait on a still-running startup pre-warm.
18978
+ * Measured on a loaded Windows ARM64 box, a fresh install's pre-warm of
18979
+ * two npx/oam servers finished 4-6 s after initialize; this leaves room
18980
+ * for a larger bundle without holding a call anywhere near a client's
18981
+ * tool timeout (Codex: 300 s). Not readonly, so a test can shrink it. */
18982
+ static STARTUP_PREWARM_WAIT_MS = 2e4;
18983
+ /** The line a load reply needs for a client that never re-lists tools
18984
+ * (NO_RELIST_CLIENTS), or null for every other client.
18985
+ *
18986
+ * The reply above it enumerates the tools just loaded as if they were now
18987
+ * callable, which is true for a client that re-lists and false for this
18988
+ * one: its tool list is the startup one, so the model's direct call fails
18989
+ * inside the client. The example names a tool that is really reachable --
18990
+ * a served, not shadowed, tool of the first namespace that loaded -- and,
18991
+ * where the server has one, a tool that needs no arguments (read-only
18992
+ * first), so `args: {}` runs as written. When every tool needs arguments
18993
+ * the line says to fill them in rather than show a call that would fail. */
18994
+ execHintForNonRelistingClient(loaded) {
18995
+ if (clientRelistsTools(this.server.getClientVersion())) return null;
18996
+ const needsNoArgs = (t) => {
18997
+ const required = t.inputSchema?.required;
18998
+ return !Array.isArray(required) || required.length === 0;
18999
+ };
19000
+ for (const ns of loaded) {
19001
+ const conn = this.connections.get(ns);
19002
+ if (!conn) continue;
19003
+ const served = this.splitShadowedTools(ns, conn.tools).served;
19004
+ const example = served.find((t) => needsNoArgs(t) && t.annotations?.readOnlyHint === true) ?? served.find(needsNoArgs) ?? served[0];
19005
+ if (example === void 0) continue;
19006
+ const call = JSON.stringify({ steps: [{ tool: example.namespacedName, args: {} }] });
19007
+ const fill = needsNoArgs(example) ? "" : ` (with the tool's own arguments in "args"; mcp_connect_read_tool shows a tool's arguments)`;
19008
+ return `This client keeps the tool list it read at startup, so the tools just loaded are not in it and a direct call to one fails. Call them through mcp_connect_exec instead, e.g. ${call}${fill}`;
19009
+ }
19010
+ return null;
19011
+ }
18927
19012
  rebuildRoutes() {
18928
19013
  this.toolRoutes = buildToolRoutes(this.connections, this.getDeferredServers());
18929
19014
  this.resourceRoutes = buildResourceRoutes(this.connections);
@@ -19407,12 +19492,16 @@ var ConnectServer = class _ConnectServer {
19407
19492
  serverCount: this.config?.servers.length ?? 0
19408
19493
  });
19409
19494
  await this.hydrateComplianceGrades();
19495
+ this.rebuildRoutes();
19410
19496
  if (this.getProfiledActiveServers().some((s) => s.command !== void 0 && uvLaunchKind(s.command) !== null)) {
19411
19497
  ensureUv().catch((err) => log("warn", "uv prewarm failed", { error: err?.message }));
19412
19498
  }
19413
19499
  const transport = new StdioServerTransport();
19414
19500
  this.server.oninitialized = () => {
19415
- this.prewarmDormantServers().catch((err) => log("warn", "Pre-warm failed", { error: err?.message }));
19501
+ const prewarm = this.prewarmDormantServers().catch((err) => log("warn", "Pre-warm failed", { error: err?.message })).finally(() => {
19502
+ if (this.startupPrewarm === prewarm) this.startupPrewarm = null;
19503
+ });
19504
+ this.startupPrewarm = prewarm;
19416
19505
  if (isAutoLoadEnabled()) {
19417
19506
  if (this.persistenceReady) {
19418
19507
  this.autoLoadRecurringPack().catch((err) => log("warn", "Auto-load failed", { error: err?.message }));
@@ -19657,7 +19746,7 @@ var ConnectServer = class _ConnectServer {
19657
19746
  if (name === META_TOOLS.findTool.name) {
19658
19747
  const q = typeof args.query === "string" ? args.query : "";
19659
19748
  const limit = typeof args.limit === "number" && Number.isFinite(args.limit) ? args.limit : void 0;
19660
- return this.observed(this.attachGuideNudge(this.handleFindTool(q, limit)));
19749
+ return this.observed(this.attachGuideNudge(await this.handleFindTool(q, limit)));
19661
19750
  }
19662
19751
  if (name === META_TOOLS.exec.name) {
19663
19752
  const result2 = await this.handleExec(args, extra?.signal);
@@ -20162,7 +20251,10 @@ var ConnectServer = class _ConnectServer {
20162
20251
  return { content: [{ type: "text", text: this.emptyStateText() }] };
20163
20252
  }
20164
20253
  const allProfiled = this.getProfiledActiveServers();
20165
- const warmPrefix = warmedNamespace ? `Auto-loaded "${warmedNamespace}" \u2014 top match for your query.
20254
+ const warmExecHint = warmedNamespace ? this.execHintForNonRelistingClient([warmedNamespace]) : null;
20255
+ const warmBanner = warmedNamespace ? `Auto-loaded "${warmedNamespace}" \u2014 top match for your query.${warmExecHint ? `
20256
+ ${warmExecHint}` : ""}` : "";
20257
+ const warmPrefix = warmBanner ? `${warmBanner}
20166
20258
 
20167
20259
  ` : "";
20168
20260
  const focusMiss = (text) => ({
@@ -20219,8 +20311,8 @@ var ConnectServer = class _ConnectServer {
20219
20311
  allProfiled.length === 0 ? `${this.noServersEnabledText()}
20220
20312
  ` : context ? "Servers ranked by relevance:\n" : "Installed MCP servers:\n"
20221
20313
  );
20222
- if (warmedNamespace) {
20223
- lines.push(`Auto-loaded "${warmedNamespace}" \u2014 top match for your query.
20314
+ if (warmBanner) {
20315
+ lines.push(`${warmBanner}
20224
20316
  `);
20225
20317
  }
20226
20318
  const minCompliance = resolveMinCompliance();
@@ -20880,6 +20972,18 @@ Name collision: ${subject} of "${namespace}" cannot be called. ${entries}${more}
20880
20972
  message: `Could not load "${namespace}": it still reports ${missing.join(", ")} missing, so the values just provided were not accepted.${retryHint}`
20881
20973
  };
20882
20974
  }
20975
+ if (this.credentialElicited.has(namespace)) {
20976
+ const reason = this.credentialElicited.get(namespace);
20977
+ log("debug", "Namespace already declined or unreachable for credential prompt; not asking again", {
20978
+ namespace,
20979
+ missing,
20980
+ reason
20981
+ });
20982
+ if (reason === "no-page" || reason === "no-browser") {
20983
+ return this.credentialUnreachableRefusal(namespace, missing, reason);
20984
+ }
20985
+ return null;
20986
+ }
20883
20987
  const asked = this.credentialPrompts.get(namespace) ?? 0;
20884
20988
  if (asked >= MAX_CREDENTIAL_PROMPTS) {
20885
20989
  log("info", "Missing credentials persist after the prompt budget; not asking again", {
@@ -20897,43 +21001,59 @@ Name collision: ${subject} of "${namespace}" cannot be called. ${entries}${more}
20897
21001
  });
20898
21002
  return null;
20899
21003
  }
20900
- const properties = {};
20901
- for (const key of missing) {
20902
- properties[key] = {
20903
- type: "string",
20904
- title: key,
20905
- description: `The value for ${key} required by "${namespace}". Stored only for this yaw-mcp session.`
20906
- };
20907
- }
20908
21004
  progress?.(`Asking for ${missing.length === 1 ? "credential" : "credentials"}: ${missing.join(", ")}`);
20909
21005
  this.credentialPrompts.set(namespace, asked + 1);
20910
- let result;
20911
- try {
20912
- result = await this.server.elicitInput({
20913
- message: `"${namespace}" can't start without ${missing.join(", ")}. Provide ${missing.length === 1 ? "it" : "them"} to retry, or decline to cancel.`,
20914
- requestedSchema: {
20915
- type: "object",
20916
- properties,
20917
- required: missing
20918
- }
20919
- });
20920
- } catch (err) {
20921
- log("warn", "Elicitation request failed", {
20922
- namespace,
20923
- error: err instanceof Error ? err.message : String(err)
20924
- });
21006
+ const isPlural = missing.length !== 1;
21007
+ const what = isPlural ? "them" : "it";
21008
+ const pronoun = isPlural ? "their" : "its";
21009
+ const fixHint = `Set ${what} in this server's "env" in ~/.yaw-mcp/bundles.json to skip this prompt in future sessions.`;
21010
+ const why = `"${namespace}" cannot start: it reports ${missing.join(", ")} missing. ${fixHint}`;
21011
+ const entry = await this.collectSecretOnLoopbackPage({
21012
+ namespace,
21013
+ why,
21014
+ secretNoun: isPlural ? `the values of ${missing.join(", ")}` : `the value of ${missing[0]}`,
21015
+ page: {
21016
+ title: `"${namespace}" needs ${isPlural ? "credentials" : "a credential"} to start`,
21017
+ intro: `"${namespace}" cannot start without ${missing.join(", ")} and reported ${pronoun} missing key${isPlural ? "s" : ""} on ${pronoun} own. Type ${isPlural ? "each value" : "the value"} below. yaw-mcp keeps ${what} in memory for this session only -- never written to disk, and never passed to anything other than "${namespace}". ${fixHint}`,
21018
+ fields: missing.map((name) => ({ name, label: name })),
21019
+ doneMessage: "Received. You can close this tab and return to your MCP client."
21020
+ },
21021
+ progress
21022
+ });
21023
+ if (entry.kind === "failed") {
21024
+ log("info", "Credential elicitation did not complete", { namespace, missing });
21025
+ if (this.shuttingDown) return this.shuttingDownRefusal(namespace);
20925
21026
  return null;
20926
21027
  }
20927
- if (result.action !== "accept" || !result.content) {
20928
- log("info", "User declined credential elicitation", { namespace, action: result.action });
21028
+ if (entry.kind === "declined") {
21029
+ log("info", "User declined credential elicitation", { namespace });
21030
+ if (this.shuttingDown) return this.shuttingDownRefusal(namespace);
21031
+ this.credentialElicited.set(namespace, "declined");
21032
+ return null;
21033
+ }
21034
+ if (entry.kind === "unreachable") {
21035
+ log("info", "Credential masked-entry page was unreachable", {
21036
+ namespace,
21037
+ missing,
21038
+ reason: entry.reason
21039
+ });
21040
+ if (this.shuttingDown) return this.shuttingDownRefusal(namespace);
21041
+ if (entry.reason !== "expired") {
21042
+ this.credentialElicited.set(namespace, entry.reason);
21043
+ return this.credentialUnreachableRefusal(namespace, missing, entry.reason);
21044
+ }
20929
21045
  return null;
20930
21046
  }
20931
21047
  const values = {};
20932
21048
  for (const key of missing) {
20933
- const v = result.content[key];
21049
+ const v = entry.values[key];
20934
21050
  if (typeof v === "string" && v.length > 0) values[key] = v;
20935
21051
  }
20936
- if (Object.keys(values).length === 0) return null;
21052
+ if (Object.keys(values).length === 0) {
21053
+ log("info", "Credential masked-entry page returned no values", { namespace, missing });
21054
+ this.credentialElicited.set(namespace, "empty");
21055
+ return null;
21056
+ }
20937
21057
  this.elicitedEnv.set(namespace, { ...supplied, ...values });
20938
21058
  progress?.("Got credentials \u2014 retrying load");
20939
21059
  return this.runActivateOne(
@@ -21059,6 +21179,37 @@ Name collision: ${subject} of "${namespace}" cannot be called. ${entries}${more}
21059
21179
  message: `Could not load "${namespace}": ${what}, so your local secret vault, which its env (${lastError.refKeys.join(", ")}) references, is still locked.${retryHint}`
21060
21180
  };
21061
21181
  }
21182
+ // The result for a missing-credential prompt whose masked-entry page never
21183
+ // took a value. Only called for no-page and no-browser -- expired keeps
21184
+ // the budget and falls through to runActivateOne's give-up, since the user
21185
+ // may simply have been away. The shape mirrors vaultPassphraseUnreachable
21186
+ // so a user who saw the vault message once recognises this one: explain
21187
+ // what could not happen, then point at the bundles.json env path as the
21188
+ // long-term fix. The retry hint is the same shape for both reasons: the
21189
+ // latch above this branch (no-page / no-browser) means a second activate
21190
+ // goes straight to the give-up, so a "no further prompts" line on the
21191
+ // first prompt would be inaccurate.
21192
+ credentialUnreachableRefusal(namespace, missing, reason) {
21193
+ let what;
21194
+ switch (reason) {
21195
+ case "no-browser":
21196
+ what = "yaw-mcp could not open a browser on this machine for the page that takes the credential in a masked field";
21197
+ break;
21198
+ case "no-page":
21199
+ what = "yaw-mcp could not start the local page that takes the credential in a masked field";
21200
+ break;
21201
+ case "expired":
21202
+ throw new Error(
21203
+ `credentialUnreachableRefusal called with reason "expired" -- the caller should have returned null`
21204
+ );
21205
+ }
21206
+ const retryHint = ` Activate "${namespace}" again for a new page, or set ${missing.join(", ")} in its "env" in ~/.yaw-mcp/bundles.json to skip the prompt in future sessions.`;
21207
+ return {
21208
+ ok: false,
21209
+ isChanged: false,
21210
+ message: `Could not load "${namespace}": ${what}, so ${missing.join(", ")} is still missing.${retryHint}`
21211
+ };
21212
+ }
21062
21213
  // Collect secret values WITHOUT them ever being typed into the client's
21063
21214
  // own dialog. They are typed into masked fields on a one-shot page this
21064
21215
  // process serves on 127.0.0.1 (secret-entry-page.ts, which carries the
@@ -21081,8 +21232,8 @@ Name collision: ${subject} of "${namespace}" cannot be called. ${entries}${more}
21081
21232
  // that is exactly the exposure this replaces.
21082
21233
  //
21083
21234
  // Nothing here is vault-specific. The missing-credential prompt
21084
- // (maybeElicitAndRetry, which still asks in a visible form field) can move
21085
- // onto it by supplying its own words and fields.
21235
+ // (maybeElicitAndRetry) supplies its own words and fields and goes through
21236
+ // the same page.
21086
21237
  async collectSecretOnLoopbackPage(request2) {
21087
21238
  const { namespace, why, secretNoun, progress } = request2;
21088
21239
  const modes = getSupportedElicitationModes(this.server.getClientCapabilities()?.elicitation);
@@ -21254,6 +21405,7 @@ Name collision: ${subject} of "${namespace}" cannot be called. ${entries}${more}
21254
21405
  let anyCapped = false;
21255
21406
  let advertisedGrew = false;
21256
21407
  const total = namespaces.length;
21408
+ const loadedOk = [];
21257
21409
  let i = 0;
21258
21410
  for (const namespace of namespaces) {
21259
21411
  i += 1;
@@ -21261,6 +21413,7 @@ Name collision: ${subject} of "${namespace}" cannot be called. ${entries}${more}
21261
21413
  const r = await this.activateOne(namespace, progress);
21262
21414
  results.push(r.message);
21263
21415
  if (r.isChanged) anyChanged = true;
21416
+ if (r.ok) loadedOk.push(namespace);
21264
21417
  if (r.ok) {
21265
21418
  if (!this.sessionActivated.has(namespace)) advertisedGrew = true;
21266
21419
  this.sessionActivated.add(namespace);
@@ -21299,6 +21452,8 @@ Name collision: ${subject} of "${namespace}" cannot be called. ${entries}${more}
21299
21452
  results.push(lead + fix);
21300
21453
  }
21301
21454
  }
21455
+ const execHint = this.execHintForNonRelistingClient(loadedOk);
21456
+ if (execHint) results.push(execHint);
21302
21457
  results.push(...upstreamInstructions);
21303
21458
  return {
21304
21459
  content: [{ type: "text", text: results.join("\n") }],
@@ -21439,6 +21594,7 @@ Name collision: ${subject} of "${namespace}" cannot be called. ${entries}${more}
21439
21594
  let anyError = false;
21440
21595
  let anyCapped = false;
21441
21596
  let advertisedGrew = false;
21597
+ const dispatchedOk = [];
21442
21598
  let i = 0;
21443
21599
  for (const winner of winners) {
21444
21600
  i += 1;
@@ -21449,6 +21605,7 @@ Name collision: ${subject} of "${namespace}" cannot be called. ${entries}${more}
21449
21605
  if (r.ok) {
21450
21606
  if (!this.sessionActivated.has(winner.namespace)) advertisedGrew = true;
21451
21607
  this.sessionActivated.add(winner.namespace);
21608
+ dispatchedOk.push(winner.namespace);
21452
21609
  }
21453
21610
  if (!r.ok) {
21454
21611
  if (r.capped) anyCapped = true;
@@ -21460,6 +21617,8 @@ Name collision: ${subject} of "${namespace}" cannot be called. ${entries}${more}
21460
21617
  } else if (advertisedGrew) {
21461
21618
  await this.notifyAllListsChanged();
21462
21619
  }
21620
+ const execHint = this.execHintForNonRelistingClient(dispatchedOk);
21621
+ if (execHint) results.push(execHint);
21463
21622
  const header = `Dispatched "${trimmed}" \u2014 loaded top ${winners.length} of ${ranked.length} matching server${ranked.length === 1 ? "" : "s"}.
21464
21623
  `;
21465
21624
  return {
@@ -21854,7 +22013,7 @@ Cross-session reliability (dormant, <${flakyPct}% success):`);
21854
22013
  * match rather than leaving the model to infer it -- a silently absent
21855
22014
  * schema reads as "this tool takes no arguments", which is a worse answer
21856
22015
  * than "activate it to see". */
21857
- handleFindTool(query, limit) {
22016
+ async handleFindTool(query, limit) {
21858
22017
  const servers = this.getProfiledActiveServers();
21859
22018
  if (servers.length === 0) {
21860
22019
  const configured = this.config?.servers.length ?? 0;
@@ -21876,10 +22035,17 @@ Cross-session reliability (dormant, <${flakyPct}% success):`);
21876
22035
  1,
21877
22036
  Math.min(limit ?? _ConnectServer.FIND_TOOL_DEFAULT_LIMIT, _ConnectServer.FIND_TOOL_MAX_LIMIT)
21878
22037
  );
21879
- const ranked = rankTools(
22038
+ let ranked = rankTools(
21880
22039
  query,
21881
22040
  servers.map((s) => this.rankableFor(s))
21882
22041
  );
22042
+ if (ranked.length === 0 && this.startupPrewarm) {
22043
+ await this.settleStartupPrewarm();
22044
+ ranked = rankTools(
22045
+ query,
22046
+ this.getProfiledActiveServers().map((s) => this.rankableFor(s))
22047
+ );
22048
+ }
21883
22049
  if (ranked.length === 0) {
21884
22050
  return {
21885
22051
  content: [
@@ -22091,6 +22257,13 @@ To load the top pack in one step, call \`mcp_connect_activate\` with namespaces=
22091
22257
  isError: true
22092
22258
  };
22093
22259
  }
22260
+ if (this.startupPrewarm && steps.some((s) => !this.toolRoutes.has(s.tool))) {
22261
+ await this.settleStartupPrewarm(signal);
22262
+ if (signal?.aborted) {
22263
+ return { content: [{ type: "text", text: "exec: cancelled before step 0 ran." }], isError: true };
22264
+ }
22265
+ if (steps.some((s) => !this.toolRoutes.has(s.tool))) this.rebuildRoutes();
22266
+ }
22094
22267
  for (let i = 0; i < steps.length; i++) {
22095
22268
  const step = steps[i];
22096
22269
  const route = this.toolRoutes.get(step.tool);
@@ -22306,6 +22479,7 @@ To load the top pack in one step, call \`mcp_connect_activate\` with namespaces=
22306
22479
  await Promise.allSettled(disconnects);
22307
22480
  this.connections.clear();
22308
22481
  this.elicitedEnv.clear();
22482
+ this.credentialElicited.clear();
22309
22483
  clearSessionVaultPassphrase();
22310
22484
  this.inflightCalls.clear();
22311
22485
  await this.server.close();
@@ -22350,7 +22524,7 @@ function registerShutdownTriggers(shutdown, targets) {
22350
22524
  // src/status-cmd.ts
22351
22525
  import { existsSync as existsSync10 } from "fs";
22352
22526
  import { homedir as homedir23 } from "os";
22353
- var VERSION2 = true ? "1.0.12" : "dev";
22527
+ var VERSION2 = true ? "1.0.13" : "dev";
22354
22528
  var STATUS_SCHEMA_VERSION = 1;
22355
22529
  var STATUS_USAGE = `Usage: yaw-mcp status [--json]
22356
22530
 
@@ -23130,7 +23304,7 @@ if (subcommand === "compliance") {
23130
23304
  `);
23131
23305
  process.exitCode = 0;
23132
23306
  } else if (subcommand === "--version" || subcommand === "-V") {
23133
- process.stdout.write(`yaw-mcp ${true ? "1.0.12" : "dev"}
23307
+ process.stdout.write(`yaw-mcp ${true ? "1.0.13" : "dev"}
23134
23308
  `);
23135
23309
  process.exitCode = 0;
23136
23310
  } 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.12",
3
+ "version": "1.0.13",
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",
@@ -32,7 +32,7 @@
32
32
  "@modelcontextprotocol/sdk": "^1.29.0",
33
33
  "@yawlabs/mcp-compliance": "^0.17.1",
34
34
  "jsonc-parser": "^3.3.1",
35
- "smol-toml": "^1.8.0",
35
+ "smol-toml": "~1.9.0",
36
36
  "undici": "^6.27.0"
37
37
  },
38
38
  "overrides": {