@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
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,oCAAoC,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IAEpB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,MAAM,CAAC;IAErD;;;;OAIG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IAEjB,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IAEb,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAEhB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,gEAAgE;IAChE,oBAAoB,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;IAEpD,8DAA8D;IAC9D,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;;OAGG;IAC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AM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAE9D;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;OAOG;IACH,uBAAuB,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3D;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,+BAA+B;IAC/B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B,0BAA0B;IAC1B,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1C"}
package/esm/src/types.js DELETED
@@ -1,92 +0,0 @@
1
- /**
2
- * Type definitions for the MCP Concurrent Server Framework
3
- *
4
- * This module provides TypeScript types for building high-performance
5
- * MCP servers with built-in concurrency control and backpressure.
6
- *
7
- * @module lib/server/types
8
- */
9
- /** MCP Apps MIME type constant */
10
- export const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
11
- /** URI scheme for MCP Apps resources */
12
- export const MCP_APP_URI_SCHEME = "ui:";
13
- /**
14
- * Well-known extension identifier for the MCP Apps protocol.
15
- *
16
- * Clients advertise MCP Apps support by including this key in
17
- * `clientCapabilities.extensions` (per the MCP SDK 1.29 extensions
18
- * feature). Servers read it via {@link getMcpAppsCapability} to decide
19
- * whether to register UI-rendering tools or fall back to text-only.
20
- *
21
- * @see {@link https://github.com/modelcontextprotocol/ext-apps | MCP Apps spec}
22
- */
23
- export const MCP_APPS_EXTENSION_ID = "io.modelcontextprotocol/ui";
24
- /**
25
- * MCP Apps protocol spec version this package targets.
26
- *
27
- * Matches the dated spec at
28
- * https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx
29
- *
30
- * Bump this constant in the same commit that adopts a newer dated spec.
31
- */
32
- export const MCP_APPS_PROTOCOL_VERSION = "2026-01-26";
33
- /**
34
- * Read the MCP Apps capability from a client's advertised capabilities.
35
- *
36
- * Best-effort, defensive reader. Returns `undefined` for any of:
37
- * - `null` / `undefined` input
38
- * - `clientCapabilities` without an `extensions` field
39
- * - `extensions` without the {@link MCP_APPS_EXTENSION_ID} key
40
- * - extension value that is not a plain object (string, number, null, ...)
41
- *
42
- * Malformed `mimeTypes` (wrong type, non-string entries) are silently
43
- * filtered rather than thrown — agents reading this function need a
44
- * predictable contract that never crashes downstream consumers on
45
- * untrusted client data.
46
- *
47
- * **Validation scope:** this function only validates the *type* of
48
- * `mimeTypes` entries (must be string). It does NOT validate that the
49
- * strings look like valid mime types (e.g. empty strings or garbage
50
- * content pass through). Consumers should compare against known
51
- * constants like {@link MCP_APP_MIME_TYPE} via `.includes()` rather
52
- * than treating the array as a generic allowlist.
53
- *
54
- * @param clientCapabilities - The `ClientCapabilities` object from the
55
- * MCP SDK initialize handshake. May be `null` or `undefined` if the
56
- * client never sent capabilities.
57
- * @returns The MCP Apps capability if the client advertised support,
58
- * otherwise `undefined`.
59
- *
60
- * @example
61
- * ```typescript
62
- * const cap = getMcpAppsCapability(client.getClientCapabilities());
63
- * if (cap?.mimeTypes?.includes(MCP_APP_MIME_TYPE)) {
64
- * // register UI-rendering tools
65
- * } else {
66
- * // register text-only fallback tools
67
- * }
68
- * ```
69
- */
70
- export function getMcpAppsCapability(clientCapabilities) {
71
- if (clientCapabilities === null || clientCapabilities === undefined) {
72
- return undefined;
73
- }
74
- const extensions = clientCapabilities.extensions;
75
- if (extensions === null || typeof extensions !== "object") {
76
- return undefined;
77
- }
78
- const raw = extensions[MCP_APPS_EXTENSION_ID];
79
- if (raw === null || typeof raw !== "object") {
80
- return undefined;
81
- }
82
- // We have a capability object — extract known fields defensively.
83
- const result = {};
84
- const rawMimeTypes = raw.mimeTypes;
85
- if (Array.isArray(rawMimeTypes)) {
86
- const validMimeTypes = rawMimeTypes.filter((m) => typeof m === "string");
87
- if (validMimeTypes.length > 0) {
88
- result.mimeTypes = validMimeTypes;
89
- }
90
- }
91
- return result;
92
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * MCP Apps Viewer Utilities
3
- *
4
- * Shared functions for resolving viewer dist paths and discovering
5
- * viewer directories. Used by registerViewers() and the build pipeline.
6
- *
7
- * @module lib/server/src/ui/viewer-utils
8
- */
9
- /**
10
- * Resolve the dist path for a viewer's built index.html.
11
- *
12
- * Checks two candidate locations relative to the module URL:
13
- * 1. ./src/ui/dist/{viewerName}/index.html (Deno dev)
14
- * 2. ./ui-dist/{viewerName}/index.html (npm package)
15
- *
16
- * @param moduleUrl - import.meta.url of the consumer's server.ts
17
- * @param viewerName - Viewer directory name (e.g. "invoice-viewer")
18
- * @param exists - Function to check if a path exists (injectable for tests)
19
- * @returns Absolute path to index.html, or null if not found
20
- */
21
- export declare function resolveViewerDistPath(moduleUrl: string, viewerName: string, exists: (path: string) => boolean): string | null;
22
- /** Minimal entry returned by a directory reader */
23
- export interface DirEntry {
24
- name: string;
25
- isDirectory: boolean;
26
- }
27
- /** Injectable filesystem operations for discoverViewers */
28
- export interface DiscoverViewersFS {
29
- readDir: (path: string) => DirEntry[];
30
- hasIndexHtml: (uiDir: string, viewerName: string) => boolean;
31
- }
32
- /**
33
- * Auto-discover viewer directories inside a UI root folder.
34
- *
35
- * A viewer is a directory that:
36
- * - Is not in the skip list (shared, dist, node_modules, .cache, .vite)
37
- * - Does not start with "."
38
- * - Contains an index.html file
39
- *
40
- * @param uiDir - Absolute path to the UI root directory
41
- * @param fs - Injectable filesystem operations
42
- * @returns Sorted array of viewer names
43
- */
44
- export declare function discoverViewers(uiDir: string, fs: DiscoverViewersFS): string[];
45
- //# sourceMappingURL=viewer-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viewer-utils.d.ts","sourceRoot":"","sources":["../../../src/src/ui/viewer-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAwBH;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,MAAM,GAAG,IAAI,CA2Bf;AAED,mDAAmD;AACnD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,EAAE,CAAC;IACtC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,iBAAiB,GACpB,MAAM,EAAE,CAaV"}
@@ -1,97 +0,0 @@
1
- /**
2
- * MCP Apps Viewer Utilities
3
- *
4
- * Shared functions for resolving viewer dist paths and discovering
5
- * viewer directories. Used by registerViewers() and the build pipeline.
6
- *
7
- * @module lib/server/src/ui/viewer-utils
8
- */
9
- /** Directories to skip during auto-discovery */
10
- const SKIP_DIRS = new Set([
11
- "shared",
12
- "dist",
13
- "node_modules",
14
- ".cache",
15
- ".vite",
16
- ]);
17
- /**
18
- * Convert a file:// URL to a filesystem path.
19
- * Handles Windows drive letters and UNC paths.
20
- */
21
- function fileUrlToPath(url) {
22
- const decoded = decodeURIComponent(url.pathname);
23
- // Windows: /C:/path → C:/path
24
- if (/^\/[A-Za-z]:\//.test(decoded))
25
- return decoded.slice(1);
26
- // UNC: //host/share
27
- if (url.host.length > 0)
28
- return `//${url.host}${decoded}`;
29
- return decoded;
30
- }
31
- /**
32
- * Resolve the dist path for a viewer's built index.html.
33
- *
34
- * Checks two candidate locations relative to the module URL:
35
- * 1. ./src/ui/dist/{viewerName}/index.html (Deno dev)
36
- * 2. ./ui-dist/{viewerName}/index.html (npm package)
37
- *
38
- * @param moduleUrl - import.meta.url of the consumer's server.ts
39
- * @param viewerName - Viewer directory name (e.g. "invoice-viewer")
40
- * @param exists - Function to check if a path exists (injectable for tests)
41
- * @returns Absolute path to index.html, or null if not found
42
- */
43
- export function resolveViewerDistPath(moduleUrl, viewerName, exists) {
44
- // When consumed from JSR or any remote registry, import.meta.url is an
45
- // HTTPS URL. fileUrlToPath() only handles file:// — passing an HTTPS URL
46
- // produces a broken UNC-like path ("//jsr.io/..."). Return the raw resolved
47
- // URL string instead; the caller's exists/readFile callbacks are responsible
48
- // for handling remote URLs (e.g., via fetch()).
49
- if (moduleUrl.startsWith("https://") || moduleUrl.startsWith("http://")) {
50
- const candidates = [
51
- new URL(`./src/ui/dist/${viewerName}/index.html`, moduleUrl).href,
52
- new URL(`./ui-dist/${viewerName}/index.html`, moduleUrl).href,
53
- ];
54
- for (const candidate of candidates) {
55
- if (exists(candidate))
56
- return candidate;
57
- }
58
- return null;
59
- }
60
- const candidates = [
61
- fileUrlToPath(new URL(`./src/ui/dist/${viewerName}/index.html`, moduleUrl)),
62
- fileUrlToPath(new URL(`./ui-dist/${viewerName}/index.html`, moduleUrl)),
63
- ];
64
- for (const candidate of candidates) {
65
- if (exists(candidate))
66
- return candidate;
67
- }
68
- return null;
69
- }
70
- /**
71
- * Auto-discover viewer directories inside a UI root folder.
72
- *
73
- * A viewer is a directory that:
74
- * - Is not in the skip list (shared, dist, node_modules, .cache, .vite)
75
- * - Does not start with "."
76
- * - Contains an index.html file
77
- *
78
- * @param uiDir - Absolute path to the UI root directory
79
- * @param fs - Injectable filesystem operations
80
- * @returns Sorted array of viewer names
81
- */
82
- export function discoverViewers(uiDir, fs) {
83
- const entries = fs.readDir(uiDir);
84
- const viewers = [];
85
- for (const entry of entries) {
86
- if (!entry.isDirectory)
87
- continue;
88
- if (entry.name.startsWith("."))
89
- continue;
90
- if (SKIP_DIRS.has(entry.name))
91
- continue;
92
- if (!fs.hasIndexHtml(uiDir, entry.name))
93
- continue;
94
- viewers.push(entry.name);
95
- }
96
- return viewers.sort();
97
- }
@@ -1,115 +0,0 @@
1
- /**
2
- * Schema Validator
3
- *
4
- * JSON Schema validation using ajv for MCP tool arguments.
5
- * Compiles schemas once for optimal performance.
6
- *
7
- * @module lib/server/schema-validator
8
- */
9
- /**
10
- * Validation error with formatted message
11
- */
12
- export interface ValidationError {
13
- /** Error message */
14
- message: string;
15
- /** Path to invalid property */
16
- path: string;
17
- /** Invalid value */
18
- value?: unknown;
19
- /** Expected type or constraint */
20
- expected?: string;
21
- }
22
- /**
23
- * Validation result
24
- */
25
- export interface ValidationResult {
26
- valid: boolean;
27
- errors: ValidationError[];
28
- }
29
- /**
30
- * One immutable, compiled input-schema policy.
31
- *
32
- * McpApp stores this beside the tool handler so an in-flight call keeps the
33
- * schema it entered with even if live registration later replaces or removes
34
- * the public tool name.
35
- */
36
- export interface CompiledSchemaValidator {
37
- validate(args: Record<string, unknown>): ValidationResult;
38
- validateOrThrow(toolName: string, args: Record<string, unknown>): void;
39
- }
40
- /**
41
- * Schema validator with compiled schema caching
42
- *
43
- * @example
44
- * ```typescript
45
- * const validator = new SchemaValidator();
46
- *
47
- * // Register tool schema
48
- * validator.addSchema("my_tool", {
49
- * type: "object",
50
- * properties: { count: { type: "number" } },
51
- * required: ["count"]
52
- * });
53
- *
54
- * // Validate arguments
55
- * const result = validator.validate("my_tool", { count: 5 });
56
- * if (!result.valid) {
57
- * console.error(result.errors);
58
- * }
59
- * ```
60
- */
61
- export declare class SchemaValidator {
62
- private ajv;
63
- private validators;
64
- constructor();
65
- /**
66
- * Add a schema for a tool
67
- *
68
- * @param toolName - Name of the tool
69
- * @param schema - JSON Schema for tool arguments
70
- */
71
- addSchema(toolName: string, schema: Record<string, unknown>): CompiledSchemaValidator;
72
- /**
73
- * Compile a schema into a standalone validation snapshot.
74
- *
75
- * The returned object closes over one Ajv function rather than looking up a
76
- * mutable tool name. This is useful for request snapshots and remains safe to
77
- * retain after the name is unregistered from this cache.
78
- */
79
- compileSchema(schema: Record<string, unknown>): CompiledSchemaValidator;
80
- /**
81
- * Remove a schema
82
- */
83
- removeSchema(toolName: string): void;
84
- /**
85
- * Check if a schema exists
86
- */
87
- hasSchema(toolName: string): boolean;
88
- /**
89
- * Validate arguments against a tool's schema
90
- *
91
- * @param toolName - Name of the tool
92
- * @param args - Arguments to validate
93
- * @returns Validation result with errors if invalid
94
- */
95
- validate(toolName: string, args: Record<string, unknown>): ValidationResult;
96
- /**
97
- * Validate and throw if invalid
98
- *
99
- * @throws Error with formatted validation message
100
- */
101
- validateOrThrow(toolName: string, args: Record<string, unknown>): void;
102
- /**
103
- * Format ajv errors into readable messages
104
- */
105
- private formatErrors;
106
- /**
107
- * Get number of registered schemas
108
- */
109
- get count(): number;
110
- /**
111
- * Clear all schemas
112
- */
113
- clear(): void;
114
- }
115
- //# sourceMappingURL=schema-validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../../src/src/validation/schema-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA8CH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAAC;IAC1D,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,IAAI,CAAC;CACT;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,UAAU,CAA8C;;IAWhE;;;;;OAKG;IACH,SAAS,CACP,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,uBAAuB;IAQ1B;;;;;;OAMG;IACH,aAAa,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,uBAAuB;IA8B1B;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIpC;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB;IAU3E;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAKtE;;OAEG;IACH,OAAO,CAAC,YAAY;IAmHpB;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
@@ -1,249 +0,0 @@
1
- /**
2
- * Schema Validator
3
- *
4
- * JSON Schema validation using ajv for MCP tool arguments.
5
- * Compiles schemas once for optimal performance.
6
- *
7
- * @module lib/server/schema-validator
8
- */
9
- // deno-lint-ignore-file no-explicit-any
10
- // Draft 2020-12, not ajv's default export (draft-07). Spec 2026-07-28
11
- // (SEP-2106) allows any JSON Schema 2020-12 keyword in `inputSchema` /
12
- // `outputSchema`, and the draft-07 build treats the keywords added in 2020-12 —
13
- // `prefixItems`, `unevaluatedProperties`, `unevaluatedItems`, `$dynamicRef` —
14
- // as unknown. Combined with `strict: false` that failure is silent: the schema
15
- // compiles, the constraint is never applied, and a violating payload validates
16
- // clean. A tool author's declared boundary has to actually hold.
17
- //
18
- // Spelled as the full `dist/` path, not `ajv/2020`: `build-node.sh` copies
19
- // import specifiers verbatim into the npm distribution, and ajv 8 ships no
20
- // `exports` map and no root-level `2020.js`, so `ajv/2020` resolves under
21
- // Deno's import map and then fails at runtime in Node with ERR_MODULE_NOT_FOUND.
22
- // This path resolves under both.
23
- import AjvDefault from "ajv/dist/2020.js";
24
- // Get the Ajv constructor (handles ESM/CJS differences)
25
- const Ajv = AjvDefault.default ?? AjvDefault;
26
- /**
27
- * Count with its noun, agreeing in number.
28
- *
29
- * A bound of 1 is a legitimate schema (`minItems: 1`), and "must have at least
30
- * 1 items" reads as a bug in the server rather than a problem with the input.
31
- */
32
- function plural(n, singular, plural = `${singular}s`) {
33
- return `${n} ${n === 1 ? singular : plural}`;
34
- }
35
- /**
36
- * Schema validator with compiled schema caching
37
- *
38
- * @example
39
- * ```typescript
40
- * const validator = new SchemaValidator();
41
- *
42
- * // Register tool schema
43
- * validator.addSchema("my_tool", {
44
- * type: "object",
45
- * properties: { count: { type: "number" } },
46
- * required: ["count"]
47
- * });
48
- *
49
- * // Validate arguments
50
- * const result = validator.validate("my_tool", { count: 5 });
51
- * if (!result.valid) {
52
- * console.error(result.errors);
53
- * }
54
- * ```
55
- */
56
- export class SchemaValidator {
57
- ajv;
58
- validators = new Map();
59
- constructor() {
60
- this.ajv = new Ajv({
61
- allErrors: true, // Report all errors, not just first
62
- strict: false, // Allow additional keywords
63
- useDefaults: true, // Apply default values
64
- coerceTypes: false, // Don't coerce types (strict validation)
65
- });
66
- }
67
- /**
68
- * Add a schema for a tool
69
- *
70
- * @param toolName - Name of the tool
71
- * @param schema - JSON Schema for tool arguments
72
- */
73
- addSchema(toolName, schema) {
74
- // Compilation happens before the map update. A malformed replacement
75
- // therefore leaves the previously cached schema intact.
76
- const compiled = this.compileSchema(schema);
77
- this.validators.set(toolName, compiled);
78
- return compiled;
79
- }
80
- /**
81
- * Compile a schema into a standalone validation snapshot.
82
- *
83
- * The returned object closes over one Ajv function rather than looking up a
84
- * mutable tool name. This is useful for request snapshots and remains safe to
85
- * retain after the name is unregistered from this cache.
86
- */
87
- compileSchema(schema) {
88
- const validate = this.ajv.compile(schema);
89
- const run = (args) => {
90
- const valid = validate(args);
91
- if (valid) {
92
- return { valid: true, errors: [] };
93
- }
94
- return {
95
- valid: false,
96
- errors: this.formatErrors(validate.errors || []),
97
- };
98
- };
99
- return Object.freeze({
100
- validate: run,
101
- validateOrThrow: (toolName, args) => {
102
- const result = run(args);
103
- if (!result.valid) {
104
- const messages = result.errors.map((e) => e.message).join("; ");
105
- throw new Error(`Invalid arguments for ${toolName}: ${messages}`);
106
- }
107
- },
108
- });
109
- }
110
- /**
111
- * Remove a schema
112
- */
113
- removeSchema(toolName) {
114
- this.validators.delete(toolName);
115
- }
116
- /**
117
- * Check if a schema exists
118
- */
119
- hasSchema(toolName) {
120
- return this.validators.has(toolName);
121
- }
122
- /**
123
- * Validate arguments against a tool's schema
124
- *
125
- * @param toolName - Name of the tool
126
- * @param args - Arguments to validate
127
- * @returns Validation result with errors if invalid
128
- */
129
- validate(toolName, args) {
130
- const compiled = this.validators.get(toolName);
131
- if (!compiled) {
132
- // No schema registered - pass through
133
- return { valid: true, errors: [] };
134
- }
135
- return compiled.validate(args);
136
- }
137
- /**
138
- * Validate and throw if invalid
139
- *
140
- * @throws Error with formatted validation message
141
- */
142
- validateOrThrow(toolName, args) {
143
- const compiled = this.validators.get(toolName);
144
- if (compiled)
145
- compiled.validateOrThrow(toolName, args);
146
- }
147
- /**
148
- * Format ajv errors into readable messages
149
- */
150
- formatErrors(errors) {
151
- return errors.map((error) => {
152
- const path = error.instancePath || "/";
153
- const param = error.params;
154
- let message;
155
- let expected;
156
- switch (error.keyword) {
157
- case "required":
158
- message = `Missing required property: ${param.missingProperty}`;
159
- break;
160
- case "type":
161
- message = `Property ${path} must be ${param.type}`;
162
- expected = param.type;
163
- break;
164
- case "enum":
165
- message = `Property ${path} must be one of: ${param.allowedValues?.join(", ")}`;
166
- expected = param.allowedValues?.join(" | ");
167
- break;
168
- case "minimum":
169
- message = `Property ${path} must be >= ${param.limit}`;
170
- expected = `>= ${param.limit}`;
171
- break;
172
- case "maximum":
173
- message = `Property ${path} must be <= ${param.limit}`;
174
- expected = `<= ${param.limit}`;
175
- break;
176
- case "minLength":
177
- message =
178
- `Property ${path} must have at least ${param.limit} characters`;
179
- expected = `length >= ${param.limit}`;
180
- break;
181
- case "maxLength":
182
- message =
183
- `Property ${path} must have at most ${param.limit} characters`;
184
- expected = `length <= ${param.limit}`;
185
- break;
186
- case "pattern":
187
- message = `Property ${path} must match pattern: ${param.pattern}`;
188
- expected = param.pattern;
189
- break;
190
- // Collection bounds. ajv enforces these already — what was missing is a
191
- // message shaped like the others, with a structured `expected`. Without
192
- // it these fell through to `default` and surfaced ajv's bare prose
193
- // ("must NOT have more than 8 items"), which states the limit but names
194
- // neither the property nor an `expected` a caller can act on.
195
- //
196
- // `expected` says "items"/"properties" rather than "length": it is read
197
- // on its own as a recovery hint, where "length <= 8" is indistinguishable
198
- // from the character bound that minLength/maxLength above produce.
199
- case "minItems":
200
- message = `Property ${path} must have at least ${plural(param.limit, "item")}`;
201
- expected = `items >= ${param.limit}`;
202
- break;
203
- case "maxItems":
204
- message = `Property ${path} must have at most ${plural(param.limit, "item")}`;
205
- expected = `items <= ${param.limit}`;
206
- break;
207
- case "uniqueItems":
208
- // ajv reports the two colliding array indices, zero-based, and in
209
- // either order depending on how it optimised the comparison. The
210
- // indices are not what is equal — the items at them are.
211
- message =
212
- `Property ${path} must not contain duplicate items (items at indices ${param.j} and ${param.i} are equal)`;
213
- expected = "unique items";
214
- break;
215
- case "minProperties":
216
- message = `Property ${path} must have at least ${plural(param.limit, "property", "properties")}`;
217
- expected = `properties >= ${param.limit}`;
218
- break;
219
- case "maxProperties":
220
- message = `Property ${path} must have at most ${plural(param.limit, "property", "properties")}`;
221
- expected = `properties <= ${param.limit}`;
222
- break;
223
- case "additionalProperties":
224
- message = `Unknown property: ${param.additionalProperty}`;
225
- break;
226
- default:
227
- message = error.message || `Validation failed at ${path}`;
228
- }
229
- return {
230
- message,
231
- path,
232
- value: error.data,
233
- expected,
234
- };
235
- });
236
- }
237
- /**
238
- * Get number of registered schemas
239
- */
240
- get count() {
241
- return this.validators.size;
242
- }
243
- /**
244
- * Clear all schemas
245
- */
246
- clear() {
247
- this.validators.clear();
248
- }
249
- }