@yawlabs/mcp 0.80.0 → 1.0.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.
- package/CHANGELOG.md +1341 -995
- package/README.md +116 -11
- package/dist/{auto-upgrade-OHFS4H24.js → auto-upgrade-PREISPB3.js} +1 -1
- package/dist/{chunk-EXO2NR5I.js → chunk-PZMKIDQV.js} +145 -7
- package/dist/index.js +11610 -6995
- package/package.json +2 -2
- package/schemas/yaw-mcp.config.v1.json +31 -4
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ Your MCP client (Claude Code, Cursor, ...)
|
|
|
32
32
|
| Meta-tool | What it does |
|
|
33
33
|
|-----------|--------------|
|
|
34
34
|
| `mcp_connect_dispatch` | Describe a task in plain English; picks the best server, loads its tools, exposes them in one call. The fast path. |
|
|
35
|
-
| `mcp_connect_discover` | List available servers, optionally ranked by a context string. Auto-loads the top match when one clearly wins. |
|
|
35
|
+
| `mcp_connect_discover` | List available servers, optionally ranked by a context string. Auto-loads the top match when one clearly wins. Tool-name lists are capped at five per server; pass `server` for one server's full list. |
|
|
36
36
|
| `mcp_connect_activate` / `deactivate` | Load / unload specific servers by namespace. |
|
|
37
37
|
| `mcp_connect_read_tool` | Return one tool's schema without loading its server. |
|
|
38
38
|
| `mcp_connect_exec` | Run a short declarative pipeline of tool calls in one round-trip (`{"$ref": "<step>[.path]"}` splices prior outputs; no eval, max 16 steps). |
|
|
@@ -47,24 +47,26 @@ Your MCP client (Claude Code, Cursor, ...)
|
|
|
47
47
|
- **Learning** -- servers that succeeded before get a small nudge (+10% max), persisted across restarts.
|
|
48
48
|
- **Sampling tiebreak** -- when the top two are within 10% and your client supports [MCP sampling](https://modelcontextprotocol.io/specification/server/sampling), yaw-mcp asks your own model to pick (no extra provider key or cost).
|
|
49
49
|
|
|
50
|
-
Servers auto-unload after ~10 tool calls to other servers, so context stays clean even if you forget. The threshold is adaptive per namespace (`[5, 50]`): bursty servers get more patience, long-idle ones unload at the baseline.
|
|
50
|
+
Servers auto-unload after ~10 tool calls to other servers, so context stays clean even if you forget. The threshold is adaptive per namespace (`[5, 50]`): bursty servers get more patience, long-idle ones unload at the baseline. A server that is expensive to *start* can opt out entirely with `yaw-mcp set <server> pinned=true` -- it then stays loaded however idle it gets, and `mcp_connect_health` still reports how idle that is.
|
|
51
51
|
|
|
52
52
|
## Install
|
|
53
53
|
|
|
54
54
|
### One command (recommended)
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
npx -y @yawlabs/mcp@latest install <claude-code|claude-desktop|cursor|vscode>
|
|
57
|
+
npx -y @yawlabs/mcp@latest install <claude-code|claude-desktop|cursor|vscode|windsurf|gemini-cli>
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
This edits the chosen client's config (correct path + JSON shape for your OS) to launch yaw-mcp. On Windows it wraps `npx` in `cmd /c` (without which MCP clients hit `ENOENT` on the `npx.cmd` shim). Run it once per client.
|
|
61
61
|
|
|
62
62
|
Useful flags:
|
|
63
63
|
|
|
64
|
-
- `--scope user|project|local` -- which file to write
|
|
64
|
+
- `--scope user|project|local` -- which file to write. Claude Code and Cursor support project and local; VS Code and Gemini CLI support user and project; Claude Desktop and Windsurf are user-only.
|
|
65
65
|
- `--dry-run` -- print what would be added (never the rest of the file) and exit without writing.
|
|
66
66
|
- `--force` / `--skip` -- overwrite or leave an existing `mcp` entry (otherwise prompts on a TTY, refuses off-TTY).
|
|
67
67
|
|
|
68
|
+
After it writes, install reports two things it did **not** change. First, how many servers `~/.yaw-mcp/bundles.json` gives yaw-mcp to serve -- and when that is none, the `yaw-mcp add <slug>` step still to take -- though no longer *before* a restart, since yaw-mcp re-reads that file while the session runs and picks up a server added afterwards on the next `mcp_connect_*` call. Second, how many other MCP servers were already configured in the client file it just edited; those keep launching directly from the client, and installing yaw-mcp does not move them behind the broker. The count is a number, never the server names. Under `--all` the bundles.json line prints once for the run, while the per-client count prints under each client.
|
|
69
|
+
|
|
68
70
|
Or do every detected client at once:
|
|
69
71
|
|
|
70
72
|
```bash
|
|
@@ -167,17 +169,50 @@ yaw-mcp doctor [--json] # diagnose config, clients, learning, reliability
|
|
|
167
169
|
|
|
168
170
|
```bash
|
|
169
171
|
yaw-mcp add <slug> [--env KEY=value] [--dry-run] # add a catalog server to bundles.json
|
|
170
|
-
yaw-mcp
|
|
172
|
+
yaw-mcp add <name> --command "npx -y my-mcp" # ...or define a local server yourself
|
|
173
|
+
yaw-mcp add <name> --url https://host/mcp # ...or a remote one
|
|
174
|
+
yaw-mcp import <client> [--dry-run] # adopt the servers a client already has
|
|
175
|
+
yaw-mcp remove <slug-or-namespace-or-name> # drop a server
|
|
171
176
|
yaw-mcp list [--json] # list configured servers with their cached compliance grade
|
|
172
177
|
yaw-mcp try <slug> [--client <name>] [--ttl 1h] # wire a one-off trial straight into your client (expires)
|
|
173
178
|
yaw-mcp try-cleanup <slug> # remove a trial early (doctor GCs expired ones)
|
|
174
179
|
yaw-mcp trust [--yes|--list|--revoke [<path>]] # approve the project-local .yaw-mcp/bundles.json found from cwd so yaw-mcp loads it (pinned to its exact contents)
|
|
175
180
|
```
|
|
176
181
|
|
|
177
|
-
`add` is not `install`: `install <client>` connects an AI client to yaw-mcp; `add <slug>` adds an MCP server to yaw-mcp itself. `try` points the client directly at the upstream server, bypassing yaw-mcp, so you can evaluate it in isolation. A `--env` value lands in your shell history and process argv like any argument. With `add` it is stored in plain text (
|
|
182
|
+
`add` is not `install`: `install <client>` connects an AI client to yaw-mcp; `add <slug>` adds an MCP server to yaw-mcp itself. `try` points the client directly at the upstream server, bypassing yaw-mcp, so you can evaluate it in isolation. A `--env` value lands in your shell history and process argv like any argument. With `add` it is stored in plain text in `bundles.json` (written owner-only, mode `0600`, on macOS and Linux; on Windows that mode is not applied -- Node maps it to the read-only attribute only -- so the file is protected by the NTFS permissions it inherits from your user profile) -- keep real credentials in the [local secret vault](#local-secret-vault) and pass `--env KEY='${secret:NAME}'` instead (the single quotes are for bash, zsh and PowerShell; in cmd.exe pass it unquoted, since `$` is not special there and cmd.exe would keep the quotes as part of the value). A `missing` row in `yaw-mcp secrets audit` whose name starts with `<malformed ref>` is a reference that did not parse -- fix the typo in `bundles.json`. With `try` the value is written inline, in plain text, into the client's own config for the trial's lifetime, and is not vault-resolved (the client spawns the server, not yaw-mcp).
|
|
183
|
+
|
|
184
|
+
**Servers you already have.** If a client is already configured with MCP servers, `yaw-mcp import <client>` reads that client's own config and adds every server in it to your `bundles.json` -- command, args, url, headers and env as they stand, so the imported server starts exactly as it did before. yaw-mcp's own entry is never imported. `--dry-run` shows what would come across without writing anything.
|
|
185
|
+
|
|
186
|
+
After an import the client is *still* launching those servers itself, so each one would run twice -- once directly, once through yaw-mcp. `import` says so and offers to remove the originals from the client config: on a terminal it asks (a bare Enter is no), and off one it leaves them alone and names the `--remove-originals` flag. It refuses to remove them at all if the client has no yaw-mcp entry, since that entry is the only way it would still reach them -- run `yaw-mcp install <client>` first.
|
|
187
|
+
|
|
188
|
+
An imported entry carries no catalog slug, so its handles are its namespace and its **name** (the key the client used). `remove`, `set`, `enable` and `disable` all accept either: `yaw-mcp remove "GitHub Copilot"` works as well as `yaw-mcp remove githubcopilot`.
|
|
189
|
+
|
|
190
|
+
A credential that was sitting in the client config comes across as a plain value in `bundles.json` (file mode `0600`); the import prints the key names -- never the values -- and points at `yaw-mcp secrets set` for moving them into the [vault](#local-secret-vault).
|
|
191
|
+
|
|
192
|
+
**Servers the catalog does not list.** The catalog is a curated front door, not the only one. Pass `--command` for a local (stdio) server or `--url` for a remote (HTTP) one, and `add` defines the server from your flags instead of looking up a slug -- no catalog fetch, so this also works offline:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
yaw-mcp add mytool --command "npx -y @scope/my-mcp@latest" --description "what it is for"
|
|
196
|
+
yaw-mcp add linear --url https://mcp.linear.app/mcp \
|
|
197
|
+
--header 'Authorization: Bearer ${secret:linear}'
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`--header` is repeatable and remote-only: a remote server spawns no process, so `--env` cannot reach it (see [`headers`](#remote-servers-headers)). `--transport sse` selects SSE over the streamable-HTTP default. `--description` is worth setting either way, since dispatch ranks servers on it.
|
|
178
201
|
|
|
179
202
|
A project-local `.yaw-mcp/bundles.json` (committed with a repo) is ignored until `yaw-mcp trust` approves it, since every server in it is a command yaw-mcp spawns as you. Approval is pinned to the file's exact contents, so an edited file needs approving again; `--list` shows approvals (stale ones flagged) and `--revoke` withdraws one. Your own `~/.yaw-mcp/bundles.json` is never gated.
|
|
180
203
|
|
|
204
|
+
**Calling a server from a shell** -- for a git hook, a Makefile, a cron job or an agent loop that does not speak MCP:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
yaw-mcp call <namespace> <tool> '{"key":"value"}' # call one tool, print the result
|
|
208
|
+
yaw-mcp call github search --args-stdin < args.json # ...or pipe the argument object in
|
|
209
|
+
yaw-mcp call github search --json # the raw MCP envelope, not just its text
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
One call, one spawn: the server is started for the call and torn down again, so nothing stays loaded and two calls are two spawns (for a batch, the `mcp_connect_exec` pipeline is the right tool). The tool's text goes to stdout verbatim so it can be piped; diagnostics go to stderr. Exit `0` when the tool answered, `1` when it could not be called or answered with an error, `2` when your own config refused the call.
|
|
213
|
+
|
|
214
|
+
It gets the same policy a proxied call gets, and gets it *before* the server is spawned: a disabled server, one your project profile blocks, one below `YAW_MCP_MIN_COMPLIANCE`, and any tool on the [`blockedTools`](#blocking-individual-tools) deny list are all refused. A `${secret:NAME}` in the server's env resolves from the vault exactly as it does for the broker.
|
|
215
|
+
|
|
181
216
|
**Inspection & maintenance**
|
|
182
217
|
|
|
183
218
|
```bash
|
|
@@ -222,15 +257,55 @@ The project `.yaw-mcp/` is found by walking up from the cwd -- stopping just bef
|
|
|
222
257
|
|
|
223
258
|
That shape ships as a JSON Schema -- [`schemas/yaw-mcp.config.v1.json`](schemas/yaw-mcp.config.v1.json), served from the raw URL in the `$schema` line above -- so any editor that honors `$schema` completes the keys and flags a typo as you type. A namespace is `[a-z][a-z0-9_]{0,29}` (so `prod_db`, not `prod-db`); the schema rejects anything else, while the loader only warns and keeps loading.
|
|
224
259
|
|
|
225
|
-
Malformed files log a warning and fall through (fail-open). yaw-mcp reads
|
|
260
|
+
Malformed files log a warning and fall through (fail-open). yaw-mcp reads *this* file once at startup, so restart the client after editing it -- unlike `bundles.json`, which is re-read while the session runs. `mcp_connect_health` shows which files are applied.
|
|
226
261
|
|
|
227
262
|
### Project guide -- `YAW-MCP.md`
|
|
228
263
|
|
|
229
264
|
Drop a `YAW-MCP.md` next to `config.json` in either `.yaw-mcp/` and yaw-mcp surfaces it via a `yaw-mcp://guide` MCP resource. The `discover`/`dispatch` descriptions tell the model to read it first, so project routing conventions ("use the `gh` server, not bash") and credential guidance stick without restating them each session. A user guide (`~/.yaw-mcp/YAW-MCP.md`) and a project guide are concatenated with the project one last; a missing file is skipped silently.
|
|
230
265
|
|
|
266
|
+
### Finding a server
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
yaw-mcp search sql # slug, name, tags, category, description
|
|
270
|
+
yaw-mcp search # list the whole catalog
|
|
271
|
+
yaw-mcp search sql --json # machine-readable
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Each match prints its runtime, tool count and the credentials it needs by name, so you know what an `add` will ask for before you run it. Nothing is written; `yaw-mcp add <slug>` is what installs. A slug that misses now suggests the closest real one rather than only naming a URL.
|
|
275
|
+
|
|
276
|
+
### Changing a server without editing JSON
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
yaw-mcp set github isActive=false # or: yaw-mcp disable github
|
|
280
|
+
yaw-mcp set github pinned=true # never idle-unload this one
|
|
281
|
+
yaw-mcp set github runtime=oam # host it on the oam runtime
|
|
282
|
+
yaw-mcp set github connectTimeoutMs=60000 # slower handshake, this server only
|
|
283
|
+
yaw-mcp set github env.GITHUB_TOKEN='${secret:gh}' # point at the vault
|
|
284
|
+
yaw-mcp set github env.OLD_VAR= # remove one variable
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Only the entry you name is rewritten, so comments and formatting elsewhere in `bundles.json` survive -- unlike `add` and `remove`, which rewrite the whole file. `enable` and `disable` are the same edit as `set <server> isActive=true|false`.
|
|
288
|
+
|
|
289
|
+
Settable: `isActive`, `pinned`, `runtime`, `connectTimeoutMs`, `description`, and one `env.KEY` at a time. Everything else is refused, including `command`, `args` and `url` -- those decide which program yaw-mcp launches as you, and belong to `add`/`remove` or a deliberate edit. A trailing `=` clears a field; clearing a stored env value asks first, since it does not come back.
|
|
290
|
+
|
|
291
|
+
### Blocking individual tools
|
|
292
|
+
|
|
293
|
+
`blocked` turns a whole server off. `blockedTools` turns off individual tools on servers you otherwise want:
|
|
294
|
+
|
|
295
|
+
```jsonc
|
|
296
|
+
// .yaw-mcp/config.json
|
|
297
|
+
{ "blockedTools": ["gh_delete_repo", "pg_drop_*"] }
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Entries are the flattened `<namespace>_<tool>` names that appear in the tool list, matched literally and case-sensitively, with an optional single trailing `*` for a prefix match. A bare `*` is refused, and a bare tool name does not match across servers -- `<namespace>_<tool>` cannot be split back apart reliably, because a namespace may itself contain `_`. The broker's own `mcp_connect_*` tools cannot be blocked.
|
|
301
|
+
|
|
302
|
+
The two keys act on different events. `blocked` is checked when a server would start; `blockedTools` is checked when a tool would be called, which is also what makes it cover a tool reached inside an `mcp_connect_exec` pipeline. A pipeline naming a blocked tool is refused before any step runs, rather than failing partway through. Denies merge across config scopes, so a project config can add one but never remove one, and there is no allow-list counterpart.
|
|
303
|
+
|
|
304
|
+
A blocked tool is withheld from the tool list, so the model does not see it as an option, but it keeps its route: calling it by name returns an explicit refusal rather than an unknown-tool error that reads like a typo. `discover` still shows it in a server's known-tools line, marked `[blocked]`, since that line describes what the server offers.
|
|
305
|
+
|
|
231
306
|
## Local secret vault
|
|
232
307
|
|
|
233
|
-
Rather than putting credentials in a client config, keep a value in an encrypted file on your own machine and reference it
|
|
308
|
+
Rather than putting credentials in a client config, keep a value in an encrypted file on your own machine and reference it with a `${secret:NAME}` placeholder. A **local** server takes it in `env`, which becomes the child process's environment:
|
|
234
309
|
|
|
235
310
|
```jsonc
|
|
236
311
|
"env": {
|
|
@@ -239,7 +314,33 @@ Rather than putting credentials in a client config, keep a value in an encrypted
|
|
|
239
314
|
}
|
|
240
315
|
```
|
|
241
316
|
|
|
242
|
-
|
|
317
|
+
A **remote** (HTTP/SSE) server takes it in `headers`, which are sent on every request the transport makes:
|
|
318
|
+
|
|
319
|
+
```jsonc
|
|
320
|
+
{ "namespace": "linear", "type": "remote", "url": "https://mcp.linear.app/mcp",
|
|
321
|
+
"headers": { "Authorization": "Bearer ${secret:linear}" } }
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
The two are the local and remote halves of one mechanism: same vault, same placeholder, same refusal. `env` on a remote entry is ignored (it warns and tells you to use `headers`), and `headers` on a local entry is ignored the same way. A header name is dropped at load, with a warning, if its value is blank, if the name is not a valid HTTP header name, or if it is `Mcp-Session-Id` or `Mcp-Protocol-Version` in any casing -- the transport sets those, and a duplicate would corrupt the session rather than override it.
|
|
325
|
+
|
|
326
|
+
When the server starts -- a spawn for a local one, a connect for a remote one -- if `YAW_MCP_VAULT_PASSPHRASE` is set in yaw-mcp's own env, it decrypts the referenced names and substitutes them into the child's env or onto the request headers. If the passphrase is absent or a name isn't stored, the start is **refused** -- the literal `${secret:NAME}` is never passed through, since some servers would treat the placeholder as a real token. The value never leaves your machine, and it is stripped out of error text before that text reaches a log or the model.
|
|
327
|
+
|
|
328
|
+
### Remote servers: `headers`
|
|
329
|
+
|
|
330
|
+
A remote (HTTP/SSE) server spawns no process, so it has no env to put a credential in -- yaw-mcp warns and ignores `env` on a remote entry. Its credential channel is `headers`, which takes the same `${secret:NAME}` references:
|
|
331
|
+
|
|
332
|
+
```jsonc
|
|
333
|
+
{
|
|
334
|
+
"namespace": "linear",
|
|
335
|
+
"type": "remote",
|
|
336
|
+
"url": "https://mcp.linear.app/mcp",
|
|
337
|
+
"headers": {
|
|
338
|
+
"Authorization": "Bearer ${secret:linear}"
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Headers are resolved through the same fail-closed path: a missing or malformed reference refuses the **connect**, so no request is made at all rather than one carrying the literal to a third party. They apply to both transports, including the SSE stream.
|
|
243
344
|
|
|
244
345
|
**Where the passphrase comes from.** Three ways, in the order you'll meet them:
|
|
245
346
|
|
|
@@ -276,7 +377,8 @@ MCP servers are third-party code you choose to run. yaw-mcp doesn't sandbox them
|
|
|
276
377
|
- **Compliance grades (A-F)** -- the `@yawlabs/mcp-compliance` suite (88 tests) grades a server; `yaw-mcp list` shows it in a `GRADE` column and `discover` shows it inline (`github [ready] [A]`). `YAW_MCP_MIN_COMPLIANCE=B` makes `activate` refuse anything below the floor. Ungraded servers pass (don't punish unknown); audit them yourself with `yaw-mcp compliance <target>`.
|
|
277
378
|
- **Source transparency** -- `list` and `discover` show the exact `command`, `args`, and `url` each server launches with. Nothing is wrapped.
|
|
278
379
|
- **Local credentials** -- vault values are encrypted at rest (scrypt + AES-256-GCM), injected at spawn, and never logged. Nothing is transmitted off the machine.
|
|
279
|
-
- **
|
|
380
|
+
- **Failure output reaches your client** -- when a server fails to start, the tail of its stderr is attached to the activation error, so it lands in your client's context (and your model's) as well as the log. That tail is the server's own output -- never your files, buffers or shell history -- and it is redacted first: values yaw-mcp injected from `bundles.json` or the vault, resolved request headers, and credential-named variables inherited from your shell (`GITHUB_TOKEN`, `AWS_SECRET_ACCESS_KEY`, `NPM_TOKEN`, ...) are each replaced with `***NAME***`, which names the credential to rotate without showing it. Redaction is exact-substring on values of 8 characters or more, so a credential parked under a name that does not read as one is not covered. There is no opt-out: the tail is what makes a failed start diagnosable, and the missing-credential prompt below reads the same text.
|
|
381
|
+
- **Response pruning** (`YAW_MCP_PRUNE_RESPONSES`, on by default) -- trims token cost by dropping no-information keys (null / empty array / empty object) and trimming trailing whitespace and long blank runs in text results. The text rules classify the block before editing it, so a unified diff comes back byte-faithful, fenced code blocks are left alone, and Markdown hard line breaks survive. Structured values are never altered or redacted; it is a token-savings feature, not a security control.
|
|
280
382
|
- **Namespace isolation** -- tools are namespace-prefixed (`gh_create_issue`, never bare `create_issue`), so a server can't impersonate another's tools. `mcp_connect_read_tool` inspects a schema before any code runs.
|
|
281
383
|
|
|
282
384
|
yaw-mcp does **not** block outbound traffic, firewall DNS, analyze source, or pin hashes -- a malicious server you chose to run can reach any URL your machine can. Review the command before adding a server, run untrusted ones under a restricted user or container, and prefer graded servers when alternatives are equivalent. Report a security issue in yaw-mcp itself via [GitHub private advisories](https://github.com/YawLabs/mcp/security/advisories/new) (see [`SECURITY.md`](./SECURITY.md)).
|
|
@@ -291,17 +393,20 @@ Common ones (run `yaw-mcp --help` for the full list):
|
|
|
291
393
|
|
|
292
394
|
| Variable | Description |
|
|
293
395
|
|----------|-------------|
|
|
294
|
-
| `YAW_MCP_SERVER_CAP` | Max concurrently active servers. Default `6`; `0` disables the cap. |
|
|
396
|
+
| `YAW_MCP_SERVER_CAP` | Max concurrently active servers. Default `6`; `0` disables the cap. Counts servers that are loaded and advertising tools, not upstream processes: startup pre-warm briefly spawns servers it never advertises (see `YAW_MCP_PREWARM`), so on a first session the live child count can exceed this by up to the pre-warm batch size of three, each extra child closing as soon as its tool list is read. |
|
|
295
397
|
| `YAW_MCP_MIN_COMPLIANCE` | Minimum grade (`A`-`F`) an installed server must report before `activate` loads it. |
|
|
296
398
|
| `YAW_MCP_VAULT_PASSPHRASE` | Passphrase for the local secret vault. Required for spawn-time `${secret:NAME}` substitution -- set it in yaw-mcp's own env, not the upstream server's. Clients supporting elicitation prompt for it instead. |
|
|
297
399
|
| `YAW_MCP_TRUST_PROJECT` | `1` skips the consent check on a project-local `.yaw-mcp/bundles.json` and loads it unconditionally. CI/automation only -- it lets any repo you run yaw-mcp inside spawn commands as you. Default: the file must be approved with `yaw-mcp trust`. |
|
|
298
400
|
| `YAW_MCP_AUTO_ACTIVATE` | `0` disables discover auto-loading a clearly-winning server. Default on. |
|
|
299
401
|
| `YAW_MCP_AUTO_UPGRADE` | `0` disables the background self-upgrade check at startup. Default on. |
|
|
300
402
|
| `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. |
|
|
403
|
+
| `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. |
|
|
301
404
|
| `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. |
|
|
302
405
|
| `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"`. |
|
|
303
406
|
| `YAW_MCP_AUTO_LOAD` | `1` pre-activates the top recurring pack at startup (needs persistence). Default off. |
|
|
304
407
|
| `YAW_MCP_PRUNE_RESPONSES` | `0` disables response pruning. Default on. |
|
|
408
|
+
| `YAW_MCP_MAX_RESULT_BYTES` | Ceiling on a single proxied tool result. Over it, the reply is cut and carries a marker saying so, with the byte total and what was dropped -- a silently truncated result reads to the model as a complete one. Default `100000` (~25k tokens); `0` disables. `structuredContent` is passed through verbatim and is never cut. |
|
|
409
|
+
| `YAW_MCP_TOOL_TOKEN_CAP` | Ceiling on the estimated tokens of the whole loaded tool surface, checked alongside `YAW_MCP_SERVER_CAP` when a server is activated. The server cap counts servers, which says nothing about their size: six 3-tool servers and six 60-tool servers both sit at a cap of `6`. Default off. |
|
|
305
410
|
| `MCP_CONNECT_TIMEOUT` | Milliseconds to wait for a server's MCP handshake. Default `15000`; a server's own `connectTimeoutMs` in `bundles.json` always wins. Whole milliseconds in `1..2147483647` -- anything else falls back to the default with one warn. |
|
|
306
411
|
| `MCP_LIST_TIMEOUT` | Milliseconds to wait for a server's tool/resource/prompt inventory calls after the handshake. Default `15000`; same `1..2147483647` whole-millisecond parse, invalid values fall back with one warn. |
|
|
307
412
|
| `MCP_CALL_TIMEOUT` | Milliseconds to wait for a single proxied `tools/call`. Default `60000` (the SDK's own bound); raise it for legitimately slow servers. Same `1..2147483647` whole-millisecond parse, invalid values fall back with one warn. |
|
|
@@ -51,9 +51,35 @@ function guardStderrErrors() {
|
|
|
51
51
|
} catch {
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
var surface = "server";
|
|
55
|
+
function setLogSurface(next) {
|
|
56
|
+
surface = next;
|
|
57
|
+
}
|
|
58
|
+
function logLevelRequested() {
|
|
59
|
+
const raw = process.env.LOG_LEVEL?.trim().toLowerCase();
|
|
60
|
+
return raw !== void 0 && raw in LOG_LEVELS;
|
|
61
|
+
}
|
|
62
|
+
function renderData(data) {
|
|
63
|
+
if (data === void 0) return "";
|
|
64
|
+
try {
|
|
65
|
+
const parts = Object.entries(data).map(([k, v]) => `${k}=${typeof v === "string" ? v : JSON.stringify(v)}`);
|
|
66
|
+
return parts.length > 0 ? ` (${parts.join("; ")})` : "";
|
|
67
|
+
} catch {
|
|
68
|
+
return " (details omitted)";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
54
71
|
function log(level, msg, data) {
|
|
55
72
|
if (LOG_LEVELS[level] < minLevel()) return;
|
|
56
73
|
guardStderrErrors();
|
|
74
|
+
if (surface === "cli" && !logLevelRequested()) {
|
|
75
|
+
if (LOG_LEVELS[level] < LOG_LEVELS.warn) return;
|
|
76
|
+
try {
|
|
77
|
+
process.stderr.write(`yaw-mcp: ${level === "warn" ? "warning" : "error"}: ${msg}${renderData(data)}
|
|
78
|
+
`);
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
57
83
|
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
58
84
|
let entry;
|
|
59
85
|
try {
|
|
@@ -67,6 +93,27 @@ function log(level, msg, data) {
|
|
|
67
93
|
} catch {
|
|
68
94
|
}
|
|
69
95
|
}
|
|
96
|
+
var brokenStreams = /* @__PURE__ */ new WeakSet();
|
|
97
|
+
var guardedStreams = /* @__PURE__ */ new WeakSet();
|
|
98
|
+
function createStreamWriter(stream) {
|
|
99
|
+
if (!guardedStreams.has(stream)) {
|
|
100
|
+
guardedStreams.add(stream);
|
|
101
|
+
try {
|
|
102
|
+
stream.on("error", () => {
|
|
103
|
+
brokenStreams.add(stream);
|
|
104
|
+
});
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return (s) => {
|
|
109
|
+
if (brokenStreams.has(stream)) return;
|
|
110
|
+
try {
|
|
111
|
+
stream.write(s);
|
|
112
|
+
} catch {
|
|
113
|
+
brokenStreams.add(stream);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
70
117
|
|
|
71
118
|
// src/upgrade-cmd.ts
|
|
72
119
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -154,8 +201,17 @@ var INSTALL_TARGETS = [
|
|
|
154
201
|
label: "VS Code",
|
|
155
202
|
jsonShape: "servers",
|
|
156
203
|
availableOn: ["macos", "linux", "windows"],
|
|
157
|
-
notes: "VS Code uses `servers` (not `mcpServers`) as the top-level key in .vscode/mcp.json.",
|
|
204
|
+
notes: "VS Code uses `servers` (not `mcpServers`) as the top-level key in mcp.json -- the user-profile file and .vscode/mcp.json share that shape. The user file covers the DEFAULT profile only; a custom profile keeps its own copy under Code/User/profiles/<id>/mcp.json. Needs VS Code 1.102 or newer, before which user-level MCP lived under the `mcp` key in settings.json.",
|
|
158
205
|
scopes: [
|
|
206
|
+
// User FIRST: enumerateProbeSlots walks this array in order, so it
|
|
207
|
+
// decides --list and doctor row order, and every other multi-scope
|
|
208
|
+
// client lists user before project.
|
|
209
|
+
{
|
|
210
|
+
scope: "user",
|
|
211
|
+
label: "User (global)",
|
|
212
|
+
description: "Private to this machine; applies to every VS Code workspace.",
|
|
213
|
+
requiresProjectDir: false
|
|
214
|
+
},
|
|
159
215
|
{
|
|
160
216
|
scope: "project",
|
|
161
217
|
label: "Workspace",
|
|
@@ -163,6 +219,45 @@ var INSTALL_TARGETS = [
|
|
|
163
219
|
requiresProjectDir: true
|
|
164
220
|
}
|
|
165
221
|
]
|
|
222
|
+
},
|
|
223
|
+
// APPENDED, never inserted: autoDetectClient returns the first usable probe
|
|
224
|
+
// slot in array order and documents Claude-Code-first as an invariant, so an
|
|
225
|
+
// insert would silently change which client `try` picks for existing users.
|
|
226
|
+
{
|
|
227
|
+
clientId: "windsurf",
|
|
228
|
+
label: "Windsurf",
|
|
229
|
+
jsonShape: "mcpServers",
|
|
230
|
+
availableOn: ["macos", "linux", "windows"],
|
|
231
|
+
notes: "Windsurf reads ~/.codeium/windsurf/mcp_config.json and does not create it on first launch. If the server does not appear, open Cascade -> MCP servers -> Manage plugins -> View raw config and check it is the file above.",
|
|
232
|
+
scopes: [
|
|
233
|
+
{
|
|
234
|
+
scope: "user",
|
|
235
|
+
label: "User (global)",
|
|
236
|
+
description: "The only config file Windsurf reads; it has no workspace scope.",
|
|
237
|
+
requiresProjectDir: false
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
clientId: "gemini-cli",
|
|
243
|
+
label: "Gemini CLI",
|
|
244
|
+
jsonShape: "mcpServers",
|
|
245
|
+
availableOn: ["macos", "linux", "windows"],
|
|
246
|
+
notes: "Gemini CLI merges ~/.gemini/settings.json with <project>/.gemini/settings.json, project winning. `mcpServers` is a top-level key, distinct from the sibling `mcp` object that holds discovery knobs.",
|
|
247
|
+
scopes: [
|
|
248
|
+
{
|
|
249
|
+
scope: "user",
|
|
250
|
+
label: "User (global)",
|
|
251
|
+
description: "Private to this machine; applies to every project.",
|
|
252
|
+
requiresProjectDir: false
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
scope: "project",
|
|
256
|
+
label: "Project",
|
|
257
|
+
description: "Commit to share with your team; wins over the user file.",
|
|
258
|
+
requiresProjectDir: true
|
|
259
|
+
}
|
|
260
|
+
]
|
|
166
261
|
}
|
|
167
262
|
];
|
|
168
263
|
function resolveAppDataDir(opts) {
|
|
@@ -258,12 +353,52 @@ function pathFor(client, scope, os, base) {
|
|
|
258
353
|
};
|
|
259
354
|
}
|
|
260
355
|
if (client === "vscode") {
|
|
356
|
+
if (scope === "user") {
|
|
357
|
+
if (os === "windows") {
|
|
358
|
+
return {
|
|
359
|
+
absolute: join(appData, "Code", "User", "mcp.json"),
|
|
360
|
+
display: "%APPDATA%\\Code\\User\\mcp.json",
|
|
361
|
+
containerPath: ["servers"]
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
if (os === "macos") {
|
|
365
|
+
return {
|
|
366
|
+
absolute: join(home, "Library", "Application Support", "Code", "User", "mcp.json"),
|
|
367
|
+
display: "~/Library/Application Support/Code/User/mcp.json",
|
|
368
|
+
containerPath: ["servers"]
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
return {
|
|
372
|
+
absolute: join(home, ".config", "Code", "User", "mcp.json"),
|
|
373
|
+
display: "~/.config/Code/User/mcp.json",
|
|
374
|
+
containerPath: ["servers"]
|
|
375
|
+
};
|
|
376
|
+
}
|
|
261
377
|
return {
|
|
262
378
|
absolute: join(projectDir, ".vscode", "mcp.json"),
|
|
263
379
|
display: joinPath("<project folder>", ".vscode", "mcp.json"),
|
|
264
380
|
containerPath: ["servers"]
|
|
265
381
|
};
|
|
266
382
|
}
|
|
383
|
+
if (client === "windsurf") {
|
|
384
|
+
const display = os === "windows" ? "%USERPROFILE%\\.codeium\\windsurf\\mcp_config.json" : "~/.codeium/windsurf/mcp_config.json";
|
|
385
|
+
return {
|
|
386
|
+
absolute: join(home, ".codeium", "windsurf", "mcp_config.json"),
|
|
387
|
+
display,
|
|
388
|
+
containerPath: ["mcpServers"]
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
if (client === "gemini-cli") {
|
|
392
|
+
if (scope === "user") {
|
|
393
|
+
const display = os === "windows" ? "%USERPROFILE%\\.gemini\\settings.json" : "~/.gemini/settings.json";
|
|
394
|
+
return { absolute: join(home, ".gemini", "settings.json"), display, containerPath: ["mcpServers"] };
|
|
395
|
+
}
|
|
396
|
+
return {
|
|
397
|
+
absolute: join(projectDir, ".gemini", "settings.json"),
|
|
398
|
+
display: joinPath("<project folder>", ".gemini", "settings.json"),
|
|
399
|
+
containerPath: ["mcpServers"]
|
|
400
|
+
};
|
|
401
|
+
}
|
|
267
402
|
throw new Error(`Unhandled client: ${client}`);
|
|
268
403
|
}
|
|
269
404
|
var CMD_METACHARS = /[&|<>^()]/g;
|
|
@@ -1413,7 +1548,7 @@ async function oamFloorLines(probe) {
|
|
|
1413
1548
|
}
|
|
1414
1549
|
async function defaultRunningPrefix(argvPath) {
|
|
1415
1550
|
if (process.env.VITEST) return null;
|
|
1416
|
-
const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-
|
|
1551
|
+
const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-PREISPB3.js");
|
|
1417
1552
|
return detectRunningInstallPrefix2(argvPath);
|
|
1418
1553
|
}
|
|
1419
1554
|
async function defaultSpawn(cmd, args, cwd) {
|
|
@@ -1444,8 +1579,8 @@ async function detectSea() {
|
|
|
1444
1579
|
}
|
|
1445
1580
|
}
|
|
1446
1581
|
async function runUpgrade(opts = {}) {
|
|
1447
|
-
const write = opts.out ?? (
|
|
1448
|
-
const writeErr = opts.err ?? (
|
|
1582
|
+
const write = opts.out ?? createStreamWriter(process.stdout);
|
|
1583
|
+
const writeErr = opts.err ?? createStreamWriter(process.stderr);
|
|
1449
1584
|
const lines = [];
|
|
1450
1585
|
const print = (s = "") => {
|
|
1451
1586
|
lines.push(s);
|
|
@@ -1474,7 +1609,7 @@ async function runUpgrade(opts = {}) {
|
|
|
1474
1609
|
if (method === "global-npm") {
|
|
1475
1610
|
const rawPrefix = await (opts.runningPrefix ?? defaultRunningPrefix)(argvPath);
|
|
1476
1611
|
if (rawPrefix !== null) {
|
|
1477
|
-
const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-
|
|
1612
|
+
const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-PREISPB3.js");
|
|
1478
1613
|
const spawnForm = quoteShellArgIfNeeded2(rawPrefix, opts.platform);
|
|
1479
1614
|
const displayForm = quoteArgForDisplay2(rawPrefix, opts.platform);
|
|
1480
1615
|
if (spawnForm !== null && displayForm !== null) {
|
|
@@ -1591,7 +1726,7 @@ async function runUpgrade(opts = {}) {
|
|
|
1591
1726
|
return { exitCode: 3, lines };
|
|
1592
1727
|
}
|
|
1593
1728
|
function readCurrentVersion() {
|
|
1594
|
-
return true ? "0.
|
|
1729
|
+
return true ? "1.0.0" : "dev";
|
|
1595
1730
|
}
|
|
1596
1731
|
|
|
1597
1732
|
// src/auto-upgrade.ts
|
|
@@ -1858,7 +1993,7 @@ function defaultSpawn2(cmd, args, onDone = () => {
|
|
|
1858
1993
|
async function maybeAutoUpgrade(deps = {}) {
|
|
1859
1994
|
const optOut = process.env.YAW_MCP_AUTO_UPGRADE;
|
|
1860
1995
|
if (optOut === "0" || optOut?.toLowerCase() === "false") return;
|
|
1861
|
-
const current = deps.currentVersion ?? (true ? "0.
|
|
1996
|
+
const current = deps.currentVersion ?? (true ? "1.0.0" : "dev");
|
|
1862
1997
|
if (current === "dev") return;
|
|
1863
1998
|
const argvPath = deps.argvPath ?? process.argv[1];
|
|
1864
1999
|
const method = (deps.isSeaImpl ? await deps.isSeaImpl() : await detectSea()) ? "binary" : detectInstallMethod(argvPath, realpathSync2, ["unknown", "local-node-modules"]);
|
|
@@ -1968,7 +2103,9 @@ export {
|
|
|
1968
2103
|
INTERNAL_SECRET_ENV_KEYS,
|
|
1969
2104
|
scrubInternalSecretsFromProcessEnv,
|
|
1970
2105
|
stripInternalSecretsFromEnv,
|
|
2106
|
+
setLogSurface,
|
|
1971
2107
|
log,
|
|
2108
|
+
createStreamWriter,
|
|
1972
2109
|
cacheDir,
|
|
1973
2110
|
CONFIG_DIRNAME,
|
|
1974
2111
|
sidecarsRoot,
|
|
@@ -1987,6 +2124,7 @@ export {
|
|
|
1987
2124
|
buildLaunchEntry,
|
|
1988
2125
|
isProjectLocalEntry,
|
|
1989
2126
|
ENTRY_NAME,
|
|
2127
|
+
LEGACY_ENTRY_NAMES,
|
|
1990
2128
|
findLegacyEntry,
|
|
1991
2129
|
CLAUDE_CODE_ALLOW_PATTERN,
|
|
1992
2130
|
resolveClaudeCodeSettingsPath,
|