@casys/mcp-server 0.27.0 → 0.27.2

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.
Files changed (253) hide show
  1. package/CHANGELOG.md +18 -1764
  2. package/README.md +21 -631
  3. package/esm/mod.d.ts +1 -102
  4. package/esm/mod.js +1 -103
  5. package/package.json +17 -25
  6. package/esm/_dnt.polyfills.d.ts +0 -12
  7. package/esm/_dnt.polyfills.d.ts.map +0 -1
  8. package/esm/_dnt.polyfills.js +0 -15
  9. package/esm/_dnt.shims.d.ts +0 -2
  10. package/esm/_dnt.shims.d.ts.map +0 -1
  11. package/esm/_dnt.shims.js +0 -57
  12. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts +0 -33
  13. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts.map +0 -1
  14. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.js +0 -48
  15. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts +0 -106
  16. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts.map +0 -1
  17. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.js +0 -636
  18. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts +0 -67
  19. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts.map +0 -1
  20. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.js +0 -1393
  21. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts +0 -44
  22. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts.map +0 -1
  23. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.js +0 -117
  24. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts +0 -3
  25. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts.map +0 -1
  26. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.js +0 -103
  27. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts +0 -3
  28. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts.map +0 -1
  29. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.js +0 -32
  30. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts +0 -3
  31. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts.map +0 -1
  32. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.js +0 -96
  33. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts +0 -3
  34. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts.map +0 -1
  35. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.js +0 -159
  36. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts +0 -3
  37. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts.map +0 -1
  38. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.js +0 -14
  39. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts +0 -3
  40. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts.map +0 -1
  41. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.js +0 -10
  42. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts +0 -3
  43. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts.map +0 -1
  44. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.js +0 -22
  45. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts +0 -3
  46. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts.map +0 -1
  47. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.js +0 -29
  48. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts +0 -3
  49. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts.map +0 -1
  50. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.js +0 -19
  51. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts +0 -3
  52. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts.map +0 -1
  53. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.js +0 -30
  54. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts +0 -3
  55. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts.map +0 -1
  56. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.js +0 -10
  57. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts +0 -3
  58. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts.map +0 -1
  59. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.js +0 -14
  60. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts +0 -3
  61. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts.map +0 -1
  62. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.js +0 -9
  63. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts +0 -3
  64. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts.map +0 -1
  65. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.js +0 -81
  66. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts +0 -3
  67. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts.map +0 -1
  68. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.js +0 -20
  69. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts +0 -32
  70. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts.map +0 -1
  71. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.js +0 -6
  72. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts +0 -4
  73. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts.map +0 -1
  74. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.js +0 -13
  75. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts +0 -51
  76. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts.map +0 -1
  77. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.js +0 -53
  78. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts +0 -79
  79. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts.map +0 -1
  80. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.js +0 -91
  81. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts +0 -100
  82. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts.map +0 -1
  83. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.js +0 -33
  84. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts +0 -111
  85. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts.map +0 -1
  86. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.js +0 -104
  87. package/esm/mod.d.ts.map +0 -1
  88. package/esm/package.json +0 -3
  89. package/esm/src/auth/as-metadata-proxy.d.ts +0 -112
  90. package/esm/src/auth/as-metadata-proxy.d.ts.map +0 -1
  91. package/esm/src/auth/as-metadata-proxy.js +0 -171
  92. package/esm/src/auth/config.d.ts +0 -117
  93. package/esm/src/auth/config.d.ts.map +0 -1
  94. package/esm/src/auth/config.js +0 -219
  95. package/esm/src/auth/jwt-provider.d.ts +0 -157
  96. package/esm/src/auth/jwt-provider.d.ts.map +0 -1
  97. package/esm/src/auth/jwt-provider.js +0 -187
  98. package/esm/src/auth/middleware.d.ts +0 -61
  99. package/esm/src/auth/middleware.d.ts.map +0 -1
  100. package/esm/src/auth/middleware.js +0 -209
  101. package/esm/src/auth/mod.d.ts +0 -23
  102. package/esm/src/auth/mod.d.ts.map +0 -1
  103. package/esm/src/auth/mod.js +0 -27
  104. package/esm/src/auth/multi-tenant-middleware.d.ts +0 -131
  105. package/esm/src/auth/multi-tenant-middleware.d.ts.map +0 -1
  106. package/esm/src/auth/multi-tenant-middleware.js +0 -128
  107. package/esm/src/auth/presets.d.ts +0 -231
  108. package/esm/src/auth/presets.d.ts.map +0 -1
  109. package/esm/src/auth/presets.js +0 -223
  110. package/esm/src/auth/provider.d.ts +0 -47
  111. package/esm/src/auth/provider.d.ts.map +0 -1
  112. package/esm/src/auth/provider.js +0 -34
  113. package/esm/src/auth/scope-middleware.d.ts +0 -30
  114. package/esm/src/auth/scope-middleware.d.ts.map +0 -1
  115. package/esm/src/auth/scope-middleware.js +0 -48
  116. package/esm/src/auth/static-token-provider.d.ts +0 -155
  117. package/esm/src/auth/static-token-provider.d.ts.map +0 -1
  118. package/esm/src/auth/static-token-provider.js +0 -256
  119. package/esm/src/auth/types.d.ts +0 -151
  120. package/esm/src/auth/types.d.ts.map +0 -1
  121. package/esm/src/auth/types.js +0 -64
  122. package/esm/src/client-auth/callback-server.d.ts +0 -34
  123. package/esm/src/client-auth/callback-server.d.ts.map +0 -1
  124. package/esm/src/client-auth/callback-server.js +0 -141
  125. package/esm/src/client-auth/client-id-metadata.d.ts +0 -29
  126. package/esm/src/client-auth/client-id-metadata.d.ts.map +0 -1
  127. package/esm/src/client-auth/client-id-metadata.js +0 -149
  128. package/esm/src/client-auth/connect.d.ts +0 -32
  129. package/esm/src/client-auth/connect.d.ts.map +0 -1
  130. package/esm/src/client-auth/connect.js +0 -47
  131. package/esm/src/client-auth/mod.d.ts +0 -19
  132. package/esm/src/client-auth/mod.d.ts.map +0 -1
  133. package/esm/src/client-auth/mod.js +0 -19
  134. package/esm/src/client-auth/provider.d.ts +0 -78
  135. package/esm/src/client-auth/provider.d.ts.map +0 -1
  136. package/esm/src/client-auth/provider.js +0 -246
  137. package/esm/src/client-auth/token-store/file-store.d.ts +0 -20
  138. package/esm/src/client-auth/token-store/file-store.d.ts.map +0 -1
  139. package/esm/src/client-auth/token-store/file-store.js +0 -62
  140. package/esm/src/client-auth/token-store/memory-store.d.ts +0 -14
  141. package/esm/src/client-auth/token-store/memory-store.d.ts.map +0 -1
  142. package/esm/src/client-auth/token-store/memory-store.js +0 -25
  143. package/esm/src/client-auth/types.d.ts +0 -89
  144. package/esm/src/client-auth/types.d.ts.map +0 -1
  145. package/esm/src/client-auth/types.js +0 -10
  146. package/esm/src/concurrency/rate-limiter.d.ts +0 -87
  147. package/esm/src/concurrency/rate-limiter.d.ts.map +0 -1
  148. package/esm/src/concurrency/rate-limiter.js +0 -165
  149. package/esm/src/concurrency/request-queue.d.ts +0 -71
  150. package/esm/src/concurrency/request-queue.d.ts.map +0 -1
  151. package/esm/src/concurrency/request-queue.js +0 -128
  152. package/esm/src/http/body.d.ts +0 -20
  153. package/esm/src/http/body.d.ts.map +0 -1
  154. package/esm/src/http/body.js +0 -63
  155. package/esm/src/http/request-guards.d.ts +0 -54
  156. package/esm/src/http/request-guards.d.ts.map +0 -1
  157. package/esm/src/http/request-guards.js +0 -114
  158. package/esm/src/http/wire.d.ts +0 -26
  159. package/esm/src/http/wire.d.ts.map +0 -1
  160. package/esm/src/http/wire.js +0 -35
  161. package/esm/src/inspector/launcher.d.ts +0 -48
  162. package/esm/src/inspector/launcher.d.ts.map +0 -1
  163. package/esm/src/inspector/launcher.js +0 -100
  164. package/esm/src/mcp-app.d.ts +0 -728
  165. package/esm/src/mcp-app.d.ts.map +0 -1
  166. package/esm/src/mcp-app.js +0 -3530
  167. package/esm/src/middleware/backpressure.d.ts +0 -24
  168. package/esm/src/middleware/backpressure.d.ts.map +0 -1
  169. package/esm/src/middleware/backpressure.js +0 -31
  170. package/esm/src/middleware/mod.d.ts +0 -11
  171. package/esm/src/middleware/mod.d.ts.map +0 -1
  172. package/esm/src/middleware/mod.js +0 -11
  173. package/esm/src/middleware/rate-limit.d.ts +0 -22
  174. package/esm/src/middleware/rate-limit.d.ts.map +0 -1
  175. package/esm/src/middleware/rate-limit.js +0 -33
  176. package/esm/src/middleware/runner.d.ts +0 -32
  177. package/esm/src/middleware/runner.d.ts.map +0 -1
  178. package/esm/src/middleware/runner.js +0 -49
  179. package/esm/src/middleware/types.d.ts +0 -76
  180. package/esm/src/middleware/types.d.ts.map +0 -1
  181. package/esm/src/middleware/types.js +0 -9
  182. package/esm/src/middleware/validation.d.ts +0 -24
  183. package/esm/src/middleware/validation.d.ts.map +0 -1
  184. package/esm/src/middleware/validation.js +0 -30
  185. package/esm/src/mrtr/capability-check.d.ts +0 -75
  186. package/esm/src/mrtr/capability-check.d.ts.map +0 -1
  187. package/esm/src/mrtr/capability-check.js +0 -233
  188. package/esm/src/mrtr/mod.d.ts +0 -18
  189. package/esm/src/mrtr/mod.d.ts.map +0 -1
  190. package/esm/src/mrtr/mod.js +0 -12
  191. package/esm/src/mrtr/replay-store.d.ts +0 -50
  192. package/esm/src/mrtr/replay-store.d.ts.map +0 -1
  193. package/esm/src/mrtr/replay-store.js +0 -61
  194. package/esm/src/mrtr/request-state.d.ts +0 -181
  195. package/esm/src/mrtr/request-state.d.ts.map +0 -1
  196. package/esm/src/mrtr/request-state.js +0 -313
  197. package/esm/src/mrtr/retry-guard.d.ts +0 -61
  198. package/esm/src/mrtr/retry-guard.d.ts.map +0 -1
  199. package/esm/src/mrtr/retry-guard.js +0 -53
  200. package/esm/src/mrtr/types.d.ts +0 -99
  201. package/esm/src/mrtr/types.d.ts.map +0 -1
  202. package/esm/src/mrtr/types.js +0 -14
  203. package/esm/src/observability/metrics.d.ts +0 -104
  204. package/esm/src/observability/metrics.d.ts.map +0 -1
  205. package/esm/src/observability/metrics.js +0 -207
  206. package/esm/src/observability/mod.d.ts +0 -12
  207. package/esm/src/observability/mod.d.ts.map +0 -1
  208. package/esm/src/observability/mod.js +0 -11
  209. package/esm/src/observability/otel.d.ts +0 -73
  210. package/esm/src/observability/otel.d.ts.map +0 -1
  211. package/esm/src/observability/otel.js +0 -260
  212. package/esm/src/runtime/runtime.d.ts +0 -10
  213. package/esm/src/runtime/runtime.d.ts.map +0 -1
  214. package/esm/src/runtime/runtime.deno.d.ts +0 -50
  215. package/esm/src/runtime/runtime.deno.d.ts.map +0 -1
  216. package/esm/src/runtime/runtime.deno.js +0 -120
  217. package/esm/src/runtime/runtime.js +0 -41
  218. package/esm/src/runtime/runtime.node.d.ts +0 -51
  219. package/esm/src/runtime/runtime.node.d.ts.map +0 -1
  220. package/esm/src/runtime/runtime.node.js +0 -268
  221. package/esm/src/runtime/types.d.ts +0 -107
  222. package/esm/src/runtime/types.d.ts.map +0 -1
  223. package/esm/src/runtime/types.js +0 -12
  224. package/esm/src/security/channel-hmac.d.ts +0 -43
  225. package/esm/src/security/channel-hmac.d.ts.map +0 -1
  226. package/esm/src/security/channel-hmac.js +0 -135
  227. package/esm/src/security/csp.d.ts +0 -50
  228. package/esm/src/security/csp.d.ts.map +0 -1
  229. package/esm/src/security/csp.js +0 -63
  230. package/esm/src/security/message-signer.d.ts +0 -88
  231. package/esm/src/security/message-signer.d.ts.map +0 -1
  232. package/esm/src/security/message-signer.js +0 -166
  233. package/esm/src/subscriptions/subscription-registry.d.ts +0 -256
  234. package/esm/src/subscriptions/subscription-registry.d.ts.map +0 -1
  235. package/esm/src/subscriptions/subscription-registry.js +0 -406
  236. package/esm/src/tasks/mod.d.ts +0 -13
  237. package/esm/src/tasks/mod.d.ts.map +0 -1
  238. package/esm/src/tasks/mod.js +0 -11
  239. package/esm/src/tasks/task-store.d.ts +0 -342
  240. package/esm/src/tasks/task-store.d.ts.map +0 -1
  241. package/esm/src/tasks/task-store.js +0 -649
  242. package/esm/src/transport/request-headers.d.ts +0 -145
  243. package/esm/src/transport/request-headers.d.ts.map +0 -1
  244. package/esm/src/transport/request-headers.js +0 -525
  245. package/esm/src/types.d.ts +0 -776
  246. package/esm/src/types.d.ts.map +0 -1
  247. package/esm/src/types.js +0 -92
  248. package/esm/src/ui/viewer-utils.d.ts +0 -45
  249. package/esm/src/ui/viewer-utils.d.ts.map +0 -1
  250. package/esm/src/ui/viewer-utils.js +0 -97
  251. package/esm/src/validation/schema-validator.d.ts +0 -115
  252. package/esm/src/validation/schema-validator.d.ts.map +0 -1
  253. package/esm/src/validation/schema-validator.js +0 -249
package/CHANGELOG.md CHANGED
@@ -2,1778 +2,32 @@
2
2
 
3
3
  All notable changes to `@casys/mcp-server` will be documented in this file.
4
4
 
5
- ## [0.27.0] — 2026-08-28
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project adheres
6
+ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
7
 
7
- ### Added
8
+ ## [Unreleased]
8
9
 
9
- - Static bearer tokens can now opt into identity-aware credentials with a frozen
10
- `subject` and scope set per token. The existing `string[]` allowlist retains
11
- its shared-authority semantics, while credential mode rejects unusable
12
- subjects, ambiguous mixed or duplicate mappings, and metadata that omits a
13
- granted scope without exposing raw bearer tokens.
14
-
15
- ### Security
16
-
17
- - HTTP scope authorization now follows live tool registration. A tool added or
18
- replaced with `registerToolLive()` is checked against its current
19
- `requiredScopes` even when the server started with no scoped tools. Each call
20
- binds one tool definition for authorization, input validation, handler
21
- dispatch, and result metadata, so a concurrent replacement cannot mix old
22
- scopes or schemas with a new handler. Scoped HTTP tools also fail closed when
23
- no auth provider is configured; stdio remains the trusted local transport.
24
-
25
- ### Fixed
26
-
27
- - Live registration now copies the caller's scope array and validates schemas
28
- before replacing registry state. Unregistering a tool also removes its cached
29
- schema, allowing a later tool with the same name to start cleanly.
30
- - The npm package now contains native ESM JavaScript and TypeScript declarations
31
- generated by `dnt`, and includes its MIT license. The previous build rewrote
32
- relative imports to `.js` but published only `.ts` files, so its `tsx`-based
33
- smoke test passed while a normal Node import failed. Publication now tests a
34
- freshly installed tarball with Node itself, and the public MCP Apps metadata
35
- type no longer leaks an upstream declaration-layout incompatibility into
36
- NodeNext consumers.
37
-
38
- ### Documentation
39
-
40
- - Added a test-only native stdio adoption kit for provider repositories. It
41
- covers real-command launch, HTTP/stdio flag contracts, modern and legacy
42
- protocol probes, JSON-only stdout, bounded EOF cleanup, and dynamic resource
43
- lifecycle checks without adding a runtime API or shared CLI parser.
44
-
45
- ## [0.26.1] — 2026-08-21
46
-
47
- ### Fixed
48
-
49
- - **MCP 2026-07-28 over stdio now uses the official era-aware serving path.**
50
- Modern clients receive the required `resultType: "complete"` envelope on
51
- `server/discover`, `tools/list`, and other completed results, while clients
52
- that begin with legacy `initialize` retain their 2025-11-25 wire shape. The
53
- server factory creates a fresh protocol instance for a modern probe and a
54
- possible legacy fallback, so the fallback never reuses a discarded instance.
55
- This restores all ERPNext tools in Claude Code and fixes
56
- [mcp-erpnext#22](https://github.com/Casys-AI/mcp-erpnext/issues/22).
57
-
58
- - **MRTR retries now have one transport-neutral admission policy.** stdio and
59
- HTTP share the same signed-state bindings and atomic replay check before
60
- application dispatch. Modern stdio consumes the v2 retry fields directly;
61
- legacy stdio uses the SDK compatibility shim and re-enters the same verified
62
- handler. Malformed lifted responses are rejected before their nonce can be
63
- spent.
64
-
65
- - stdio discovery no longer advertises the HTTP-only Tasks extension or
66
- `tools.listChanged` until those operations are actually served. Resource
67
- list-change notifications continue to be emitted when resources are enabled.
68
-
69
- - The npm build now declares `@modelcontextprotocol/server` and excludes stdio
70
- test fixtures, so the published Node distribution resolves the v2 runtime it
71
- imports.
72
-
73
- ## [0.26.0] — 2026-08-11
74
-
75
- ### Added
76
-
77
- - **Full resource content and lifecycle support.** `ResourceContent` is now a
78
- discriminated union: return either `{ text }` or `{ blob }`, never both.
79
- `blob` is standard padded base64, so binary resources such as images,
80
- archives, and generated files travel without lossy text coercion. The public
81
- `TextResourceContent` and `BlobResourceContent` types are exported alongside
82
- `ResourceContent` and `ResourceHandler`.
83
-
84
- The framework enforces the same boundary at runtime for JavaScript consumers
85
- and unchecked TypeScript: a handler response must contain exactly one payload
86
- form, echo the requested URI exactly, have a non-empty MIME type, and use
87
- canonical base64 for blobs. Resource-content `_meta` is preserved; resource
88
- `annotations`, `icons`, `title`, and `_meta` belong to the `resources/list`
89
- metadata where the MCP schema defines them. Existing text handlers that
90
- already return their requested URI and a MIME type continue to work unchanged.
91
-
92
- - `MCPResource.size?: number` publishes a known byte size in `resources/list`
93
- and attests it on every read: the response must contain exactly that many
94
- UTF-8 text bytes or decoded blob bytes. The package rejects fractional,
95
- unsafe, or negative values at registration, rather than emitting metadata a
96
- client has to disregard. When a resource explicitly registers `mimeType`, a
97
- read response must use the same value; an omitted resource MIME type is also
98
- omitted from the listing rather than guessed.
99
-
100
- - `unregisterResource(uri): boolean` removes a registered resource safely before
101
- or after transport startup once resource handlers are installed. The framework
102
- owns one resource registry and exposes it through low-level MCP list/read/
103
- templates handlers, so a failed SDK-side rollback cannot leave a ghost
104
- resource. A missing URI returns `false`, enabling idempotent cleanup.
105
-
106
- - `registerResources()` validates handlers, canonical URIs, metadata, existing
107
- duplicates, and intra-batch duplicates before committing the complete batch.
108
- It emits exactly one best-effort `notifications/resources/list_changed` after
109
- a successful started-server mutation, and none on validation failure.
110
-
111
- - `expectResources: true` predeclares `resources: { listChanged: true }`,
112
- including while the registry is empty. `resources/list`, `resources/read`, and
113
- `resources/templates/list` are then available from startup; the template list
114
- is explicitly empty until template support is added.
10
+ ## [0.27.2] - 2026-09-19
115
11
 
116
12
  ### Changed
117
13
 
118
- - `resourceCsp` only injects into the text branch of an HTML resource. Binary
119
- blobs are returned byte-for-byte as their base64 payload, even when their MIME
120
- type is `text/html`.
121
-
122
- ## [0.25.0] — 2026-08-08
123
-
124
- ### Security
125
-
126
- - **Client credentials are now bound to the authorization server that minted
127
- them** (spec 2026-07-28, SEP-2352). Previously `tokens()` returned stored
128
- credentials to any caller. The SDK's `auth()` discovers the authorization
129
- server from the **MCP server's own** protected-resource metadata and then
130
- hands those tokens to `refreshAuthorization(authorizationServerUrl, …)` — so
131
- an MCP server that changed, or was made to advertise, a different
132
- authorization server received a refresh token minted by the previous one. A
133
- client must not let a resource server choose who sees its credentials.
134
-
135
- The binding is recorded from `saveDiscoveryState()`, which `auth()` calls
136
- after discovery and before asking for tokens. Two details matter:
137
-
138
- - It binds to the **discovered URL**, not to `metadata.issuer`. `issuer` is
139
- published by the authorization server about itself, and SDK 1.29 validates
140
- the metadata's shape without checking it against the URL it was fetched from
141
- — so binding to the claim would let an attacker's server unlock another
142
- server's credentials by claiming its name. A mismatch is logged (RFC 8414
143
- requires them to match) but nothing depends on the claim.
144
- - The `refresh_token` carry-over in `saveTokens()` is now scoped to the same
145
- authorization server. `auth({ authorizationCode })` reaches `saveTokens()`
146
- without passing through `tokens()`, so an exchange returning no refresh
147
- token would otherwise have re-labelled the previous server's secret with the
148
- new issuer.
149
-
150
- **On upgrade:** existing stored credentials carry no recorded issuer, so they
151
- are discarded once and re-authorization is required. A genuine authorization
152
- server migration behaves the same way — old credentials dropped, new
153
- authorization performed — and both are reported through the new optional
154
- `logger` on the client config.
155
-
156
- ### Added
157
-
158
- - `logger?: (message: string) => void` on the OAuth client config. Credential
159
- lifecycle events — an authorization server change, a discarded legacy record —
160
- are otherwise invisible, and an operator seeing an unexpected login prompt has
161
- no way to find out why. URLs are redacted to origin and path before being
162
- logged.
163
-
164
- - **W3C trace context propagation** (spec 2026-07-28, SEP-414). A tool-call span
165
- now joins the caller's trace instead of starting a detached one. `traceparent`
166
- and `tracestate` are read from `params._meta` — bare, not namespaced, which
167
- the revision spells out as an explicit exception to the `_meta` prefix rule so
168
- the values match what a caller would put in an HTTP header — and become the
169
- span's remote parent.
170
-
171
- Both are validated against the W3C grammar rather than passed through:
172
- `traceparent` follows the forward-compatibility rule (version `00` is a fixed
173
- 55 characters, a higher version may carry unknown trailing fields), and
174
- `tracestate` members are checked against the ABNF, with invalid or duplicate
175
- members dropped. The list is re-serialised onto the next hop, so accepting a
176
- malformed member would turn one peer's bug into ours. `tracestate` is carried
177
- through a minimal `TraceState` implementation because `@opentelemetry/api`
178
- declares the interface but ships no implementation.
179
-
180
- **`baggage` is deliberately not read.** It is an unbounded, caller-controlled
181
- key/value list that routinely carries tenant, user and session identifiers,
182
- and the only thing this server could do with it is copy it into spans —
183
- exporting whatever a caller put there to the trace backend, with no way to
184
- know whether it holds PII or a secret. Propagating it safely needs the OTel
185
- baggage API and an explicit key allowlist; until a use case asks for that,
186
- reading it at all is a liability.
187
-
188
- Wired on both transports — a local stdio server is where a detached span is
189
- hardest to trace back to the host that caused it. stdio now also reads
190
- `io.modelcontextprotocol/logLevel`, which it previously ignored. A malformed
191
- header degrades to an unparented span and never fails the call.
192
-
193
- ### Fixed
194
-
195
- - **`server/discover` now answers on stdio.** The spec makes the RPC a MUST for
196
- every server and names stdio as a primary use — a client probes it for
197
- backward compatibility. Only the HTTP path implemented it, so a stdio peer got
198
- `-32601` and concluded this was not a 2026-07-28 server. That conclusion was
199
- wrong in exactly the case the probe exists for: the SDK's stdio handshake
200
- negotiates `2025-11-25`, so `server/discover` is the only way a peer learns
201
- the server also speaks `2026-07-28` over HTTP.
202
-
203
- Routed through the SDK's `fallbackRequestHandler` — `setRequestHandler` takes
204
- a Zod schema and the method is absent from the SDK's type surface; declaring
205
- one schema is not worth a Zod peer dependency in the public API. Unknown
206
- methods still answer `MethodNotFound`. Both transports now build the payload
207
- from one `buildDiscoverResult()`, so `instructions` or a new capability cannot
208
- land on one path only.
209
-
210
- - **Tool argument validation now runs on JSON Schema 2020-12.** The validator
211
- imported ajv's default export, which is **draft-07**. Spec 2026-07-28
212
- (SEP-2106) allows any 2020-12 keyword in `inputSchema` / `outputSchema`, and
213
- the draft-07 build treats the keywords added in 2020-12 — `prefixItems`,
214
- `unevaluatedProperties`, `unevaluatedItems`, `$dynamicRef` — as unknown.
215
- Combined with `strict: false` the failure was **silent**: the schema compiled,
216
- the constraint never ran, and a violating payload validated clean. A tool
217
- declaring `prefixItems: [{type:"string"}, {type:"number"}]` accepted
218
- `[42, "nope"]`.
219
-
220
- **Two breaking consequences**, both worth checking before upgrading:
221
-
222
- 1. A deployment already shipping a 2020-12 schema will see payloads that used
223
- to pass now correctly fail.
224
- 2. A schema using the **draft-07 tuple form** — `items: [...]` with an array —
225
- is now rejected by ajv at compile time, so `registerTool` throws and the
226
- tool never registers. 2020-12 replaced that form with `prefixItems` and
227
- requires `items` to be a single subschema. The failure is at startup, not
228
- on first call, and it is deliberate: a tool whose declared boundary cannot
229
- be enforced should not come up pretending it can. Migration is mechanical —
230
- rename `items` to `prefixItems`.
231
-
232
- Everything draft-07 and 2020-12 share is unaffected, including
233
- `items`-as-a-single-subschema, which is the form used throughout this repo.
234
- Both cases are pinned by tests.
235
-
236
- - **`fallbackRequestHandler` changes the message on unrouted methods.** The code
237
- is unchanged (`-32601`), but the string a stdio peer receives goes from
238
- `"Method not found"` to `"MCP error -32601: Method not found"`: an error
239
- raised from a handler travels as `McpError`, whose constructor adds that
240
- prefix, and there is no way to raise the code from a handler without it. Only
241
- a peer matching on the message text rather than the code is affected.
242
-
243
- ## [0.24.1] — 2026-07-31
244
-
245
- ### Fixed
246
-
247
- - Signed MRTR `requestState` tokens are now consumed before handler dispatch, so
248
- a second use of the same nonce is rejected with `reason: "replayed"` without
249
- re-running business logic. The default `MemoryMrtrReplayStore` protects one
250
- continuously running process and fails closed at bounded capacity.
251
- - `MrtrOptions.replayStore` accepts an atomic shared implementation for
252
- load-balanced and restart-safe deployments. Store errors fail closed with
253
- `mrtr_replay_store_unavailable`; they never degrade silently to an unverified
254
- retry.
255
-
256
- This is at-most-once admission, not exactly-once completion. A deployment that
257
- must return the outcome after a lost response still needs an idempotency/result
258
- ledger coordinated with its downstream mutation.
259
-
260
- ## [0.24.0] — 2026-07-30
261
-
262
- ### Removed — BREAKING
263
-
264
- The stateful transport is gone. `transport` now accepts only `"stateless"`;
265
- consumers that passed `"stateful"` explicitly must drop it, and those that
266
- omitted the option are unaffected because omission already selected the only
267
- remaining behaviour.
268
-
269
- Removed with it: protocol-level sessions and `Mcp-Session-Id`, the `GET /mcp`
270
- SSE stream, `Last-Event-ID` resumption, `sendToSession`,
271
- `broadcastNotification`, `getSSEClientCount`, and the deprecated
272
- `SamplingBridge` — superseded by MRTR, which carries server→client interactions
273
- inside results instead of as separate requests.
274
-
275
- Also removed: tolerance for pre-2026 protocol revisions.
276
- `STATELESS_SUPPORTED_VERSIONS` is `["2026-07-28"]` alone; a request declaring
277
- `2025-06-18` or `2025-11-25` now receives `-32022` with `data.supported`. That
278
- tolerance never served a real client — pre-2026 revisions used `initialize` plus
279
- the `MCP-Protocol-Version` header, never the per-request `_meta` envelope this
280
- transport requires before dispatch. What it accepted was a hybrid that only our
281
- own tests constructed.
282
-
283
- ### Fixed
284
-
285
- - A missing `MCP-Protocol-Version` header now returns `-32020`
286
- (`HeaderMismatch`) rather than `-32602`. The spec lists a missing required
287
- standard header as a header-validation failure; answering `-32602` pointed a
288
- legacy client at the wrong fix — its body field — when the header was the
289
- primary violation.
290
- - `DELETE /mcp` returns `405` rather than `404`, alongside `GET`. DELETE was the
291
- session-termination verb in earlier revisions, and `404` reads to an older
292
- client as "no MCP endpoint here", triggering a fallback to the deprecated
293
- HTTP+SSE transport.
294
-
295
- ### Changed
296
-
297
- - `minItems`, `maxItems`, `uniqueItems`, `minProperties` and `maxProperties`
298
- validation errors now carry a formatted message and a structured `expected`,
299
- like every other keyword. They were always enforced — ajv compiles the whole
300
- schema — but fell through to the default branch with `expected` undefined,
301
- which is the field an agent reads to build a recovery.
302
- - Internal: `src/http/{body,request-guards,wire}.ts` extracted from `mcp-app.ts`
303
- (4640 → 3867 lines). None is re-exported; no public API change.
304
-
305
- ## [0.23.0] — 2026-07-30
306
-
307
- MCP **2026-07-28 is Final** (shipped 2026-07-28). Tracks A–F were built against
308
- the May 2026 Release Candidate, which the final revision changed in ways that
309
- made part of 0.21.0 non-conformant. This release covers **Track H** (result
310
- envelope + removals), the **Track F fix** (error-code renumbering), **Track C**
311
- (request-metadata headers + cache fields), **Track G** (`subscriptions/listen`),
312
- **Track B** (Multi Round-Trip Requests) and **Track I** (the Tasks extension).
313
-
314
- All changes are confined to peers that negotiate `2026-07-28`. The default
315
- **stateful** transport is byte-identical to 0.22.0, and a peer negotiating an
316
- earlier revision over the stateless transport also sees the 0.22.0 shape. (Both
317
- of those statements ceased to hold in 0.24.0, which removed the stateful
318
- transport and pre-2026 tolerance entirely.)
319
-
320
- ### Changed — BREAKING on the stateless transport
321
-
322
- - **Error codes renumbered** to match the final allocation policy, which
323
- partitions the JSON-RPC server-error range: `-32000`..`-32019` stays
324
- implementation-defined (existing SDK usage grandfathered), `-32020`..`-32099`
325
- is reserved for the specification.
326
-
327
- | Condition | 0.21.0 (RC) | Now |
328
- | ------------------------------------ | ----------- | -------- |
329
- | Unsupported `protocolVersion` | `-32004` | `-32022` |
330
- | `MCP-Protocol-Version` header ≠ body | `-32602` | `-32020` |
331
-
332
- The 403-forbidden code stays `-32002`: it sits in the grandfathered range, so
333
- a server-specific meaning is legitimate there. Its original justification —
334
- "SEP-2575 reserves `-32003`" — no longer holds, since that reservation moved
335
- to `-32021`; only the inline rationale changed.
336
-
337
- - **`ping` and `logging/setLevel` now return HTTP 404 + `-32601`.** The final
338
- spec **removes** both methods rather than deprecating them. 0.21.0
339
- deliberately kept answering `ping` with `{}` for backward compatibility; that
340
- turned out to be actively harmful — a client probing for a modern server
341
- distinguishes it from a legacy HTTP+SSE server precisely by the 404 + `-32601`
342
- response, so answering `{}` defeated the probe. Both methods still work on the
343
- stateful path, whose peers negotiate `2025-06-18`.
344
-
345
- The 404 applies to **any** unimplemented stateless RPC, not just these two —
346
- including `subscriptions/listen` until Track G lands. Special-casing the two
347
- removed methods would have left every other unknown method answering 200.
348
-
349
- ### Fixed — four rounds of adversarial review
350
-
351
- Four review rounds found 11, then 8, then 5, then 2 blocking defects. The trend
352
- matters: after round 1, most findings were regressions in the _repair paths_,
353
- not in the original work — so each round was pointed at the previous round's
354
- fixes first.
355
-
356
- The ones worth knowing about as a consumer:
357
-
358
- - **A serialisation-boundary bypass.** The MRTR sub-capability gate inspected
359
- live JS values while the response serialised the original object later — two
360
- different checks over one payload. `mode: new String("url")` is not
361
- `=== "url"` but serialises to `"url"`; a `toJSON()` can introduce `tools` only
362
- at serialisation time. The gate canonicalises the whole `inputRequests` map
363
- once and the transport emits **that clone**, so the value checked and the
364
- value sent are the same object. An earlier attempt canonicalised only for the
365
- check and let the transport serialise the original again — which a stateful
366
- `toJSON()` walks straight through.
367
- - **`requiredCapabilities` was flat** (`{"elicitation.url": {}}`), which a typed
368
- client deserialises as `{}` — reading as "nothing missing", the opposite of
369
- the message. Now nested per `ClientCapabilities`.
370
- - **A rejected HMAC key import was cached forever**, so every later MRTR retry
371
- surfaced as `-32700 Parse error` and no second import was attempted.
372
- - **Task authorization.** Tasks are bound to an owner key;
373
- `McpAppOptions.taskOwnerKey` is the hook for deployments authorizing on more
374
- than identity. It must derive everything from its arguments — `tasks/*` does
375
- not run the middleware pipeline, so pipeline-injected state such as a tenant
376
- id is not visible there. An empty or non-string key is refused rather than
377
- collapsing every caller onto one owner.
378
- - **Shutdown behaviour.** No task is accepted once `stop()` begins, and a
379
- restarted server accepts them again. Tasks are reachable only over the
380
- stateless HTTP transport — stdio has no per-request capability negotiation —
381
- but its `start()` shares the same reset, so a stopped stdio server no longer
382
- keeps a disposed store.
383
-
384
- ### Fixed — conformance and security, from adversarial review
385
-
386
- A final review round found eleven blocking defects in the newly wired tracks.
387
- All are fixed; each is listed because several were only visible on the wire, not
388
- in the modules.
389
-
390
- **Security**
391
-
392
- - **`inputResponses` without a `requestState` bypassed verification entirely.**
393
- The two fields were read independently, so a caller could supply answers with
394
- no token and the handler received them unverified. Refused now, before
395
- dispatch.
396
- - **Tasks had no owner.** Any authenticated caller who learned another caller's
397
- task id could read, answer or cancel it. The spec makes this a MUST: "Servers
398
- MUST perform authentication and authorization checks on each task-related
399
- request." Tasks are bound to their creating principal, and a foreign id is
400
- reported exactly like an unknown one — telling a caller that a task exists but
401
- is not theirs would confirm the id an unguessable handle is meant to withhold.
402
- - **An authenticated token with no `sub` collapsed every caller onto one
403
- identity.** `AuthInfo.subject` falls back to `"unknown"`, and sealing against
404
- that made the principal binding look enforced while separating nothing. Now
405
- throws: worse than no auth, because it is invisible.
406
- - **Unknown MRTR methods could be "satisfied".** An unrecognised
407
- `inputRequests[*].method` was mapped to its own name, so a client declaring a
408
- capability of that name passed the check. MRTR permits exactly elicitation,
409
- sampling and roots; anything else now fails unconditionally.
410
-
411
- **Conformance**
412
-
413
- - `tasks/update` and `tasks/cancel` return **empty acknowledgements**. Returning
414
- task state was non-conformant and, since the spec calls these acks eventually
415
- consistent, potentially stale.
416
- - A completed task now carries the **result shape the original request would
417
- have returned** (a `CallToolResult`), not the handler's raw return value. The
418
- store stays MCP-agnostic: the transport injects the same conversion the
419
- synchronous path uses, so both produce identical output for the same handler.
420
- - Tasks and `subscriptions/listen` are **gated on the negotiated version**, not
421
- just the capability. A `2025-11-25` peer could previously use a 2026-only
422
- extension, which the spec forbids outright.
423
- - `requiredCapabilities` is a **`ClientCapabilities` object**, not an array of
424
- names, on both the Tasks and MRTR errors — and the MRTR one now carries `data`
425
- at all.
426
- - An absent or non-object `notifications` filter on `subscriptions/listen` is
427
- **rejected** rather than read as `{}`, which had produced a 200 stream that
428
- stayed silent forever with no way to tell why.
429
- - An unknown `taskId` is an error on all three task methods, not a successful
430
- no-op.
431
-
432
- **Robustness**
433
-
434
- - The MRTR argument digest is **snapshotted at ingress**. It was re-derived at
435
- seal time from the same mutable `args` the middleware pipeline had already
436
- touched, so a client replaying its request byte-for-byte could fail
437
- `wrong_params` through no fault of its own.
438
- - The task sweep timer is **unref'd**, and `stop()` disposes the task store and
439
- subscription registry **before** its `started` guard — a server that failed
440
- during startup previously left both armed with no way to reach them.
441
- Notifications are suppressed after disposal, since a drained task's work can
442
- still settle afterwards (abort is cooperative).
443
-
444
- ### Added — Tracks G, B and I: subscriptions, MRTR and Tasks
445
-
446
- All three are now reachable from the transport, not just present as modules.
447
-
448
- - **`subscriptions/listen`** replaces the removed GET stream and
449
- `resources/subscribe`. The response is the SSE stream; the acknowledgement is
450
- guaranteed first; `X-Accel-Buffering: no` keeps proxies from buffering events.
451
- `sendNotification()` now fans out through the registry on the stateless
452
- transport — previously it walked the session-keyed SSE map, which is always
453
- empty there, so notifications vanished with no error.
454
- - **MRTR** (`resultType: "input_required"`): a handler asks the client for
455
- input, and the framework seals the `requestState` binding principal, method,
456
- argument digest and expiry. A tampered, expired or cross-request token is
457
- rejected before the handler runs. Confined to a negotiated `2026-07-28`.
458
- - **Tasks extension**, switched on by declaring
459
- `extensions["io.modelcontextprotocol/tasks"]`. `createTask()` in a handler
460
- returns a task handle; `tasks/get`, `tasks/update` and `tasks/cancel` are each
461
- capability-guarded.
462
-
463
- New options: `McpAppOptions.mrtr` and the `extensions` declaration for Tasks.
464
- `ToolHandlerContext` gains `inputResponses` and `retryVerified`.
465
-
466
- Not covered: MRTR on `resources/read` (needs a breaking `ResourceHandler` return
467
- type) and `prompts/get` (needs a prompts API), and single-use `requestState` —
468
- the spec states plainly that its measures do not guarantee at-most-once.
469
-
470
- ### Changed — errors carry structured recovery data
471
-
472
- Every `-32020` (HeaderMismatch) now ships a JSON-RPC `data` payload instead of
473
- leaving the caller to parse an English sentence:
474
-
475
- ```json
476
- {
477
- "code": -32020,
478
- "message": "Mcp-Name header \"wrong_tool\" does not match body value \"echo\"",
479
- "data": {
480
- "problem": "header_body_mismatch",
481
- "header": "Mcp-Name",
482
- "expected": "echo",
483
- "received": "wrong_tool",
484
- "bodyField": "params.name",
485
- "recovery": "Set the header to mirror the body: 'Mcp-Name: echo'."
486
- }
487
- }
488
- ```
489
-
490
- `problem` is an enum — `missing_header`, `header_body_mismatch`,
491
- `malformed_encoding`, `unmirrorable_body` — meant to be switched on. `recovery`
492
- is one concrete action. A client that gets a header wrong can correct itself
493
- without natural-language processing, which matters because these are the errors
494
- an automated caller hits most often. Applies to all fourteen rejection paths in
495
- the validator plus the two the transport builds directly.
496
-
497
- ### Changed — fail at the boundary, and one verb per job
498
-
499
- - `mrtr.signingKey` is validated in the constructor. A typo in a 64-hex secret
500
- used to surface on the first request that needed it — a production runtime
501
- failure rather than a boot failure.
502
- - `sendToSession` and `broadcastNotification` are `@deprecated`. Three public
503
- verbs meant "notify", and two of them silently reach nobody on the stateless
504
- transport. `sendNotification` is the one that works everywhere; the others die
505
- with the stateful path.
506
-
507
- ### Fixed
508
-
509
- - `createTask` and the MRTR / subscription types were absent from the package
510
- barrel, so the Tasks extension was fully wired, fully tested and **unusable by
511
- any consumer**. Added, along with `packages/server/api-surface_test.ts`, which
512
- imports through `mod.ts` the way a consumer does — internal tests reach into
513
- `src/` and prove nothing about reachability.
514
- - `enableSampling` now warns that it has no effect on the stateless transport.
515
- Spec 2026-07-28 removed server-initiated requests, so the bridge has no
516
- channel there; without the warning the failure looks like a request that never
517
- returns.
518
-
519
- ### Changed — BREAKING: auth and session error codes moved out of the reserved range
520
-
521
- - `401` unauthorized `-32001` → **`-31401`**, `403` forbidden `-32002` →
522
- **`-31403`**, stateful session-expired `-32001` → **`-31404`**.
523
-
524
- Not cosmetic. The final spec states that implementations of this revision
525
- **MUST NOT** emit `-32002` (2025-11-25 used it for resource-not-found, now
526
- `-32602`), and that new implementations **SHOULD NOT** use `-32000`..`-32019`
527
- at all — receivers "MUST NOT assume any specific meaning" for that sub-range.
528
- Earlier readings of the allocation policy, including a review of this very
529
- file, treated the low range as a grandfathered sandbox. It is not.
530
-
531
- The spec's guidance for codes it does not define is to allocate outside the
532
- JSON-RPC reserved range entirely, hence `-314xx` — mnemonic for the HTTP
533
- status each accompanies. Anything matching on the old numbers must be updated.
534
-
535
- ### Added — Track C: request-metadata headers and cache fields
536
-
537
- - **Required request headers are now validated** (SEP-2243). Every POST from a
538
- peer negotiating `2026-07-28` must carry `MCP-Protocol-Version` and
539
- `Mcp-Method`, plus `Mcp-Name` on `tools/call`, `prompts/get` and
540
- `resources/read`. A missing or disagreeing header is rejected with HTTP 400
541
- and `-32020`.
542
-
543
- This closes a real hole rather than ticking a box: intermediaries route, meter
544
- and rate-limit on the headers while the server executes the body. Letting the
545
- two disagree is what the spec's mandatory validation exists to prevent.
546
-
547
- `MCP-Protocol-Version` was previously checked "tolerantly" — only when
548
- present. It is now required.
549
-
550
- - **`x-mcp-header` parameter mirroring.** A tool may annotate primitive,
551
- statically-reachable `inputSchema` properties so clients mirror them into
552
- `Mcp-Param-{Name}` headers; the server validates each against the argument at
553
- that exact property path. Annotations are validated **at registration**, not
554
- per call: a conforming client drops the whole tool from `tools/list` over a
555
- malformed annotation, so a typo would otherwise present as a tool that
556
- silently does not exist.
557
-
558
- The `=?base64?…?=` sentinel is decoded before comparison, integers compare
559
- numerically (`42.0` equals `42`), and header names compare case-insensitively
560
- per RFC 9110.
561
-
562
- - **`ttlMs` / `cacheScope` on list and read results** (SEP-2549), required
563
- fields of `CacheableResult`. Configured via `McpAppOptions.cache`, with
564
- deliberately inert defaults — `ttlMs: 0` and `cacheScope: "private"`. A
565
- framework has no business choosing a staleness window for a tool list built
566
- from a live database, nor permitting shared caches to store results that may
567
- be scoped to the authenticated principal.
568
-
569
- - **`tools/list` is ordered deterministically.** Map iteration was already
570
- insertion-ordered, so this only matters where registration order is not stable
571
- — which it is not in relay/proxy mode, where tools are registered as child
572
- servers are discovered asynchronously.
573
-
574
- - Legacy peers and notifications are exempt from the header contract: the
575
- headers do not exist before `2026-07-28`, and the revision leaves requirements
576
- for notification POSTs undefined.
577
-
578
- ### Added
579
-
580
- - **`resultType: "complete"` on every stateless result** (SEP-2322), plus the
581
- server's identity under `_meta["io.modelcontextprotocol/serverInfo"]`
582
- (SEP-2575). A tool's own `_meta` is merged, never replaced — MCP Apps viewers
583
- carry their UI hints there.
584
-
585
- Gated on the **negotiated version**, not on the transport. The distinction
586
- matters: the stateless transport also accepts `2025-06-18` and `2025-11-25`,
587
- so gating on the transport would have stamped a 2026 envelope onto responses
588
- to peers on an earlier revision. Omitting it for them is safe — the spec
589
- instructs clients to read a missing `resultType` as `"complete"`.
590
-
591
- - **`extensions` option** on `McpAppOptions`, surfaced under
592
- `capabilities.extensions` on `server/discover` and `initialize`. Keyed by
593
- reverse-DNS identifier (e.g. `{ "io.modelcontextprotocol/tasks": {} }`) and
594
- emitted **only when non-empty**: an empty `extensions: {}` would assert "this
595
- server supports no extensions", a stronger claim than the framework can make
596
- on a consumer's behalf. Prerequisite for declaring the Tasks extension.
597
-
598
- - **Per-request log level.** `ToolHandlerContext.logLevel` exposes
599
- `params._meta["io.modelcontextprotocol/logLevel"]`, replacing the removed
600
- `logging/setLevel` RPC. `undefined` means the client opted out of logging, and
601
- the spec is explicit that a server **MUST NOT** emit `notifications/message`
602
- in that case. Unrecognized severities are dropped rather than rejected —
603
- failing a whole tool call over a bad hint would be the worse outcome.
604
-
605
- - `packages/server/src/result-envelope_test.ts`: walks the method table instead
606
- of asserting a single endpoint, so a new handler that forgets the envelope
607
- fails here rather than in a consumer.
608
-
609
- ## [0.22.0] - 2026-07-21
610
-
611
- ### Added
612
-
613
- - `createStaticTokenAuthProvider` / `StaticTokenAuthProvider`: a static (opaque)
614
- bearer-token `AuthProvider` for same-network deployments, service-to-service,
615
- and CI — validate a fixed set of pre-shared tokens with no OIDC/JWT
616
- infrastructure (no issuer, no JWKS, no key management). All valid tokens share
617
- one `AuthInfo` (frozen); RFC 9728 metadata is emitted with an empty
618
- `authorization_servers` (tokens are provisioned out of band).
619
- - `docs/guides/securing-your-http-server.md`: task-oriented guide for choosing
620
- between static tokens and OAuth/OIDC, plus `requireAuth` and per-tool scopes.
621
-
622
- ## [0.21.1] - 2026-07-16
623
-
624
- Runtime-portability fix: consumers that bundle the JSR source for Node.js (e.g.
625
- `@casys/mcp-erpnext`'s npm build) no longer crash with
626
- `ReferenceError: Deno is not defined` in HTTP mode.
627
-
628
- Thanks to **Denny Pradipta**
629
- ([@dennypradipta](https://github.com/dennypradipta)) for reporting and
630
- documenting the bug in
631
- [Casys-AI/mcp-erpnext#4](https://github.com/Casys-AI/mcp-erpnext/pull/4).
632
-
633
- ### Fixed
634
-
635
- - **Runtime adapter selected at load time instead of a build-time file swap.**
636
- `src/runtime/runtime.ts` is now a selector that probes the host runtime
637
- (`Deno.version.deno`) and dynamically imports `runtime.deno.ts` or
638
- `runtime.node.ts`. The previous `build-node.sh` swap only applied to our own
639
- npm build — JSR consumers bundling for Node shipped `Deno.readTextFile` /
640
- `Deno.serve` and crashed in `startHttp()`. The inactive adapter is never
641
- evaluated, so Deno Deploy stays clear of `node:http` at load time and Node
642
- stays clear of `Deno.*`.
643
- - **`launchInspector` now works under Node.** The inspector launcher was the
644
- last module calling `Deno.*` directly (`Deno.Command`, `Deno.env.toObject`,
645
- `Deno.exit`, `Deno.build.os`); it now uses `node:child_process` /
646
- `node:process` — supported by both runtimes — imported lazily inside the
647
- function bodies.
648
-
649
- ### Changed
650
-
651
- - `build-node.sh` no longer swaps runtime files; the npm dist ships all three
652
- (`runtime.ts` selector + both adapters), identical to the JSR source.
653
- - The npm publish smoke test now covers `McpApp.startHttp()` + an MCP
654
- `initialize` round-trip under Node, guarding the runtime selector against
655
- regressions.
656
-
657
- ## [0.21.0] - 2026-06-30
658
-
659
- Stateless transport brought in line with the finalized **SEP-2575**, plus
660
- auth/OAuth conformance fixes. All changes are confined to the stateless
661
- transport and the auth/client-auth layers — the default **stateful** transport
662
- is unchanged.
663
-
664
- ### Added
665
-
666
- - **`server/discover` RPC in the stateless transport (SEP-2575).** A stateless
667
- server now answers `server/discover` with its `supportedVersions`,
668
- `capabilities`, `serverInfo`, and (when configured) `instructions`, letting
669
- clients negotiate without an `initialize` handshake. Stateful mode is
670
- unaffected.
671
- - **Per-request `clientInfo` / `clientCapabilities` exposed to tool handlers.**
672
- In stateless mode, tool handlers can read the client's identity and
673
- capabilities from the SEP-2575 namespaced `_meta` keys via
674
- `ToolHandlerContext`. Both fields are optional — a request without them still
675
- succeeds.
676
-
677
- ### Changed
678
-
679
- - **Stateless error codes aligned with the finalized SEP-2575.** A missing
680
- per-request protocol version now returns `-32602` (INVALID_PARAMS) instead of
681
- `-32020`, and an unsupported version returns `-32004`
682
- (UNSUPPORTED_PROTOCOL_VERSION) instead of `-32022`. Stateless transport only.
683
- - **`MCP-Protocol-Version` header validated in stateless mode (tolerant).** When
684
- the header is present it must match the `_meta` protocol version, otherwise
685
- the request is rejected with `400` / `-32602`. The header stays optional for
686
- backward compatibility with existing `_meta`-only clients.
687
- - **403 responses are now distinct from 401.** Insufficient-scope responses use
688
- a dedicated JSON-RPC code (`-32002`, chosen to avoid the SEP-2575 reserved
689
- `-32003`) and emit `WWW-Authenticate: Bearer ..., error="insufficient_scope"`
690
- per RFC 6750/9728, so clients can tell an authorization failure from an
691
- authentication one.
692
- - **The OAuth client now declares the `refresh_token` grant.** `grant_types`
693
- includes `"refresh_token"` (provider metadata and CIMD document), and
694
- `saveTokens` preserves an existing refresh token when a later save omits one.
695
-
696
- ### Notes
697
-
698
- - `initialize` and `ping` are intentionally retained in stateless mode for
699
- backward compatibility, even though SEP-2575 removes them.
700
- - The stateless transport is not yet interoperable with the stock
701
- `@modelcontextprotocol/sdk` 1.29 client (which does not emit the SEP-2575 wire
702
- format); the acceptance suite uses a conformant in-house client and verifies
703
- round-robin across two instances with no sticky session.
704
-
705
- ## [0.20.0] - 2026-06-29
706
-
707
- MCP 2026-07-28 groundwork: an experimental stateless transport (Track A) plus
708
- the Track D and Track E deprecations and additions.
709
-
710
- ### Added
711
-
712
- - **Experimental stateless HTTP transport (`transport: "stateless"`, MCP
713
- 2026-07-28 Track A).** The server can serve requests without a session (no
714
- `Mcp-Session-Id`); the protocol version is carried per-request in
715
- `params._meta` (`io.modelcontextprotocol/protocolVersion`). Opt-in via the new
716
- `transport` option (`"stateful"` default, `"stateless"`), which replaces the
717
- earlier `enableStatelessV2` flag.
718
- - **`application_type: "native"` in DCR client metadata (Track E, MCP
719
- 2026-07-28).** Loopback CLI/desktop clients advertise the native application
720
- type so strict authorization servers don't reject `http://127.0.0.1` redirect
721
- URIs.
722
-
723
- ### Deprecated
724
-
725
- - **Sampling and `logging/setLevel` (Track D, MCP 2026-07-28).** Marked
726
- deprecated ahead of their removal in the stateless model.
727
-
728
- ### Changed
729
-
730
- - Bump `@modelcontextprotocol/ext-apps` to `^1.7.4`.
731
-
732
- ## [0.19.0] - 2026-06-29
733
-
734
- ### Added
735
-
736
- - **Client-side Client ID Metadata Document (CIMD) support is now public and
737
- opt-in.** OAuth clients can configure
738
- `clientRegistration.method = "client_id_metadata"` and use
739
- `buildClientIdMetadataDocument()` to publish a spec-shaped client metadata
740
- document where `client_id` is the metadata URL.
741
- - **The OAuth client-auth surface is now exported from the package root.**
742
- `prepareOAuthProvider`, `OAuthClientProviderImpl`, `CallbackServer`, token
743
- stores, client-auth config types, and CIMD helpers are available from
744
- `@casys/mcp-server` alongside the server auth APIs.
745
-
746
- ### Changed
747
-
748
- - **The OAuth callback server now binds to `127.0.0.1` by default.** This keeps
749
- local authorization-code callbacks on loopback instead of listening on all
750
- interfaces, while preserving explicit hostname configuration for callers that
751
- need it.
752
- - **The public client-auth runtime now uses the shared runtime port.**
753
- `CallbackServer` and `FileTokenStore` no longer depend on Deno-only globals in
754
- the Node/npm build, while static client registrations keep the historical
755
- `http://localhost:<port>/callback` redirect URI.
756
- - **Callback bind failures now reject cleanly across Deno and Node.** The
757
- runtime port exposes an optional bind-error channel, so a fixed CIMD callback
758
- port collision fails `CallbackServer.start()` instead of crashing the Node
759
- process with an unhandled server `error` event.
760
- - **The npm publish path now runs a client-auth smoke test before publish.** The
761
- generated `dist-node` package imports the public API and exercises CIMD
762
- document building, `FileTokenStore`, `CallbackServer`, and occupied-port
763
- rejection.
764
- - **CIMD config validation is stricter before runtime work begins.** Invalid or
765
- incomplete `clientRegistration` objects now fail with structured
766
- `CimdConfigError` codes, and `metadata.extra` rejects all reserved OAuth
767
- client metadata keys instead of silently shadowing derived fields.
768
- - **The MCP 2026-07-28 migration plan now treats CIMD as the modern Track E
769
- registration path.** The AS metadata proxy remains documented as a DCR
770
- compatibility/legacy interop path, and the erroneous note about injecting DCR
771
- `application_type` from the proxy has been removed.
772
-
773
- ## [0.18.0] - 2026-06-03
774
-
775
- ### Removed (breaking)
776
-
777
- - **Dropped the `@casys/mcp-compose` dependency entirely.** `mod.ts` no longer
778
- re-exports the UI composition helpers `composeEvents`, `uiMeta`,
779
- `COMPOSE_EVENT_METHOD` (nor their types `ComposeEventHandler`,
780
- `ComposeEventPayload`, `ComposeEvents`, `ComposeSource`, `ComposeTarget`,
781
- `UiMetaOptions`, `UiMetaResult`, `UiMetaUi`). These were a convenience
782
- pass-through that forced every `@casys/mcp-server` consumer to install
783
- `@casys/mcp-compose`. **Migration:** import them directly from
784
- `@casys/mcp-compose/sdk` instead. With the base `McpUiToolMeta` type now
785
- sourced from `@modelcontextprotocol/ext-apps` (0.17.7), server depends only on
786
- the official protocol packages (`@modelcontextprotocol/sdk` + `ext-apps`) and
787
- is a lean MCP framework again.
788
-
789
- ## [0.17.7] - 2026-06-03
790
-
791
- ### Changed
792
-
793
- - **`McpUiToolMeta` base type now imported from `@modelcontextprotocol/ext-apps`
794
- instead of `@casys/mcp-compose/core`.** The base type was never owned by
795
- compose — `compose/core` merely re-exported it verbatim from the official
796
- ext-apps package. Server already wraps `@modelcontextprotocol/sdk` throughout,
797
- so consuming the MCP Apps contract from its real upstream source (the same
798
- official `@modelcontextprotocol/*` family) removes a needless detour through
799
- compose for a type that lives in the spec. Type-only import — erased at
800
- runtime, no behaviour change. `@modelcontextprotocol/ext-apps` is now a
801
- declared dependency of the npm build. The `@casys/mcp-compose` dependency
802
- stays (still used for the `composeEvents`/`uiMeta` value re-exports in
803
- `mod.ts`).
804
-
805
- ## [0.17.6] - 2026-06-03
806
-
807
- ### Fixed
808
-
809
- - **npm package now declares its `@casys/mcp-compose` dependency.** `mod.ts`
810
- re-exports `@casys/mcp-compose/sdk` and `src/types.ts` imports
811
- `@casys/mcp-compose/core`, but the generated npm `package.json` never listed
812
- the dependency — it only resolved through the Deno workspace. As a result
813
- `npm install @casys/mcp-server` left the bare `@casys/mcp-compose/*` imports
814
- unresolvable (`Cannot find module`). `build-node.sh` now reads the compose
815
- version from `../compose/deno.json` and adds `@casys/mcp-compose` to the
816
- generated dependencies, and `deno.json` declares the import explicitly
817
- (`jsr:@casys/mcp-compose@^0.5.2`) so JSR records the same coupling. The build
818
- script's in-place `sed` calls were also made portable (GNU + BSD/macOS).
819
-
820
- ## [0.17.5] - 2026-04-16
821
-
822
- ### Fixed
823
-
824
- - **JWT rejection now logs the reason instead of swallowing it.** The bare
825
- `catch {}` in `verifyToken` (jwt-provider.ts) returned `null` for _all_
826
- errors, so JWKS fetch failures, audience mismatches, signature errors, and
827
- token expiration were indistinguishable in production logs. Operators looking
828
- at a 401 had no signal to differentiate "wrong audience" from "JWKS
829
- unreachable" from "token genuinely invalid". The actual error message is now
830
- written to `console.error` before mapping back to the `401` response,
831
- preserving the existing external behaviour while making the failure mode
832
- diagnosable.
833
-
834
- ## [0.17.4] - 2026-04-16
835
-
836
- ### Fixed
837
-
838
- - **Eliminated redundant `verifyToken` call on `tools/call`.** The HTTP-level
839
- auth gate (`verifyHttpAuth`) and the middleware pipeline
840
- (`createAuthMiddleware`) both called `provider.verifyToken()`, causing two
841
- independent JWKS lookups per tool call. On cold cache (after server restart),
842
- concurrent requests could race against the JWKS fetch — one call succeeds
843
- while the other gets a transient failure swallowed by `catch {} → null → 401`.
844
- Fix: `verifyHttpAuth` now returns the verified `AuthInfo`, which is passed to
845
- the middleware context. `createAuthMiddleware` skips re-verification when
846
- `ctx.authInfo` is already set.
847
-
848
- ## [0.17.3] - 2026-04-16
849
-
850
- ### Fixed
851
-
852
- - **`resolveViewerDistPath` now handles HTTPS module URLs (JSR / remote
853
- modules).** When a package is consumed from JSR, `import.meta.url` is an
854
- `https://jsr.io/...` URL, not a `file://` URL. The previous code passed it to
855
- `fileUrlToPath()`, which only handles `file://` URLs, producing a broken
856
- UNC-like path (`//jsr.io/...`) and making every candidate `exists` check fail.
857
- The fix adds an early HTTPS branch that returns the raw resolved URL string
858
- (via `new URL(...).href`) instead of calling `fileUrlToPath`. The `exists` and
859
- `readFile` callbacks receive the HTTPS URL string and are responsible for
860
- handling it (e.g., via `fetch()`). The existing `file://` path is unchanged.
861
-
862
- ## [0.17.2] - 2026-04-16
863
-
864
- ### Fixed
865
-
866
- - **Auth gate now covers `initialize` method** when `requireAuth: true`.
867
- Previously, `initialize` was excluded from auth checking, which prevented MCP
868
- clients (Claude.ai, Cursor) from discovering the OAuth flow — they received a
869
- 200 response instead of the 401 needed to trigger WWW-Authenticate → PRM → AS
870
- metadata → DCR discovery.
14
+ - Both JSR and npm publications now depend on `@casys/mcp-platform@^0.28.0`, with the npm build
15
+ deriving that range from the Deno package manifest so the two registries cannot drift apart. The
16
+ package remains a pure re-export, and compatible Platform patches are adopted without another
17
+ alias release.
18
+ - The npm publication smoke now type-checks a strict NodeNext consumer through the deprecated
19
+ package name as well as importing it at runtime, against both the newest compatible Platform and
20
+ the declared `0.28.0` lower bound. This protects value and type re-exports without silently
21
+ raising the alias floor.
871
22
 
872
- - **Protocol version bumped to `2025-06-18`** (was `2025-03-26`). The 2025-06-18
873
- spec introduced mandatory auth support; clients seeing the old version skip
874
- the auth flow entirely.
875
-
876
- ## [0.17.1] - 2026-04-16
877
-
878
- ### Added
879
-
880
- - **`createAsMetadataHandler`** — framework-agnostic Web Standard handler that
881
- serves an RFC 8414 Authorization Server Metadata document enriched with
882
- `registration_endpoint` (RFC 7591). Enables MCP servers behind IdPs without
883
- native Dynamic Client Registration (e.g., Zitadel, unconfigured Keycloak, Okta
884
- free tier) to advertise a DCR proxy so clients like Claude.ai can
885
- auto-register. See `AsMetadataProxyOptions` for configuration.
886
- - Two input forms: `upstreamMetadataUrl` (any AS) or `upstreamIssuer` (OIDC
887
- shorthand) — mutually exclusive, validated at construction time
888
- - Built-in stale-while-revalidate caching (default 24h TTL) with
889
- thundering-herd guard on background refreshes
890
- - Upstream response shape validation (requires JSON object with `issuer`)
891
- - Injectable `fetch` for testing and advanced use cases (mTLS, retries)
892
- - Fail-fast validation at construction: URLs, mutual exclusivity, `cacheTtlMs`
893
- - 405 Method Not Allowed on non-GET/HEAD requests
894
- - `extraFields` for overriding upstream metadata — `registration_endpoint` is
895
- always preserved regardless of `extraFields` content
896
-
897
- ## [0.17.0] - 2026-04-11
898
-
899
- This release bundles the four deferred items from the 0.16.0 type-design review
900
- (issues [#11](https://github.com/Casys-AI/mcp-server/issues/11),
901
- [#12](https://github.com/Casys-AI/mcp-server/issues/12),
902
- [#13](https://github.com/Casys-AI/mcp-server/issues/13),
903
- [#14](https://github.com/Casys-AI/mcp-server/issues/14)) into one breaking minor
904
- bump. Three of four are BREAKING; one is additive. All four live in `src/auth/`,
905
- so a single migration pass covers the whole auth module. Preset users (the 90%
906
- case) need **zero changes**; only direct `new JwtAuthProvider(...)` callers,
907
- custom `AuthProvider` subclasses, and app-code constructing `AuthConfig` /
908
- `AuthOptions` literals need updates.
909
-
910
- ### BREAKING
911
-
912
- **(1) [#12](https://github.com/Casys-AI/mcp-server/issues/12) —
913
- `JwtAuthProviderOptions` now requires a `kind: "url" | "opaque"` discriminant
914
- tag.**
915
-
916
- The 0.16.0 DU lacked a discriminant, which made:
917
-
918
- - TypeScript narrowing unsound (finding C1 from the 0.16.0 review). After
919
- `if (options.resourceMetadataUrl !== undefined)`, TS could not narrow
920
- `options.resource` from `HttpsUrl | string` to `HttpsUrl` because the union
921
- collapsed to `string`. The constructor comment documented this honestly as
922
- "defense-in-depth via re-validation" but the type system wasn't doing the work
923
- it claimed.
924
- - Branches not strictly disjoint (finding C2). A caller annotating their
925
- constant as `JwtAuthProviderOptionsOpaqueResource` with an `HttpsUrl`-branded
926
- `resource` type-checked anyway because `HttpsUrl
927
- extends string`.
928
- Semantically misleading, no runtime bug.
929
-
930
- 0.17.0 adds an explicit `kind` tag to both branches:
931
-
932
- ```typescript
933
- // Before (0.16.x)
934
- new JwtAuthProvider({
935
- issuer: "https://idp.example.com",
936
- audience: "https://api.example.com",
937
- resource: httpsUrl("https://api.example.com"),
938
- authorizationServers: [httpsUrl("https://idp.example.com")],
939
- });
940
-
941
- // After (0.17.0)
942
- new JwtAuthProvider({
943
- kind: "url", // ← NEW: required
944
- issuer: "https://idp.example.com",
945
- audience: "https://api.example.com",
946
- resource: httpsUrl("https://api.example.com"),
947
- authorizationServers: [httpsUrl("https://idp.example.com")],
948
- });
949
- ```
950
-
951
- The constructor now narrows soundly on `options.kind === "opaque"`: after the
952
- check, TS knows `resource` is `string` with required `resourceMetadataUrl`; in
953
- the else branch, TS knows `resource` is `HttpsUrl`. No more honest-but-unsound
954
- comments.
955
-
956
- **(2) [#11](https://github.com/Casys-AI/mcp-server/issues/11) — `AuthConfig` is
957
- now a discriminated union on `provider` tag.**
958
-
959
- The flat 0.16.x interface used optional `domain?` / `issuer?` fields guarded by
960
- runtime checks in `loadAuthConfig()`. A TS caller could construct an invalid
961
- `AuthConfig` literal (e.g., `provider: "auth0"` without `domain`) and the
962
- compiler wouldn't complain — the failure only surfaced at boot.
963
-
964
- 0.17.0 lifts the invariant to the type level via 4 exported variants:
965
-
966
- ```typescript
967
- export interface GitHubAuthConfig extends AuthConfigBase {
968
- provider: "github";
969
- }
970
- export interface GoogleAuthConfig extends AuthConfigBase {
971
- provider: "google";
972
- }
973
- export interface Auth0AuthConfig extends AuthConfigBase {
974
- provider: "auth0";
975
- domain: string; // required
976
- }
977
- export interface OIDCAuthConfig extends AuthConfigBase {
978
- provider: "oidc";
979
- issuer: string; // required
980
- jwksUri?: string;
981
- }
982
- export type AuthConfig =
983
- | GitHubAuthConfig
984
- | GoogleAuthConfig
985
- | Auth0AuthConfig
986
- | OIDCAuthConfig;
987
- ```
988
-
989
- `createAuthProviderFromConfig()` no longer needs non-null assertions
990
- (`config.domain!`) — TypeScript narrowing on `config.provider` types the
991
- required fields correctly in each branch.
992
-
993
- `loadAuthConfig()` still runtime-validates YAML/env input (untyped at the
994
- file-system boundary) and throws with the same error messages as 0.16.x — the
995
- failure mode is unchanged for config-file users. The DU benefits TS callers who
996
- construct `AuthConfig` literals directly in application code (typically test
997
- fixtures or programmatic wiring).
998
-
999
- Migration: literals that already pass `domain` / `issuer` where needed satisfy
1000
- the DU unchanged. The break bites only when the literal was missing a required
1001
- field and relying on runtime validation (a latent bug).
1002
-
1003
- **(3) [#13](https://github.com/Casys-AI/mcp-server/issues/13) — `AuthOptions`
1004
- slimmed; dead `resource` / `authorizationServers` / `scopesSupported` fields
1005
- removed.**
1006
-
1007
- The pre-0.17 `AuthOptions` exposed `authorizationServers: string[]`,
1008
- `resource: string`, and `scopesSupported?: string[]` alongside
1009
- `provider: AuthProvider`. **Only `provider` was ever read by `McpApp` at
1010
- runtime** (at `mcp-app.ts:1061`, where
1011
- `this.authProvider =
1012
- this.options.auth.provider`). The three other fields were
1013
- vestigial from a pre-0.15 design where `McpApp` could auto-construct a
1014
- `JwtAuthProvider` from its own `auth:` option — that auto-construction path was
1015
- removed when `createAuthProviderFromConfig` took over YAML/env provider
1016
- construction, but the dead fields stayed in the interface.
1017
-
1018
- ```typescript
1019
- // Before (0.16.x) — the 3 extra fields were SILENTLY IGNORED
1020
- new McpApp({
1021
- name: "my-server",
1022
- version: "1.0.0",
1023
- auth: {
1024
- provider: myProvider,
1025
- authorizationServers: ["https://idp.example.com"], // silently ignored
1026
- resource: "https://my-mcp.example.com", // silently ignored
1027
- },
1028
- });
1029
-
1030
- // After (0.17.0)
1031
- new McpApp({
1032
- name: "my-server",
1033
- version: "1.0.0",
1034
- auth: {
1035
- provider: myProvider,
1036
- },
1037
- });
1038
- ```
1039
-
1040
- Callers who passed the vestigial fields now get a TS error
1041
- (`Object literal may only specify known properties`). The fix is to remove them
1042
- — they had no effect before, they have no effect now, the type system is just
1043
- honest about it.
1044
-
1045
- ### Added
1046
-
1047
- **(4) [#14](https://github.com/Casys-AI/mcp-server/issues/14) —
1048
- `buildJwtAuthProvider` exported as public API** _(non-breaking addition)_.
1049
-
1050
- The bridge helper previously named `buildJwtProvider` (private in `presets.ts`)
1051
- is now exported from `mod.ts` as `buildJwtAuthProvider`, alongside its
1052
- `BuildJwtAuthProviderOptions` interface. 3rd-party OIDC provider implementations
1053
- (Keycloak, Zitadel custom, Okta, …) can now build factory functions that
1054
- delegate URL-vs-opaque detection, `HttpsUrl` validation, and `kind`-tag
1055
- selection to the shared bridge instead of reimplementing it:
1056
-
1057
- ```typescript
1058
- import { buildJwtAuthProvider, type JwtAuthProvider } from "@casys/mcp-server";
1059
-
1060
- export function createKeycloakAuthProvider(
1061
- options: KeycloakPresetOptions,
1062
- ): JwtAuthProvider {
1063
- const issuer = `https://${options.keycloakHost}/realms/${options.realm}`;
1064
- return buildJwtAuthProvider(
1065
- {
1066
- issuer,
1067
- audience: options.audience,
1068
- authorizationServers: [issuer],
1069
- jwksUri: `${issuer}/protocol/openid-connect/certs`,
1070
- resource: options.resource,
1071
- resourceMetadataUrl: options.resourceMetadataUrl,
1072
- },
1073
- "createKeycloakAuthProvider",
1074
- );
1075
- }
1076
- ```
1077
-
1078
- The `label` second argument is optional (defaults to `"buildJwtAuthProvider"`)
1079
- and threads through to error messages for preset-level diagnostics.
1080
-
1081
- ### Changed
1082
-
1083
- - **`JwtAuthProvider` constructor narrows on the `kind` tag.** The 0.16.0
1084
- comment documenting the narrowing's unsoundness is replaced with an honest
1085
- comment explaining the now-sound behavior. The RFC 9728 § 3.1 derivation logic
1086
- is unchanged.
1087
-
1088
- - **`loadAuthConfig()` constructs DU variants explicitly.** Instead of building
1089
- a flat object with `domain?` / `issuer?` fields, it switches on the provider
1090
- and returns the correctly-shaped variant. Runtime checks for `domain` /
1091
- `issuer` stay — the YAML/env boundary is untyped.
1092
-
1093
- - **`createAuthProviderFromConfig()` drops non-null assertions.** The DU
1094
- narrowing on `config.provider` makes `config.domain` / `config.issuer` typed
1095
- as required in their respective branches.
1096
-
1097
- - **Preset bridge sets the `kind` tag explicitly.** `buildJwtAuthProvider` (née
1098
- `buildJwtProvider`) passes `kind: "url"` or `kind: "opaque"` to the
1099
- `JwtAuthProvider` constructor based on the detected case. Preset callers never
1100
- see the tag — it's encapsulated in the bridge.
1101
-
1102
- ### Removed
1103
-
1104
- - **`AuthOptions.resource`, `AuthOptions.authorizationServers`,
1105
- `AuthOptions.scopesSupported`.** Vestigial from pre-0.15 auto-construction
1106
- path — never read by `McpApp`. See BREAKING (3) above for migration.
1107
-
1108
- - **Non-null assertions in `createAuthProviderFromConfig`.** Were
1109
- `config.domain!` / `config.issuer!`, now typed as required by the DU.
1110
-
1111
- ## [0.16.1] - 2026-04-11
1112
-
1113
- ### Added
1114
-
1115
- - **`McpApp.name` public readonly field.** The server name (identifier reported
1116
- to MCP clients in `InitializeResult.serverInfo.name`) is now exposed as
1117
- `app.name` on every `McpApp` instance. Previously it was only stored in
1118
- `this.options.name` (private), forcing consumers to either reach into the
1119
- private field, keep a separate reference, or re-construct the value from their
1120
- own config. The compose integration test stubs
1121
- (`packages/compose/stubs/shared.ts`) had been doing `server.name` in a log
1122
- prefix since inception — a latent type error that was never caught because
1123
- `deno task check` on `packages/compose` only type-checked `mod.ts`, not the
1124
- stubs. 0.16.1 fixes the underlying type gap by making the field a first-class
1125
- part of the public API.
1126
-
1127
- This completes the `ConcurrentMCPServer` → `McpApp` hard rename started in
1128
- `b155f7c` (source class) and `def49b2` (tests + stubs) — the final piece was
1129
- exposing what the old consumers implicitly expected.
1130
-
1131
- ### Changed
1132
-
1133
- - **`packages/compose` `check` task now type-checks the stubs.** Previously
1134
- `"check": "deno check mod.ts"` covered only the public API surface. The new
1135
- task also type-checks `stubs/stub-*/server.ts` and `stubs/shared.ts` so drift
1136
- like the pre-0.16.1 `server.name` silent bug is caught in CI before shipping.
1137
-
1138
- ## [0.16.0] - 2026-04-11
1139
-
1140
- ### Fixed
1141
-
1142
- - **RFC 9728 § 3.1 compliance: metadata URL derivation for non-root paths.**
1143
- When a caller's `resource` had a path or query component (e.g.,
1144
- `"https://api.example.com/v1/mcp"`), the naive 0.15.x derivation appended
1145
- `/.well-known/oauth-protected-resource` AFTER the full path, producing
1146
- `"https://api.example.com/v1/mcp/.well-known/oauth-protected-resource"` — a
1147
- 404 for any client following RFC 9728 discovery. The correct output inserts
1148
- the well-known suffix BETWEEN the host and the path:
1149
- `"https://api.example.com/.well-known/oauth-protected-resource/v1/mcp"`. The
1150
- bug survived 0.15.x because all existing tests exercised root-path resources
1151
- (where both approaches produce identical output); it was caught during the
1152
- 0.16.0 code review. Query strings and deeply nested paths are now covered by 5
1153
- new regression tests in `auth_test.ts`. Fragments are dropped per RFC 3986 §
1154
- 3.5.
1155
-
1156
- ### Added
1157
-
1158
- - **`HttpsUrl` branded type.** New nominal type in `src/auth/types.ts`
1159
- representing a string validated as an absolute HTTP(S) URL. Constructed
1160
- exclusively via the new `httpsUrl(raw)` factory, which:
1161
- 1. Trims leading/trailing whitespace
1162
- 2. Parses via `new URL()` (lowercases the scheme — accepts `HTTPS://...`)
1163
- 3. Rejects non-HTTP(S) schemes (`javascript:`, `ftp:`, relative paths, …)
1164
- 4. Throws on empty / whitespace-only input
1165
- 5. Returns the normalized URL string with the brand applied
1166
-
1167
- Also exports `tryHttpsUrl(raw): HttpsUrl | null` — the non-throwing variant
1168
- used by the preset bridge layer to distinguish URL resources from opaque URIs
1169
- without exception handling.
1170
-
1171
- - **`JwtAuthProviderOptions` discriminated union.** Replaces the flat interface
1172
- with two branches enforcing metadata-URL presence at compile time:
1173
- - `JwtAuthProviderOptionsUrlResource`: `resource: HttpsUrl`,
1174
- `resourceMetadataUrl?: HttpsUrl` (optional, auto-derived).
1175
- - `JwtAuthProviderOptionsOpaqueResource`: `resource: string` (opaque),
1176
- `resourceMetadataUrl: HttpsUrl` (REQUIRED).
1177
-
1178
- TypeScript narrows based on which branch accepts the call-site fields. A
1179
- caller that passes a raw string for `resource` without `resourceMetadataUrl`
1180
- gets a compile error telling them to either wrap via `httpsUrl()` or supply
1181
- the metadata URL explicitly.
1182
-
1183
- - **`OIDCPresetOptions` type.** Preset-style interface for
1184
- `createOIDCAuthProvider` that accepts raw `string` fields (like the other
1185
- three presets). The bridge helper inside `presets.ts` wraps them through
1186
- `httpsUrl()` before reaching the `JwtAuthProvider` constructor.
1187
-
1188
- - **`httpsUrl()` / `tryHttpsUrl()` test coverage.** 14 new unit tests in
1189
- `src/auth/auth_test.ts` covering the factory's validation matrix (valid HTTPS,
1190
- valid HTTP, uppercase scheme normalization, whitespace trimming, empty /
1191
- whitespace-only rejection, non-URL rejection, relative-path rejection,
1192
- `javascript:` / `ftp:` scheme rejection, error message formatting,
1193
- `tryHttpsUrl` success / opaque / empty handling).
1194
-
1195
- ### Changed
1196
-
1197
- - **`ProtectedResourceMetadata.resource_metadata_url`** now typed as `HttpsUrl`
1198
- (was `string`). The invariant is structurally enforced — producers construct
1199
- the value via `httpsUrl()` instead of relying on a runtime validator in
1200
- `JwtAuthProvider`'s constructor.
1201
-
1202
- - **`ProtectedResourceMetadata.authorization_servers`** now typed as
1203
- `HttpsUrl[]` (was `string[]`). Downstream consumers can rely on each entry
1204
- being parseable without re-validation.
1205
-
1206
- - **`AuthProvider` subclasses** must now return `HttpsUrl`-branded values from
1207
- `getResourceMetadata()`. Construct via `httpsUrl()` or import the brand type
1208
- from `@casys/mcp-server`.
1209
-
1210
- - **`JwtAuthProvider` constructor simplified.** All URL validation has been
1211
- lifted to the `httpsUrl()` factory call sites. The constructor no longer
1212
- performs runtime URL parsing, whitespace trimming, or scheme checking — the
1213
- type system guarantees that any field requiring those properties is already
1214
- validated. The 0.15.1 `validateAbsoluteHttpUrl` helper has been removed (dead
1215
- code).
1216
-
1217
- - **Preset factories bridge raw strings → branded DU.** Each preset
1218
- (`createGitHubAuthProvider`, `createGoogleAuthProvider`,
1219
- `createAuth0AuthProvider`, `createOIDCAuthProvider`) centralizes
1220
- raw-to-branded translation through a private `buildJwtProvider` helper that
1221
- handles the URL-vs-opaque resource detection, auth server validation, and
1222
- empty-metadata-URL fall-through in one place.
1223
-
1224
- - **`authorization_servers` values are now normalized.** `httpsUrl()` delegates
1225
- parsing to `new URL().toString()`, which appends a trailing slash to host-only
1226
- URLs (`"https://foo.com"` → `"https://foo.com/"`). Tests comparing these
1227
- values as raw strings must adjust their expectations.
1228
-
1229
- ### Removed
1230
-
1231
- - **`JwtAuthProvider`'s private `validateAbsoluteHttpUrl` helper.** The logic
1232
- has been moved to the public `httpsUrl()` factory in `types.ts`, where it
1233
- belongs on the brand constructor instead of a runtime guard.
1234
-
1235
- - **0.15.1 runtime validation tests for constructor-level URL checks.** These
1236
- tests (empty-string `resourceMetadataUrl`, whitespace-only, invalid URL,
1237
- non-HTTP(S) scheme, trailing whitespace in `resource`, uppercase scheme) have
1238
- been re-homed:
1239
- - Factory-level validation → `httpsUrl()` tests in `auth_test.ts`
1240
- - Fall-through behavior (YAML empty key) → preset bridge tests in
1241
- `auth_test.ts`
1242
-
1243
- ### BREAKING
1244
-
1245
- This is a **minor version bump with breaking changes** — semver-permitted before
1246
- 1.0, but migration is required.
1247
-
1248
- 1. **Direct `new JwtAuthProvider(...)` callers must wrap URL fields.** Every
1249
- `resource`, `authorizationServers[i]`, and `resourceMetadataUrl` that was a
1250
- raw string in 0.15.x must now be wrapped in `httpsUrl()`:
1251
-
1252
- ```typescript
1253
- // Before (0.15.x)
1254
- new JwtAuthProvider({
1255
- issuer: "https://idp.example.com",
1256
- audience: "https://api.example.com",
1257
- resource: "https://api.example.com",
1258
- authorizationServers: ["https://idp.example.com"],
1259
- });
1260
-
1261
- // After (0.16.0)
1262
- import { httpsUrl, JwtAuthProvider } from "@casys/mcp-server";
1263
- new JwtAuthProvider({
1264
- issuer: "https://idp.example.com",
1265
- audience: "https://api.example.com",
1266
- resource: httpsUrl("https://api.example.com"),
1267
- authorizationServers: [httpsUrl("https://idp.example.com")],
1268
- });
1269
- ```
1270
-
1271
- 2. **`createOIDCAuthProvider` signature changed.** Previously accepted
1272
- `JwtAuthProviderOptions` directly; now accepts the new `OIDCPresetOptions`
1273
- with raw `string` fields. Migration: drop any `httpsUrl()` wrappers — the
1274
- preset handles it internally.
1275
-
1276
- ```typescript
1277
- // Before (0.15.x) — JwtAuthProviderOptions direct
1278
- createOIDCAuthProvider({
1279
- issuer: "https://idp.example.com",
1280
- audience: "https://api.example.com",
1281
- resource: "https://api.example.com",
1282
- authorizationServers: ["https://idp.example.com"],
1283
- });
1284
-
1285
- // After (0.16.0) — same call-site, still works with raw strings
1286
- createOIDCAuthProvider({
1287
- issuer: "https://idp.example.com",
1288
- audience: "https://api.example.com",
1289
- resource: "https://api.example.com",
1290
- // authorizationServers optional, defaults to [issuer]
1291
- });
1292
- ```
1293
-
1294
- 3. **Custom `AuthProvider` subclasses must return `HttpsUrl`-branded values**
1295
- from `getResourceMetadata()`. Previously `string` / `string[]`:
1296
-
1297
- ```typescript
1298
- // Before (0.15.x)
1299
- getResourceMetadata(): ProtectedResourceMetadata {
1300
- return {
1301
- resource: "https://foo.com",
1302
- resource_metadata_url: "https://foo.com/.well-known/oauth-protected-resource",
1303
- authorization_servers: ["https://idp.example.com"],
1304
- bearer_methods_supported: ["header"],
1305
- };
1306
- }
1307
-
1308
- // After (0.16.0)
1309
- getResourceMetadata(): ProtectedResourceMetadata {
1310
- return {
1311
- resource: "https://foo.com", // stays string — RFC 9728 § 2 allows opaque
1312
- resource_metadata_url: httpsUrl(
1313
- "https://foo.com/.well-known/oauth-protected-resource",
1314
- ),
1315
- authorization_servers: [httpsUrl("https://idp.example.com")],
1316
- bearer_methods_supported: ["header"],
1317
- };
1318
- }
1319
- ```
1320
-
1321
- 4. **`ProtectedResourceMetadata.authorization_servers` values now include
1322
- trailing slashes** for host-only URLs due to `new URL().toString()`
1323
- normalization. Downstream code comparing these values as raw strings must
1324
- adjust: `"https://foo.com"` becomes `"https://foo.com/"`. The JSON payload
1325
- served at `/.well-known/oauth-protected-resource` contains the normalized
1326
- form — OIDC clients that trim trailing slashes are unaffected, but strict
1327
- string matchers should update.
1328
-
1329
- ### Migration path
1330
-
1331
- Most callers go through `createAuthProviderFromConfig()` or one of the presets
1332
- (`createGitHubAuthProvider`, `createGoogleAuthProvider`,
1333
- `createAuth0AuthProvider`, `createOIDCAuthProvider`) and will not need any
1334
- changes — the preset bridge layer accepts raw strings and wraps them internally.
1335
- Only direct `new JwtAuthProvider(...)` callers and custom `AuthProvider`
1336
- subclasses need the updates above.
1337
-
1338
- ### Why
1339
-
1340
- 0.14.x had a class of bugs where `WWW-Authenticate` headers could be produced
1341
- with `"://host/.well-known/..."` when the caller mis-set `resource`. 0.15.0
1342
- closed it with a required `resource_metadata_url` field on the metadata type.
1343
- 0.15.1 added runtime validation in the `JwtAuthProvider` constructor. 0.16.0
1344
- lifts the invariant to the type layer: raw strings for URL fields are now a
1345
- compile error, and the runtime validator is removed as dead code. The bug is
1346
- closed three times: structurally (type), behaviorally (runtime at factory), and
1347
- by the 14 new `httpsUrl()` unit tests covering every validation path.
1348
-
1349
- ## [0.15.1] - 2026-04-11
1350
-
1351
- ### Fixed
1352
-
1353
- - **`JwtAuthProvider` constructor now runtime-validates `resourceMetadataUrl`**
1354
- — both the explicit-value branch and the auto-derive-from-`resource` branch
1355
- call `new URL()` on the resulting string and reject non-HTTP(S) schemes with a
1356
- clear error message. Previously the constructor stored the value verbatim and
1357
- trusted the type system; a caller passing `"not a url"`, a relative path, a
1358
- `javascript:` scheme, or a value with trailing whitespace would silently
1359
- produce a broken `WWW-Authenticate` header at runtime — the exact class of bug
1360
- that 0.15.0 was meant to eliminate, just transferred to the constructor layer.
1361
- 0.15.1 closes that hole with a `validateAbsoluteHttpUrl` helper.
1362
-
1363
- - **Empty-string and whitespace-only `resourceMetadataUrl` are now treated as
1364
- absent.** Previously `if (options.resourceMetadataUrl)` accepted `""` as falsy
1365
- and silently fell through to derivation. Now the code trims the value and
1366
- checks for non-empty explicitly — a YAML key with no value or an env var
1367
- expanded to empty gets the same behavior as omitting the key entirely (instead
1368
- of producing `"://host"`).
1369
-
1370
- - **Trailing whitespace in `resource` is now trimmed before derivation.**
1371
- Previously `"https://foo.com "` produced
1372
- `"https://foo.com /.well-known/oauth-protected-resource"` — unparseable.
1373
- 0.15.1 trims before the path append AND runs the result through
1374
- `validateAbsoluteHttpUrl` as a belt-and-suspenders check.
1375
-
1376
- - **`resource` URL detection is now case-insensitive.** `"HTTPS://foo.com"` is a
1377
- valid URL per RFC 3986 (scheme comparison is case-insensitive) and 0.15.1
1378
- accepts it, normalizing to lowercase via `new URL().toString()`. Previously
1379
- the `/^https?:\/\//` regex was case-sensitive and would have thrown on
1380
- uppercase schemes as if they were opaque URIs.
1381
-
1382
- - **`clearAuthEnv()` test helper now clears `MCP_AUTH_RESOURCE_METADATA_URL`.**
1383
- The helper was written for 0.14.0 and the 0.15.0 commit added a read of the
1384
- new env var in `config.ts:loadEnvAuth` but forgot to mirror that in the
1385
- cleanup. A test that sets the env var leaked its value to subsequent tests in
1386
- the same process — intermittent green/red flips waiting to happen. Fix:
1387
- one-line addition to the helper.
1388
-
1389
- ### Changed
1390
-
1391
- - **Error message on invalid `resource` now `JSON.stringify`s the value.**
1392
- Previously the error template embedded `${options.resource}` raw; a value
1393
- containing quotes, newlines, or other specials could break error log parsing.
1394
- Now the value is unambiguously inspectable even when weird.
1395
-
1396
- ### Migration
1397
-
1398
- No migration needed. Backward compatible with 0.15.0 — all existing valid
1399
- configurations keep working. The changes only make previously-silent-wrong
1400
- configurations fail loudly at construction. If your tests set
1401
- `MCP_AUTH_RESOURCE_METADATA_URL` you may want to mirror the `clearAuthEnv()`
1402
- update in your own test helpers.
1403
-
1404
- ## [0.15.0] - 2026-04-11
1405
-
1406
- ### BREAKING
1407
-
1408
- - **`ProtectedResourceMetadata.resource_metadata_url` is now required**
1409
- (previously the field did not exist and the middleware derived the metadata
1410
- URL from `resource`, which produced a broken URL when `resource` was not
1411
- itself an HTTP(S) URL — e.g., when using an opaque OIDC project ID as JWT
1412
- audience per RFC 9728 § 2).
1413
-
1414
- ### Fixed
1415
-
1416
- - **`WWW-Authenticate` header now always contains a valid absolute HTTP(S) URL**
1417
- in the `resource_metadata="..."` parameter. Previously, if a custom
1418
- `AuthProvider` returned a non-URL `resource` (for example, an opaque OAuth2
1419
- resource URI or an OIDC project ID used as audience — both valid per RFC 9728
1420
- § 2), the middleware would compute
1421
- `${resource}/.well-known/oauth-protected-resource` and produce something like
1422
- `"367545125829670172/.well-known/oauth-protected-resource"` — not a valid URL,
1423
- causing RFC 9728 § 5 compliant clients (Claude.ai / ChatGPT) to fail OAuth
1424
- discovery.
1425
-
1426
- The fix makes `resource_metadata_url` a first-class required field on
1427
- `ProtectedResourceMetadata`, always set by the provider, and used directly by
1428
- the middleware. Derivation from `resource` is no longer attempted.
1429
-
1430
- ### Changed
1431
-
1432
- - `JwtAuthProviderOptions` accepts a new optional
1433
- `resourceMetadataUrl?: string`.
1434
- - When the option is set, it is used as-is.
1435
- - When omitted AND `resource` is an HTTP(S) URL, the factory auto-derives
1436
- `${resource}/.well-known/oauth-protected-resource` and stores it (existing
1437
- URL-resource callers get a no-op migration — no code change needed on their
1438
- side).
1439
- - When omitted AND `resource` is not an HTTP(S) URL, `JwtAuthProvider` throws
1440
- at construction with a clear error message pointing to RFC 9728 and
1441
- suggesting the fix.
1442
-
1443
- ### Migration
1444
-
1445
- - **If your `resource` is an HTTP(S) URL**: no change needed. The factory
1446
- auto-derives the metadata URL and stores it. `getResourceMetadata()` now
1447
- returns a `resource_metadata_url` field, but you don't need to provide one.
1448
- - **If your `resource` is an opaque URI** (e.g., OIDC project ID): add
1449
- `resourceMetadataUrl` to the `createOIDCAuthProvider` / `JwtAuthProvider`
1450
- options, pointing to the HTTPS URL where your
1451
- `/.well-known/oauth-protected-resource` endpoint is served publicly.
1452
- - **If you have a custom `AuthProvider` subclass**: the
1453
- `ProtectedResourceMetadata` returned by `getResourceMetadata()` must include
1454
- `resource_metadata_url`. TypeScript will catch missing values at compile time.
1455
- - **If you configure `@casys/mcp-server` via YAML or environment variables AND
1456
- your `resource` is an opaque URI** (not an HTTP(S) URL): set
1457
- `auth.resourceMetadataUrl` in YAML or the env var
1458
- `MCP_AUTH_RESOURCE_METADATA_URL` to the public HTTPS URL of your
1459
- `/.well-known/oauth-protected-resource` endpoint. Previously this case would
1460
- fail at startup with a `JwtAuthProvider` error and no recovery path — the
1461
- config layer silently dropped any override attempt because the field was not
1462
- plumbed through `AuthConfig` / `loadYamlAuth` / `loadEnvAuth` /
1463
- `createAuthProviderFromConfig`. Now wired end-to-end.
1464
-
1465
- ## [0.14.0] - 2026-04-08
1466
-
1467
- ### Added
1468
-
1469
- - **MCP Apps capability negotiation** — new helpers and constants to read the
1470
- MCP Apps extension capability advertised by clients (per the
1471
- `@modelcontextprotocol/ext-apps` spec dated 2026-01-26 and the SDK 1.29
1472
- `extensions` field on `ClientCapabilities`).
1473
- - `MCP_APPS_EXTENSION_ID = "io.modelcontextprotocol/ui"` — well-known
1474
- extension key.
1475
- - `MCP_APPS_PROTOCOL_VERSION = "2026-01-26"` — dated spec this package
1476
- targets. Bump in lockstep when adopting newer dated specs.
1477
- - `getMcpAppsCapability(clientCapabilities)` — best-effort, defensive reader.
1478
- Returns `McpAppsClientCapability | undefined`. Tolerates `null`/`undefined`
1479
- input, missing `extensions` field, malformed extension values, and silently
1480
- filters non-string `mimeTypes` entries.
1481
- - `McpApp.getClientMcpAppsCapability()` — instance method that wires the above
1482
- against the connected client. Use it from a tool handler to decide between
1483
- returning a `_meta.ui` resource or a text-only fallback.
1484
- - `McpAppsClientCapability` interface (currently `{ mimeTypes?: string[] }`,
1485
- extensible to match future spec additions).
1486
- - 13 boundary tests in `mcp-apps-capability_test.ts` cover happy paths,
1487
- null/undefined inputs, missing extensions, non-object extension values,
1488
- malformed `mimeTypes`, and determinism.
1489
-
1490
- ### Changed
1491
-
1492
- - **Bumped `@modelcontextprotocol/sdk` from `^1.27.0` → `^1.29.0`** in both
1493
- `packages/server` and `packages/compose`. SDK 1.28 brought
1494
- `scopes_supported`-from-resource-metadata default behavior and
1495
- `client_secret_basic` defaulting — both verified harmless against our
1496
- `JwtAuthProvider` (we already emit `scopes_supported` server-side) and
1497
- `client-auth/provider.ts` (we already override `token_endpoint_auth_method` to
1498
- `"none"` for our public PKCE client). SDK 1.29 brings the
1499
- `extensions`-on-`ClientCapabilities` feature that powers MCP Apps capability
1500
- negotiation, plus an npm audit fix and several minor schema fixes (`size` on
1501
- `ResourceSchema`, missing types exports, Windows stdio hide, infinite-TTL
1502
- guard).
1503
-
1504
- ### Fixed
1505
-
1506
- - **`scripts/build-node.sh` SDK version drift** — the generated
1507
- `dist-node/package.json` for npm consumers hardcoded
1508
- `@modelcontextprotocol/sdk: ^1.15.1`, far behind the `^1.29.0` used at build
1509
- time. The script now reads the version from `deno.json` (single source of
1510
- truth) and fails fast with a clear error if parsing fails. This was a latent
1511
- bug since the package's first npm release — npm consumers may have been
1512
- resolving an SDK floor too old to support features the code uses.
1513
-
1514
- ## [0.13.0] - 2026-04-08
1515
-
1516
- ### Added
1517
-
1518
- - **`createMultiTenantMiddleware()`** — tenant resolution middleware sitting
1519
- after the auth middleware. Delegates tenant identification to a user-provided
1520
- `TenantResolver`, injects the resolved `tenantId` into `ctx.authInfo`, and
1521
- rejects mismatches with a generic `invalid_token` error. Passthrough on STDIO;
1522
- fails fast with a config error if `ctx.authInfo` is missing on HTTP. Existing
1523
- single-tenant servers require no changes.
1524
- - **`AuthInfo.tenantId`** — new optional field populated by the multi-tenant
1525
- middleware. Tool handlers should read this instead of raw JWT claims.
1526
- `authInfo` is re-frozen after injection.
1527
- - **`MultiTenantMiddlewareOptions.onRejection`** — async audit hook awaited
1528
- before the 401 is thrown. Rejection reasons are server-side only; the client
1529
- always sees a generic `invalid_token` error. Hook exceptions are caught and
1530
- logged to stderr — they can never change client-visible behaviour or become an
1531
- oracle for attackers.
1532
- - **Empty-`tenantId` guard** — `{ ok: true, tenantId: "" }` is rejected as if it
1533
- were a resolver failure, preventing truthy-guard bypasses in downstream
1534
- handlers.
1535
- - **`McpApp.getFetchHandler()`** — returns a Web Standard fetch handler without
1536
- binding a port. Use this to mount the MCP HTTP layer inside another framework
1537
- (Fresh, Hono, Express, Cloudflare Workers, etc.) without giving up port
1538
- ownership to `startHttp`. Auth, multi-tenant middleware, scope checks, rate
1539
- limiting, sessions, and SSE all run identically. Designed for the multi-tenant
1540
- SaaS pattern of caching one server-per-tenant and dispatching from the host
1541
- framework's routing layer.
1542
- - **`HttpServerOptions.embedded` + `embeddedHandlerCallback`** — internal
1543
- mechanism powering `getFetchHandler`. Most consumers should use
1544
- `getFetchHandler` directly rather than setting these.
1545
- - **`FetchHandler` type re-exported from `./types.ts`** — was already exported
1546
- from the runtime port at top-level, now also re-exported alongside
1547
- `HttpServerOptions` for ergonomic single-import use.
1548
- - **New types** — `TenantResolver`, `TenantResolution`,
1549
- `MultiTenantMiddlewareOptions` exported from `mod.ts`.
1550
-
1551
- ### Changed
1552
-
1553
- - **`ConcurrentMCPServer` → `McpApp`** — **non-breaking**. The framework's main
1554
- class has been renamed and its source file moved from
1555
- `src/concurrent-server.ts` to `src/mcp-app.ts` (git-tracked rename, history
1556
- preserved). `McpApp` is now the canonical name everywhere — class body, error
1557
- messages, JSDoc, internal modules, tests, README, and the compose stubs. The
1558
- options type follows: `ConcurrentServerOptions → McpAppOptions`. Existing code
1559
- keeps working unchanged thanks to the deprecated re-exports in `mod.ts` (see
1560
- Deprecated below) —
1561
- `import { ConcurrentMCPServer } from
1562
- "@casys/mcp-server"` still resolves to
1563
- the same constructor at runtime, `ConcurrentMCPServer === McpApp` is true, and
1564
- `instanceof` checks pass in both directions. Migration is a one-line import
1565
- swap when consumers are ready. Rationale: "Concurrent" described a trivial
1566
- implementation detail (any HTTP server is concurrent), while `McpApp` captures
1567
- the actual value of the lib — a middleware-first framework on top of the MCP
1568
- SDK, mirroring the Hono idiom (`new Hono()` → `new McpApp()`). `McpServer` was
1569
- off the table because it would collide with the SDK's own `McpServer` class
1570
- which we wrap.
1571
-
1572
- ### Deprecated
1573
-
1574
- - **`ConcurrentMCPServer`** — kept as a re-export of `McpApp` for backwards
1575
- compatibility (`export { McpApp as ConcurrentMCPServer }`). Both names point
1576
- to the exact same class at runtime, so `instanceof` checks pass in both
1577
- directions and migration is a one-line import swap. The deprecated alias will
1578
- be removed in **v1.0**.
1579
- - **`ConcurrentServerOptions`** — same treatment as a re-export of
1580
- `McpAppOptions`. Will be removed in v1.0.
1581
-
1582
- ### Fixed
1583
-
1584
- - **`setRequestHandler` callbacks now have explicit type annotations** — the
1585
- `tools/call` and `resources/read` handlers in `McpApp` (formerly
1586
- `ConcurrentMCPServer`) relied on TypeScript inference for their `request`
1587
- parameter. The MCP SDK exports the Zod-inferred types (`CallToolRequest`,
1588
- `ReadResourceRequest`) from `@modelcontextprotocol/sdk/types.js` but the
1589
- callback sites used neither imports nor annotations. Consumers who pulled the
1590
- package via a local-path workspace and built with strict `noImplicitAny` were
1591
- tripping on the inference gap. Both callbacks now import and annotate the
1592
- request types explicitly, surfacing full type info at the call site and
1593
- catching SDK shape drift early. Runtime behaviour unchanged.
1594
-
1595
- ## [0.12.0] - 2026-03-22
1596
-
1597
- ### Added
1598
-
1599
- - **`structuredContent` support** — tool handlers can return
1600
- `{ content: "summary", structuredContent: { ...data } }` to separate LLM
1601
- context (text summary) from viewer payload (structured data). Reduces LLM
1602
- token usage for data-heavy tools.
1603
- - **`outputSchema` on tools** — optional JSON Schema for tool output, passed
1604
- through in `tools/list`. Enables host-side validation of tool results.
1605
- - **`annotations` on tools** — behavioural hints (`title`, `readOnlyHint`,
1606
- `destructiveHint`, `idempotentHint`, `openWorldHint`) passed through in
1607
- `tools/list`.
1608
- - **Tool visibility filtering** — tools with `_meta.ui.visibility: ["app"]` are
1609
- excluded from `tools/list` (hidden from LLM) but remain callable via
1610
- `tools/call`. Cleans up LLM tool list from UI-only actions (refresh,
1611
- pagination, etc.).
1612
- - **`registerAppOnlyTool()` helper** — shortcut to register app-only tools with
1613
- `visibility: ["app"]` auto-injected.
1614
- - **`toolErrorMapper` option** — centralized error-to-`isError` mapping.
1615
- Business errors produce `{ isError: true }` results; system errors rethrow as
1616
- JSON-RPC errors. Configurable via `ConcurrentServerOptions.toolErrorMapper`.
1617
- - **New types** — `ToolAnnotations`, `StructuredToolResult`, `ToolErrorMapper`
1618
- exported from `mod.ts`.
1619
-
1620
- ### Changed
1621
-
1622
- - **`tools/list` refactored** — both STDIO and HTTP paths now use shared
1623
- `buildToolListing()` method (deduplication).
1624
- - **`tools/call` refactored** — both STDIO and HTTP paths now use shared
1625
- `buildToolCallResult()` and `handleToolError()` methods. Serialization errors
1626
- are no longer routed through `toolErrorMapper`.
1627
-
1628
- ## [0.11.0] - 2026-03-20
1629
-
1630
- ### Added
1631
-
1632
- - **`registerViewers()` CSP option** — `csp` field on `RegisterViewersConfig`
1633
- declares external domains the viewer needs (tiles, APIs, CDNs). Injects
1634
- `_meta.ui.csp` into resource content.
1635
- - **Re-export compose SDK helpers** — `composeEvents`, `uiMeta`, and related
1636
- types re-exported from `mod.ts` via `@casys/mcp-compose`.
1637
-
1638
- ### Changed
1639
-
1640
- - **Bump `@casys/mcp-compose` ^0.2.0 → ^0.3.0**.
1641
-
1642
- ## [0.10.0] - 2026-03-20
1643
-
1644
- ### Changed
1645
-
1646
- - **Bump MCP SDK ^1.15 → ^1.27** — unlocks `structuredContent`, `outputSchema`,
1647
- `annotations`, `isError` at the protocol level.
1648
- - **Bump `@casys/mcp-compose` → ^0.2.0** — adds sub-path exports (`/sdk`,
1649
- `/core`).
1650
- - **`McpUiToolMeta` imported from mcp-compose** — replaced inlined base type
1651
- with `import type { McpUiToolMeta } from "@casys/mcp-compose/core"`. No API
1652
- change.
1653
-
1654
- ## [0.9.2] - 2026-03-17
1655
-
1656
- ### Added
1657
-
1658
- - **MCP Inspector launcher** — `launchInspector()` starts an interactive MCP
1659
- Inspector session for debugging. Exported from `mod.ts` with
1660
- `InspectorOptions` type.
1661
-
1662
- ## [0.9.1] - 2026-03-17
1663
-
1664
- ### Changed
1665
-
1666
- - **Import `McpUiToolMetaBase` from `@casys/mcp-compose/core`** — replaced
1667
- inlined visibility/resourceUri type with proper dependency import.
1668
-
1669
- ## [0.9.0] - 2026-03-17
1670
-
1671
- ### Added
1672
-
1673
- - **Client-side OAuth2 flow** — `CallbackServer` (localhost redirect capture),
1674
- `OAuthClientProviderImpl`, `connect()` helper for MCP client auth. Token
1675
- stores: `FileTokenStore` (persistent, 0o600 permissions) and
1676
- `MemoryTokenStore` (ephemeral).
1677
- - **MCP Apps viewer utilities** — `resolveViewerDistPath()` and
1678
- `discoverViewers()` for auto-discovering built UI viewers. `registerViewers()`
1679
- method on `ConcurrentMCPServer` for bulk resource registration.
1680
- - **New exports** — `RegisterViewersConfig`, `RegisterViewersSummary`,
1681
- `resolveViewerDistPath`, `discoverViewers` from `mod.ts`.
1682
-
1683
- ## [0.8.0] - 2026-02-12
23
+ ### Documentation
1684
24
 
1685
- ### Added
25
+ - Added explicit npm and Deno migration steps plus the full migration guide, so consumers can adopt
26
+ `@casys/mcp-platform` without treating the rename as an API migration.
1686
27
 
1687
- - **Security: HMAC-SHA256 channel authentication for PostMessage (MCP Apps)** —
1688
- `MessageSigner` class for signing/verifying JSON-RPC messages with `_hmac` +
1689
- `_seq` (anti-replay). `injectChannelAuth()` injects an inline script into
1690
- iframe HTML that signs outgoing postMessages. Host-side verification via
1691
- `MessageSigner.verify()`.
1692
- - **Security: HTTP hardening options** — `maxBodyBytes` (default 1 MB, returns
1693
- 413 JSON-RPC error), `corsOrigins` allowlist with wildcard warning,
1694
- `requireAuth` fail-fast at startup, `ipRateLimit` per-IP 429 + `Retry-After`
1695
- header, `sessionId` propagation into middleware context.
1696
- - **Security: CSP injection** — `buildCspHeader()` and `injectCspMetaTag()` for
1697
- Content-Security-Policy in MCP Apps HTML resources. Configurable via
1698
- `resourceCsp` in `ConcurrentServerOptions`.
1699
- - **Security: CORS wildcard warning** — logs `[WARN]` when `corsOrigins` is
1700
- `"*"` regardless of auth configuration.
1701
- - **Node.js runtime adapter** — `runtime.node.ts` implements the `RuntimePort`
1702
- contract for Node.js 18+ with `maxBodyBytes` enforcement at both
1703
- `Content-Length` and streaming body levels.
1704
- - **Observability: `recordAuthEvent()` wired** — auth tracing spans now fire on
1705
- token verify, reject, and JWT cache hit (gated by `isOtelEnabled()`).
1706
- - **`HttpServerInstance` return type** — `startHttp()` now returns
1707
- `{ shutdown(), addr }` for programmatic control.
28
+ ## [0.27.1] - 2026-09-18
1708
29
 
1709
30
  ### Changed
1710
31
 
1711
- - **File reorganization** — moved files into domain subfolders: `src/runtime/`,
1712
- `src/concurrency/`, `src/validation/`, `src/sampling/`. All re-exports from
1713
- `mod.ts` are unchanged.
1714
- - **API cleanup** — removed internal types from public barrel
1715
- (`PromiseResolver`, `QueueOptions`, `MCP_APP_URI_SCHEME`).
1716
- - **Lint cleanup** — zero `deno lint` errors, zero `deno fmt` issues, no slow
1717
- types.
1718
-
1719
- ## [0.7.0] - 2026-02-07
1720
-
1721
- ### Added
1722
-
1723
- - **Observability: OTel tracing** — every tool call emits an OpenTelemetry span
1724
- (`mcp.tool.call {name}`) with attributes (tool name, server name, transport,
1725
- session ID, duration, success/error). Requires `OTEL_DENO=true` +
1726
- `--unstable-otel`.
1727
- - **Observability: Prometheus `/metrics` endpoint** — exposes counters (tool
1728
- calls, auth, sessions, rate limiting), histogram (tool call latency), and
1729
- gauges (active requests, queued, sessions, SSE clients, uptime) in Prometheus
1730
- text format.
1731
- - **Observability: `ServerMetrics` class** — embeddable metrics collector with
1732
- per-tool breakdown, `getSnapshot()`, `toPrometheusFormat()`, and `reset()`.
1733
- - **Observability: `getServerMetrics()` / `getPrometheusMetrics()`** — public
1734
- methods on `ConcurrentMCPServer` for programmatic access.
1735
- - **Observability: auth event tracing** — `recordAuthEvent()` helper for
1736
- fire-and-forget auth spans.
1737
- - **Security: per-IP rate limiting on `initialize`** — 10 requests/min per IP to
1738
- prevent session exhaustion attacks (DoS).
1739
- - **Reliability: session cleanup grace period** — 60s grace period added to
1740
- session TTL so in-flight requests are not killed mid-execution.
1741
- - **Reliability: `RateLimiter.purgeExpiredKeys()`** — periodic cleanup of stale
1742
- keys to prevent unbounded memory growth. Auto-triggers every 1000 operations.
1743
-
1744
- ### Fixed
1745
-
1746
- - **Critical: RateLimiter memory leak** — keys with no active requests were
1747
- never removed from the internal Map, causing unbounded growth in long-running
1748
- servers with per-IP rate limiting.
1749
- - **Critical: SSE zombie clients** — failed `controller.enqueue()` calls were
1750
- silently caught without removing the dead client from the Map, causing memory
1751
- leaks and wasted CPU on every `sendToSession()`.
1752
- - **High: JWT token cache** — added SHA-256 token cache (max 1000 entries, TTL =
1753
- min(token expiry, 5min)) to avoid redundant JWKS network round-trips on every
1754
- tool call.
1755
-
1756
- ## [0.6.0] - 2026-02-06
1757
-
1758
- ### Added
1759
-
1760
- - **OAuth2/Bearer authentication** — `JwtAuthProvider` with JWKS validation, 4
1761
- presets (Google, Auth0, GitHub, OIDC).
1762
- - **YAML + env config** — `loadAuthConfig()` reads `mcp-server.yaml` +
1763
- `MCP_AUTH_*` env vars with priority: programmatic > env > YAML.
1764
- - **Middleware pipeline** — composable onion-model pipeline: rate-limit → auth →
1765
- custom → scope-check → validation → backpressure → handler.
1766
- - **Scope enforcement** — `requiredScopes` on tools with AND-based checking.
1767
- - **RFC 9728** — `/.well-known/oauth-protected-resource` metadata endpoint.
1768
- - **HTTP/SSE transport** — `startHttp()` with Streamable HTTP, session
1769
- management, SSE streaming.
1770
- - **MCP Apps** — `ui://` scheme, `MCP_APP_MIME_TYPE`, `registerResource()`.
1771
-
1772
- ## [0.5.0] - 2026-01-28
1773
-
1774
- ### Added
1775
-
1776
- - Initial release: `ConcurrentMCPServer`, `RequestQueue`, `RateLimiter`,
1777
- `SchemaValidator`, `SamplingBridge`.
1778
- - STDIO transport with backpressure strategies (sleep/queue/reject).
1779
- - Schema validation with ajv.
32
+ - **Deprecated alias:** the framework moved to `@casys/mcp-platform@^0.28.0`. This package now
33
+ re-exports it unchanged. Framework history continues in the `@casys/mcp-platform` changelog.