@cyanheads/mcp-ts-core 0.9.18 → 0.9.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Package:** `@cyanheads/mcp-ts-core`
4
- **Version:** 0.9.18
4
+ **Version:** 0.9.19
5
5
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
6
6
  **MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.0
7
7
  **Zod:** ^4.4.3
@@ -555,6 +555,6 @@ Badge order when both set: `· ⚠️ Breaking · 🛡️ Security`. Summary > 3
555
555
 
556
556
  ## Publishing
557
557
 
558
- If the user requests it, run the `release-and-publish` skill — it runs the verification gate (`devcheck`, `rebuild`, `test:all`), pushes commits and tags, and publishes to every applicable destination. After pushing, create a GitHub Release on the annotated tag (`gh release create v<VERSION> --verify-tag --notes-from-tag`) no assets to attach, but the Release surfaces the tag's notes in the repo UI. **Skip the Docker build/push step** — this framework package is consumed via npm, not as a container image.
558
+ If the user requests it, run the `release-and-publish` skill — it runs the verification gate (`devcheck`, `rebuild`, `test:all`), pushes commits and tags, and publishes to every applicable destination. After pushing, create a GitHub Release via `bun run release:github` no `manifest.json` here so no assets to attach, but the Release surfaces the tag's notes with the correct `v<VERSION>: <subject>` title. **Skip the Docker build/push step** — this framework package is consumed via npm, not as a container image.
559
559
 
560
560
  **Tag annotations render as GitHub Release bodies** via `--notes-from-tag`. They must be structured markdown — never a flat comma-separated string. Subject must omit the version number (GitHub prepends `v<VERSION>:`). Body uses Keep a Changelog sections with bullets. See `changelog/template.md` for the full format reference including an example.
package/CLAUDE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Package:** `@cyanheads/mcp-ts-core`
4
- **Version:** 0.9.18
4
+ **Version:** 0.9.19
5
5
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
6
6
  **MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.0
7
7
  **Zod:** ^4.4.3
@@ -555,6 +555,6 @@ Badge order when both set: `· ⚠️ Breaking · 🛡️ Security`. Summary > 3
555
555
 
556
556
  ## Publishing
557
557
 
558
- If the user requests it, run the `release-and-publish` skill — it runs the verification gate (`devcheck`, `rebuild`, `test:all`), pushes commits and tags, and publishes to every applicable destination. After pushing, create a GitHub Release on the annotated tag (`gh release create v<VERSION> --verify-tag --notes-from-tag`) no assets to attach, but the Release surfaces the tag's notes in the repo UI. **Skip the Docker build/push step** — this framework package is consumed via npm, not as a container image.
558
+ If the user requests it, run the `release-and-publish` skill — it runs the verification gate (`devcheck`, `rebuild`, `test:all`), pushes commits and tags, and publishes to every applicable destination. After pushing, create a GitHub Release via `bun run release:github` no `manifest.json` here so no assets to attach, but the Release surfaces the tag's notes with the correct `v<VERSION>: <subject>` title. **Skip the Docker build/push step** — this framework package is consumed via npm, not as a container image.
559
559
 
560
560
  **Tag annotations render as GitHub Release bodies** via `--notes-from-tag`. They must be structured markdown — never a flat comma-separated string. Subject must omit the version number (GitHub prepends `v<VERSION>:`). Body uses Keep a Changelog sections with bullets. See `changelog/template.md` for the full format reference including an example.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  <div align="center">
7
7
 
8
- [![Version](https://img.shields.io/badge/Version-0.9.18-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![MCP Spec](https://img.shields.io/badge/MCP%20Spec-2025--11--25-8A2BE2.svg?style=flat-square)](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-11-25/changelog.mdx)
8
+ [![Version](https://img.shields.io/badge/Version-0.9.19-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![MCP Spec](https://img.shields.io/badge/MCP%20Spec-2025--11--25-8A2BE2.svg?style=flat-square)](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-11-25/changelog.mdx)
9
9
 
10
10
  [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![TypeScript](https://img.shields.io/badge/TypeScript-^6.0.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.0%2B-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
@@ -0,0 +1,22 @@
1
+ ---
2
+ summary: "withRetry fail-fast on data.retryable === false; bun run release:github enforces v<VERSION>: <subject> title; Gate after column in workflow phase tables"
3
+ breaking: false
4
+ security: false
5
+ ---
6
+
7
+ # 0.9.19 — 2026-05-31
8
+
9
+ ## Added
10
+
11
+ - **`defaultIsTransient` fail-fast opt-out.** `withRetry`'s default predicate now checks `error.data.retryable === false` and returns non-transient immediately — even when the error code is in the transient set (`Timeout`, `ServiceUnavailable`, `RateLimited`). Closes [#174](https://github.com/cyanheads/mcp-ts-core/issues/174).
12
+ - **`ctx.fail` auto-populates `data.retryable`.** `createFail` uses the contract entry's `retryable` value as a base default on `data.retryable`, so every `ctx.fail(reason)` call carries the right flag automatically. Caller can still override per-occurrence by passing `data.retryable` explicitly; `reason` is forced last regardless.
13
+ - **`bun run release:github` script.** `scripts/release-github.ts` constructs the GitHub Release title from the tag subject (`v<VERSION>: <subject>`), enforcing the title format that `--notes-from-tag` alone does not set. Handles `--verify-tag`, conditional `.mcpb` attach, and the "release already exists" fallback. Shipped in `files:` so consumer projects inherit it; `templates/package.json` adds the `release:github` script entry. Closes [#179](https://github.com/cyanheads/mcp-ts-core/issues/179).
14
+ - **`Gate after` column in workflow phase tables** ([#183](https://github.com/cyanheads/mcp-ts-core/issues/183)). Every phase row in `skills/orchestrations/workflows/*.md` now carries a `Gate after` value: `barrier` (with a terse reason) or `gate-free`. Spawn/round structure is derivable from the table without re-derivation. `skills/orchestrations/SKILL.md` adds a one-line pointer tying the column back to the "Barriers only where gates sit" principle.
15
+
16
+ ## Changed
17
+
18
+ - **`ErrorContract.retryable` JSDoc updated** to document both audiences — the `withRetry` predicate and `ctx.fail` auto-population — in addition to the existing client backoff hint.
19
+ - **`RetryOptions.isTransient` JSDoc clarified** that a custom predicate fully replaces the default (including the `data.retryable` opt-out); the doc now points to `data.retryable: false` as the preferred single-site opt-out.
20
+ - **`release-and-publish` skill updated** (v2.7 → v2.8): Step 6 is now "Create GitHub Release" for all projects (not just MCPB), using `bun run release:github` as the single command. Prior manual `gh release create` flag sequence replaced.
21
+ - **`add-service` skill updated** (v1.6 → v1.7): adds the deterministic HTTP 200 fail-fast caveat to the retry guidance bullet.
22
+ - **MirrorService design guidance** added to `skills/design-mcp-server/SKILL.md` (v2.14 → v2.15): new bullet under output-design guidance covering when to mirror a bulk upstream instead of paginating it live, with corpus-size thresholds and backend options.
@@ -327,6 +327,17 @@ export type HandlerContext<R extends string = never, E extends ZodRawShape | und
327
327
  * data, which is spread first and then overwritten so the contract reason
328
328
  * wins. This keeps `data.reason` a stable observability identifier.
329
329
  *
330
+ * **`data.retryable` precedence.** When the contract entry declares `retryable`,
331
+ * it is used as the base default. Caller-supplied `data.retryable` (per-occurrence
332
+ * override) is then spread on top, so a throw site can still override the
333
+ * contract default for that one occurrence. `reason` is always forced last.
334
+ * Only the `retryable` key is injected when the entry actually declares it —
335
+ * entries without the field produce no `retryable` key on `data`.
336
+ *
337
+ * Net effect: `withRetry`'s default predicate receives `data.retryable === false`
338
+ * automatically for any contract entry that declares `retryable: false`, so
339
+ * deterministic failures fail fast without a per-throw-site flag.
340
+ *
330
341
  * If the reason isn't in the contract — a JS caller or stale contract slipping
331
342
  * past the `TypedFail` type-system guard — `createFail` returns an
332
343
  * `McpError(InternalError)` with diagnostic data (`{ reason, declaredReasons }`)
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"A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,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAE7E;AAMD,gBAAgB;AAChB,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC7D,yBAAyB,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACjE,qBAAqB,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACzD,qBAAqB,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,gBAAgB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAClE,GAAG,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CA4DxD"}
@@ -16,6 +16,17 @@ import { invalidRequest, JsonRpcErrorCode, McpError, } from '../types-global/err
16
16
  * data, which is spread first and then overwritten so the contract reason
17
17
  * wins. This keeps `data.reason` a stable observability identifier.
18
18
  *
19
+ * **`data.retryable` precedence.** When the contract entry declares `retryable`,
20
+ * it is used as the base default. Caller-supplied `data.retryable` (per-occurrence
21
+ * override) is then spread on top, so a throw site can still override the
22
+ * contract default for that one occurrence. `reason` is always forced last.
23
+ * Only the `retryable` key is injected when the entry actually declares it —
24
+ * entries without the field produce no `retryable` key on `data`.
25
+ *
26
+ * Net effect: `withRetry`'s default predicate receives `data.retryable === false`
27
+ * automatically for any contract entry that declares `retryable: false`, so
28
+ * deterministic failures fail fast without a per-throw-site flag.
29
+ *
19
30
  * If the reason isn't in the contract — a JS caller or stale contract slipping
20
31
  * past the `TypedFail` type-system guard — `createFail` returns an
21
32
  * `McpError(InternalError)` with diagnostic data (`{ reason, declaredReasons }`)
@@ -33,10 +44,12 @@ export function createFail(errors) {
33
44
  // Surface the bug clearly rather than silently picking a code.
34
45
  return new McpError(JsonRpcErrorCode.InternalError, `ctx.fail() called with unknown reason '${reason}' — not declared in errors[].`, { reason, declaredReasons: [...byReason.keys()] }, options);
35
46
  }
36
- // `reason` is spread last so caller-supplied `data.reason` (accidental or
37
- // adversarial) cannot override the contract reason preserves the
38
- // observability invariant that `data.reason` always matches the contract.
39
- return new McpError(entry.code, message ?? entry.when, { ...data, reason }, options);
47
+ // Precedence (last write wins):
48
+ // 1. contract `retryable` as base default (only when the entry declares it)
49
+ // 2. caller-supplied `data` (per-occurrence override, spread over the default)
50
+ // 3. contract `reason` forced last (never overridable observability invariant)
51
+ const retryableBase = entry.retryable !== undefined ? { retryable: entry.retryable } : undefined;
52
+ return new McpError(entry.code, message ?? entry.when, { ...retryableBase, ...data, reason }, options);
40
53
  };
41
54
  }
42
55
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,OAAO,EAEL,cAAc,EACd,gBAAgB,EAChB,QAAQ,GACT,MAAM,0BAA0B,CAAC;AA0VlC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,UAAU,CAAC,MAAgC;IACzD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAC;IAClD,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE9D,OAAO,CAAC,MAAM,EAAE,O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Y,CAAC,CAAC,CAAC,SAAS,CACjE,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,OAAO;YAClB,MAAM,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC3D,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ {"level":40,"time":1780225427928,"env":"testing","version":"0.9.18","pid":81052,"transport":"http","requestId":"VVRRG-H0319","timestamp":"2026-05-31T11:03:47.928Z","operation":"TransportManager.start","component":"HttpTransportSetup","msg":"MCP_ALLOWED_ORIGINS is not set — CORS is wildcard for CLI clients; browser Origin headers are restricted to loopback. Set MCP_ALLOWED_ORIGINS for production deployments accepting remote browser origins."}
2
+ {"level":40,"time":1780225429690,"env":"testing","version":"0.9.18","pid":81052,"transport":"http","requestId":"VVRRG-H0319","timestamp":"2026-05-31T11:03:47.928Z","operation":"TransportManager.start","component":"HttpTransportSetup","sessionId":"not-a-real-session-1780225429690","msg":"Session validation failed - invalid or hijacked session"}
3
+ {"level":50,"time":1780225433452,"env":"testing","version":"0.0.0-test","pid":81242,"requestId":"JKUAU-THL6D","timestamp":"2026-05-31T11:03:53.451Z","operation":"HandleToolRequest","critical":false,"errorCode":-32005,"originalErrorType":"McpError","finalErrorType":"McpError","sessionId":"f6bd7a9479f95e541e8fc4ff349f26e58f52d11e0adb27c998363281fc996cc0","toolName":"scoped_echo","tenantId":"authz-tenant","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"errorData":{"sessionId":"f6bd7a9479f95e541e8fc4ff349f26e58f52d11e0adb27c998363281fc996cc0","toolName":"scoped_echo","requestId":"JKUAU-THL6D","timestamp":"2026-05-31T11:03:53.451Z","tenantId":"authz-tenant","operation":"HandleToolRequest","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"originalErrorName":"McpError","originalMessage":"Insufficient permissions.","originalStack":"McpError: Insufficient permissions.\n at forbidden (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:84:58)\n at withRequiredScopes (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/authUtils.js:68:15)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:251:17)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Insufficient permissions.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:170:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:293:26)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)","msg":"Error in tool:scoped_echo: Insufficient permissions."}
4
+ {"level":50,"time":1780225433460,"env":"testing","version":"0.0.0-test","pid":81242,"requestId":"NZFY2-LDFDA","timestamp":"2026-05-31T11:03:53.460Z","operation":"HandleToolRequest","critical":false,"errorCode":-32005,"originalErrorType":"McpError","finalErrorType":"McpError","sessionId":"9cb9c32a32ff6dff5a162b462fb458ef271bb64711acab8467014cc411071dcb","toolName":"scoped_echo","tenantId":"authz-tenant","auth":{"sub":"authz-user","scopes":["openid","email","profile","offline_access"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"errorData":{"sessionId":"9cb9c32a32ff6dff5a162b462fb458ef271bb64711acab8467014cc411071dcb","toolName":"scoped_echo","requestId":"NZFY2-LDFDA","timestamp":"2026-05-31T11:03:53.460Z","tenantId":"authz-tenant","operation":"HandleToolRequest","auth":{"sub":"authz-user","scopes":["openid","email","profile","offline_access"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"originalErrorName":"McpError","originalMessage":"Insufficient permissions.","originalStack":"McpError: Insufficient permissions.\n at forbidden (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:84:58)\n at withRequiredScopes (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/authUtils.js:68:15)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:251:17)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Insufficient permissions.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:170:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:293:26)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)","msg":"Error in tool:scoped_echo: Insufficient permissions."}
5
+ {"level":40,"time":1780225576585,"env":"testing","version":"0.9.19","pid":84938,"transport":"http","requestId":"IJUO1-6Q9UC","timestamp":"2026-05-31T11:06:16.584Z","operation":"TransportManager.start","component":"HttpTransportSetup","msg":"MCP_ALLOWED_ORIGINS is not set — CORS is wildcard for CLI clients; browser Origin headers are restricted to loopback. Set MCP_ALLOWED_ORIGINS for production deployments accepting remote browser origins."}
6
+ {"level":40,"time":1780225578334,"env":"testing","version":"0.9.19","pid":84938,"transport":"http","requestId":"IJUO1-6Q9UC","timestamp":"2026-05-31T11:06:16.584Z","operation":"TransportManager.start","component":"HttpTransportSetup","sessionId":"not-a-real-session-1780225578334","msg":"Session validation failed - invalid or hijacked session"}
7
+ {"level":50,"time":1780225582015,"env":"testing","version":"0.0.0-test","pid":85073,"requestId":"RROQC-F3QA4","timestamp":"2026-05-31T11:06:22.014Z","operation":"HandleToolRequest","critical":false,"errorCode":-32005,"originalErrorType":"McpError","finalErrorType":"McpError","sessionId":"074c0eb19abb7162d7e9535ee0f84ab27ff7b26d97b00cc186a0bdb3be13c85e","toolName":"scoped_echo","tenantId":"authz-tenant","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"errorData":{"sessionId":"074c0eb19abb7162d7e9535ee0f84ab27ff7b26d97b00cc186a0bdb3be13c85e","toolName":"scoped_echo","requestId":"RROQC-F3QA4","timestamp":"2026-05-31T11:06:22.014Z","tenantId":"authz-tenant","operation":"HandleToolRequest","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"originalErrorName":"McpError","originalMessage":"Insufficient permissions.","originalStack":"McpError: Insufficient permissions.\n at forbidden (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:84:58)\n at withRequiredScopes (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/authUtils.js:68:15)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:251:17)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Insufficient permissions.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:170:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:293:26)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)","msg":"Error in tool:scoped_echo: Insufficient permissions."}
8
+ {"level":50,"time":1780225582022,"env":"testing","version":"0.0.0-test","pid":85073,"requestId":"KL3EP-RS5AO","timestamp":"2026-05-31T11:06:22.022Z","operation":"HandleToolRequest","critical":false,"errorCode":-32005,"originalErrorType":"McpError","finalErrorType":"McpError","sessionId":"211605bd738f777e38d582853d167849c027f5d280e6e0622ca9946ab08da583","toolName":"scoped_echo","tenantId":"authz-tenant","auth":{"sub":"authz-user","scopes":["openid","email","profile","offline_access"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"errorData":{"sessionId":"211605bd738f777e38d582853d167849c027f5d280e6e0622ca9946ab08da583","toolName":"scoped_echo","requestId":"KL3EP-RS5AO","timestamp":"2026-05-31T11:06:22.022Z","tenantId":"authz-tenant","operation":"HandleToolRequest","auth":{"sub":"authz-user","scopes":["openid","email","profile","offline_access"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"originalErrorName":"McpError","originalMessage":"Insufficient permissions.","originalStack":"McpError: Insufficient permissions.\n at forbidden (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:84:58)\n at withRequiredScopes (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/authUtils.js:68:15)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:251:17)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Insufficient permissions.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:170:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:293:26)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)","msg":"Error in tool:scoped_echo: Insufficient permissions."}
@@ -0,0 +1,4 @@
1
+ {"level":50,"time":1780225433452,"env":"testing","version":"0.0.0-test","pid":81242,"requestId":"JKUAU-THL6D","timestamp":"2026-05-31T11:03:53.451Z","operation":"HandleToolRequest","critical":false,"errorCode":-32005,"originalErrorType":"McpError","finalErrorType":"McpError","sessionId":"f6bd7a9479f95e541e8fc4ff349f26e58f52d11e0adb27c998363281fc996cc0","toolName":"scoped_echo","tenantId":"authz-tenant","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"errorData":{"sessionId":"f6bd7a9479f95e541e8fc4ff349f26e58f52d11e0adb27c998363281fc996cc0","toolName":"scoped_echo","requestId":"JKUAU-THL6D","timestamp":"2026-05-31T11:03:53.451Z","tenantId":"authz-tenant","operation":"HandleToolRequest","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"originalErrorName":"McpError","originalMessage":"Insufficient permissions.","originalStack":"McpError: Insufficient permissions.\n at forbidden (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:84:58)\n at withRequiredScopes (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/authUtils.js:68:15)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:251:17)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Insufficient permissions.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:170:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:293:26)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)","msg":"Error in tool:scoped_echo: Insufficient permissions."}
2
+ {"level":50,"time":1780225433460,"env":"testing","version":"0.0.0-test","pid":81242,"requestId":"NZFY2-LDFDA","timestamp":"2026-05-31T11:03:53.460Z","operation":"HandleToolRequest","critical":false,"errorCode":-32005,"originalErrorType":"McpError","finalErrorType":"McpError","sessionId":"9cb9c32a32ff6dff5a162b462fb458ef271bb64711acab8467014cc411071dcb","toolName":"scoped_echo","tenantId":"authz-tenant","auth":{"sub":"authz-user","scopes":["openid","email","profile","offline_access"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"errorData":{"sessionId":"9cb9c32a32ff6dff5a162b462fb458ef271bb64711acab8467014cc411071dcb","toolName":"scoped_echo","requestId":"NZFY2-LDFDA","timestamp":"2026-05-31T11:03:53.460Z","tenantId":"authz-tenant","operation":"HandleToolRequest","auth":{"sub":"authz-user","scopes":["openid","email","profile","offline_access"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"originalErrorName":"McpError","originalMessage":"Insufficient permissions.","originalStack":"McpError: Insufficient permissions.\n at forbidden (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:84:58)\n at withRequiredScopes (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/authUtils.js:68:15)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:251:17)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Insufficient permissions.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:170:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:293:26)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)","msg":"Error in tool:scoped_echo: Insufficient permissions."}
3
+ {"level":50,"time":1780225582015,"env":"testing","version":"0.0.0-test","pid":85073,"requestId":"RROQC-F3QA4","timestamp":"2026-05-31T11:06:22.014Z","operation":"HandleToolRequest","critical":false,"errorCode":-32005,"originalErrorType":"McpError","finalErrorType":"McpError","sessionId":"074c0eb19abb7162d7e9535ee0f84ab27ff7b26d97b00cc186a0bdb3be13c85e","toolName":"scoped_echo","tenantId":"authz-tenant","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"errorData":{"sessionId":"074c0eb19abb7162d7e9535ee0f84ab27ff7b26d97b00cc186a0bdb3be13c85e","toolName":"scoped_echo","requestId":"RROQC-F3QA4","timestamp":"2026-05-31T11:06:22.014Z","tenantId":"authz-tenant","operation":"HandleToolRequest","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"originalErrorName":"McpError","originalMessage":"Insufficient permissions.","originalStack":"McpError: Insufficient permissions.\n at forbidden (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:84:58)\n at withRequiredScopes (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/authUtils.js:68:15)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:251:17)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Insufficient permissions.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:170:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:293:26)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)","msg":"Error in tool:scoped_echo: Insufficient permissions."}
4
+ {"level":50,"time":1780225582022,"env":"testing","version":"0.0.0-test","pid":85073,"requestId":"KL3EP-RS5AO","timestamp":"2026-05-31T11:06:22.022Z","operation":"HandleToolRequest","critical":false,"errorCode":-32005,"originalErrorType":"McpError","finalErrorType":"McpError","sessionId":"211605bd738f777e38d582853d167849c027f5d280e6e0622ca9946ab08da583","toolName":"scoped_echo","tenantId":"authz-tenant","auth":{"sub":"authz-user","scopes":["openid","email","profile","offline_access"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"errorData":{"sessionId":"211605bd738f777e38d582853d167849c027f5d280e6e0622ca9946ab08da583","toolName":"scoped_echo","requestId":"KL3EP-RS5AO","timestamp":"2026-05-31T11:06:22.022Z","tenantId":"authz-tenant","operation":"HandleToolRequest","auth":{"sub":"authz-user","scopes":["openid","email","profile","offline_access"],"clientId":"authz-client","tenantId":"authz-tenant","token":"[REDACTED]"},"originalErrorName":"McpError","originalMessage":"Insufficient permissions.","originalStack":"McpError: Insufficient permissions.\n at forbidden (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:84:58)\n at withRequiredScopes (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/authUtils.js:68:15)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:251:17)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Insufficient permissions.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:170:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:293:26)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)","msg":"Error in tool:scoped_echo: Insufficient permissions."}
File without changes
@@ -126,9 +126,13 @@ export type ErrorResponse = z.infer<typeof ErrorSchema>;
126
126
  * - Use `when` for the natural-language explanation, not the message that ends
127
127
  * up on the error itself. The error's runtime `message` is per-occurrence;
128
128
  * `when` is the type-level description.
129
- * - Set `retryable` for ergonomics clients can adjust their backoff strategy
130
- * without re-deriving from the code. When omitted, callers can infer from
131
- * the code (see `getErrorCategory`).
129
+ * - Set `retryable` on every entry where retry behavior matters. It drives two
130
+ * things: (1) `withRetry`'s default predicate fails fast when
131
+ * `data.retryable === false`, even for transient-coded errors — so deterministic
132
+ * failures don't hammer the upstream; (2) `ctx.fail` auto-populates
133
+ * `data.retryable` from the contract entry so no per-throw-site flag is needed.
134
+ * A caller can still override per-occurrence by passing `data.retryable`
135
+ * explicitly. When omitted, callers infer retryability from the code.
132
136
  *
133
137
  * @example
134
138
  * ```ts
@@ -177,8 +181,29 @@ export interface ErrorContract {
177
181
  */
178
182
  recovery: string;
179
183
  /**
180
- * Whether the failure is transient (eligible for retry). Optional hint for
181
- * clients; when omitted, callers fall back to inferring from the code.
184
+ * Whether the failure is transient (eligible for retry).
185
+ *
186
+ * This field is now wired to two distinct audiences:
187
+ *
188
+ * **Retry engine (`withRetry`).** The default predicate (`defaultIsTransient`)
189
+ * checks `error.data.retryable === false` and fails fast when set, even when the
190
+ * error code is in the transient set (`Timeout`, `ServiceUnavailable`,
191
+ * `RateLimited`). This lets deterministic upstream failures (e.g. a query too
192
+ * expensive to ever succeed) fail immediately without hammering the upstream
193
+ * through all retry attempts.
194
+ *
195
+ * **Auto-population via `ctx.fail`.** `createFail` uses the contract entry's
196
+ * `retryable` as a base default on `data.retryable`, so every `ctx.fail(reason)`
197
+ * call automatically carries the right flag — no per-throw-site flag needed.
198
+ * A caller can still override it per-occurrence by passing `data.retryable`
199
+ * explicitly; `reason` is always forced last regardless.
200
+ *
201
+ * **Client backoff hint.** Clients that don't use `withRetry` can read
202
+ * `error.data.retryable` to decide their own backoff strategy; when omitted,
203
+ * they fall back to inferring from the code.
204
+ *
205
+ * When omitted from a contract entry, no `retryable` key is injected onto
206
+ * `data` — callers can still infer from the code.
182
207
  */
183
208
  retryable?: boolean;
184
209
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types-global/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,oBAAY,gBAAgB;IAE1B,UAAU,SAAS;IACnB,cAAc,SAAS;IACvB,cAAc,SAAS;IACvB,aAAa,SAAS;IACtB,aAAa,SAAS;IAGtB,kBAAkB,SAAS;IAC3B,QAAQ,SAAS;IACjB,QAAQ,SAAS;IACjB,WAAW,SAAS;IACpB,OAAO,SAAS;IAChB,SAAS,SAAS;IAClB,YAAY,SAAS;IACrB,eAAe,SAAS;IACxB,kBAAkB,SAAS;IAC3B,oBAAoB,SAAS;IAC7B,aAAa,SAAS;IACtB,kBAAkB,SAAS,CAAE,4CAA4C;IACzE,YAAY,SAAS;CACtB;AAED;;;;;;;GAOG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC;;OAEG;IACH,SAAgB,IAAI,EAAE,gBAAgB,CAAC;IAEvC;;;;OAIG;IACH,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/C;;;;;;OAMG;gBAED,IAAI,EAAE,gBAAgB,EACtB,OAAO,CAAC,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAkBhC;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D;AAClD,eAAO,MAAM,kBAAkB,GAC7B,SAAS,MAAM,EACf,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,UAAU,mBAAmB,aAC+C,CAAC;AAE/E,8CAA8C;AAC9C,eAAO,MAAM,aAAa,GACxB,SAAS,MAAM,EACf,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,UAAU,mBAAmB,aAC0C,CAAC;AAE1E,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,GAC7B,SAAS,MAAM,EACf,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,UAAU,mBAAmB,aAC+C,CAAC;AAE/E,6CAA6C;AAC7C,eAAO,MAAM,aAAa,GACxB,SAAS,MAAM,EACf,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,UAAU,mBAAmB,aAC0C,CAAC;AAE1E;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;;;;iBA4BrB,CAAC;AAEJ;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAMxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,IAAI,EAAE,gBAAgB,CAAC;IACvB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -20,8 +20,14 @@ export interface RetryOptions {
20
20
  context?: RequestContext;
21
21
  /**
22
22
  * Custom predicate to determine if an error is transient and should be
23
- * retried. When provided, this replaces the default `McpError` code check.
24
- * Return `true` to retry, `false` to fail immediately.
23
+ * retried. When provided, this **replaces** the default predicate entirely
24
+ * (including the `data.retryable === false` opt-out). Return `true` to
25
+ * retry, `false` to fail immediately.
26
+ *
27
+ * Use this only when you need fully custom classification logic. For the
28
+ * common case of opting a single throw site out of retry, set
29
+ * `data.retryable: false` on the thrown `McpError` instead — the default
30
+ * predicate handles it automatically.
25
31
  */
26
32
  isTransient?: (error: unknown) => boolean;
27
33
  /**
@@ -57,6 +63,13 @@ export interface RetryOptions {
57
63
  * parsing, and validation — not just the network call. This ensures that
58
64
  * transient upstream errors (e.g., HTTP 200 with an error body) are retried.
59
65
  *
66
+ * **Deterministic-failure opt-out.** When the thrown `McpError` carries
67
+ * `data.retryable === false`, the default predicate treats it as non-transient
68
+ * and fails immediately — even for `Timeout`/`ServiceUnavailable`/`RateLimited`
69
+ * codes. Use this at the throw site (or let the error contract auto-populate it
70
+ * via `ctx.fail`) for failures that can never succeed on retry (oversized query,
71
+ * malformed request surfaced as HTTP 200 + error body, etc.).
72
+ *
60
73
  * When retries exhaust, the final error is enriched with attempt count in both
61
74
  * the message and structured data, so callers know retries were already attempted.
62
75
  *
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/utils/network/retry.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAYzE,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC3B;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAE1C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AA6DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,CAAC,CAAC,CAiD/F"}
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/utils/network/retry.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAYzE,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC3B;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAE1C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAyED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,CAAC,CAAC,CAiD/F"}
@@ -34,9 +34,22 @@ function computeDelay(attempt, baseDelayMs, maxDelayMs, jitter) {
34
34
  /**
35
35
  * Default transient check: `McpError` with a transient code, or any non-McpError
36
36
  * (network failures, unexpected throws) which are assumed transient.
37
+ *
38
+ * **Per-error opt-out.** When a thrown `McpError` carries `data.retryable === false`,
39
+ * the error is treated as non-transient and fails fast — even if its code is in
40
+ * `TRANSIENT_CODES`. This is the in-band escape hatch for deterministic upstream
41
+ * failures (e.g. a query too expensive to ever succeed surfaced as HTTP 200 +
42
+ * error body) that arrive with a transient code but should never be retried.
43
+ *
44
+ * Absent the flag (or when it is `true`), behavior is unchanged — code-based
45
+ * classification applies. Non-`McpError` throws (raw network errors, unexpected
46
+ * throws) are always assumed transient regardless of the flag.
37
47
  */
38
48
  function defaultIsTransient(error) {
39
49
  if (error instanceof McpError) {
50
+ // Explicit opt-out wins over code-based classification.
51
+ if (error.data?.retryable === false)
52
+ return false;
40
53
  return TRANSIENT_CODES.has(error.code);
41
54
  }
42
55
  // Non-McpError (raw network errors, unexpected throws) — assume transient
@@ -72,6 +85,13 @@ function enrichExhaustedError(error, totalAttempts, operation) {
72
85
  * parsing, and validation — not just the network call. This ensures that
73
86
  * transient upstream errors (e.g., HTTP 200 with an error body) are retried.
74
87
  *
88
+ * **Deterministic-failure opt-out.** When the thrown `McpError` carries
89
+ * `data.retryable === false`, the default predicate treats it as non-transient
90
+ * and fails immediately — even for `Timeout`/`ServiceUnavailable`/`RateLimited`
91
+ * codes. Use this at the throw site (or let the error contract auto-populate it
92
+ * via `ctx.fail`) for failures that can never succeed on retry (oversized query,
93
+ * malformed request surfaced as HTTP 200 + error body, etc.).
94
+ *
75
95
  * When retries exhaust, the final error is enriched with attempt count in both
76
96
  * the message and structured data, so callers know retries were already attempted.
77
97
  *
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/utils/network/retry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD;;;GAGG;AACH,MAAM,eAA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18",
3
+ "version": "0.9.19",
4
4
  "mcpName": "io.github.cyanheads/mcp-ts-core",
5
5
  "description": "Agent-native TypeScript framework for building MCP servers. Declarative definitions with auth, multi-backend storage, OpenTelemetry, and first-class support for Bun/Node/Cloudflare Workers.",
6
6
  "main": "dist/core/index.js",
@@ -19,6 +19,7 @@
19
19
  "scripts/lint-mcp.ts",
20
20
  "scripts/lint-packaging.ts",
21
21
  "scripts/list-skills.ts",
22
+ "scripts/release-github.ts",
22
23
  "scripts/tree.ts",
23
24
  "skills/",
24
25
  "templates/",
@@ -161,6 +162,7 @@
161
162
  "audit:refresh": "rm -f bun.lock && bun install && bun audit",
162
163
  "changelog:build": "bun run scripts/build-changelog.ts",
163
164
  "changelog:check": "bun run scripts/build-changelog.ts --check",
165
+ "release:github": "bun run scripts/release-github.ts",
164
166
  "publish-mcp": "mcp-publisher login github -token \"$(security find-generic-password -a \"$USER\" -s mcp-publisher-github-pat -w)\" && mcp-publisher publish"
165
167
  },
166
168
  "resolutions": {
@@ -0,0 +1,187 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @fileoverview Create (or repair) a GitHub Release on the current package version's
4
+ * annotated tag, enforcing the `v<VERSION>: <tag subject>` title format that
5
+ * `--notes-from-tag` alone cannot set.
6
+ *
7
+ * What it does:
8
+ * 1. Reads `version` from `package.json`.
9
+ * 2. Derives the tag subject via `git for-each-ref refs/tags/v<version>`.
10
+ * 3. Runs `gh release create v<version> --verify-tag --notes-from-tag
11
+ * --title "v<version>: <subject>"` plus `dist/*.mcpb` when
12
+ * `manifest.json` exists (MCPB bundle attach).
13
+ * 4. On "release already exists" (re-invocation after partial run):
14
+ * - If `manifest.json` exists: `gh release upload v<version> --clobber dist/*.mcpb`
15
+ * to attach/replace the asset, then `gh release edit` to set the title.
16
+ * - Otherwise: `gh release edit` to set the title on the existing release.
17
+ *
18
+ * The framework itself has no `manifest.json`/`.mcpb`, so the attach path is
19
+ * skipped here but scaffolded servers that do have a manifest get the full flow.
20
+ *
21
+ * @module scripts/release-github
22
+ *
23
+ * @example
24
+ * // Create a GitHub Release for the current package version:
25
+ * // bun run release:github
26
+ *
27
+ * @example
28
+ * // Dry-run — print the command that would be executed without running it:
29
+ * // bun run release:github -- --dry-run
30
+ */
31
+
32
+ import { spawnSync } from 'node:child_process';
33
+ import { existsSync, readFileSync } from 'node:fs';
34
+ import { resolve } from 'node:path';
35
+ import process from 'node:process';
36
+
37
+ const DRY_RUN = process.argv.includes('--dry-run');
38
+
39
+ // ── Helpers ───────────────────────────────────────────────────────────────────
40
+
41
+ /**
42
+ * Run a command synchronously and return its trimmed stdout.
43
+ * Exits the process on non-zero exit when `required` is true.
44
+ */
45
+ function run(
46
+ cmd: string,
47
+ args: string[],
48
+ options: { required?: boolean; capture?: boolean } = {},
49
+ ): string {
50
+ const { required = true, capture = true } = options;
51
+ const result = spawnSync(cmd, args, {
52
+ encoding: 'utf-8',
53
+ stdio: capture ? ['ignore', 'pipe', 'pipe'] : ['inherit', 'inherit', 'pipe'],
54
+ });
55
+ const stdout = (result.stdout ?? '').trim();
56
+ const stderr = (result.stderr ?? '').trim();
57
+
58
+ if (result.error) {
59
+ console.error(`Failed to spawn '${cmd}': ${result.error.message}`);
60
+ if (required) process.exit(1);
61
+ return '';
62
+ }
63
+
64
+ if ((result.status ?? 1) !== 0) {
65
+ if (required) {
66
+ console.error(`Command failed: ${cmd} ${args.join(' ')}`);
67
+ if (stderr) console.error(stderr);
68
+ process.exit(1);
69
+ }
70
+ // Return stderr concatenated so callers can inspect the failure reason.
71
+ return `__ERROR__:${stderr}`;
72
+ }
73
+
74
+ return stdout;
75
+ }
76
+
77
+ /**
78
+ * Run a `gh` CLI command.
79
+ * On "release already exists" the return value starts with `__ERROR__:`.
80
+ */
81
+ function gh(args: string[], options: { required?: boolean } = {}): string {
82
+ return run('gh', args, { required: options.required ?? true, capture: true });
83
+ }
84
+
85
+ // ── Main ──────────────────────────────────────────────────────────────────────
86
+
87
+ function main(): void {
88
+ // 1. Read version from package.json
89
+ const pkgPath = resolve('package.json');
90
+ if (!existsSync(pkgPath)) {
91
+ console.error('package.json not found in current directory. Run from the project root.');
92
+ process.exit(1);
93
+ }
94
+
95
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) as { version?: string };
96
+ const version = pkg.version?.trim();
97
+ if (!version) {
98
+ console.error('package.json has no version field.');
99
+ process.exit(1);
100
+ }
101
+
102
+ const tag = `v${version}`;
103
+
104
+ // 2. Derive tag subject via git for-each-ref
105
+ const subject = run('git', ['for-each-ref', `refs/tags/${tag}`, '--format=%(contents:subject)']);
106
+
107
+ if (!subject) {
108
+ console.error(
109
+ `Tag ${tag} not found locally or has no subject line. ` +
110
+ `Create the annotated tag first: git tag -a ${tag} -m "..."`,
111
+ );
112
+ process.exit(1);
113
+ }
114
+
115
+ const title = `${tag}: ${subject}`;
116
+ const hasMcpb = existsSync('manifest.json');
117
+
118
+ // 3. Build the gh release create command
119
+ const createArgs = [
120
+ 'release',
121
+ 'create',
122
+ tag,
123
+ '--verify-tag',
124
+ '--notes-from-tag',
125
+ '--title',
126
+ title,
127
+ ];
128
+ if (hasMcpb) {
129
+ createArgs.push('dist/*.mcpb');
130
+ }
131
+
132
+ if (DRY_RUN) {
133
+ console.log(`[dry-run] gh ${createArgs.join(' ')}`);
134
+ if (hasMcpb) {
135
+ console.log(
136
+ `[dry-run] fallback (if release exists): gh release upload ${tag} dist/*.mcpb --clobber`,
137
+ );
138
+ console.log(
139
+ `[dry-run] fallback (if release exists): gh release edit ${tag} --title "${title}"`,
140
+ );
141
+ } else {
142
+ console.log(
143
+ `[dry-run] fallback (if release exists): gh release edit ${tag} --title "${title}"`,
144
+ );
145
+ }
146
+ return;
147
+ }
148
+
149
+ console.log(`Creating GitHub Release ${tag}…`);
150
+ console.log(` title: ${title}`);
151
+ if (hasMcpb) {
152
+ console.log(' asset: dist/*.mcpb');
153
+ }
154
+
155
+ // 4. Try to create the release
156
+ const createResult = gh(createArgs, { required: false });
157
+
158
+ if (!createResult.startsWith('__ERROR__:')) {
159
+ // Success — print the release URL returned by gh
160
+ if (createResult) console.log(createResult);
161
+ console.log(`Release ${tag} created.`);
162
+ return;
163
+ }
164
+
165
+ const errText = createResult.slice('__ERROR__:'.length);
166
+ const alreadyExists = /release already exists/i.test(errText);
167
+
168
+ if (!alreadyExists) {
169
+ console.error(`gh release create failed:\n${errText}`);
170
+ process.exit(1);
171
+ }
172
+
173
+ // 5. Release already exists — repair: upload asset (if applicable) and set title.
174
+ console.log(`Release ${tag} already exists. Repairing…`);
175
+
176
+ if (hasMcpb) {
177
+ console.log(' uploading dist/*.mcpb (--clobber)…');
178
+ gh(['release', 'upload', tag, 'dist/*.mcpb', '--clobber']);
179
+ }
180
+
181
+ console.log(` setting title: ${title}`);
182
+ gh(['release', 'edit', tag, '--title', title]);
183
+
184
+ console.log(`Release ${tag} repaired.`);
185
+ }
186
+
187
+ main();
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a new service integration. Use when the user asks to add a service, integrate an external API, or create a reusable domain module with its own initialization and state.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.6"
7
+ version: "1.7"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -131,7 +131,7 @@ async fetchItem(id: string, ctx: Context): Promise<Item> {
131
131
 
132
132
  1. **Calibrate backoff to the upstream.** 200–500ms for ephemeral failures, 1–2s for rate-limited APIs, 2–5s for service degradation. The default `baseDelayMs: 1000` suits most APIs.
133
133
  2. **Check HTTP status before parsing.** `fetchWithTimeout` already throws on non-OK responses with granular status mapping (401→`Unauthorized`, 403→`Forbidden`, 404→`NotFound`, 408/425→`Timeout`, 422→`ValidationError`, 429→`RateLimited`, 5xx→`ServiceUnavailable`/`InternalError`) — this prevents feeding HTML error pages into XML/JSON parsers.
134
- 3. **Classify parse failures by content.** If the upstream returns HTTP 200 with an HTML error page, detect it and throw `ServiceUnavailable` (transient) instead of `SerializationError` (non-transient).
134
+ 3. **Classify parse failures by content.** If the upstream returns HTTP 200 with an HTML error page, detect it and throw `ServiceUnavailable` (transient) instead of `SerializationError` (non-transient). **Exception — deterministic HTTP 200 errors fail fast, not transient.** Some upstreams return HTTP 200 with a structured error body for failures that will *never* succeed regardless of how many times you retry: a query too expensive for the server's budget, an oversized result set, or a malformed request the server rejects. Retrying these wastes upstream capacity and delays the client. Declare them in the contract with `retryable: false` (or pass `{ retryable: false }` in `data` at the throw site) — `withRetry`'s default predicate reads `error.data.retryable === false` and fails immediately, even for `Timeout`/`ServiceUnavailable` codes. `ctx.fail` auto-populates `data.retryable` from the contract entry, so declaring it once in `errors[]` is enough.
135
135
  4. **Exhausted retries say so.** `withRetry` automatically enriches the final error with attempt count — callers know retries were already attempted.
136
136
 
137
137
  ### When you need finer-grained HTTP error classification
@@ -4,7 +4,7 @@ description: >
4
4
  Pick and run a multi-phase workflow that chains foundational task skills (`git-wrapup`, `release-and-publish`, `maintenance`, `field-test`, `setup`, etc.) end-to-end. Routes user intent to a workflow file under `workflows/` — greenfield builds, maintenance + release, field-test + fix, or known-work + release. Single source for the universal rules (no commits without authorization, no destructive git, no marketing language), the orchestrator posture (own the goal, ground sub-agents in primary sources, verify against the goal), and the sub-agent strategy (orient block, parallel fanout, isolation, normalization) that apply across every workflow. Sub-agents are an optional capability — workflows run linearly when fanout isn't available.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.1"
7
+ version: "1.2"
8
8
  audience: internal
9
9
  type: workflow
10
10
  ---
@@ -157,7 +157,7 @@ For N targets in a phase:
157
157
  3. Collect their reports
158
158
  4. Verify with a read-only orchestrator check before advancing to the next phase
159
159
 
160
- **Barriers only where gates sit.** Step 4's "advance to the next phase" implies a barrier — collect every target's phase-N result before any target starts phase N+1. That barrier is only required when a gate sits between the phases: a human decision (authorization, version-bump intent) or cross-target synthesis (the roll-up). Where no gate intervenes, a target may flow through consecutive phases independently — tier-3 platforms pipeline this for wall-clock, and even hand-spawned runs can let one sub-agent carry a target across adjacent gate-free phases. Keep the barrier at gate boundaries; drop it elsewhere.
160
+ **Barriers only where gates sit.** Step 4's "advance to the next phase" implies a barrier — collect every target's phase-N result before any target starts phase N+1. That barrier is only required when a gate sits between the phases: a human decision (authorization, version-bump intent) or cross-target synthesis (the roll-up). Where no gate intervenes, a target may flow through consecutive phases independently — tier-3 platforms pipeline this for wall-clock, and even hand-spawned runs can let one sub-agent carry a target across adjacent gate-free phases. Keep the barrier at gate boundaries; drop it elsewhere. Each workflow's phases table encodes this directly: the `Gate after` column marks every boundary as `barrier` (with a terse reason) or `gate-free` so the spawn/round structure is derivable without re-derivation.
161
161
 
162
162
  ### Editor / wrap-up separation
163
163
 
@@ -49,15 +49,15 @@ Per target:
49
49
 
50
50
  Each phase's Objective column is the goal state per target — the verifiable end state the phase must produce.
51
51
 
52
- | # | Phase | Objective | Sub-agent mode |
53
- |:--|:---|:---|:---|
54
- | 1 | Field-test | Per target: live tool/resource/prompt surface exercised across happy/error/edge paths; valid findings filed as GH issues against the server's own repo; noise filtered | parallel fanout per target; within a target, 1 or 3 sub-agents (see below) |
55
- | 2 | Issue triage | Per-target GH issue count + severity breakdown reconciled against actual GH state | orchestrator (serial) |
56
- | 3 | Fix | Per target: priority issues fixed in source, tests updated, `devcheck` + `test` green, each issue commented with fix details, working tree dirty for review | parallel fanout (one sub-agent per target — hard constraint) |
57
- | 4 | Verify | Per target: full diff cold-reviewed; simplified if warranted; each fix re-exercised against the running server with actual tool output in the summary | parallel fanout |
58
- | 5 | Loop decision | Orchestrator decision recorded — proceed to release, loop another field-test cycle, or pause/surface to user. Evidence-based | orchestrator (serial) |
59
- | 6 | Wrap-up + release | (Optional) Per target: fixes split into per-file commits with a release commit on top; annotated tag; published per repo visibility; tag annotation is structured markdown with issue backlinks | parallel fanout (Bash git only) |
60
- | 7 | Issue cleanup | Every GH issue that shipped a fix closed with "Fixed in v\<version\>" comment; skipped issues remain open | orchestrator (serial) |
52
+ | # | Phase | Objective | Sub-agent mode | Gate after |
53
+ |:--|:---|:---|:---|:---|
54
+ | 1 | Field-test | Per target: live tool/resource/prompt surface exercised across happy/error/edge paths; valid findings filed as GH issues against the server's own repo; noise filtered | parallel fanout per target; within a target, 1 or 3 sub-agents (see below) | **barrier** — cross-target synthesis: orchestrator reconciles all findings before filing triage |
55
+ | 2 | Issue triage | Per-target GH issue count + severity breakdown reconciled against actual GH state | orchestrator (serial) | gate-free |
56
+ | 3 | Fix | Per target: priority issues fixed in source, tests updated, `devcheck` + `test` green, each issue commented with fix details, working tree dirty for review | parallel fanout (one sub-agent per target — hard constraint) | gate-free |
57
+ | 4 | Verify | Per target: full diff cold-reviewed; simplified if warranted; each fix re-exercised against the running server with actual tool output in the summary | parallel fanout | **barrier** — orchestrator loop decision (human/evidence-based: proceed, loop, or surface to user) |
58
+ | 5 | Loop decision | Orchestrator decision recorded — proceed to release, loop another field-test cycle, or pause/surface to user. Evidence-based | orchestrator (serial) | **barrier** — release authorization required before advancing |
59
+ | 6 | Wrap-up + release | (Optional) Per target: fixes split into per-file commits with a release commit on top; annotated tag; published per repo visibility; tag annotation is structured markdown with issue backlinks | parallel fanout (Bash git only) | gate-free |
60
+ | 7 | Issue cleanup | Every GH issue that shipped a fix closed with "Fixed in v\<version\>" comment; skipped issues remain open | orchestrator (serial) | — |
61
61
 
62
62
  Phase 6 is optional — stop earlier if release isn't authorized. Phase 7 only runs if Phase 6 ran.
63
63
 
@@ -57,13 +57,13 @@ Per target:
57
57
 
58
58
  Each phase's Objective column is the goal state per target — the verifiable end state the phase must produce.
59
59
 
60
- | # | Phase | Objective | Sub-agent mode |
61
- |:--|:---|:---|:---|
62
- | 1a | Validate (conditional) | Each handoff finding field-tested live; valid ones filed as GH issues; invalidated ones reported back with reason. If zero validate, workflow stops | one sub-agent per target |
63
- | 1b | Fix | Per target: targeted issues fixed in source, tests updated/added, `devcheck` + `rebuild` + `test` green, each fixed issue commented with fix details, working tree dirty for review | parallel fanout (one sub-agent per target — hard constraint) |
64
- | 2 | Verify | Per target: full diff cold-reviewed; simplified if warranted; each fix re-exercised against the running server with actual tool output in the summary | parallel fanout |
65
- | 3 | Wrap-up + release | Per target: fixes split into per-file commits with a release commit on top; annotated tag; published per repo visibility; tag annotation is structured markdown with issue backlinks | parallel fanout (Bash git only) |
66
- | 4 | Issue cleanup | Every GH issue that shipped a fix closed with "Fixed in v\<version\>" comment | orchestrator (serial) |
60
+ | # | Phase | Objective | Sub-agent mode | Gate after |
61
+ |:--|:---|:---|:---|:---|
62
+ | 1a | Validate (conditional) | Each handoff finding field-tested live; valid ones filed as GH issues; invalidated ones reported back with reason. If zero validate, workflow stops | one sub-agent per target | **barrier** — cross-target synthesis: orchestrator confirms validated findings before fix proceeds (or stops workflow if zero validate) |
63
+ | 1b | Fix | Per target: targeted issues fixed in source, tests updated/added, `devcheck` + `rebuild` + `test` green, each fixed issue commented with fix details, working tree dirty for review | parallel fanout (one sub-agent per target — hard constraint) | **barrier** — orchestrator reviews diffs before verify (explicit gate in checklist) |
64
+ | 2 | Verify | Per target: full diff cold-reviewed; simplified if warranted; each fix re-exercised against the running server with actual tool output in the summary | parallel fanout | **barrier** — orchestrator reviews simplified diff and verified outputs; release authorization required |
65
+ | 3 | Wrap-up + release | Per target: fixes split into per-file commits with a release commit on top; annotated tag; published per repo visibility; tag annotation is structured markdown with issue backlinks | parallel fanout (Bash git only) | gate-free |
66
+ | 4 | Issue cleanup | Every GH issue that shipped a fix closed with "Fixed in v\<version\>" comment | orchestrator (serial) | — |
67
67
 
68
68
  Phase 1a is conditional — only runs when the input is a handoff document or otherwise unvalidated. When the input is already tracked GH issues, skip directly to Phase 1b. The release portion of Phase 3 is conditional on user authorization to ship.
69
69
 
@@ -52,26 +52,26 @@ Everything stays at **v0.1.0** through the build. Intermediate commits don't bum
52
52
 
53
53
  Each phase's Objective column is the goal state per target — the verifiable end state the phase must produce. Phase notes only appear for orchestration overrides; phases without notes run the foundational skill end-to-end.
54
54
 
55
- | # | Phase | Objective | Sub-agent mode |
56
- |:--|:---|:---|:---|
57
- | 1 | Scaffold + repo | `bunx init` scaffold complete; `--private` GH repo created; LICENSE in place; working tree dirty (no commit) | parallel fanout |
58
- | 2 | Initial commit | v0.1.0 commit + annotated tag + push to private GH repo | parallel fanout |
59
- | 3 | Design | `docs/design.md` authored with Decisions Log | parallel fanout |
60
- | 4 | Design validation | `docs/design.md` hardened by review pass; gate sub-agent returned PASS | two sub-agents per target |
61
- | 5 | Design commit | Design changes committed and pushed | parallel fanout |
62
- | 6 | Build | All designed tools/resources/prompts implemented; no echo definitions; `devcheck` + `test` green | parallel fanout |
63
- | 7 | Tool-def audit | `tool-defs-analysis` findings reviewed and applied | parallel fanout |
64
- | 8 | Test coverage | Tests extended beyond happy path; `devcheck` + `test` green | parallel fanout |
65
- | 9 | Design ↔ implementation check | Every surface element in `docs/design.md` has a definition (or `docs/design.md` updated to reflect what shipped) | parallel fanout or orchestrator-direct |
66
- | 10 | Build commit | Build work committed and pushed | parallel fanout |
67
- | 11 | Field-test loop (optional) | Live API surface exercised; valid findings filed and fixed (or skipped with note) | conditional |
68
- | 12 | Simplify | `code-simplifier` applied; `devcheck` + `test` green — last source-code modification | parallel fanout |
69
- | 13 | Polish docs/meta | README, metadata, and agent protocol aligned to gold-standard reference | parallel fanout |
70
- | 14 | Security pass | `security-pass` findings addressed; no open security gaps | parallel fanout |
71
- | 15 | Final-state check | `rebuild` + `devcheck` + `test:all` + `lint:packaging` green; LICENSE present; no unfinished TODO/FIXME | orchestrator-direct |
72
- | 16 | Pre-launch commit | Final polish + security work committed and pushed | parallel fanout |
73
- | 17 | Final wrap-up | Launch version (typically v0.1.1) commit + annotated tag in place; **not pushed** | parallel fanout (Bash git only) |
74
- | 18 | Release | Pushed and published per scope; tag annotation renders as structured markdown on GitHub Release; artifacts reachable | parallel fanout or serial (per npm 2FA mode) |
55
+ | # | Phase | Objective | Sub-agent mode | Gate after |
56
+ |:--|:---|:---|:---|:---|
57
+ | 1 | Scaffold + repo | `bunx init` scaffold complete; `--private` GH repo created; LICENSE in place; working tree dirty (no commit) | parallel fanout | gate-free |
58
+ | 2 | Initial commit | v0.1.0 commit + annotated tag + push to private GH repo | parallel fanout | gate-free |
59
+ | 3 | Design | `docs/design.md` authored with Decisions Log | parallel fanout | gate-free |
60
+ | 4 | Design validation | `docs/design.md` hardened by review pass; gate sub-agent returned PASS | two sub-agents per target | **barrier** — gate sub-agent must return PASS (or FAIL → fix loop) before build proceeds |
61
+ | 5 | Design commit | Design changes committed and pushed | parallel fanout | gate-free |
62
+ | 6 | Build | All designed tools/resources/prompts implemented; no echo definitions; `devcheck` + `test` green | parallel fanout | **barrier** — orchestrator inspects each target and spawns finish sub-agents for incomplete work (cross-target synthesis) |
63
+ | 7 | Tool-def audit | `tool-defs-analysis` findings reviewed and applied | parallel fanout | gate-free |
64
+ | 8 | Test coverage | Tests extended beyond happy path; `devcheck` + `test` green | parallel fanout | gate-free |
65
+ | 9 | Design ↔ implementation check | Every surface element in `docs/design.md` has a definition (or `docs/design.md` updated to reflect what shipped) | parallel fanout or orchestrator-direct | gate-free |
66
+ | 10 | Build commit | Build work committed and pushed | parallel fanout | gate-free |
67
+ | 11 | Field-test loop (optional) | Live API surface exercised; valid findings filed and fixed (or skipped with note) | conditional | gate-free |
68
+ | 12 | Simplify | `code-simplifier` applied; `devcheck` + `test` green — last source-code modification | parallel fanout | gate-free |
69
+ | 13 | Polish docs/meta | README, metadata, and agent protocol aligned to gold-standard reference | parallel fanout | gate-free |
70
+ | 14 | Security pass | `security-pass` findings addressed; no open security gaps | parallel fanout | gate-free |
71
+ | 15 | Final-state check | `rebuild` + `devcheck` + `test:all` + `lint:packaging` green; LICENSE present; no unfinished TODO/FIXME | orchestrator-direct | gate-free |
72
+ | 16 | Pre-launch commit | Final polish + security work committed and pushed | parallel fanout | **barrier** — human decision: version-bump intent (typically v0.1.1) |
73
+ | 17 | Final wrap-up | Launch version (typically v0.1.1) commit + annotated tag in place; **not pushed** | parallel fanout (Bash git only) | **barrier** — release authorization required before push and publish |
74
+ | 18 | Release | Pushed and published per scope; tag annotation renders as structured markdown on GitHub Release; artifacts reachable | parallel fanout or serial (per npm 2FA mode) | — |
75
75
 
76
76
  Phase 11 is optional. Phase 12 is the last phase that modifies source code — everything after is docs/metadata/verification.
77
77
 
@@ -46,12 +46,12 @@ Per target:
46
46
 
47
47
  Each phase's Objective column is the goal state per target — the verifiable end state the phase must produce.
48
48
 
49
- | # | Phase | Objective | Sub-agent mode |
50
- |:--|:---|:---|:---|
51
- | 1 | Maintenance | Per target: deps updated, framework adoption applied, project skills synced, `rebuild` + `devcheck` + `test` green, Step 8 numbered summary returned | parallel fanout |
52
- | 2 | Double-check | Adoption gaps from Phase 1 fixed; `manifest.json`/`server.json` content validated; audience compliance verified; `rebuild` + `devcheck` + `test` green | parallel fanout |
53
- | 3 | Roll-up | Per-target headlines + cross-target patterns surfaced to user; version-bump intent confirmed (patch/minor/major) | orchestrator (serial) |
54
- | 4 | Wrap-up + release | Per target: version-bumped commit + annotated tag + push + publish per scope; tag annotation renders as structured markdown on GitHub Release | parallel fanout (Bash git only) |
49
+ | # | Phase | Objective | Sub-agent mode | Gate after |
50
+ |:--|:---|:---|:---|:---|
51
+ | 1 | Maintenance | Per target: deps updated, framework adoption applied, project skills synced, `rebuild` + `devcheck` + `test` green, Step 8 numbered summary returned | parallel fanout | gate-free |
52
+ | 2 | Double-check | Adoption gaps from Phase 1 fixed; `manifest.json`/`server.json` content validated; audience compliance verified; `rebuild` + `devcheck` + `test` green | parallel fanout | **barrier** — cross-target synthesis: orchestrator roll-up + human decision on version-bump intent |
53
+ | 3 | Roll-up | Per-target headlines + cross-target patterns surfaced to user; version-bump intent confirmed (patch/minor/major) | orchestrator (serial) | **barrier** — release authorization required before wrap-up and publish |
54
+ | 4 | Wrap-up + release | Per target: version-bumped commit + annotated tag + push + publish per scope; tag annotation renders as structured markdown on GitHub Release | parallel fanout (Bash git only) | — |
55
55
 
56
56
  Phase 4 combines wrap-up and release in one sub-agent because the work is sequential and shares context (version, changelog, tag annotation). The sub-agent reads both Tier 1 skills.
57
57
 
@@ -4,7 +4,7 @@ description: >
4
4
  Ship a release end-to-end across every registry the project targets (npm, MCP Registry, GitHub Releases for `.mcpb` bundles, GHCR). Runs the final verification gate, pushes commits and tags, then publishes to each applicable destination. Assumes git wrapup (version bumps, changelog, commit, annotated tag) is already complete — this skill is the post-wrapup publish workflow. Retries transient network failures on publish steps; halts with a partial-state report when retries are exhausted or the failure is terminal.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "2.7"
7
+ version: "2.8"
8
8
  audience: external
9
9
  type: workflow
10
10
  ---
@@ -127,34 +127,41 @@ security add-generic-password -a "$USER" -s mcp-publisher-github-pat -w
127
127
 
128
128
  Halt on any publisher error other than "cannot publish duplicate version".
129
129
 
130
- ### 6. Attach MCPB bundle to GitHub Release
130
+ ### 6. Create GitHub Release
131
131
 
132
- Only if `manifest.json` exists at the repo root (otherwise skip).
133
-
134
- Build the bundle, then create a Release on the existing annotated tag and attach the `.mcpb`. The Release sits on top of the tag from wrapup — `--verify-tag` enforces that the tag already exists on the remote and prevents `gh` from creating a lightweight tag that would shadow the annotated one. `--notes-from-tag` pulls the tag annotation body as release notes. `--title` sets the release title from the tag subject — `--notes-from-tag` alone does NOT set the title (it defaults to the bare tag name, e.g. "v0.1.8" with no theme). The tag subject already omits the version number per the git-wrapup skill, so prepending `v<VERSION>:` produces the correct display title.
132
+ For all projects (including those without `manifest.json`):
135
133
 
136
134
  ```bash
137
- bun run bundle # produces dist/<name>.mcpb (stable filename, no version)
138
- SUBJECT=$(git tag -l --format='%(contents:subject)' v<VERSION>)
139
- gh release create v<VERSION> --verify-tag --notes-from-tag --title "v<VERSION>: $SUBJECT" dist/*.mcpb
135
+ bun run release:github
140
136
  ```
141
137
 
142
- The stable filename matters: it lets the README "Install in Claude Desktop" badge point at `releases/latest/download/<name>.mcpb` and always resolve to the most recent release. The `bundle` script in the templates outputs `dist/{{PACKAGE_NAME}}.mcpb` for this reason.
138
+ The script (`scripts/release-github.ts`) handles everything in one command:
139
+
140
+ - Reads `version` from `package.json`
141
+ - Derives the tag subject via `git for-each-ref refs/tags/v<version>`
142
+ - Runs `gh release create v<version> --verify-tag --notes-from-tag --title "v<version>: <subject>"`
143
+ - Attaches `dist/*.mcpb` when `manifest.json` exists (skip the `bun run bundle` step first if not already built — see below)
144
+ - On "release already exists" (re-invocation after a prior partial run): uploads/clobbers the `.mcpb` asset (if applicable) and patches the title via `gh release edit`
143
145
 
144
- If the release already exists (re-invocation after a prior partial run), `gh release create` exits with "release already exists" fall back to uploading the asset to the existing release:
146
+ **If `manifest.json` exists**, build the bundle first so the asset is ready:
145
147
 
146
148
  ```bash
147
- gh release upload v<VERSION> dist/*.mcpb --clobber
149
+ bun run bundle # produces dist/<name>.mcpb (stable filename, no version)
150
+ bun run release:github # attach + release in one step
148
151
  ```
149
152
 
150
- Deterministic download URLs:
153
+ The stable filename matters: it lets the README "Install in Claude Desktop" badge point at `releases/latest/download/<name>.mcpb` and always resolve to the most recent release. The `bundle` script in the templates outputs `dist/{{PACKAGE_NAME}}.mcpb` for this reason.
154
+
155
+ Deterministic download URLs (for MCPB projects):
151
156
 
152
157
  - Pinned to this version: `https://github.com/<OWNER>/<REPO>/releases/download/v<VERSION>/<name>.mcpb`
153
158
  - Always latest (powers the install badge): `https://github.com/<OWNER>/<REPO>/releases/latest/download/<name>.mcpb`
154
159
 
155
160
  If `server.json` includes an MCPB `packages[]` entry, its `identifier` should match this URL and `fileSha256` should match `shasum -a 256 <bundle>` — keep these in sync during wrapup, not here.
156
161
 
157
- Halt on any error other than "release already exists" (handled via the upload fallback above).
162
+ **Framework note:** `mcp-ts-core` has no `manifest.json` the bundle attach path is skipped automatically. Skip the Docker build/push step too (this framework package is consumed via npm, not as a container image).
163
+
164
+ Halt on any non-zero exit not handled by the script's built-in fallback.
158
165
 
159
166
  ### 7. Publish Docker image
160
167
 
@@ -206,7 +213,7 @@ If any check fails, halt and report which destination is unreachable. A successf
206
213
  - [ ] Tags pushed to origin
207
214
  - [ ] `bun publish --access public` succeeds
208
215
  - [ ] `bun run publish-mcp` succeeds (if `server.json` present)
209
- - [ ] `bun run bundle` + `gh release create --verify-tag --notes-from-tag --title` succeeds (if `manifest.json` present)
216
+ - [ ] `bun run bundle` (if `manifest.json` present) + `bun run release:github` succeeds
210
217
  - [ ] Docker buildx multi-arch push succeeds (if `Dockerfile` present)
211
218
  - [ ] All published artifacts verified reachable (npm, MCP Registry, GH Release asset, GHCR manifest)
212
219
  - [ ] On re-invocation: idempotent-success signals recognized for already-published destinations
@@ -33,6 +33,7 @@
33
33
  "bundle": "npm run build && npx -y @anthropic-ai/mcpb pack . dist/{{PACKAGE_NAME}}.mcpb",
34
34
  "changelog:build": "tsx scripts/build-changelog.ts",
35
35
  "changelog:check": "tsx scripts/build-changelog.ts --check",
36
+ "release:github": "tsx scripts/release-github.ts",
36
37
  "test": "vitest run",
37
38
  "start": "node dist/index.js",
38
39
  "start:stdio": "MCP_TRANSPORT_TYPE=stdio node dist/index.js",