outask 0.0.0-stage → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (831) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +38 -2
  3. package/bin/outask +7 -0
  4. package/bin/tasks +7 -0
  5. package/cli.mjs +151 -0
  6. package/mcp/package-lock.json +175 -0
  7. package/mcp/package.json +15 -0
  8. package/mcp/server.mjs +132 -0
  9. package/node_modules/@modelcontextprotocol/core/LICENSE +216 -0
  10. package/node_modules/@modelcontextprotocol/core/README.md +40 -0
  11. package/node_modules/@modelcontextprotocol/core/dist/auth-Anm-lwWi.d.mts +8507 -0
  12. package/node_modules/@modelcontextprotocol/core/dist/auth-Anm-lwWi.d.mts.map +1 -0
  13. package/node_modules/@modelcontextprotocol/core/dist/auth-BNDyLTqp.mjs +1681 -0
  14. package/node_modules/@modelcontextprotocol/core/dist/auth-BNDyLTqp.mjs.map +1 -0
  15. package/node_modules/@modelcontextprotocol/core/dist/auth-D1CeV_Jr.cjs +2902 -0
  16. package/node_modules/@modelcontextprotocol/core/dist/auth-D1CeV_Jr.cjs.map +1 -0
  17. package/node_modules/@modelcontextprotocol/core/dist/auth-V9XJSCfa.d.cts +8507 -0
  18. package/node_modules/@modelcontextprotocol/core/dist/auth-V9XJSCfa.d.cts.map +1 -0
  19. package/node_modules/@modelcontextprotocol/core/dist/index.cjs +175 -0
  20. package/node_modules/@modelcontextprotocol/core/dist/index.d.cts +2 -0
  21. package/node_modules/@modelcontextprotocol/core/dist/index.d.mts +2 -0
  22. package/node_modules/@modelcontextprotocol/core/dist/index.mjs +3 -0
  23. package/node_modules/@modelcontextprotocol/core/dist/internal.cjs +201 -0
  24. package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts +99 -0
  25. package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts.map +1 -0
  26. package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts +99 -0
  27. package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts.map +1 -0
  28. package/node_modules/@modelcontextprotocol/core/dist/internal.mjs +3 -0
  29. package/node_modules/@modelcontextprotocol/core/package.json +85 -0
  30. package/node_modules/@modelcontextprotocol/server/LICENSE +216 -0
  31. package/node_modules/@modelcontextprotocol/server/README.md +30 -0
  32. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CEoC__sr.mjs +7514 -0
  33. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CEoC__sr.mjs.map +1 -0
  34. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CgI-5L6O.d.mts +1071 -0
  35. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CgI-5L6O.d.mts.map +1 -0
  36. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-FOQRM7up.d.cts +1071 -0
  37. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-FOQRM7up.d.cts.map +1 -0
  38. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-ZaoO9afR.cjs +7531 -0
  39. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-ZaoO9afR.cjs.map +1 -0
  40. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-BwbPzsdI.cjs +986 -0
  41. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-BwbPzsdI.cjs.map +1 -0
  42. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-C03CSigr.d.mts +74 -0
  43. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-C03CSigr.d.mts.map +1 -0
  44. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-doTkZbTr.d.cts +74 -0
  45. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-doTkZbTr.d.cts.map +1 -0
  46. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-p3WaZPqB.mjs +981 -0
  47. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-p3WaZPqB.mjs.map +1 -0
  48. package/node_modules/@modelcontextprotocol/server/dist/chunk-Bnu9O96Y.cjs +60 -0
  49. package/node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs +42 -0
  50. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-D4NN8WsG.d.mts +4168 -0
  51. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-D4NN8WsG.d.mts.map +1 -0
  52. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-DZmmlN8e.d.cts +4170 -0
  53. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-DZmmlN8e.d.cts.map +1 -0
  54. package/node_modules/@modelcontextprotocol/server/dist/dialects-D8eXzoGv.cjs +46 -0
  55. package/node_modules/@modelcontextprotocol/server/dist/dialects-D8eXzoGv.cjs.map +1 -0
  56. package/node_modules/@modelcontextprotocol/server/dist/dialects-DoSzNhcb.mjs +34 -0
  57. package/node_modules/@modelcontextprotocol/server/dist/dialects-DoSzNhcb.mjs.map +1 -0
  58. package/node_modules/@modelcontextprotocol/server/dist/index.cjs +1978 -0
  59. package/node_modules/@modelcontextprotocol/server/dist/index.cjs.map +1 -0
  60. package/node_modules/@modelcontextprotocol/server/dist/index.d.cts +810 -0
  61. package/node_modules/@modelcontextprotocol/server/dist/index.d.cts.map +1 -0
  62. package/node_modules/@modelcontextprotocol/server/dist/index.d.mts +810 -0
  63. package/node_modules/@modelcontextprotocol/server/dist/index.d.mts.map +1 -0
  64. package/node_modules/@modelcontextprotocol/server/dist/index.mjs +1790 -0
  65. package/node_modules/@modelcontextprotocol/server/dist/index.mjs.map +1 -0
  66. package/node_modules/@modelcontextprotocol/server/dist/mcp-BumlNux0.cjs +2477 -0
  67. package/node_modules/@modelcontextprotocol/server/dist/mcp-BumlNux0.cjs.map +1 -0
  68. package/node_modules/@modelcontextprotocol/server/dist/mcp-DIH4cS6P.mjs +2326 -0
  69. package/node_modules/@modelcontextprotocol/server/dist/mcp-DIH4cS6P.mjs.map +1 -0
  70. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.cjs +23 -0
  71. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.cjs.map +1 -0
  72. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.d.cts +11 -0
  73. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.d.cts.map +1 -0
  74. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.d.mts +11 -0
  75. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.d.mts.map +1 -0
  76. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.mjs +22 -0
  77. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.mjs.map +1 -0
  78. package/node_modules/@modelcontextprotocol/server/dist/shimsNode.cjs +12 -0
  79. package/node_modules/@modelcontextprotocol/server/dist/shimsNode.d.cts +3 -0
  80. package/node_modules/@modelcontextprotocol/server/dist/shimsNode.d.mts +3 -0
  81. package/node_modules/@modelcontextprotocol/server/dist/shimsNode.mjs +4 -0
  82. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.cjs +30 -0
  83. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.cjs.map +1 -0
  84. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.d.cts +10 -0
  85. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.d.cts.map +1 -0
  86. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.d.mts +10 -0
  87. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.d.mts.map +1 -0
  88. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.mjs +29 -0
  89. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.mjs.map +1 -0
  90. package/node_modules/@modelcontextprotocol/server/dist/src-BhnGYybN.cjs +8200 -0
  91. package/node_modules/@modelcontextprotocol/server/dist/src-BhnGYybN.cjs.map +1 -0
  92. package/node_modules/@modelcontextprotocol/server/dist/src-Cqbh3MYc.mjs +7702 -0
  93. package/node_modules/@modelcontextprotocol/server/dist/src-Cqbh3MYc.mjs.map +1 -0
  94. package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs +591 -0
  95. package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs.map +1 -0
  96. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts +115 -0
  97. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts.map +1 -0
  98. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts +115 -0
  99. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts.map +1 -0
  100. package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs +589 -0
  101. package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs.map +1 -0
  102. package/node_modules/@modelcontextprotocol/server/dist/types-DUs7mGBv.d.mts +1099 -0
  103. package/node_modules/@modelcontextprotocol/server/dist/types-DUs7mGBv.d.mts.map +1 -0
  104. package/node_modules/@modelcontextprotocol/server/dist/types-DsbMXNFL.d.cts +1099 -0
  105. package/node_modules/@modelcontextprotocol/server/dist/types-DsbMXNFL.d.cts.map +1 -0
  106. package/node_modules/@modelcontextprotocol/server/dist/validators/ajv.cjs +5 -0
  107. package/node_modules/@modelcontextprotocol/server/dist/validators/ajv.d.cts +2 -0
  108. package/node_modules/@modelcontextprotocol/server/dist/validators/ajv.d.mts +2 -0
  109. package/node_modules/@modelcontextprotocol/server/dist/validators/ajv.mjs +3 -0
  110. package/node_modules/@modelcontextprotocol/server/dist/validators/cfWorker.cjs +3 -0
  111. package/node_modules/@modelcontextprotocol/server/dist/validators/cfWorker.d.cts +2 -0
  112. package/node_modules/@modelcontextprotocol/server/dist/validators/cfWorker.d.mts +2 -0
  113. package/node_modules/@modelcontextprotocol/server/dist/validators/cfWorker.mjs +3 -0
  114. package/node_modules/@modelcontextprotocol/server/package.json +160 -0
  115. package/node_modules/jsonc-parser/CHANGELOG.md +76 -0
  116. package/node_modules/jsonc-parser/LICENSE.md +21 -0
  117. package/node_modules/jsonc-parser/README.md +364 -0
  118. package/node_modules/jsonc-parser/SECURITY.md +41 -0
  119. package/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
  120. package/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
  121. package/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
  122. package/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
  123. package/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
  124. package/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
  125. package/node_modules/jsonc-parser/lib/esm/main.js +178 -0
  126. package/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
  127. package/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
  128. package/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
  129. package/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
  130. package/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
  131. package/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
  132. package/node_modules/jsonc-parser/lib/umd/main.js +194 -0
  133. package/node_modules/jsonc-parser/package.json +37 -0
  134. package/node_modules/zod/LICENSE +21 -0
  135. package/node_modules/zod/README.md +218 -0
  136. package/node_modules/zod/compile.cjs +96 -0
  137. package/node_modules/zod/compile.d.cts +1 -0
  138. package/node_modules/zod/compile.d.ts +1 -0
  139. package/node_modules/zod/compile.js +52 -0
  140. package/node_modules/zod/index.cjs +52 -0
  141. package/node_modules/zod/index.d.cts +3 -0
  142. package/node_modules/zod/index.d.ts +3 -0
  143. package/node_modules/zod/index.js +7 -0
  144. package/node_modules/zod/locales/index.cjs +36 -0
  145. package/node_modules/zod/locales/index.d.cts +1 -0
  146. package/node_modules/zod/locales/index.d.ts +1 -0
  147. package/node_modules/zod/locales/index.js +1 -0
  148. package/node_modules/zod/locales/package.json +7 -0
  149. package/node_modules/zod/mini/index.cjs +51 -0
  150. package/node_modules/zod/mini/index.d.cts +3 -0
  151. package/node_modules/zod/mini/index.d.ts +3 -0
  152. package/node_modules/zod/mini/index.js +3 -0
  153. package/node_modules/zod/mini/package.json +7 -0
  154. package/node_modules/zod/package.json +147 -0
  155. package/node_modules/zod/src/compile.ts +56 -0
  156. package/node_modules/zod/src/index.ts +7 -0
  157. package/node_modules/zod/src/locales/index.ts +1 -0
  158. package/node_modules/zod/src/mini/index.ts +3 -0
  159. package/node_modules/zod/src/v3/ZodError.ts +340 -0
  160. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  161. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  162. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  163. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  164. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  165. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  166. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  167. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  168. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  169. package/node_modules/zod/src/v3/errors.ts +13 -0
  170. package/node_modules/zod/src/v3/external.ts +6 -0
  171. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  172. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  173. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  174. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  175. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  176. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  177. package/node_modules/zod/src/v3/index.ts +4 -0
  178. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  179. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  180. package/node_modules/zod/src/v3/types.ts +5138 -0
  181. package/node_modules/zod/src/v4/classic/checks.ts +33 -0
  182. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  183. package/node_modules/zod/src/v4/classic/compat.ts +78 -0
  184. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  185. package/node_modules/zod/src/v4/classic/errors.ts +97 -0
  186. package/node_modules/zod/src/v4/classic/external.ts +57 -0
  187. package/node_modules/zod/src/v4/classic/from-json-schema.ts +944 -0
  188. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  189. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  190. package/node_modules/zod/src/v4/classic/iso.ts +20 -0
  191. package/node_modules/zod/src/v4/classic/parse.ts +88 -0
  192. package/node_modules/zod/src/v4/classic/schemas.ts +2937 -0
  193. package/node_modules/zod/src/v4/core/api.ts +1875 -0
  194. package/node_modules/zod/src/v4/core/checks.ts +1266 -0
  195. package/node_modules/zod/src/v4/core/compile.ts +2322 -0
  196. package/node_modules/zod/src/v4/core/core.ts +230 -0
  197. package/node_modules/zod/src/v4/core/doc.ts +52 -0
  198. package/node_modules/zod/src/v4/core/errors.ts +543 -0
  199. package/node_modules/zod/src/v4/core/index.ts +19 -0
  200. package/node_modules/zod/src/v4/core/json-schema-generator.ts +131 -0
  201. package/node_modules/zod/src/v4/core/json-schema-processors.ts +934 -0
  202. package/node_modules/zod/src/v4/core/json-schema.ts +148 -0
  203. package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
  204. package/node_modules/zod/src/v4/core/parse.ts +309 -0
  205. package/node_modules/zod/src/v4/core/regexes.ts +217 -0
  206. package/node_modules/zod/src/v4/core/registries.ts +105 -0
  207. package/node_modules/zod/src/v4/core/schemas.ts +5226 -0
  208. package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
  209. package/node_modules/zod/src/v4/core/to-json-schema.ts +857 -0
  210. package/node_modules/zod/src/v4/core/util.ts +1293 -0
  211. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  212. package/node_modules/zod/src/v4/core/visit.ts +193 -0
  213. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  214. package/node_modules/zod/src/v4/index.ts +4 -0
  215. package/node_modules/zod/src/v4/locales/ar.ts +120 -0
  216. package/node_modules/zod/src/v4/locales/az.ts +116 -0
  217. package/node_modules/zod/src/v4/locales/be.ts +188 -0
  218. package/node_modules/zod/src/v4/locales/bg.ts +133 -0
  219. package/node_modules/zod/src/v4/locales/bn.ts +123 -0
  220. package/node_modules/zod/src/v4/locales/ca.ts +121 -0
  221. package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
  222. package/node_modules/zod/src/v4/locales/cs.ts +123 -0
  223. package/node_modules/zod/src/v4/locales/da.ts +128 -0
  224. package/node_modules/zod/src/v4/locales/de.ts +121 -0
  225. package/node_modules/zod/src/v4/locales/el.ts +124 -0
  226. package/node_modules/zod/src/v4/locales/en.ts +136 -0
  227. package/node_modules/zod/src/v4/locales/eo.ts +123 -0
  228. package/node_modules/zod/src/v4/locales/es.ts +145 -0
  229. package/node_modules/zod/src/v4/locales/fa.ts +131 -0
  230. package/node_modules/zod/src/v4/locales/fi.ts +126 -0
  231. package/node_modules/zod/src/v4/locales/fr-CA.ts +121 -0
  232. package/node_modules/zod/src/v4/locales/fr.ts +139 -0
  233. package/node_modules/zod/src/v4/locales/gu.ts +123 -0
  234. package/node_modules/zod/src/v4/locales/he.ts +253 -0
  235. package/node_modules/zod/src/v4/locales/hi.ts +126 -0
  236. package/node_modules/zod/src/v4/locales/hr.ts +135 -0
  237. package/node_modules/zod/src/v4/locales/hu.ts +122 -0
  238. package/node_modules/zod/src/v4/locales/hy.ts +175 -0
  239. package/node_modules/zod/src/v4/locales/id.ts +120 -0
  240. package/node_modules/zod/src/v4/locales/index.ts +63 -0
  241. package/node_modules/zod/src/v4/locales/is.ts +124 -0
  242. package/node_modules/zod/src/v4/locales/it.ts +121 -0
  243. package/node_modules/zod/src/v4/locales/ja.ts +119 -0
  244. package/node_modules/zod/src/v4/locales/ka.ts +128 -0
  245. package/node_modules/zod/src/v4/locales/kh.ts +7 -0
  246. package/node_modules/zod/src/v4/locales/km.ts +124 -0
  247. package/node_modules/zod/src/v4/locales/kn.ts +126 -0
  248. package/node_modules/zod/src/v4/locales/ko.ts +126 -0
  249. package/node_modules/zod/src/v4/locales/lt.ts +243 -0
  250. package/node_modules/zod/src/v4/locales/mk.ts +123 -0
  251. package/node_modules/zod/src/v4/locales/ms.ts +120 -0
  252. package/node_modules/zod/src/v4/locales/ne.ts +128 -0
  253. package/node_modules/zod/src/v4/locales/nl.ts +126 -0
  254. package/node_modules/zod/src/v4/locales/nn.ts +121 -0
  255. package/node_modules/zod/src/v4/locales/no.ts +121 -0
  256. package/node_modules/zod/src/v4/locales/ota.ts +122 -0
  257. package/node_modules/zod/src/v4/locales/pl.ts +123 -0
  258. package/node_modules/zod/src/v4/locales/ps.ts +131 -0
  259. package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
  260. package/node_modules/zod/src/v4/locales/pt.ts +159 -0
  261. package/node_modules/zod/src/v4/locales/ro.ts +132 -0
  262. package/node_modules/zod/src/v4/locales/ru.ts +188 -0
  263. package/node_modules/zod/src/v4/locales/sk.ts +123 -0
  264. package/node_modules/zod/src/v4/locales/sl.ts +123 -0
  265. package/node_modules/zod/src/v4/locales/sv.ts +124 -0
  266. package/node_modules/zod/src/v4/locales/ta.ts +123 -0
  267. package/node_modules/zod/src/v4/locales/tg.ts +135 -0
  268. package/node_modules/zod/src/v4/locales/th.ts +124 -0
  269. package/node_modules/zod/src/v4/locales/tk.ts +113 -0
  270. package/node_modules/zod/src/v4/locales/tr.ts +116 -0
  271. package/node_modules/zod/src/v4/locales/ua.ts +7 -0
  272. package/node_modules/zod/src/v4/locales/uk.ts +122 -0
  273. package/node_modules/zod/src/v4/locales/ur.ts +124 -0
  274. package/node_modules/zod/src/v4/locales/uz.ts +120 -0
  275. package/node_modules/zod/src/v4/locales/vi.ts +122 -0
  276. package/node_modules/zod/src/v4/locales/yo.ts +129 -0
  277. package/node_modules/zod/src/v4/locales/zh-CN.ts +121 -0
  278. package/node_modules/zod/src/v4/locales/zh-TW.ts +120 -0
  279. package/node_modules/zod/src/v4/mini/checks.ts +33 -0
  280. package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
  281. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  282. package/node_modules/zod/src/v4/mini/external.ts +52 -0
  283. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  284. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  285. package/node_modules/zod/src/v4/mini/iso.ts +66 -0
  286. package/node_modules/zod/src/v4/mini/parse.ts +16 -0
  287. package/node_modules/zod/src/v4/mini/schemas.ts +2051 -0
  288. package/node_modules/zod/src/v4-mini/index.ts +3 -0
  289. package/node_modules/zod/v3/ZodError.cjs +167 -0
  290. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  291. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  292. package/node_modules/zod/v3/ZodError.js +143 -0
  293. package/node_modules/zod/v3/errors.cjs +36 -0
  294. package/node_modules/zod/v3/errors.d.cts +5 -0
  295. package/node_modules/zod/v3/errors.d.ts +5 -0
  296. package/node_modules/zod/v3/errors.js +9 -0
  297. package/node_modules/zod/v3/external.cjs +41 -0
  298. package/node_modules/zod/v3/external.d.cts +6 -0
  299. package/node_modules/zod/v3/external.d.ts +6 -0
  300. package/node_modules/zod/v3/external.js +6 -0
  301. package/node_modules/zod/v3/helpers/enumUtil.cjs +21 -0
  302. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  303. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  304. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  305. package/node_modules/zod/v3/helpers/errorUtil.cjs +28 -0
  306. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  307. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  308. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  309. package/node_modules/zod/v3/helpers/parseUtil.cjs +143 -0
  310. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  311. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  312. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  313. package/node_modules/zod/v3/helpers/partialUtil.cjs +21 -0
  314. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  315. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  316. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  317. package/node_modules/zod/v3/helpers/typeAliases.cjs +21 -0
  318. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  319. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  320. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  321. package/node_modules/zod/v3/helpers/util.cjs +156 -0
  322. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  323. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  324. package/node_modules/zod/v3/helpers/util.js +133 -0
  325. package/node_modules/zod/v3/index.cjs +52 -0
  326. package/node_modules/zod/v3/index.d.cts +4 -0
  327. package/node_modules/zod/v3/index.d.ts +4 -0
  328. package/node_modules/zod/v3/index.js +4 -0
  329. package/node_modules/zod/v3/locales/en.cjs +112 -0
  330. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  331. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  332. package/node_modules/zod/v3/locales/en.js +109 -0
  333. package/node_modules/zod/v3/package.json +7 -0
  334. package/node_modules/zod/v3/standard-schema.cjs +21 -0
  335. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  336. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  337. package/node_modules/zod/v3/standard-schema.js +1 -0
  338. package/node_modules/zod/v3/types.cjs +3798 -0
  339. package/node_modules/zod/v3/types.d.cts +1034 -0
  340. package/node_modules/zod/v3/types.d.ts +1034 -0
  341. package/node_modules/zod/v3/types.js +3697 -0
  342. package/node_modules/zod/v4/classic/checks.cjs +53 -0
  343. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  344. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  345. package/node_modules/zod/v4/classic/checks.js +1 -0
  346. package/node_modules/zod/v4/classic/coerce.cjs +66 -0
  347. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  348. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  349. package/node_modules/zod/v4/classic/coerce.js +17 -0
  350. package/node_modules/zod/v4/classic/compat.cjs +80 -0
  351. package/node_modules/zod/v4/classic/compat.d.cts +48 -0
  352. package/node_modules/zod/v4/classic/compat.d.ts +48 -0
  353. package/node_modules/zod/v4/classic/compat.js +31 -0
  354. package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
  355. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  356. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  357. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  358. package/node_modules/zod/v4/classic/errors.cjs +102 -0
  359. package/node_modules/zod/v4/classic/errors.d.cts +29 -0
  360. package/node_modules/zod/v4/classic/errors.d.ts +29 -0
  361. package/node_modules/zod/v4/classic/errors.js +57 -0
  362. package/node_modules/zod/v4/classic/external.cjs +97 -0
  363. package/node_modules/zod/v4/classic/external.d.cts +19 -0
  364. package/node_modules/zod/v4/classic/external.d.ts +19 -0
  365. package/node_modules/zod/v4/classic/external.js +17 -0
  366. package/node_modules/zod/v4/classic/from-json-schema.cjs +926 -0
  367. package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
  368. package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
  369. package/node_modules/zod/v4/classic/from-json-schema.js +881 -0
  370. package/node_modules/zod/v4/classic/in-out.cjs +82 -0
  371. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  372. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  373. package/node_modules/zod/v4/classic/in-out.js +36 -0
  374. package/node_modules/zod/v4/classic/index.cjs +52 -0
  375. package/node_modules/zod/v4/classic/index.d.cts +3 -0
  376. package/node_modules/zod/v4/classic/index.d.ts +3 -0
  377. package/node_modules/zod/v4/classic/index.js +4 -0
  378. package/node_modules/zod/v4/classic/iso.cjs +68 -0
  379. package/node_modules/zod/v4/classic/iso.d.cts +7 -0
  380. package/node_modules/zod/v4/classic/iso.d.ts +7 -0
  381. package/node_modules/zod/v4/classic/iso.js +15 -0
  382. package/node_modules/zod/v4/classic/package.json +7 -0
  383. package/node_modules/zod/v4/classic/parse.cjs +63 -0
  384. package/node_modules/zod/v4/classic/parse.d.cts +44 -0
  385. package/node_modules/zod/v4/classic/parse.d.ts +44 -0
  386. package/node_modules/zod/v4/classic/parse.js +16 -0
  387. package/node_modules/zod/v4/classic/schemas.cjs +1676 -0
  388. package/node_modules/zod/v4/classic/schemas.d.cts +816 -0
  389. package/node_modules/zod/v4/classic/schemas.d.ts +816 -0
  390. package/node_modules/zod/v4/classic/schemas.js +1535 -0
  391. package/node_modules/zod/v4/core/api.cjs +1269 -0
  392. package/node_modules/zod/v4/core/api.d.cts +335 -0
  393. package/node_modules/zod/v4/core/api.d.ts +335 -0
  394. package/node_modules/zod/v4/core/api.js +1107 -0
  395. package/node_modules/zod/v4/core/checks.cjs +561 -0
  396. package/node_modules/zod/v4/core/checks.d.cts +294 -0
  397. package/node_modules/zod/v4/core/checks.d.ts +294 -0
  398. package/node_modules/zod/v4/core/checks.js +516 -0
  399. package/node_modules/zod/v4/core/compile.cjs +1916 -0
  400. package/node_modules/zod/v4/core/compile.d.cts +65 -0
  401. package/node_modules/zod/v4/core/compile.d.ts +65 -0
  402. package/node_modules/zod/v4/core/compile.js +1866 -0
  403. package/node_modules/zod/v4/core/core.cjs +167 -0
  404. package/node_modules/zod/v4/core/core.d.cts +82 -0
  405. package/node_modules/zod/v4/core/core.d.ts +82 -0
  406. package/node_modules/zod/v4/core/core.js +141 -0
  407. package/node_modules/zod/v4/core/doc.cjs +61 -0
  408. package/node_modules/zod/v4/core/doc.d.cts +16 -0
  409. package/node_modules/zod/v4/core/doc.d.ts +16 -0
  410. package/node_modules/zod/v4/core/doc.js +38 -0
  411. package/node_modules/zod/v4/core/errors.cjs +317 -0
  412. package/node_modules/zod/v4/core/errors.d.cts +225 -0
  413. package/node_modules/zod/v4/core/errors.d.ts +225 -0
  414. package/node_modules/zod/v4/core/errors.js +267 -0
  415. package/node_modules/zod/v4/core/index.cjs +70 -0
  416. package/node_modules/zod/v4/core/index.d.cts +19 -0
  417. package/node_modules/zod/v4/core/index.d.ts +19 -0
  418. package/node_modules/zod/v4/core/index.js +19 -0
  419. package/node_modules/zod/v4/core/json-schema-generator.cjs +122 -0
  420. package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
  421. package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
  422. package/node_modules/zod/v4/core/json-schema-generator.js +99 -0
  423. package/node_modules/zod/v4/core/json-schema-processors.cjs +929 -0
  424. package/node_modules/zod/v4/core/json-schema-processors.d.cts +65 -0
  425. package/node_modules/zod/v4/core/json-schema-processors.d.ts +65 -0
  426. package/node_modules/zod/v4/core/json-schema-processors.js +843 -0
  427. package/node_modules/zod/v4/core/json-schema.cjs +21 -0
  428. package/node_modules/zod/v4/core/json-schema.d.cts +89 -0
  429. package/node_modules/zod/v4/core/json-schema.d.ts +89 -0
  430. package/node_modules/zod/v4/core/json-schema.js +1 -0
  431. package/node_modules/zod/v4/core/memoizer.cjs +360 -0
  432. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  433. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  434. package/node_modules/zod/v4/core/memoizer.js +311 -0
  435. package/node_modules/zod/v4/core/package.json +7 -0
  436. package/node_modules/zod/v4/core/parse.cjs +233 -0
  437. package/node_modules/zod/v4/core/parse.d.cts +52 -0
  438. package/node_modules/zod/v4/core/parse.d.ts +52 -0
  439. package/node_modules/zod/v4/core/parse.js +175 -0
  440. package/node_modules/zod/v4/core/regexes.cjs +209 -0
  441. package/node_modules/zod/v4/core/regexes.d.cts +90 -0
  442. package/node_modules/zod/v4/core/regexes.d.ts +90 -0
  443. package/node_modules/zod/v4/core/regexes.js +156 -0
  444. package/node_modules/zod/v4/core/registries.cjs +75 -0
  445. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  446. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  447. package/node_modules/zod/v4/core/registries.js +51 -0
  448. package/node_modules/zod/v4/core/schemas.cjs +2699 -0
  449. package/node_modules/zod/v4/core/schemas.d.cts +1275 -0
  450. package/node_modules/zod/v4/core/schemas.d.ts +1275 -0
  451. package/node_modules/zod/v4/core/schemas.js +2636 -0
  452. package/node_modules/zod/v4/core/standard-schema.cjs +21 -0
  453. package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
  454. package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
  455. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  456. package/node_modules/zod/v4/core/to-json-schema.cjs +681 -0
  457. package/node_modules/zod/v4/core/to-json-schema.d.cts +154 -0
  458. package/node_modules/zod/v4/core/to-json-schema.d.ts +154 -0
  459. package/node_modules/zod/v4/core/to-json-schema.js +651 -0
  460. package/node_modules/zod/v4/core/util.cjs +964 -0
  461. package/node_modules/zod/v4/core/util.d.cts +280 -0
  462. package/node_modules/zod/v4/core/util.d.ts +280 -0
  463. package/node_modules/zod/v4/core/util.js +873 -0
  464. package/node_modules/zod/v4/core/versions.cjs +27 -0
  465. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  466. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  467. package/node_modules/zod/v4/core/versions.js +5 -0
  468. package/node_modules/zod/v4/core/visit.cjs +214 -0
  469. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  470. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  471. package/node_modules/zod/v4/core/visit.js +169 -0
  472. package/node_modules/zod/v4/index.cjs +51 -0
  473. package/node_modules/zod/v4/index.d.cts +3 -0
  474. package/node_modules/zod/v4/index.d.ts +3 -0
  475. package/node_modules/zod/v4/index.js +4 -0
  476. package/node_modules/zod/v4/locales/ar.cjs +138 -0
  477. package/node_modules/zod/v4/locales/ar.d.cts +5 -0
  478. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  479. package/node_modules/zod/v4/locales/ar.js +111 -0
  480. package/node_modules/zod/v4/locales/az.cjs +137 -0
  481. package/node_modules/zod/v4/locales/az.d.cts +5 -0
  482. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  483. package/node_modules/zod/v4/locales/az.js +110 -0
  484. package/node_modules/zod/v4/locales/be.cjs +195 -0
  485. package/node_modules/zod/v4/locales/be.d.cts +5 -0
  486. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  487. package/node_modules/zod/v4/locales/be.js +168 -0
  488. package/node_modules/zod/v4/locales/bg.cjs +152 -0
  489. package/node_modules/zod/v4/locales/bg.d.cts +5 -0
  490. package/node_modules/zod/v4/locales/bg.d.ts +4 -0
  491. package/node_modules/zod/v4/locales/bg.js +125 -0
  492. package/node_modules/zod/v4/locales/bn.cjs +140 -0
  493. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  494. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  495. package/node_modules/zod/v4/locales/bn.js +113 -0
  496. package/node_modules/zod/v4/locales/ca.cjs +139 -0
  497. package/node_modules/zod/v4/locales/ca.d.cts +5 -0
  498. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  499. package/node_modules/zod/v4/locales/ca.js +112 -0
  500. package/node_modules/zod/v4/locales/ckb.cjs +160 -0
  501. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  502. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  503. package/node_modules/zod/v4/locales/ckb.js +133 -0
  504. package/node_modules/zod/v4/locales/cs.cjs +143 -0
  505. package/node_modules/zod/v4/locales/cs.d.cts +5 -0
  506. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  507. package/node_modules/zod/v4/locales/cs.js +116 -0
  508. package/node_modules/zod/v4/locales/da.cjs +147 -0
  509. package/node_modules/zod/v4/locales/da.d.cts +5 -0
  510. package/node_modules/zod/v4/locales/da.d.ts +4 -0
  511. package/node_modules/zod/v4/locales/da.js +120 -0
  512. package/node_modules/zod/v4/locales/de.cjs +140 -0
  513. package/node_modules/zod/v4/locales/de.d.cts +5 -0
  514. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  515. package/node_modules/zod/v4/locales/de.js +113 -0
  516. package/node_modules/zod/v4/locales/el.cjs +139 -0
  517. package/node_modules/zod/v4/locales/el.d.cts +5 -0
  518. package/node_modules/zod/v4/locales/el.d.ts +4 -0
  519. package/node_modules/zod/v4/locales/el.js +112 -0
  520. package/node_modules/zod/v4/locales/en.cjs +152 -0
  521. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  522. package/node_modules/zod/v4/locales/en.d.ts +4 -0
  523. package/node_modules/zod/v4/locales/en.js +125 -0
  524. package/node_modules/zod/v4/locales/eo.cjs +141 -0
  525. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  526. package/node_modules/zod/v4/locales/eo.d.ts +4 -0
  527. package/node_modules/zod/v4/locales/eo.js +114 -0
  528. package/node_modules/zod/v4/locales/es.cjs +163 -0
  529. package/node_modules/zod/v4/locales/es.d.cts +5 -0
  530. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  531. package/node_modules/zod/v4/locales/es.js +136 -0
  532. package/node_modules/zod/v4/locales/fa.cjs +146 -0
  533. package/node_modules/zod/v4/locales/fa.d.cts +5 -0
  534. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  535. package/node_modules/zod/v4/locales/fa.js +119 -0
  536. package/node_modules/zod/v4/locales/fi.cjs +144 -0
  537. package/node_modules/zod/v4/locales/fi.d.cts +5 -0
  538. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  539. package/node_modules/zod/v4/locales/fi.js +117 -0
  540. package/node_modules/zod/v4/locales/fr-CA.cjs +139 -0
  541. package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
  542. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  543. package/node_modules/zod/v4/locales/fr-CA.js +112 -0
  544. package/node_modules/zod/v4/locales/fr.cjs +156 -0
  545. package/node_modules/zod/v4/locales/fr.d.cts +5 -0
  546. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  547. package/node_modules/zod/v4/locales/fr.js +129 -0
  548. package/node_modules/zod/v4/locales/gu.cjs +140 -0
  549. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  550. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  551. package/node_modules/zod/v4/locales/gu.js +113 -0
  552. package/node_modules/zod/v4/locales/he.cjs +248 -0
  553. package/node_modules/zod/v4/locales/he.d.cts +5 -0
  554. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  555. package/node_modules/zod/v4/locales/he.js +221 -0
  556. package/node_modules/zod/v4/locales/hi.cjs +138 -0
  557. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  558. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  559. package/node_modules/zod/v4/locales/hi.js +111 -0
  560. package/node_modules/zod/v4/locales/hr.cjs +153 -0
  561. package/node_modules/zod/v4/locales/hr.d.cts +5 -0
  562. package/node_modules/zod/v4/locales/hr.d.ts +4 -0
  563. package/node_modules/zod/v4/locales/hr.js +126 -0
  564. package/node_modules/zod/v4/locales/hu.cjs +140 -0
  565. package/node_modules/zod/v4/locales/hu.d.cts +5 -0
  566. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  567. package/node_modules/zod/v4/locales/hu.js +113 -0
  568. package/node_modules/zod/v4/locales/hy.cjs +185 -0
  569. package/node_modules/zod/v4/locales/hy.d.cts +5 -0
  570. package/node_modules/zod/v4/locales/hy.d.ts +4 -0
  571. package/node_modules/zod/v4/locales/hy.js +158 -0
  572. package/node_modules/zod/v4/locales/id.cjs +138 -0
  573. package/node_modules/zod/v4/locales/id.d.cts +5 -0
  574. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  575. package/node_modules/zod/v4/locales/id.js +111 -0
  576. package/node_modules/zod/v4/locales/index.cjs +152 -0
  577. package/node_modules/zod/v4/locales/index.d.cts +63 -0
  578. package/node_modules/zod/v4/locales/index.d.ts +63 -0
  579. package/node_modules/zod/v4/locales/index.js +63 -0
  580. package/node_modules/zod/v4/locales/is.cjs +141 -0
  581. package/node_modules/zod/v4/locales/is.d.cts +5 -0
  582. package/node_modules/zod/v4/locales/is.d.ts +4 -0
  583. package/node_modules/zod/v4/locales/is.js +114 -0
  584. package/node_modules/zod/v4/locales/it.cjs +140 -0
  585. package/node_modules/zod/v4/locales/it.d.cts +5 -0
  586. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  587. package/node_modules/zod/v4/locales/it.js +113 -0
  588. package/node_modules/zod/v4/locales/ja.cjs +139 -0
  589. package/node_modules/zod/v4/locales/ja.d.cts +5 -0
  590. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  591. package/node_modules/zod/v4/locales/ja.js +112 -0
  592. package/node_modules/zod/v4/locales/ka.cjs +144 -0
  593. package/node_modules/zod/v4/locales/ka.d.cts +5 -0
  594. package/node_modules/zod/v4/locales/ka.d.ts +4 -0
  595. package/node_modules/zod/v4/locales/ka.js +117 -0
  596. package/node_modules/zod/v4/locales/kh.cjs +12 -0
  597. package/node_modules/zod/v4/locales/kh.d.cts +5 -0
  598. package/node_modules/zod/v4/locales/kh.d.ts +5 -0
  599. package/node_modules/zod/v4/locales/kh.js +5 -0
  600. package/node_modules/zod/v4/locales/km.cjs +142 -0
  601. package/node_modules/zod/v4/locales/km.d.cts +5 -0
  602. package/node_modules/zod/v4/locales/km.d.ts +4 -0
  603. package/node_modules/zod/v4/locales/km.js +115 -0
  604. package/node_modules/zod/v4/locales/kn.cjs +143 -0
  605. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  606. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  607. package/node_modules/zod/v4/locales/kn.js +116 -0
  608. package/node_modules/zod/v4/locales/ko.cjs +143 -0
  609. package/node_modules/zod/v4/locales/ko.d.cts +5 -0
  610. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  611. package/node_modules/zod/v4/locales/ko.js +116 -0
  612. package/node_modules/zod/v4/locales/lt.cjs +234 -0
  613. package/node_modules/zod/v4/locales/lt.d.cts +5 -0
  614. package/node_modules/zod/v4/locales/lt.d.ts +4 -0
  615. package/node_modules/zod/v4/locales/lt.js +207 -0
  616. package/node_modules/zod/v4/locales/mk.cjs +141 -0
  617. package/node_modules/zod/v4/locales/mk.d.cts +5 -0
  618. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  619. package/node_modules/zod/v4/locales/mk.js +114 -0
  620. package/node_modules/zod/v4/locales/ms.cjs +139 -0
  621. package/node_modules/zod/v4/locales/ms.d.cts +5 -0
  622. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  623. package/node_modules/zod/v4/locales/ms.js +112 -0
  624. package/node_modules/zod/v4/locales/ne.cjs +138 -0
  625. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  626. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  627. package/node_modules/zod/v4/locales/ne.js +111 -0
  628. package/node_modules/zod/v4/locales/nl.cjs +142 -0
  629. package/node_modules/zod/v4/locales/nl.d.cts +5 -0
  630. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  631. package/node_modules/zod/v4/locales/nl.js +115 -0
  632. package/node_modules/zod/v4/locales/nn.cjs +140 -0
  633. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  634. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  635. package/node_modules/zod/v4/locales/nn.js +113 -0
  636. package/node_modules/zod/v4/locales/no.cjs +140 -0
  637. package/node_modules/zod/v4/locales/no.d.cts +5 -0
  638. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  639. package/node_modules/zod/v4/locales/no.js +113 -0
  640. package/node_modules/zod/v4/locales/ota.cjs +141 -0
  641. package/node_modules/zod/v4/locales/ota.d.cts +5 -0
  642. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  643. package/node_modules/zod/v4/locales/ota.js +114 -0
  644. package/node_modules/zod/v4/locales/package.json +7 -0
  645. package/node_modules/zod/v4/locales/pl.cjs +141 -0
  646. package/node_modules/zod/v4/locales/pl.d.cts +5 -0
  647. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  648. package/node_modules/zod/v4/locales/pl.js +114 -0
  649. package/node_modules/zod/v4/locales/ps.cjs +146 -0
  650. package/node_modules/zod/v4/locales/ps.d.cts +5 -0
  651. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  652. package/node_modules/zod/v4/locales/ps.js +119 -0
  653. package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
  654. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  655. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  656. package/node_modules/zod/v4/locales/pt-BR.js +143 -0
  657. package/node_modules/zod/v4/locales/pt.cjs +169 -0
  658. package/node_modules/zod/v4/locales/pt.d.cts +5 -0
  659. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  660. package/node_modules/zod/v4/locales/pt.js +142 -0
  661. package/node_modules/zod/v4/locales/ro.cjs +149 -0
  662. package/node_modules/zod/v4/locales/ro.d.cts +5 -0
  663. package/node_modules/zod/v4/locales/ro.d.ts +4 -0
  664. package/node_modules/zod/v4/locales/ro.js +122 -0
  665. package/node_modules/zod/v4/locales/ru.cjs +195 -0
  666. package/node_modules/zod/v4/locales/ru.d.cts +5 -0
  667. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  668. package/node_modules/zod/v4/locales/ru.js +168 -0
  669. package/node_modules/zod/v4/locales/sk.cjs +143 -0
  670. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  671. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  672. package/node_modules/zod/v4/locales/sk.js +116 -0
  673. package/node_modules/zod/v4/locales/sl.cjs +141 -0
  674. package/node_modules/zod/v4/locales/sl.d.cts +5 -0
  675. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  676. package/node_modules/zod/v4/locales/sl.js +114 -0
  677. package/node_modules/zod/v4/locales/sv.cjs +142 -0
  678. package/node_modules/zod/v4/locales/sv.d.cts +5 -0
  679. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  680. package/node_modules/zod/v4/locales/sv.js +115 -0
  681. package/node_modules/zod/v4/locales/ta.cjs +142 -0
  682. package/node_modules/zod/v4/locales/ta.d.cts +5 -0
  683. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  684. package/node_modules/zod/v4/locales/ta.js +115 -0
  685. package/node_modules/zod/v4/locales/tg.cjs +144 -0
  686. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  687. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  688. package/node_modules/zod/v4/locales/tg.js +117 -0
  689. package/node_modules/zod/v4/locales/th.cjs +142 -0
  690. package/node_modules/zod/v4/locales/th.d.cts +5 -0
  691. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  692. package/node_modules/zod/v4/locales/th.js +115 -0
  693. package/node_modules/zod/v4/locales/tk.cjs +134 -0
  694. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  695. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  696. package/node_modules/zod/v4/locales/tk.js +107 -0
  697. package/node_modules/zod/v4/locales/tr.cjs +137 -0
  698. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  699. package/node_modules/zod/v4/locales/tr.d.ts +4 -0
  700. package/node_modules/zod/v4/locales/tr.js +110 -0
  701. package/node_modules/zod/v4/locales/ua.cjs +12 -0
  702. package/node_modules/zod/v4/locales/ua.d.cts +5 -0
  703. package/node_modules/zod/v4/locales/ua.d.ts +5 -0
  704. package/node_modules/zod/v4/locales/ua.js +5 -0
  705. package/node_modules/zod/v4/locales/uk.cjs +140 -0
  706. package/node_modules/zod/v4/locales/uk.d.cts +5 -0
  707. package/node_modules/zod/v4/locales/uk.d.ts +4 -0
  708. package/node_modules/zod/v4/locales/uk.js +113 -0
  709. package/node_modules/zod/v4/locales/ur.cjs +142 -0
  710. package/node_modules/zod/v4/locales/ur.d.cts +5 -0
  711. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  712. package/node_modules/zod/v4/locales/ur.js +115 -0
  713. package/node_modules/zod/v4/locales/uz.cjs +140 -0
  714. package/node_modules/zod/v4/locales/uz.d.cts +5 -0
  715. package/node_modules/zod/v4/locales/uz.d.ts +4 -0
  716. package/node_modules/zod/v4/locales/uz.js +113 -0
  717. package/node_modules/zod/v4/locales/vi.cjs +140 -0
  718. package/node_modules/zod/v4/locales/vi.d.cts +5 -0
  719. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  720. package/node_modules/zod/v4/locales/vi.js +113 -0
  721. package/node_modules/zod/v4/locales/yo.cjs +139 -0
  722. package/node_modules/zod/v4/locales/yo.d.cts +5 -0
  723. package/node_modules/zod/v4/locales/yo.d.ts +4 -0
  724. package/node_modules/zod/v4/locales/yo.js +112 -0
  725. package/node_modules/zod/v4/locales/zh-CN.cjs +141 -0
  726. package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
  727. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  728. package/node_modules/zod/v4/locales/zh-CN.js +114 -0
  729. package/node_modules/zod/v4/locales/zh-TW.cjs +139 -0
  730. package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
  731. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  732. package/node_modules/zod/v4/locales/zh-TW.js +112 -0
  733. package/node_modules/zod/v4/mini/checks.cjs +54 -0
  734. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  735. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  736. package/node_modules/zod/v4/mini/checks.js +1 -0
  737. package/node_modules/zod/v4/mini/coerce.cjs +71 -0
  738. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  739. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  740. package/node_modules/zod/v4/mini/coerce.js +22 -0
  741. package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
  742. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  743. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  744. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  745. package/node_modules/zod/v4/mini/external.cjs +95 -0
  746. package/node_modules/zod/v4/mini/external.d.cts +16 -0
  747. package/node_modules/zod/v4/mini/external.d.ts +16 -0
  748. package/node_modules/zod/v4/mini/external.js +16 -0
  749. package/node_modules/zod/v4/mini/in-out.cjs +82 -0
  750. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  751. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  752. package/node_modules/zod/v4/mini/in-out.js +36 -0
  753. package/node_modules/zod/v4/mini/index.cjs +51 -0
  754. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  755. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  756. package/node_modules/zod/v4/mini/index.js +3 -0
  757. package/node_modules/zod/v4/mini/iso.cjs +83 -0
  758. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  759. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  760. package/node_modules/zod/v4/mini/iso.js +34 -0
  761. package/node_modules/zod/v4/mini/package.json +7 -0
  762. package/node_modules/zod/v4/mini/parse.cjs +37 -0
  763. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  764. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  765. package/node_modules/zod/v4/mini/parse.js +1 -0
  766. package/node_modules/zod/v4/mini/schemas.cjs +1147 -0
  767. package/node_modules/zod/v4/mini/schemas.d.cts +480 -0
  768. package/node_modules/zod/v4/mini/schemas.d.ts +480 -0
  769. package/node_modules/zod/v4/mini/schemas.js +1002 -0
  770. package/node_modules/zod/v4/package.json +7 -0
  771. package/node_modules/zod/v4-mini/index.cjs +51 -0
  772. package/node_modules/zod/v4-mini/index.d.cts +3 -0
  773. package/node_modules/zod/v4-mini/index.d.ts +3 -0
  774. package/node_modules/zod/v4-mini/index.js +3 -0
  775. package/node_modules/zod/v4-mini/package.json +7 -0
  776. package/package.json +32 -4
  777. package/runtime.cjs +14 -0
  778. package/scripts/arguments.mjs +77 -0
  779. package/scripts/continuation.mjs +31 -0
  780. package/scripts/create-task.mjs +27 -0
  781. package/scripts/delete-task.mjs +3 -0
  782. package/scripts/entry.mjs +6 -0
  783. package/scripts/get-task.mjs +40 -0
  784. package/scripts/get-tasks.mjs +84 -0
  785. package/scripts/hook.mjs +89 -0
  786. package/scripts/inspect-blockers.mjs +76 -0
  787. package/scripts/install-launcher.mjs +28 -0
  788. package/scripts/install-migration.mjs +82 -0
  789. package/scripts/install-path.mjs +105 -0
  790. package/scripts/install-release.mjs +252 -0
  791. package/scripts/lifecycle.mjs +35 -0
  792. package/scripts/list-tasks.mjs +117 -0
  793. package/scripts/output.mjs +67 -0
  794. package/scripts/schema.mjs +41 -0
  795. package/scripts/search-tasks.mjs +96 -0
  796. package/scripts/task-write-input.mjs +80 -0
  797. package/scripts/transition-task.mjs +3 -0
  798. package/scripts/update-release.mjs +82 -0
  799. package/scripts/update-task.mjs +29 -0
  800. package/scripts/validate-task-stores.mjs +34 -0
  801. package/src/blockers.mjs +134 -0
  802. package/src/cache.mjs +50 -0
  803. package/src/config.mjs +30 -0
  804. package/src/create.mjs +145 -0
  805. package/src/cursor.mjs +30 -0
  806. package/src/destinations.mjs +74 -0
  807. package/src/errors.mjs +16 -0
  808. package/src/field-rules.mjs +105 -0
  809. package/src/fields.mjs +32 -0
  810. package/src/input.mjs +146 -0
  811. package/src/limits.mjs +5 -0
  812. package/src/locations.mjs +19 -0
  813. package/src/pagination.mjs +30 -0
  814. package/src/project-lock.mjs +74 -0
  815. package/src/projects.mjs +33 -0
  816. package/src/response.mjs +75 -0
  817. package/src/schema.mjs +76 -0
  818. package/src/search-index-worker.mjs +10 -0
  819. package/src/search-index.mjs +639 -0
  820. package/src/search.mjs +228 -0
  821. package/src/service.mjs +260 -0
  822. package/src/source.mjs +48 -0
  823. package/src/sqlite.mjs +17 -0
  824. package/src/storage-format.mjs +15 -0
  825. package/src/stores.mjs +337 -0
  826. package/src/tasks.mjs +290 -0
  827. package/src/timestamps.mjs +22 -0
  828. package/src/transition.mjs +181 -0
  829. package/src/update.mjs +56 -0
  830. package/src/validation.mjs +144 -0
  831. package/src/version.mjs +5 -0
@@ -0,0 +1,4170 @@
1
+ import { i as jsonSchemaValidator } from "./types-DsbMXNFL.cjs";
2
+ import { AnnotationsSchema, AudioContentSchema, AuthorizationServerMetadata, BAGGAGE_META_KEY, BaseMetadataSchema, BaseRequestParamsSchema, BlobResourceContentsSchema, BooleanSchemaSchema, CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, CallToolRequestParamsSchema, CallToolRequestSchema, CallToolResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, CancelledNotificationParamsSchema, CancelledNotificationSchema, ClientCapabilitiesSchema, ClientNotificationSchema, ClientRequestSchema, ClientResultSchema, ClientTasksCapabilitySchema, CompatibilityCallToolResultSchema, CompleteRequestParamsSchema, CompleteRequestSchema, CompleteResultSchema, ContentBlockSchema, CreateMessageRequestParamsSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, CreateTaskResultSchema, CursorSchema, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, DiscoverRequestSchema, DiscoverResultSchema, ElicitRequestFormParamsSchema, ElicitRequestParamsSchema, ElicitRequestSchema, ElicitRequestURLParamsSchema, ElicitResultSchema, ElicitationCompleteNotificationParamsSchema, ElicitationCompleteNotificationSchema, EmbeddedResourceSchema, EmptyResultSchema, EnumSchemaSchema, GetPromptRequestParamsSchema, GetPromptRequestSchema, GetPromptResultSchema, GetTaskPayloadRequestSchema, GetTaskPayloadResultSchema, GetTaskRequestSchema, GetTaskResultSchema, INTERNAL_ERROR, INVALID_PARAMS, INVALID_REQUEST, IconSchema, IconsSchema, IdJagTokenExchangeResponse, ImageContentSchema, ImplementationSchema, InitializeRequestParamsSchema, InitializeRequestSchema, InitializeResultSchema, InitializedNotificationSchema, JSONArray, JSONArraySchema, JSONObject, JSONObjectSchema, JSONRPCErrorResponseSchema, JSONRPCMessageSchema, JSONRPCNotificationSchema, JSONRPCRequestSchema, JSONRPCResponseSchema, JSONRPCResultResponseSchema, JSONRPC_VERSION, JSONValue, JSONValueSchema, LATEST_PROTOCOL_VERSION, LOG_LEVEL_META_KEY, LegacyTitledEnumSchemaSchema, ListChangedOptionsBaseSchema, ListPromptsRequestSchema, ListPromptsResultSchema, ListResourceTemplatesRequestSchema, ListResourceTemplatesResultSchema, ListResourcesRequestSchema, ListResourcesResultSchema, ListRootsRequestSchema, ListRootsResultSchema, ListTasksRequestSchema, ListTasksResultSchema, ListToolsRequestSchema, ListToolsResultSchema, LoggingLevelSchema, LoggingMessageNotificationParamsSchema, LoggingMessageNotificationSchema, METHOD_NOT_FOUND, ModelHintSchema, ModelPreferencesSchema, MultiSelectEnumSchemaSchema, NotificationSchema, NotificationsParamsSchema, NumberSchemaSchema, OAuthClientInformation, OAuthClientInformationFull, OAuthClientInformationMixed, OAuthClientMetadata, OAuthClientRegistrationError, OAuthErrorResponse, OAuthMetadata, OAuthProtectedResourceMetadata, OAuthTokenRevocationRequest, OAuthTokens, OpenIdProviderDiscoveryMetadata, OpenIdProviderMetadata, PARSE_ERROR, PROTOCOL_VERSION_META_KEY, PaginatedRequestParamsSchema, PaginatedRequestSchema, PaginatedResultSchema, PingRequestSchema, PrimitiveSchemaDefinitionSchema, ProgressNotificationParamsSchema, ProgressNotificationSchema, ProgressSchema, ProgressTokenSchema, PromptArgumentSchema, PromptListChangedNotificationSchema, PromptMessageSchema, PromptReferenceSchema, PromptSchema, RELATED_TASK_META_KEY, ReadResourceRequestParamsSchema, ReadResourceRequestSchema, ReadResourceResultSchema, RelatedTaskMetadataSchema, RequestIdSchema, RequestMetaSchema, RequestSchema, ResourceContentsSchema, ResourceLinkSchema, ResourceListChangedNotificationSchema, ResourceRequestParamsSchema, ResourceSchema, ResourceTemplateReferenceSchema, ResourceTemplateSchema, ResourceUpdatedNotificationParamsSchema, ResourceUpdatedNotificationSchema, ResultMetaObjectSchema, ResultSchema, RoleSchema, RootSchema, RootsListChangedNotificationSchema, SERVER_INFO_META_KEY, SUBSCRIPTION_ID_META_KEY, SUPPORTED_PROTOCOL_VERSIONS, SamplingContentSchema, SamplingMessageContentBlockSchema, SamplingMessageSchema, ServerCapabilitiesSchema, ServerNotificationSchema, ServerRequestSchema, ServerResultSchema, ServerTasksCapabilitySchema, SetLevelRequestParamsSchema, SetLevelRequestSchema, SingleSelectEnumSchemaSchema, StoredOAuthClientInformation, StoredOAuthTokens, StringSchemaSchema, SubscribeRequestParamsSchema, SubscribeRequestSchema, SubscriptionFilterSchema, SubscriptionsAcknowledgedNotificationParamsSchema, SubscriptionsAcknowledgedNotificationSchema, SubscriptionsListenRequestParamsSchema, SubscriptionsListenRequestSchema, SubscriptionsListenResultMetaSchema, SubscriptionsListenResultSchema, TRACEPARENT_META_KEY, TRACESTATE_META_KEY, TaskAugmentedRequestParamsSchema, TaskCreationParamsSchema, TaskMetadataSchema, TaskSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, TaskStatusSchema, TextContentSchema, TextResourceContentsSchema, TitledMultiSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema, ToolAnnotationsSchema, ToolChoiceSchema, ToolExecutionSchema, ToolListChangedNotificationSchema, ToolResultContentSchema, ToolSchema, ToolUseContentSchema, UnsubscribeRequestParamsSchema, UnsubscribeRequestSchema, UntitledMultiSelectEnumSchemaSchema, UntitledSingleSelectEnumSchemaSchema } from "@modelcontextprotocol/core/internal";
3
+ import * as z from "zod/v4";
4
+
5
+ //#region rolldown:runtime
6
+ //#endregion
7
+ //#region ../core-internal/src/auth/errors.d.ts
8
+ /**
9
+ * OAuth error codes as defined by {@link https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 | RFC 6749}
10
+ * and extensions.
11
+ */
12
+ declare enum OAuthErrorCode {
13
+ /**
14
+ * The request is missing a required parameter, includes an invalid parameter value,
15
+ * includes a parameter more than once, or is otherwise malformed.
16
+ */
17
+ InvalidRequest = "invalid_request",
18
+ /**
19
+ * Client authentication failed (e.g., unknown client, no client authentication included,
20
+ * or unsupported authentication method).
21
+ */
22
+ InvalidClient = "invalid_client",
23
+ /**
24
+ * The provided authorization grant or refresh token is invalid, expired, revoked,
25
+ * does not match the redirection URI used in the authorization request, or was issued to another client.
26
+ */
27
+ InvalidGrant = "invalid_grant",
28
+ /**
29
+ * The authenticated client is not authorized to use this authorization grant type.
30
+ */
31
+ UnauthorizedClient = "unauthorized_client",
32
+ /**
33
+ * The authorization grant type is not supported by the authorization server.
34
+ */
35
+ UnsupportedGrantType = "unsupported_grant_type",
36
+ /**
37
+ * The requested scope is invalid, unknown, malformed, or exceeds the scope granted by the resource owner.
38
+ */
39
+ InvalidScope = "invalid_scope",
40
+ /**
41
+ * The resource owner or authorization server denied the request.
42
+ */
43
+ AccessDenied = "access_denied",
44
+ /**
45
+ * The authorization server encountered an unexpected condition that prevented it from fulfilling the request.
46
+ */
47
+ ServerError = "server_error",
48
+ /**
49
+ * The authorization server is currently unable to handle the request due to temporary overloading or maintenance.
50
+ */
51
+ TemporarilyUnavailable = "temporarily_unavailable",
52
+ /**
53
+ * The authorization server does not support obtaining an authorization code using this method.
54
+ */
55
+ UnsupportedResponseType = "unsupported_response_type",
56
+ /**
57
+ * The authorization server does not support the requested token type.
58
+ */
59
+ UnsupportedTokenType = "unsupported_token_type",
60
+ /**
61
+ * The access token provided is expired, revoked, malformed, or invalid for other reasons.
62
+ */
63
+ InvalidToken = "invalid_token",
64
+ /**
65
+ * The HTTP method used is not allowed for this endpoint. (Custom, non-standard error)
66
+ */
67
+ MethodNotAllowed = "method_not_allowed",
68
+ /**
69
+ * Rate limit exceeded. (Custom, non-standard error based on RFC 6585)
70
+ */
71
+ TooManyRequests = "too_many_requests",
72
+ /**
73
+ * The client metadata is invalid. (Custom error for dynamic client registration - RFC 7591)
74
+ */
75
+ InvalidClientMetadata = "invalid_client_metadata",
76
+ /**
77
+ * The value of one or more redirection URIs is invalid. (Dynamic client registration - RFC 7591 §3.2.2)
78
+ */
79
+ InvalidRedirectUri = "invalid_redirect_uri",
80
+ /**
81
+ * The request requires higher privileges than provided by the access token.
82
+ */
83
+ InsufficientScope = "insufficient_scope",
84
+ /**
85
+ * The requested resource is invalid, missing, unknown, or malformed. (Custom error for resource indicators - RFC 8707)
86
+ */
87
+ InvalidTarget = "invalid_target",
88
+ /**
89
+ * The DPoP proof accompanying the request is invalid, or does not match the key the grant
90
+ * (e.g. a refresh token) is bound to. (RFC 9449 §5 / §7.1)
91
+ */
92
+ InvalidDpopProof = "invalid_dpop_proof",
93
+ /**
94
+ * The server requires a server-supplied nonce in the DPoP proof; retry with the `DPoP-Nonce`
95
+ * it returned. (RFC 9449 §8 / §9)
96
+ */
97
+ UseDpopNonce = "use_dpop_nonce",
98
+ }
99
+ /**
100
+ * OAuth error class for all OAuth-related errors.
101
+ */
102
+ declare class OAuthError extends Error {
103
+ readonly code: OAuthErrorCode | string;
104
+ readonly errorUri?: string | undefined;
105
+ static [Symbol.hasInstance](value: unknown): boolean;
106
+ /**
107
+ * Brand-based type guard: equivalent to `value instanceof this`, as an
108
+ * explicit static predicate (the axios/AWS-SDK `isInstance` style). Reads
109
+ * the caller's own brand via `this`, so every branded subclass gets a
110
+ * correctly-scoped guard by inheritance. Must be invoked on the class —
111
+ * in callback position write `v => SdkError.isInstance(v)`, not
112
+ * `.filter(SdkError.isInstance)` (detached calls throw rather than
113
+ * silently matching nothing).
114
+ */
115
+ static isInstance<T$1 extends abstract new (...args: never[]) => unknown>(this: T$1, value: unknown): value is InstanceType<T$1>;
116
+ constructor(code: OAuthErrorCode | string, message: string, errorUri?: string | undefined);
117
+ /**
118
+ * Converts the error to a standard OAuth error response object.
119
+ */
120
+ toResponseObject(): OAuthErrorResponse;
121
+ /**
122
+ * Creates an {@linkcode OAuthError} from an OAuth error response.
123
+ */
124
+ static fromResponse(response: OAuthErrorResponse): OAuthError;
125
+ }
126
+ //#endregion
127
+ //#region ../core-internal/src/errors/sdkErrors.d.ts
128
+ /**
129
+ * Error codes for SDK errors (local errors that never cross the wire).
130
+ * Unlike {@linkcode ProtocolErrorCode} which uses numeric JSON-RPC codes, `SdkErrorCode` uses
131
+ * descriptive string values for better developer experience.
132
+ *
133
+ * These errors are thrown locally by the SDK and are never serialized as
134
+ * JSON-RPC error responses.
135
+ */
136
+ declare enum SdkErrorCode {
137
+ /** Transport is not connected */
138
+ NotConnected = "NOT_CONNECTED",
139
+ /** Transport is already connected */
140
+ AlreadyConnected = "ALREADY_CONNECTED",
141
+ /** Protocol is not initialized */
142
+ NotInitialized = "NOT_INITIALIZED",
143
+ /** Required capability is not supported by the remote side */
144
+ CapabilityNotSupported = "CAPABILITY_NOT_SUPPORTED",
145
+ /** Request timed out waiting for response */
146
+ RequestTimeout = "REQUEST_TIMEOUT",
147
+ /** Connection was closed */
148
+ ConnectionClosed = "CONNECTION_CLOSED",
149
+ /** Failed to send message */
150
+ SendFailed = "SEND_FAILED",
151
+ /** Response result failed local schema validation */
152
+ InvalidResult = "INVALID_RESULT",
153
+ /**
154
+ * The response carried a `resultType` discriminator (protocol revision
155
+ * 2026-07-28) naming a result kind this client cannot consume yet, e.g.
156
+ * `input_required`. The kind is carried in `data.resultType`.
157
+ */
158
+ UnsupportedResultType = "UNSUPPORTED_RESULT_TYPE",
159
+ /**
160
+ * The multi-round-trip auto-fulfilment driver exhausted its round cap
161
+ * (`inputRequired.maxRounds`) without the server returning a complete
162
+ * result. `data.rounds` carries the cap that was hit and
163
+ * `data.lastResult` carries the last `input_required` payload received
164
+ * (`{ inputRequests, requestState? }`), so callers can inspect or resume
165
+ * the flow manually.
166
+ */
167
+ InputRequiredRoundsExceeded = "INPUT_REQUIRED_ROUNDS_EXCEEDED",
168
+ /**
169
+ * The auto-aggregating no-`cursor` `listTools()` / `listPrompts()` /
170
+ * `listResources()` / `listResourceTemplates()` walk hit the
171
+ * `ClientOptions.listMaxPages` cap without the server's pagination
172
+ * converging. `data.method` carries the list verb and
173
+ * `data.listMaxPages` the cap that was hit; raise the cap or fall back to
174
+ * explicit per-page `{ cursor }` calls.
175
+ */
176
+ ListPaginationExceeded = "LIST_PAGINATION_EXCEEDED",
177
+ /**
178
+ * The spec method being sent does not exist on the negotiated protocol
179
+ * version's wire era (e.g. `tasks/get` toward a 2026-07-28 peer, or
180
+ * `server/discover` toward a 2025-era peer). Raised locally, before
181
+ * anything reaches the transport. The method and era are carried in
182
+ * `data.method` / `data.era`.
183
+ */
184
+ MethodNotSupportedByProtocolVersion = "METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",
185
+ /**
186
+ * Protocol-era negotiation at connect time failed without producing either a
187
+ * usable modern (2026-07-28+) era or a definitive legacy fallback signal —
188
+ * e.g. the negotiation mode forbids falling back (`pin`), the probe hit a
189
+ * network failure, or the server answered the probe with a 5xx (a typed
190
+ * connect error, never an era verdict).
191
+ *
192
+ * Negotiation-phase only: this code is never used once an era is
193
+ * established. Auth walls never carry it: a 401/403 rejecting the probe
194
+ * uses {@linkcode ClientHttpAuthentication} / {@linkcode ClientHttpForbidden}
195
+ * instead, so era-recovery flows keyed on this code (e.g. cached-verdict
196
+ * gateways) can never persist a verdict for an unauthorized exchange.
197
+ */
198
+ EraNegotiationFailed = "ERA_NEGOTIATION_FAILED",
199
+ ClientHttpNotImplemented = "CLIENT_HTTP_NOT_IMPLEMENTED",
200
+ /**
201
+ * HTTP 401 authentication failure: the transport's re-auth retry still got
202
+ * 401 (`Server returned 401 after re-authentication`), or the version
203
+ * negotiation probe was rejected 401 with no `authProvider` configured
204
+ * (`Version negotiation failed: the server requires authorization (HTTP 401)`).
205
+ * Carried on an {@linkcode SdkHttpError} with `status: 401`.
206
+ */
207
+ ClientHttpAuthentication = "CLIENT_HTTP_AUTHENTICATION",
208
+ /**
209
+ * HTTP 403 denial: the step-up re-authorization retry limit was reached,
210
+ * or the version negotiation probe was rejected 403
211
+ * (`Version negotiation failed: the server denied access (HTTP 403)`).
212
+ * Carried on an {@linkcode SdkHttpError} with `status: 403`.
213
+ */
214
+ ClientHttpForbidden = "CLIENT_HTTP_FORBIDDEN",
215
+ ClientHttpUnexpectedContent = "CLIENT_HTTP_UNEXPECTED_CONTENT",
216
+ ClientHttpFailedToOpenStream = "CLIENT_HTTP_FAILED_TO_OPEN_STREAM",
217
+ ClientHttpFailedToTerminateSession = "CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",
218
+ }
219
+ /**
220
+ * SDK errors are local errors that never cross the wire.
221
+ * They are distinct from {@linkcode ProtocolError} which represents JSON-RPC protocol errors
222
+ * that are serialized and sent as error responses.
223
+ *
224
+ * @example
225
+ * ```ts source="./sdkErrors.examples.ts#SdkError_basicUsage"
226
+ * try {
227
+ * // Throwing an SDK error
228
+ * throw new SdkError(SdkErrorCode.NotConnected, 'Transport is not connected');
229
+ * } catch (error) {
230
+ * // Checking error type by code
231
+ * if (error instanceof SdkError && error.code === SdkErrorCode.RequestTimeout) {
232
+ * // Handle timeout
233
+ * }
234
+ * }
235
+ * ```
236
+ */
237
+ declare class SdkError extends Error {
238
+ readonly code: SdkErrorCode;
239
+ readonly data?: unknown | undefined;
240
+ static [Symbol.hasInstance](value: unknown): boolean;
241
+ /**
242
+ * Brand-based type guard: equivalent to `value instanceof this`, as an
243
+ * explicit static predicate (the axios/AWS-SDK `isInstance` style). Reads
244
+ * the caller's own brand via `this`, so every branded subclass gets a
245
+ * correctly-scoped guard by inheritance. Must be invoked on the class —
246
+ * in callback position write `v => SdkError.isInstance(v)`, not
247
+ * `.filter(SdkError.isInstance)` (detached calls throw rather than
248
+ * silently matching nothing).
249
+ */
250
+ static isInstance<T$1 extends abstract new (...args: never[]) => unknown>(this: T$1, value: unknown): value is InstanceType<T$1>;
251
+ /**
252
+ * @param code - Stable string code identifying the failure ({@linkcode SdkErrorCode}).
253
+ * @param message - Human-readable description.
254
+ * @param data - Optional structured payload (for example the HTTP status carried by
255
+ * {@linkcode SdkHttpError}). Opaque to the SDK: a `cause` key inside `data` is not
256
+ * promoted to `Error.cause`.
257
+ * @param options - Standard `ErrorOptions`, forwarded to `Error`. Pass the underlying
258
+ * failure as `{ cause }` so it is reachable through the `Error.cause` chain that
259
+ * loggers and error trackers walk.
260
+ */
261
+ constructor(code: SdkErrorCode, message: string, data?: unknown | undefined, options?: ErrorOptions);
262
+ }
263
+ /**
264
+ * Typed shape for HTTP error data carried by {@linkcode SdkHttpError}.
265
+ */
266
+ interface SdkHttpErrorData {
267
+ status: number;
268
+ statusText?: string;
269
+ [key: string]: unknown;
270
+ }
271
+ /**
272
+ * An {@linkcode SdkError} subclass for HTTP transport failures.
273
+ *
274
+ * Thrown by the streamable HTTP transport when the server responds with a
275
+ * non-OK status code. Narrows {@linkcode SdkError.data | data} to
276
+ * {@linkcode SdkHttpErrorData} so consumers can inspect the HTTP status
277
+ * without unsafe casting.
278
+ *
279
+ * @example
280
+ * ```ts source="./sdkErrors.examples.ts#SdkHttpError_basicUsage"
281
+ * if (error instanceof SdkHttpError) {
282
+ * console.log(error.status); // number
283
+ * console.log(error.statusText); // string | undefined
284
+ * }
285
+ * ```
286
+ */
287
+ declare class SdkHttpError extends SdkError {
288
+ readonly data: SdkHttpErrorData;
289
+ /**
290
+ * @param options - Standard `ErrorOptions`, forwarded to `Error` (see {@linkcode SdkError}).
291
+ */
292
+ constructor(code: SdkErrorCode, message: string, data: SdkHttpErrorData, options?: ErrorOptions);
293
+ get status(): number;
294
+ get statusText(): string | undefined;
295
+ }
296
+ //#endregion
297
+ //#region ../core-internal/src/shared/authUtils.d.ts
298
+ /**
299
+ * Utilities for handling OAuth resource URIs.
300
+ */
301
+ /**
302
+ * Converts a server URL to a resource URL by removing the fragment.
303
+ * {@link https://datatracker.ietf.org/doc/html/rfc8707#section-2 | RFC 8707 section 2}
304
+ * states that resource URIs "MUST NOT include a fragment component".
305
+ * Keeps everything else unchanged (scheme, domain, port, path, query).
306
+ */
307
+ declare function resourceUrlFromServerUrl(url: URL | string): URL;
308
+ /**
309
+ * Checks if a requested resource URL matches a configured resource URL.
310
+ * A requested resource matches if it has the same scheme, domain, port,
311
+ * and its path starts with the configured resource's path.
312
+ *
313
+ * @param options - The options object
314
+ * @param options.requestedResource - The resource URL being requested
315
+ * @param options.configuredResource - The resource URL that has been configured
316
+ * @returns true if the requested resource matches the configured resource, false otherwise
317
+ */
318
+ declare function checkResourceAllowed({
319
+ requestedResource,
320
+ configuredResource
321
+ }: {
322
+ requestedResource: URL | string;
323
+ configuredResource: URL | string;
324
+ }): boolean;
325
+ declare namespace schemas_d_exports {
326
+ export { AnnotationsSchema, AudioContentSchema, BaseMetadataSchema, BaseRequestParamsSchema, BlobResourceContentsSchema, BooleanSchemaSchema, CallToolRequestParamsSchema, CallToolRequestSchema, CallToolResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, CancelledNotificationParamsSchema, CancelledNotificationSchema, ClientCapabilitiesSchema, ClientNotificationSchema, ClientRequestSchema, ClientResultSchema, ClientTasksCapabilitySchema, CompatibilityCallToolResultSchema, CompleteRequestParamsSchema, CompleteRequestSchema, CompleteResultSchema, ContentBlockSchema, CreateMessageRequestParamsSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, CreateTaskResultSchema, CursorSchema, DiscoverRequestSchema, DiscoverResultSchema, ElicitRequestFormParamsSchema, ElicitRequestParamsSchema, ElicitRequestSchema, ElicitRequestURLParamsSchema, ElicitResultSchema, ElicitationCompleteNotificationParamsSchema, ElicitationCompleteNotificationSchema, EmbeddedResourceSchema, EmptyResultSchema, EnumSchemaSchema, GetPromptRequestParamsSchema, GetPromptRequestSchema, GetPromptResultSchema, GetTaskPayloadRequestSchema, GetTaskPayloadResultSchema, GetTaskRequestSchema, GetTaskResultSchema, IconSchema, IconsSchema, ImageContentSchema, ImplementationSchema, InitializeRequestParamsSchema, InitializeRequestSchema, InitializeResultSchema, InitializedNotificationSchema, JSONArraySchema, JSONObjectSchema, JSONRPCErrorResponseSchema, JSONRPCMessageSchema, JSONRPCNotificationSchema, JSONRPCRequestSchema, JSONRPCResponseSchema, JSONRPCResultResponseSchema, JSONValueSchema, LegacyTitledEnumSchemaSchema, ListChangedOptionsBaseSchema, ListPromptsRequestSchema, ListPromptsResultSchema, ListResourceTemplatesRequestSchema, ListResourceTemplatesResultSchema, ListResourcesRequestSchema, ListResourcesResultSchema, ListRootsRequestSchema, ListRootsResultSchema, ListTasksRequestSchema, ListTasksResultSchema, ListToolsRequestSchema, ListToolsResultSchema, LoggingLevelSchema, LoggingMessageNotificationParamsSchema, LoggingMessageNotificationSchema, ModelHintSchema, ModelPreferencesSchema, MultiSelectEnumSchemaSchema, NotificationSchema, NotificationsParamsSchema, NumberSchemaSchema, PaginatedRequestParamsSchema, PaginatedRequestSchema, PaginatedResultSchema, PingRequestSchema, PrimitiveSchemaDefinitionSchema, ProgressNotificationParamsSchema, ProgressNotificationSchema, ProgressSchema, ProgressTokenSchema, PromptArgumentSchema, PromptListChangedNotificationSchema, PromptMessageSchema, PromptReferenceSchema, PromptSchema, ReadResourceRequestParamsSchema, ReadResourceRequestSchema, ReadResourceResultSchema, RelatedTaskMetadataSchema, RequestIdSchema, RequestMetaSchema, RequestSchema, ResourceContentsSchema, ResourceLinkSchema, ResourceListChangedNotificationSchema, ResourceRequestParamsSchema, ResourceSchema, ResourceTemplateReferenceSchema, ResourceTemplateSchema, ResourceUpdatedNotificationParamsSchema, ResourceUpdatedNotificationSchema, ResultMetaObjectSchema, ResultSchema, RoleSchema, RootSchema, RootsListChangedNotificationSchema, SamplingContentSchema, SamplingMessageContentBlockSchema, SamplingMessageSchema, ServerCapabilitiesSchema, ServerNotificationSchema, ServerRequestSchema, ServerResultSchema, ServerTasksCapabilitySchema, SetLevelRequestParamsSchema, SetLevelRequestSchema, SingleSelectEnumSchemaSchema, StringSchemaSchema, SubscribeRequestParamsSchema, SubscribeRequestSchema, SubscriptionFilterSchema, SubscriptionsAcknowledgedNotificationParamsSchema, SubscriptionsAcknowledgedNotificationSchema, SubscriptionsListenRequestParamsSchema, SubscriptionsListenRequestSchema, SubscriptionsListenResultMetaSchema, SubscriptionsListenResultSchema, TaskAugmentedRequestParamsSchema, TaskCreationParamsSchema, TaskMetadataSchema, TaskSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, TaskStatusSchema, TextContentSchema, TextResourceContentsSchema, TitledMultiSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema, ToolAnnotationsSchema, ToolChoiceSchema, ToolExecutionSchema, ToolListChangedNotificationSchema, ToolResultContentSchema, ToolSchema, ToolUseContentSchema, UnsubscribeRequestParamsSchema, UnsubscribeRequestSchema, UntitledMultiSelectEnumSchemaSchema, UntitledSingleSelectEnumSchemaSchema };
327
+ }
328
+ //#endregion
329
+ //#region ../core-internal/src/types/types.d.ts
330
+ /**
331
+ * Utility types
332
+ */
333
+ type ExpandRecursively<T$1> = T$1 extends object ? (T$1 extends infer O ? { [K in keyof O]: ExpandRecursively<O[K]> } : never) : T$1;
334
+ type Primitive = string | number | boolean | bigint | null | undefined;
335
+ type Flatten<T$1> = T$1 extends Primitive ? T$1 : T$1 extends Array<infer U> ? Array<Flatten<U>> : T$1 extends Set<infer U> ? Set<Flatten<U>> : T$1 extends Map<infer K, infer V> ? Map<Flatten<K>, Flatten<V>> : T$1 extends object ? { [K in keyof T$1]: Flatten<T$1[K]> } : T$1;
336
+ type Infer<Schema extends z.ZodTypeAny> = Flatten<z.infer<Schema>>;
337
+ /**
338
+ * Wire-only members hidden from the public types.
339
+ *
340
+ * `resultType` is the protocol-revision-2026-07-28 wire discrimination field
341
+ * on results. It is consumed by the SDK's protocol layer (and stripped before
342
+ * results reach consumers), so the public result types do not declare it.
343
+ * The wire schemas continue to model it internally.
344
+ */
345
+ type WireOnlyResultKey = 'resultType';
346
+ /**
347
+ * Removes wire-only members from a (possibly union) schema-inferred type
348
+ * while preserving every other declared member, optionality, and the loose
349
+ * index signature.
350
+ */
351
+ type StripWireOnly<T$1> = T$1 extends unknown ? { [K in keyof T$1 as K extends WireOnlyResultKey ? never : K]: T$1[K] } : never;
352
+ type ProgressToken = Infer<typeof ProgressTokenSchema>;
353
+ type Cursor = Infer<typeof CursorSchema>;
354
+ type Request$1 = Infer<typeof RequestSchema>;
355
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
356
+ type TaskAugmentedRequestParams = Infer<typeof TaskAugmentedRequestParamsSchema>;
357
+ type RequestMeta = Infer<typeof RequestMetaSchema>;
358
+ type Notification = Infer<typeof NotificationSchema>;
359
+ type Result$1 = StripWireOnly<Infer<typeof ResultSchema>>;
360
+ type RequestId = Infer<typeof RequestIdSchema>;
361
+ type JSONRPCRequest = Infer<typeof JSONRPCRequestSchema>;
362
+ type JSONRPCNotification = Infer<typeof JSONRPCNotificationSchema>;
363
+ type JSONRPCErrorResponse = Infer<typeof JSONRPCErrorResponseSchema>;
364
+ type JSONRPCResultResponse = Omit<Infer<typeof JSONRPCResultResponseSchema>, 'result'> & {
365
+ result: Result$1;
366
+ };
367
+ type JSONRPCResponse = JSONRPCResultResponse | JSONRPCErrorResponse;
368
+ type JSONRPCMessage = JSONRPCRequest | JSONRPCNotification | JSONRPCResultResponse | JSONRPCErrorResponse;
369
+ type RequestParams = Infer<typeof BaseRequestParamsSchema>;
370
+ type NotificationParams = Infer<typeof NotificationsParamsSchema>;
371
+ /**
372
+ * The per-request `_meta` envelope carried by every request under protocol revision
373
+ * 2026-07-28 (protocol version, client info, client capabilities, optional log level).
374
+ *
375
+ * Neutral hand-written shape keyed by the public meta-key constants — never
376
+ * inferred from a wire-module schema (this neutral layer does not import from
377
+ * `wire/rev*`). A `type` alias rather than an interface so it stays assignable
378
+ * to `_meta`'s string-indexed object slot.
379
+ */
380
+ type RequestMetaEnvelope = {};
381
+ type EmptyResult = StripWireOnly<Infer<typeof EmptyResultSchema>>;
382
+ type CancelledNotificationParams = Infer<typeof CancelledNotificationParamsSchema>;
383
+ type CancelledNotification = Infer<typeof CancelledNotificationSchema>;
384
+ type Icon = Infer<typeof IconSchema>;
385
+ type Icons = Infer<typeof IconsSchema>;
386
+ type BaseMetadata = Infer<typeof BaseMetadataSchema>;
387
+ type Annotations = Infer<typeof AnnotationsSchema>;
388
+ type Role = Infer<typeof RoleSchema>;
389
+ type Implementation = Infer<typeof ImplementationSchema>;
390
+ /**
391
+ * Capabilities a client may support.
392
+ *
393
+ * Note: the `roots` and `sampling` capabilities are deprecated as of protocol
394
+ * version 2026-07-28 (SEP-2577); they remain in the specification for at least
395
+ * twelve months. See `ClientCapabilitiesSchema`.
396
+ */
397
+ type ClientCapabilities = Infer<typeof ClientCapabilitiesSchema>;
398
+ type InitializeRequestParams = Infer<typeof InitializeRequestParamsSchema>;
399
+ type InitializeRequest = Infer<typeof InitializeRequestSchema>;
400
+ /**
401
+ * Capabilities a server may support.
402
+ *
403
+ * Note: the `logging` capability is deprecated as of protocol version
404
+ * 2026-07-28 (SEP-2577); it remains in the specification for at least twelve
405
+ * months. See `ServerCapabilitiesSchema`.
406
+ */
407
+ type ServerCapabilities = Infer<typeof ServerCapabilitiesSchema>;
408
+ type InitializeResult = StripWireOnly<Infer<typeof InitializeResultSchema>>;
409
+ type InitializedNotification = Infer<typeof InitializedNotificationSchema>;
410
+ type DiscoverRequest = Infer<typeof DiscoverRequestSchema>;
411
+ type DiscoverResult = StripWireOnly<Infer<typeof DiscoverResultSchema>>;
412
+ type PingRequest = Infer<typeof PingRequestSchema>;
413
+ type Progress = Infer<typeof ProgressSchema>;
414
+ type ProgressNotificationParams = Infer<typeof ProgressNotificationParamsSchema>;
415
+ type ProgressNotification = Infer<typeof ProgressNotificationSchema>;
416
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
417
+ type Task = Infer<typeof TaskSchema>;
418
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
419
+ type TaskStatus = Infer<typeof TaskStatusSchema>;
420
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
421
+ type TaskCreationParams = Infer<typeof TaskCreationParamsSchema>;
422
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
423
+ type TaskMetadata = Infer<typeof TaskMetadataSchema>;
424
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
425
+ type RelatedTaskMetadata = Infer<typeof RelatedTaskMetadataSchema>;
426
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
427
+ type CreateTaskResult = StripWireOnly<Infer<typeof CreateTaskResultSchema>>;
428
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
429
+ type TaskStatusNotificationParams = Infer<typeof TaskStatusNotificationParamsSchema>;
430
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
431
+ type TaskStatusNotification = Infer<typeof TaskStatusNotificationSchema>;
432
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
433
+ type GetTaskRequest = Infer<typeof GetTaskRequestSchema>;
434
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
435
+ type GetTaskResult = StripWireOnly<Infer<typeof GetTaskResultSchema>>;
436
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
437
+ type GetTaskPayloadRequest = Infer<typeof GetTaskPayloadRequestSchema>;
438
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
439
+ type ListTasksRequest = Infer<typeof ListTasksRequestSchema>;
440
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
441
+ type ListTasksResult = StripWireOnly<Infer<typeof ListTasksResultSchema>>;
442
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
443
+ type CancelTaskRequest = Infer<typeof CancelTaskRequestSchema>;
444
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
445
+ type CancelTaskResult = StripWireOnly<Infer<typeof CancelTaskResultSchema>>;
446
+ /** @deprecated 2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only. */
447
+ type GetTaskPayloadResult = StripWireOnly<Infer<typeof GetTaskPayloadResultSchema>>;
448
+ type PaginatedRequestParams = Infer<typeof PaginatedRequestParamsSchema>;
449
+ type PaginatedRequest = Infer<typeof PaginatedRequestSchema>;
450
+ type PaginatedResult = StripWireOnly<Infer<typeof PaginatedResultSchema>>;
451
+ type ResourceContents = Infer<typeof ResourceContentsSchema>;
452
+ type TextResourceContents = Infer<typeof TextResourceContentsSchema>;
453
+ type BlobResourceContents = Infer<typeof BlobResourceContentsSchema>;
454
+ type Resource = Infer<typeof ResourceSchema>;
455
+ type ResourceTemplateType = Infer<typeof ResourceTemplateSchema>;
456
+ type ListResourcesRequest = Infer<typeof ListResourcesRequestSchema>;
457
+ type ListResourcesResult = StripWireOnly<Infer<typeof ListResourcesResultSchema>>;
458
+ type ListResourceTemplatesRequest = Infer<typeof ListResourceTemplatesRequestSchema>;
459
+ type ListResourceTemplatesResult = StripWireOnly<Infer<typeof ListResourceTemplatesResultSchema>>;
460
+ type ResourceRequestParams = Infer<typeof ResourceRequestParamsSchema>;
461
+ type ReadResourceRequestParams = Infer<typeof ReadResourceRequestParamsSchema>;
462
+ type ReadResourceRequest = Infer<typeof ReadResourceRequestSchema>;
463
+ type ReadResourceResult = StripWireOnly<Infer<typeof ReadResourceResultSchema>>;
464
+ type ResourceListChangedNotification = Infer<typeof ResourceListChangedNotificationSchema>;
465
+ type SubscribeRequestParams = Infer<typeof SubscribeRequestParamsSchema>;
466
+ type SubscribeRequest = Infer<typeof SubscribeRequestSchema>;
467
+ type UnsubscribeRequestParams = Infer<typeof UnsubscribeRequestParamsSchema>;
468
+ type UnsubscribeRequest = Infer<typeof UnsubscribeRequestSchema>;
469
+ type ResourceUpdatedNotificationParams = Infer<typeof ResourceUpdatedNotificationParamsSchema>;
470
+ type ResourceUpdatedNotification = Infer<typeof ResourceUpdatedNotificationSchema>;
471
+ type SubscriptionFilter = Infer<typeof SubscriptionFilterSchema>;
472
+ type SubscriptionsListenRequestParams = Infer<typeof SubscriptionsListenRequestParamsSchema>;
473
+ type SubscriptionsListenRequest = Infer<typeof SubscriptionsListenRequestSchema>;
474
+ type SubscriptionsAcknowledgedNotificationParams = Infer<typeof SubscriptionsAcknowledgedNotificationParamsSchema>;
475
+ type SubscriptionsAcknowledgedNotification = Infer<typeof SubscriptionsAcknowledgedNotificationSchema>;
476
+ type SubscriptionsListenResultMeta = Infer<typeof SubscriptionsListenResultMetaSchema>;
477
+ type SubscriptionsListenResult = StripWireOnly<Infer<typeof SubscriptionsListenResultSchema>>;
478
+ type PromptArgument = Infer<typeof PromptArgumentSchema>;
479
+ type Prompt = Infer<typeof PromptSchema>;
480
+ type ListPromptsRequest = Infer<typeof ListPromptsRequestSchema>;
481
+ type ListPromptsResult = StripWireOnly<Infer<typeof ListPromptsResultSchema>>;
482
+ type GetPromptRequestParams = Infer<typeof GetPromptRequestParamsSchema>;
483
+ type GetPromptRequest = Infer<typeof GetPromptRequestSchema>;
484
+ type TextContent = Infer<typeof TextContentSchema>;
485
+ type ImageContent = Infer<typeof ImageContentSchema>;
486
+ type AudioContent = Infer<typeof AudioContentSchema>;
487
+ /**
488
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
489
+ * in the specification for at least twelve months. Migrate to calling LLM
490
+ * provider APIs directly.
491
+ */
492
+ type ToolUseContent = Infer<typeof ToolUseContentSchema>;
493
+ /**
494
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
495
+ * in the specification for at least twelve months. Migrate to calling LLM
496
+ * provider APIs directly.
497
+ */
498
+ type ToolResultContent = Infer<typeof ToolResultContentSchema>;
499
+ type EmbeddedResource = Infer<typeof EmbeddedResourceSchema>;
500
+ type ResourceLink = Infer<typeof ResourceLinkSchema>;
501
+ type ContentBlock = Infer<typeof ContentBlockSchema>;
502
+ type PromptMessage = Infer<typeof PromptMessageSchema>;
503
+ type GetPromptResult = StripWireOnly<Infer<typeof GetPromptResultSchema>>;
504
+ type PromptListChangedNotification = Infer<typeof PromptListChangedNotificationSchema>;
505
+ type ToolAnnotations = Infer<typeof ToolAnnotationsSchema>;
506
+ type ToolExecution = Infer<typeof ToolExecutionSchema>;
507
+ type Tool = Infer<typeof ToolSchema>;
508
+ type ListToolsRequest = Infer<typeof ListToolsRequestSchema>;
509
+ type ListToolsResult = StripWireOnly<Infer<typeof ListToolsResultSchema>>;
510
+ type CallToolRequestParams = Infer<typeof CallToolRequestParamsSchema>;
511
+ type CallToolResult = StripWireOnly<Infer<typeof CallToolResultSchema>>;
512
+ type CompatibilityCallToolResult = StripWireOnly<Infer<typeof CompatibilityCallToolResultSchema>>;
513
+ type CallToolRequest = Infer<typeof CallToolRequestSchema>;
514
+ type ToolListChangedNotification = Infer<typeof ToolListChangedNotificationSchema>;
515
+ /**
516
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
517
+ * in the specification for at least twelve months. Migrate to stderr logging
518
+ * (STDIO servers) or OpenTelemetry.
519
+ */
520
+ type LoggingLevel = Infer<typeof LoggingLevelSchema>;
521
+ /**
522
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
523
+ * in the specification for at least twelve months. Migrate to stderr logging
524
+ * (STDIO servers) or OpenTelemetry.
525
+ */
526
+ type SetLevelRequestParams = Infer<typeof SetLevelRequestParamsSchema>;
527
+ /**
528
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
529
+ * in the specification for at least twelve months. Migrate to stderr logging
530
+ * (STDIO servers) or OpenTelemetry.
531
+ */
532
+ type SetLevelRequest = Infer<typeof SetLevelRequestSchema>;
533
+ /**
534
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
535
+ * in the specification for at least twelve months. Migrate to stderr logging
536
+ * (STDIO servers) or OpenTelemetry.
537
+ */
538
+ type LoggingMessageNotificationParams = Infer<typeof LoggingMessageNotificationParamsSchema>;
539
+ /**
540
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
541
+ * in the specification for at least twelve months. Migrate to stderr logging
542
+ * (STDIO servers) or OpenTelemetry.
543
+ */
544
+ type LoggingMessageNotification = Infer<typeof LoggingMessageNotificationSchema>;
545
+ /**
546
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
547
+ * in the specification for at least twelve months. Migrate to calling LLM
548
+ * provider APIs directly.
549
+ */
550
+ type ToolChoice = Infer<typeof ToolChoiceSchema>;
551
+ /**
552
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
553
+ * in the specification for at least twelve months. Migrate to calling LLM
554
+ * provider APIs directly.
555
+ */
556
+ type ModelHint = Infer<typeof ModelHintSchema>;
557
+ /**
558
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
559
+ * in the specification for at least twelve months. Migrate to calling LLM
560
+ * provider APIs directly.
561
+ */
562
+ type ModelPreferences = Infer<typeof ModelPreferencesSchema>;
563
+ /**
564
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
565
+ * in the specification for at least twelve months. Migrate to calling LLM
566
+ * provider APIs directly.
567
+ */
568
+ type SamplingContent = Infer<typeof SamplingContentSchema>;
569
+ /**
570
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
571
+ * in the specification for at least twelve months. Migrate to calling LLM
572
+ * provider APIs directly.
573
+ */
574
+ type SamplingMessageContentBlock = Infer<typeof SamplingMessageContentBlockSchema>;
575
+ /**
576
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
577
+ * in the specification for at least twelve months. Migrate to calling LLM
578
+ * provider APIs directly.
579
+ */
580
+ type SamplingMessage = Infer<typeof SamplingMessageSchema>;
581
+ /**
582
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
583
+ * in the specification for at least twelve months. Migrate to calling LLM
584
+ * provider APIs directly.
585
+ */
586
+ type CreateMessageRequestParams = Infer<typeof CreateMessageRequestParamsSchema>;
587
+ /**
588
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
589
+ * in the specification for at least twelve months. Migrate to calling LLM
590
+ * provider APIs directly.
591
+ */
592
+ type CreateMessageRequest = Infer<typeof CreateMessageRequestSchema>;
593
+ /**
594
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
595
+ * in the specification for at least twelve months. Migrate to calling LLM
596
+ * provider APIs directly.
597
+ */
598
+ type CreateMessageResult = StripWireOnly<Infer<typeof CreateMessageResultSchema>>;
599
+ /**
600
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
601
+ * in the specification for at least twelve months. Migrate to calling LLM
602
+ * provider APIs directly.
603
+ */
604
+ type CreateMessageResultWithTools = StripWireOnly<Infer<typeof CreateMessageResultWithToolsSchema>>;
605
+ type BooleanSchema = Infer<typeof BooleanSchemaSchema>;
606
+ type StringSchema = Infer<typeof StringSchemaSchema>;
607
+ type NumberSchema = Infer<typeof NumberSchemaSchema>;
608
+ type EnumSchema = Infer<typeof EnumSchemaSchema>;
609
+ type UntitledSingleSelectEnumSchema = Infer<typeof UntitledSingleSelectEnumSchemaSchema>;
610
+ type TitledSingleSelectEnumSchema = Infer<typeof TitledSingleSelectEnumSchemaSchema>;
611
+ type LegacyTitledEnumSchema = Infer<typeof LegacyTitledEnumSchemaSchema>;
612
+ type UntitledMultiSelectEnumSchema = Infer<typeof UntitledMultiSelectEnumSchemaSchema>;
613
+ type TitledMultiSelectEnumSchema = Infer<typeof TitledMultiSelectEnumSchemaSchema>;
614
+ type SingleSelectEnumSchema = Infer<typeof SingleSelectEnumSchemaSchema>;
615
+ type MultiSelectEnumSchema = Infer<typeof MultiSelectEnumSchemaSchema>;
616
+ type PrimitiveSchemaDefinition = Infer<typeof PrimitiveSchemaDefinitionSchema>;
617
+ type ElicitRequestParams = Infer<typeof ElicitRequestParamsSchema>;
618
+ type ElicitRequestFormParams = Infer<typeof ElicitRequestFormParamsSchema>;
619
+ type ElicitRequestURLParams = Infer<typeof ElicitRequestURLParamsSchema>;
620
+ type ElicitRequest = Infer<typeof ElicitRequestSchema>;
621
+ /** @deprecated Removed from the spec by #2891 (2026-07-28). 2025-era only; the 2026-07-28 wire codec excludes this notification. */
622
+ type ElicitationCompleteNotificationParams = Infer<typeof ElicitationCompleteNotificationParamsSchema>;
623
+ /** @deprecated Removed from the spec by #2891 (2026-07-28). 2025-era only; the 2026-07-28 wire codec excludes this notification. */
624
+ type ElicitationCompleteNotification = Infer<typeof ElicitationCompleteNotificationSchema>;
625
+ type ElicitResult = StripWireOnly<Infer<typeof ElicitResultSchema>>;
626
+ type ResourceTemplateReference = Infer<typeof ResourceTemplateReferenceSchema>;
627
+ type PromptReference = Infer<typeof PromptReferenceSchema>;
628
+ type CompleteRequestParams = Infer<typeof CompleteRequestParamsSchema>;
629
+ type CompleteRequest = Infer<typeof CompleteRequestSchema>;
630
+ type CompleteResult = StripWireOnly<Infer<typeof CompleteResultSchema>>;
631
+ /**
632
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
633
+ * in the specification for at least twelve months. Migrate to passing paths via
634
+ * tool parameters, resource URIs, or configuration.
635
+ */
636
+ type Root = Infer<typeof RootSchema>;
637
+ /**
638
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
639
+ * in the specification for at least twelve months. Migrate to passing paths via
640
+ * tool parameters, resource URIs, or configuration.
641
+ */
642
+ type ListRootsRequest = Infer<typeof ListRootsRequestSchema>;
643
+ /**
644
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
645
+ * in the specification for at least twelve months. Migrate to passing paths via
646
+ * tool parameters, resource URIs, or configuration.
647
+ */
648
+ type ListRootsResult = StripWireOnly<Infer<typeof ListRootsResultSchema>>;
649
+ /**
650
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
651
+ * in the specification for at least twelve months. Migrate to passing paths via
652
+ * tool parameters, resource URIs, or configuration.
653
+ */
654
+ type RootsListChangedNotification = Infer<typeof RootsListChangedNotificationSchema>;
655
+ /**
656
+ * A single embedded (de-JSON-RPC'd) input request inside an
657
+ * {@linkcode InputRequiredResult}: an elicitation, sampling, or roots request
658
+ * object carried in-band rather than sent as a server→client JSON-RPC request.
659
+ */
660
+ type InputRequest = CreateMessageRequest | ListRootsRequest | ElicitRequest;
661
+ /**
662
+ * A single embedded (de-JSON-RPC'd) input response inside a retried request's
663
+ * `inputResponses`: the bare result object for the corresponding
664
+ * {@linkcode InputRequest} (never wrapped in a `{method, result}` envelope).
665
+ */
666
+ type InputResponse = CreateMessageResult | ListRootsResult | ElicitResult;
667
+ /**
668
+ * A map of embedded input requests, keyed by server-assigned identifiers that
669
+ * are unique within the scope of the request.
670
+ */
671
+ interface InputRequests {
672
+ [key: string]: InputRequest;
673
+ }
674
+ /**
675
+ * A map of embedded input responses. Keys correspond to the keys of the
676
+ * {@linkcode InputRequests} map the server sent; values are the client's bare
677
+ * result for each request.
678
+ */
679
+ interface InputResponses {
680
+ [key: string]: InputResponse;
681
+ }
682
+ /**
683
+ * The input-required result a handler for a multi-round-trip method
684
+ * (`tools/call`, `prompts/get`, `resources/read`) returns to request more
685
+ * input from the client (protocol revision 2026-07-28). Build it with the
686
+ * `inputRequired()` builder; hand-built literals are equally legal —
687
+ * `resultType: 'input_required'` is the discriminator, and the SDK re-checks
688
+ * the at-least-one rule at the seam.
689
+ *
690
+ * This is the one place the wire discriminator `resultType` appears on the
691
+ * neutral surface: the handler authors it, the 2026-07-28 codec passes it
692
+ * through to the wire, and consumers receiving results never see it (complete
693
+ * results are lifted).
694
+ *
695
+ * At least one of `inputRequests` or `requestState` must be present.
696
+ *
697
+ * `requestState` is an opaque, server-minted string echoed back verbatim by
698
+ * the client on retry. It travels through the client and MUST be treated by
699
+ * the server as attacker-controlled input on re-entry: if it influences
700
+ * authorization, resource access, or business logic, the server MUST protect
701
+ * its integrity (e.g. HMAC or AEAD) and MUST reject state that fails
702
+ * verification (spec: basic/patterns/mrtr §Server Requirements). The SDK
703
+ * applies no integrity protection by default — without a configured
704
+ * `ServerOptions.requestState.verify` hook, `ctx.mcpReq.requestState()`
705
+ * returns the raw, unverified string; with one, the seam rejects state the
706
+ * hook refuses and the accessor returns the hook's decoded payload.
707
+ */
708
+ interface InputRequiredResult extends Result$1 {
709
+ resultType: 'input_required';
710
+ /** Embedded requests the client must fulfil before retrying. */
711
+ inputRequests?: InputRequests;
712
+ /** Opaque server state the client echoes back verbatim on retry. */
713
+ requestState?: string;
714
+ }
715
+ type ClientRequest = Infer<typeof ClientRequestSchema>;
716
+ type ClientNotification = Infer<typeof ClientNotificationSchema>;
717
+ type ClientResult = StripWireOnly<Infer<typeof ClientResultSchema>>;
718
+ type ServerRequest = Infer<typeof ServerRequestSchema>;
719
+ type ServerNotification = Infer<typeof ServerNotificationSchema>;
720
+ type ServerResult = StripWireOnly<Infer<typeof ServerResultSchema>>;
721
+ type MethodToTypeMap<U$1> = { [T in U$1 as T extends {
722
+ method: infer M extends string;
723
+ } ? M : never]: T };
724
+ /**
725
+ * Task methods are 2025-11-25 wire vocabulary with no SDK runtime: the task
726
+ * wire types stay importable (see the Tasks section above), but the typed
727
+ * method surface — `request()`, `setRequestHandler()`, `ctx.mcpReq.send()` —
728
+ * does not offer them. The wire schemas keep parsing task vocabulary for
729
+ * interoperability with 2025-11-25 peers.
730
+ */
731
+ type TaskRequestMethod = 'tasks/get' | 'tasks/result' | 'tasks/list' | 'tasks/cancel';
732
+ type TaskNotificationMethod = 'notifications/tasks/status';
733
+ type RequestMethod = Exclude<ClientRequest['method'] | ServerRequest['method'], TaskRequestMethod>;
734
+ type NotificationMethod = Exclude<ClientNotification['method'] | ServerNotification['method'], TaskNotificationMethod>;
735
+ type RequestTypeMap = MethodToTypeMap<Exclude<ClientRequest | ServerRequest, {
736
+ method: TaskRequestMethod;
737
+ }>>;
738
+ type NotificationTypeMap = MethodToTypeMap<Exclude<ClientNotification | ServerNotification, {
739
+ method: TaskNotificationMethod;
740
+ }>>;
741
+ type ResultTypeMap = {
742
+ ping: EmptyResult;
743
+ initialize: InitializeResult;
744
+ 'server/discover': DiscoverResult;
745
+ 'completion/complete': CompleteResult;
746
+ 'logging/setLevel': EmptyResult;
747
+ 'prompts/get': GetPromptResult;
748
+ 'prompts/list': ListPromptsResult;
749
+ 'resources/list': ListResourcesResult;
750
+ 'resources/templates/list': ListResourceTemplatesResult;
751
+ 'resources/read': ReadResourceResult;
752
+ 'resources/subscribe': EmptyResult;
753
+ 'resources/unsubscribe': EmptyResult;
754
+ 'subscriptions/listen': SubscriptionsListenResult;
755
+ 'tools/call': CallToolResult;
756
+ 'tools/list': ListToolsResult;
757
+ 'sampling/createMessage': CreateMessageResult | CreateMessageResultWithTools;
758
+ 'elicitation/create': ElicitResult;
759
+ 'roots/list': ListRootsResult;
760
+ };
761
+ /**
762
+ * The handler-return counterpart of {@linkcode ResultTypeMap}: what a
763
+ * registered request handler may RETURN for each method. Identical to
764
+ * `ResultTypeMap` except that the multi-round-trip methods (`tools/call`,
765
+ * `prompts/get`, `resources/read`) additionally accept an
766
+ * {@linkcode InputRequiredResult} (protocol revision 2026-07-28).
767
+ *
768
+ * `ResultTypeMap` itself — what a *requester* receives — is deliberately NOT
769
+ * widened: `client.callTool()` returns a plain {@linkcode CallToolResult} on
770
+ * both protocol eras.
771
+ */
772
+ type HandlerResultTypeMap = { [M in keyof ResultTypeMap]: M extends 'tools/call' | 'prompts/get' | 'resources/read' ? ResultTypeMap[M] | InputRequiredResult : ResultTypeMap[M] };
773
+ /**
774
+ * Information about a validated access token, provided to request handlers.
775
+ */
776
+ interface AuthInfo {
777
+ /**
778
+ * The access token.
779
+ */
780
+ token: string;
781
+ /**
782
+ * The client ID associated with this token.
783
+ */
784
+ clientId: string;
785
+ /**
786
+ * Scopes associated with this token.
787
+ */
788
+ scopes: string[];
789
+ /**
790
+ * When the token expires (in seconds since epoch).
791
+ */
792
+ expiresAt?: number;
793
+ /**
794
+ * The RFC 8707 resource server identifier for which this token is valid.
795
+ * If set, this MUST match the MCP server's resource identifier (minus hash fragment).
796
+ */
797
+ resource?: URL;
798
+ /**
799
+ * URL of the RFC 9728 Protected Resource Metadata document for the
800
+ * resource server that accepted this token.
801
+ *
802
+ * The bearer-auth helpers stamp their configured `resourceMetadataUrl`
803
+ * here when verification succeeds, so challenge responses built after
804
+ * authentication (for example per-operation `insufficient_scope` scope
805
+ * challenges) can advertise the same document as the authentication
806
+ * gate's own challenges without separate configuration. Verifiers may
807
+ * also populate it directly; a verifier-set value wins.
808
+ */
809
+ resourceMetadataUrl?: string;
810
+ /**
811
+ * Additional data associated with the token.
812
+ * This field should be used for any additional data that needs to be attached to the auth info.
813
+ */
814
+ extra?: Record<string, unknown>;
815
+ }
816
+ type JSONRPCErrorObject = {
817
+ code: number;
818
+ message: string;
819
+ data?: unknown;
820
+ };
821
+ interface ParseError extends JSONRPCErrorObject {
822
+ code: typeof PARSE_ERROR;
823
+ }
824
+ interface InvalidRequestError extends JSONRPCErrorObject {
825
+ code: typeof INVALID_REQUEST;
826
+ }
827
+ interface MethodNotFoundError extends JSONRPCErrorObject {
828
+ code: typeof METHOD_NOT_FOUND;
829
+ }
830
+ interface InvalidParamsError extends JSONRPCErrorObject {
831
+ code: typeof INVALID_PARAMS;
832
+ }
833
+ interface InternalError extends JSONRPCErrorObject {
834
+ code: typeof INTERNAL_ERROR;
835
+ }
836
+ /**
837
+ * Data carried by a `-32021` MissingRequiredClientCapability protocol error
838
+ * (protocol revision 2026-07-28).
839
+ */
840
+ interface MissingRequiredClientCapabilityErrorData {
841
+ /**
842
+ * The capabilities the server requires from the client to process the
843
+ * request, in the `ClientCapabilities` shape (only the missing
844
+ * capabilities are listed).
845
+ */
846
+ requiredCapabilities: ClientCapabilities;
847
+ }
848
+ /**
849
+ * Data carried by a `-32022` UnsupportedProtocolVersion protocol error
850
+ * (protocol revision 2026-07-28).
851
+ */
852
+ interface UnsupportedProtocolVersionErrorData {
853
+ /**
854
+ * Protocol versions the receiver supports. The sender should choose a
855
+ * mutually supported version from this list and retry.
856
+ */
857
+ supported: string[];
858
+ /**
859
+ * The protocol version that was requested.
860
+ */
861
+ requested: string;
862
+ }
863
+ /**
864
+ * Callback type for list changed notifications.
865
+ */
866
+ type ListChangedCallback<T$1> = (error: Error | null, items: T$1[] | null) => void;
867
+ /**
868
+ * Options for subscribing to list changed notifications.
869
+ *
870
+ * @typeParam T - The type of items in the list (`Tool`, `Prompt`, or `Resource`)
871
+ */
872
+ type ListChangedOptions<T$1> = {
873
+ /**
874
+ * If `true`, the list will be refreshed automatically when a list changed notification is received.
875
+ * @default true
876
+ */
877
+ autoRefresh?: boolean;
878
+ /**
879
+ * Debounce time in milliseconds. Set to `0` to disable.
880
+ * @default 300
881
+ */
882
+ debounceMs?: number;
883
+ /**
884
+ * Callback invoked when the list changes.
885
+ *
886
+ * If `autoRefresh` is `true`, `items` contains the updated list.
887
+ * If `autoRefresh` is `false`, `items` is `null` (caller should refresh manually).
888
+ */
889
+ onChanged: ListChangedCallback<T$1>;
890
+ };
891
+ /**
892
+ * Configuration for list changed notification handlers.
893
+ *
894
+ * Use this to configure handlers for tools, prompts, and resources list changes
895
+ * when creating a client.
896
+ *
897
+ * Note: Handlers are only activated if the server advertises the corresponding
898
+ * `listChanged` capability (e.g., `tools.listChanged: true`). If the server
899
+ * doesn't advertise this capability, the handler will not be set up.
900
+ */
901
+ type ListChangedHandlers = {
902
+ /**
903
+ * Handler for tool list changes.
904
+ */
905
+ tools?: ListChangedOptions<Tool>;
906
+ /**
907
+ * Handler for prompt list changes.
908
+ */
909
+ prompts?: ListChangedOptions<Prompt>;
910
+ /**
911
+ * Handler for resource list changes.
912
+ */
913
+ resources?: ListChangedOptions<Resource>;
914
+ };
915
+ /**
916
+ * Protocol-era classification of an inbound message.
917
+ *
918
+ * Populated by transports that classify messages at the edge (e.g. an HTTP
919
+ * entry distinguishing 2025-era from 2026-era traffic). The wire era itself
920
+ * is connection state (the negotiated protocol version held by the
921
+ * `Client`/`Server` instance); the protocol layer validates a classified
922
+ * message against that instance era at dispatch — a mismatch is treated as
923
+ * an entry/routing error, never a per-message era switch. Unclassified
924
+ * traffic is dispatched on the instance era unchanged.
925
+ */
926
+ interface MessageClassification {
927
+ /**
928
+ * The wire era the message was classified into: `legacy` for the
929
+ * 2025-11-25 family of revisions, `modern` for 2026-07-28 and later.
930
+ */
931
+ era: 'legacy' | 'modern';
932
+ /**
933
+ * The exact protocol revision, when the classifier derived one.
934
+ */
935
+ revision?: string;
936
+ }
937
+ /**
938
+ * Extra information about a message.
939
+ */
940
+ interface MessageExtraInfo {
941
+ /**
942
+ * The original HTTP request.
943
+ */
944
+ request?: globalThis.Request;
945
+ /**
946
+ * Protocol-era classification of the message, when the transport
947
+ * classified it at the edge. Validated by the protocol layer against the
948
+ * instance's negotiated era at dispatch (the edge→instance handoff
949
+ * check); it does not select the era itself.
950
+ */
951
+ classification?: MessageClassification;
952
+ /**
953
+ * The authentication information.
954
+ */
955
+ authInfo?: AuthInfo;
956
+ /**
957
+ * Callback to close the SSE stream for this request, triggering client reconnection.
958
+ * Only available when using {@linkcode @modelcontextprotocol/node!streamableHttp.NodeStreamableHTTPServerTransport | NodeStreamableHTTPServerTransport} with eventStore configured.
959
+ */
960
+ closeSSEStream?: () => void;
961
+ /**
962
+ * Callback to close the standalone GET SSE stream, triggering client reconnection.
963
+ * Only available when using {@linkcode @modelcontextprotocol/node!streamableHttp.NodeStreamableHTTPServerTransport | NodeStreamableHTTPServerTransport} with eventStore configured.
964
+ */
965
+ closeStandaloneSSEStream?: () => void;
966
+ }
967
+ type MetaObject = Record<string, unknown>;
968
+ type RequestMetaObject = RequestMeta;
969
+ /**
970
+ * The contents of a result's `_meta` field (the 2026-07-28 `ResultMetaObject`):
971
+ * loose, with the optional self-reported serverInfo key typed when present.
972
+ */
973
+ type ResultMetaObject = Infer<typeof ResultMetaObjectSchema>;
974
+ /**
975
+ * {@linkcode CreateMessageRequestParams} without tools - for backwards-compatible overload.
976
+ * Excludes tools/toolChoice to indicate they should not be provided.
977
+ *
978
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
979
+ * in the specification for at least twelve months. Migrate to calling LLM
980
+ * provider APIs directly.
981
+ */
982
+ type CreateMessageRequestParamsBase = Omit<CreateMessageRequestParams, 'tools' | 'toolChoice'>;
983
+ /**
984
+ * {@linkcode CreateMessageRequestParams} with required tools - for tool-enabled overload.
985
+ *
986
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
987
+ * in the specification for at least twelve months. Migrate to calling LLM
988
+ * provider APIs directly.
989
+ */
990
+ interface CreateMessageRequestParamsWithTools extends CreateMessageRequestParams {
991
+ tools: Tool[];
992
+ }
993
+ type CompleteRequestResourceTemplate = ExpandRecursively<CompleteRequest & {
994
+ params: CompleteRequestParams & {
995
+ ref: ResourceTemplateReference;
996
+ };
997
+ }>;
998
+ type CompleteRequestPrompt = ExpandRecursively<CompleteRequest & {
999
+ params: CompleteRequestParams & {
1000
+ ref: PromptReference;
1001
+ };
1002
+ }>;
1003
+ //#endregion
1004
+ //#region ../core-internal/src/wire/codec.d.ts
1005
+ /** Wire eras with distinct vocabulary. */
1006
+ type WireEra = '2025-11-25' | '2026-07-28';
1007
+ /**
1008
+ * Wire-only material lifted off an inbound message by the protocol layer
1009
+ * before dispatch (the V-3 seam): the reserved `_meta` envelope keys and the
1010
+ * multi-round-trip driver fields. This is the typed driver-material channel
1011
+ * of the codec contract — handlers never see it; the protocol layer surfaces
1012
+ * it via `ctx.mcpReq.envelope` / `.inputResponses` / `.requestState`, and the
1013
+ * MRTR driver (M4.1) consumes the retry fields from here.
1014
+ */
1015
+ interface LiftedWireMaterial {
1016
+ envelope?: Partial<RequestMetaEnvelope>;
1017
+ inputResponses?: Record<string, unknown>;
1018
+ requestState?: string;
1019
+ }
1020
+ /**
1021
+ * Tri-state validation outcome — the function-only contract for what the
1022
+ * schema-getter pair (`hasRequestMethod` ⇒ −32601-by-absence; `…Schema(m)
1023
+ * .parse` throw ⇒ −32602) used to encode in two pieces. Preserving the split
1024
+ * is the point: collapsing 'absent from this era's registry' into 'invalid'
1025
+ * would make the in-band fallback chain (validate → on `not-in-era` fall to
1026
+ * validateInputRequest) treat absence as failure and never fall through.
1027
+ */
1028
+ type ValidateOutcome<T$1> = {
1029
+ readonly ok: true;
1030
+ readonly value: T$1;
1031
+ }
1032
+ /**
1033
+ * Method is spec vocabulary but absent from THIS era's registry. Callers
1034
+ * map to −32601 (inbound) or a typed local SdkError (outbound), or fall
1035
+ * through to the in-band validator.
1036
+ */ | {
1037
+ readonly ok: false;
1038
+ readonly reason: 'not-in-era';
1039
+ }
1040
+ /**
1041
+ * Method is in this era's registry; payload failed the era-exact schema.
1042
+ * Callers map to −32602.
1043
+ */ | {
1044
+ readonly ok: false;
1045
+ readonly reason: 'invalid';
1046
+ readonly message: string;
1047
+ };
1048
+ /** A single self-identifying problem found while validating a per-request `_meta` envelope. */
1049
+ interface EnvelopeIssue {
1050
+ /**
1051
+ * The envelope key the problem is about: one of the reserved `_meta`
1052
+ * keys, or a dotted path inside one.
1053
+ */
1054
+ readonly key: string;
1055
+ /** A short description of what is wrong with that key (`missing`, or a validation message). */
1056
+ readonly problem: string;
1057
+ }
1058
+ /** Material a Client supplies for an era to build its per-request `_meta` envelope from. */
1059
+ interface OutboundEnvelopeMaterial {
1060
+ readonly protocolVersion: string;
1061
+ readonly clientInfo: Implementation;
1062
+ readonly clientCapabilities: ClientCapabilities;
1063
+ readonly logLevel?: LoggingLevel;
1064
+ }
1065
+ /** Result decode outcomes — the raw-first discrimination (V-1) lives in `decodeResult`. */
1066
+ type DecodedResult = {
1067
+ kind: 'complete';
1068
+ /** The neutral result value: wire-only material consumed/stripped. */
1069
+ result: Result$1;
1070
+ } | {
1071
+ kind: 'input_required';
1072
+ /**
1073
+ * Driver-only material (never consumer-visible). The full
1074
+ * multi-round-trip driver is M4.1 scope; this seam carries the
1075
+ * discriminated payload to it.
1076
+ */
1077
+ inputRequests: Record<string, unknown>;
1078
+ requestState?: string;
1079
+ /** Result-level `_meta`, carried through so a manual caller sees it. */
1080
+ _meta?: ResultMetaObject;
1081
+ } | {
1082
+ kind: 'invalid';
1083
+ error: SdkError;
1084
+ };
1085
+ /**
1086
+ * The per-era wire codec contract (design C §3, adapted to the live funnel
1087
+ * layout: the universal wire-only LIFT runs once in the protocol layer for
1088
+ * every message — spec, custom, and fallback paths alike — and codecs consume
1089
+ * the lifted material rather than re-implementing the strip per era).
1090
+ */
1091
+ interface WireCodec {
1092
+ readonly era: WireEra;
1093
+ /** Registry membership — the deletion story (inbound −32601 by absence; outbound typed local error). */
1094
+ hasRequestMethod(method: string): boolean;
1095
+ hasNotificationMethod(method: string): boolean;
1096
+ hasInputRequestMethod(method: string): boolean;
1097
+ /** Era-exact request validation. `not-in-era` ≡ −32601-by-absence; `invalid` ≡ −32602. */
1098
+ validateRequest<M$1 extends RequestMethod>(method: M$1, raw: unknown): ValidateOutcome<RequestTypeMap[M$1]>;
1099
+ validateRequest(method: string, raw: unknown): ValidateOutcome<unknown>;
1100
+ /** Era-exact result validation (same registry as `validateRequest`). */
1101
+ validateResult<M$1 extends RequestMethod>(method: M$1, raw: unknown): ValidateOutcome<ResultTypeMap[M$1]>;
1102
+ validateResult(method: string, raw: unknown): ValidateOutcome<unknown>;
1103
+ /** Era-exact notification validation. */
1104
+ validateNotification<M$1 extends NotificationMethod>(method: M$1, raw: unknown): ValidateOutcome<NotificationTypeMap[M$1]>;
1105
+ validateNotification(method: string, raw: unknown): ValidateOutcome<unknown>;
1106
+ /**
1107
+ * In-band (de-JSON-RPC'd) input-request validation — the embedded
1108
+ * requests a multi-round-trip `input_required` result may carry. Always
1109
+ * `not-in-era` on the 2025 era (elicitation/sampling/roots are wire
1110
+ * request methods there). Does NOT grant registry membership.
1111
+ */
1112
+ validateInputRequest<M$1 extends RequestMethod>(method: M$1, raw: unknown): ValidateOutcome<RequestTypeMap[M$1]>;
1113
+ validateInputRequest(method: string, raw: unknown): ValidateOutcome<unknown>;
1114
+ /** In-band bare-response validation answering an embedded input request. */
1115
+ validateInputResponse<M$1 extends RequestMethod>(method: M$1, raw: unknown): ValidateOutcome<ResultTypeMap[M$1]>;
1116
+ validateInputResponse(method: string, raw: unknown): ValidateOutcome<unknown>;
1117
+ /**
1118
+ * Param-conditional `sampling/createMessage` result validation — the one
1119
+ * spec result whose schema depends on REQUEST params (tools vs no tools).
1120
+ * The 2025 era owns the with-tools/plain frozen schemas; the 2026 era
1121
+ * returns `not-in-era` (sampling is in-band there — callers fall through
1122
+ * to `validateInputResponse`).
1123
+ */
1124
+ samplingResultVariant(hasTools: true, raw: unknown): ValidateOutcome<CreateMessageResultWithTools>;
1125
+ samplingResultVariant(hasTools: false, raw: unknown): ValidateOutcome<CreateMessageResult>;
1126
+ samplingResultVariant(hasTools: boolean, raw: unknown): ValidateOutcome<CreateMessageResult | CreateMessageResultWithTools>;
1127
+ /**
1128
+ * Outbound per-request `_meta` envelope encode. Returns the keyed object
1129
+ * to merge into `params._meta` on this era, or `undefined` when this era
1130
+ * carries no per-request envelope (the 2025 era — legacy wire stays
1131
+ * byte-identical).
1132
+ */
1133
+ outboundEnvelope(material: OutboundEnvelopeMaterial): Readonly<Record<string, unknown>> | undefined;
1134
+ /**
1135
+ * Structured envelope validation: maps a `_meta` object to
1136
+ * self-identifying issues. The 2025 era never requires an envelope and
1137
+ * always returns `[]`; the 2026 era owns the required-key pre-pass plus
1138
+ * the wire-exact `RequestMetaEnvelopeSchema` parse.
1139
+ */
1140
+ validateEnvelopeMeta(meta: Readonly<Record<string, unknown>>): EnvelopeIssue[];
1141
+ /**
1142
+ * Per-registration `tools/call` result projection. Two independent
1143
+ * decisions, both owned here so server-side code never re-derives them:
1144
+ *
1145
+ * - SEP-2106 §4.3 TextContent auto-append (EVERY era, value-shape-based):
1146
+ * when `structuredContent` is a non-object value (array/primitive/
1147
+ * `null`) and the handler authored no `type:'text'` block, append
1148
+ * `{type:'text', text: JSON.stringify(value)}` so consumers that read
1149
+ * only `content` still receive a rendering. The author opts out by
1150
+ * returning any `text` block themselves.
1151
+ *
1152
+ * - `{result:…}` wrap (2025 era only): wrap as `{result:<value>}` when the
1153
+ * value is non-object (the 2025 wire shape requires `structuredContent`
1154
+ * to be an object — a schema-less tool returning `[1,2,3]` would
1155
+ * otherwise ship wire-illegal bytes) OR when the tool's ADVERTISED
1156
+ * `outputSchema` has a non-object root (so the result matches the
1157
+ * `encodeResult('tools/list')` projection of the same tool). Identity on
1158
+ * the 2026 era — the wire shape carries the natural value directly.
1159
+ */
1160
+ projectCallToolResult(result: CallToolResult, advertisedOutputSchema: Readonly<Record<string, unknown>> | undefined): CallToolResult;
1161
+ /**
1162
+ * Step 1 of result decoding: RAW `resultType` handling BEFORE any schema
1163
+ * validation (V-1's structural home). Era postures (Q1-SD3):
1164
+ * - 2026 era: required discriminator — absent ⇒ typed error naming the
1165
+ * spec violation; `input_required` ⇒ driver payload; unknown ⇒ invalid,
1166
+ * no retry; `complete` ⇒ consume + lift.
1167
+ * - 2025 era: `resultType` is foreign vocabulary ⇒ strip-on-lift.
1168
+ */
1169
+ decodeResult(method: string, raw: unknown): DecodedResult;
1170
+ /**
1171
+ * Outbound result mapping (the stamp seam). The 2025-era codec is the
1172
+ * identity — it has NO stamp code path (the never-stamp guarantee; it
1173
+ * never reads `serverInfo`). The 2026-era codec strictly enforces the
1174
+ * 2026 wire shape for the known deleted-field set
1175
+ * (`execution.taskSupport`, `capabilities.tasks` — Q1-SD3 iii), stamps
1176
+ * `resultType`, fills the required `ttlMs`/`cacheScope` fields on
1177
+ * cacheable results, and — when the caller supplies its identity —
1178
+ * stamps `_meta['io.modelcontextprotocol/serverInfo']` on every result
1179
+ * (spec PR #3002 SHOULD; a handler-authored value wins). `Server`
1180
+ * instances pass their identity; clients and hand-constructed protocol
1181
+ * objects pass nothing and no identity is ever invented.
1182
+ */
1183
+ encodeResult(method: string, result: Result$1, serverInfo?: Implementation): Result$1;
1184
+ /**
1185
+ * Outbound error-code mapping (the error half of the stamp seam). A
1186
+ * handler-thrown `ProtocolError`'s numeric code passes through here on
1187
+ * its way to the JSON-RPC error response, so per-era wire-code selection
1188
+ * lives in the codec rather than in handler/funnel code. The current
1189
+ * mapping is identical on both eras (the `-32002` resource-not-found
1190
+ * domain code maps to `-32602` Invalid Params on the wire — the
1191
+ * 2026-07-28 spec MUST, and what the deployed v1.x SDK already emits on
1192
+ * earlier revisions); the seam is the structural home for any future
1193
+ * per-era divergence. Unknown codes pass through unchanged.
1194
+ */
1195
+ encodeErrorCode(code: number): number;
1196
+ /**
1197
+ * @deprecated Use {@link validateEnvelopeMeta}. Inbound envelope
1198
+ * enforcement for era-classified traffic: validates the lifted envelope
1199
+ * material of a request. Returns an error message when the era requires
1200
+ * an envelope and it is missing/invalid (→ −32602 at the dispatch
1201
+ * layer); `undefined` when acceptable. The 2025 era never requires an
1202
+ * envelope.
1203
+ */
1204
+ checkInboundEnvelope(material: LiftedWireMaterial): string | undefined;
1205
+ }
1206
+ //#endregion
1207
+ //#region ../core-internal/src/shared/inboundClassification.d.ts
1208
+ /**
1209
+ * The transport-neutral description of an inbound HTTP request the classifier
1210
+ * evaluates. The caller (the HTTP entry) reads the body exactly once and
1211
+ * extracts the two protocol headers; the classifier never touches a request
1212
+ * object itself.
1213
+ */
1214
+ interface InboundHttpRequest {
1215
+ /** The HTTP request method, e.g. `POST`, `GET`, `DELETE`. */
1216
+ httpMethod: string;
1217
+ /** The value of the `MCP-Protocol-Version` header, when present. */
1218
+ protocolVersionHeader?: string;
1219
+ /** The value of the `Mcp-Method` header, when present. */
1220
+ mcpMethodHeader?: string;
1221
+ /** The value of the `Mcp-Name` header, when present. */
1222
+ mcpNameHeader?: string;
1223
+ /** The parsed JSON request body (`undefined` for body-less methods). */
1224
+ body?: unknown;
1225
+ }
1226
+ /** Why an inbound request was routed to legacy-era serving. */
1227
+ type InboundLegacyRouteReason = /** Non-`POST` HTTP method: a body-less 2025-era session operation. */
1228
+ 'http-method'
1229
+ /** An `initialize` request without a valid modern envelope claim — the legacy handshake by definition. */ | 'initialize'
1230
+ /** A request without a per-request envelope claim. */ | 'no-claim'
1231
+ /** A notification without a body claim or a modern protocol-version header. */ | 'notification'
1232
+ /** An all-legacy JSON-RPC batch array. */ | 'batch'
1233
+ /** A JSON-RPC response posted to the endpoint (2025-era session traffic). */ | 'response';
1234
+ /**
1235
+ * The request is legacy-era traffic. It carries no classification on purpose:
1236
+ * legacy serving receives it exactly as a hand-wired 2025 transport would.
1237
+ */
1238
+ interface InboundLegacyRoute {
1239
+ kind: 'legacy';
1240
+ reason: InboundLegacyRouteReason;
1241
+ /**
1242
+ * The protocol version the request named, when it named one (an
1243
+ * `initialize` body's `protocolVersion`, or the `MCP-Protocol-Version`
1244
+ * header). Used to echo `requested` when legacy serving is not configured.
1245
+ */
1246
+ requestedVersion?: string;
1247
+ }
1248
+ /**
1249
+ * The request claims the per-request envelope mechanism and is served on the
1250
+ * modern path. Discriminated by `messageKind` so the typed `message` narrows
1251
+ * with it — the classifier has already proved the JSON-RPC shape via the
1252
+ * `isJSONRPCRequest` / `isJSONRPCNotification` guards, so consumers never
1253
+ * cast the body again.
1254
+ */
1255
+ type InboundModernRoute = {
1256
+ kind: 'modern';
1257
+ messageKind: 'request';
1258
+ /** The classified body — guard-proved {@linkcode JSONRPCRequest} shape. */
1259
+ message: JSONRPCRequest;
1260
+ /**
1261
+ * The classification handed to the per-request transport and validated by
1262
+ * the protocol layer against the serving instance's negotiated era.
1263
+ */
1264
+ classification: MessageClassification;
1265
+ } | {
1266
+ kind: 'modern';
1267
+ messageKind: 'notification';
1268
+ /** The classified body — guard-proved {@linkcode JSONRPCNotification} shape. */
1269
+ message: JSONRPCNotification;
1270
+ classification: MessageClassification;
1271
+ };
1272
+ /** The named steps of the inbound validation ladder, in evaluation order. */
1273
+ type InboundValidationRung = 'http-method' | 'jsonrpc-shape' | 'era-classification' | 'envelope' | 'method-registry' | 'request-params' | 'standard-header-validation' | 'client-capabilities' | 'param-header-validation';
1274
+ /** A ladder rejection: the JSON-RPC error to emit and the HTTP status to emit it with. */
1275
+ interface InboundLadderRejection {
1276
+ kind: 'reject';
1277
+ /** The ladder rung that produced the rejection. */
1278
+ rung: InboundValidationRung;
1279
+ /** The cell this rejection corresponds to on the ladder cell sheet (stable identifier for tests). */
1280
+ cell: string;
1281
+ /** The HTTP status the rejection is emitted with. */
1282
+ httpStatus: number;
1283
+ /** The JSON-RPC error code. */
1284
+ code: number;
1285
+ /** The JSON-RPC error message. */
1286
+ message: string;
1287
+ /** Structured error data (recognizers parse this; they never rely on class identity). */
1288
+ data?: unknown;
1289
+ /**
1290
+ * `false` when the exact error code for this cell is not settled upstream
1291
+ * yet and the emitted code is provisional.
1292
+ */
1293
+ settled: boolean;
1294
+ }
1295
+ /** The outcome of classifying one inbound HTTP request. */
1296
+ type InboundClassificationOutcome = InboundLegacyRoute | InboundModernRoute | InboundLadderRejection;
1297
+ /**
1298
+ * Classifies one inbound HTTP request for dual-era serving.
1299
+ *
1300
+ * The body-primary predicate, evaluated once at the entry boundary: see the
1301
+ * module documentation for the rules. Returns a routing outcome (`legacy` or
1302
+ * `modern`) or a ladder rejection; it never throws.
1303
+ */
1304
+ declare function classifyInboundRequest(request: InboundHttpRequest): InboundClassificationOutcome;
1305
+ //#endregion
1306
+ //#region ../core-internal/src/util/standardSchema.d.ts
1307
+ interface StandardTypedV1<Input = unknown, Output = Input> {
1308
+ readonly '~standard': StandardTypedV1.Props<Input, Output>;
1309
+ }
1310
+ declare namespace StandardTypedV1 {
1311
+ interface Props<Input = unknown, Output = Input> {
1312
+ readonly version: 1;
1313
+ readonly vendor: string;
1314
+ readonly types?: Types<Input, Output> | undefined;
1315
+ }
1316
+ interface Types<Input = unknown, Output = Input> {
1317
+ readonly input: Input;
1318
+ readonly output: Output;
1319
+ }
1320
+ type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema['~standard']['types']>['input'];
1321
+ type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema['~standard']['types']>['output'];
1322
+ }
1323
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
1324
+ readonly '~standard': StandardSchemaV1.Props<Input, Output>;
1325
+ }
1326
+ declare namespace StandardSchemaV1 {
1327
+ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
1328
+ readonly validate: (value: unknown, options?: Options | undefined) => Result<Output> | Promise<Result<Output>>;
1329
+ }
1330
+ interface Options {
1331
+ readonly libraryOptions?: Record<string, unknown> | undefined;
1332
+ }
1333
+ type Result<Output> = SuccessResult<Output> | FailureResult;
1334
+ interface SuccessResult<Output> {
1335
+ readonly value: Output;
1336
+ readonly issues?: undefined;
1337
+ }
1338
+ interface FailureResult {
1339
+ readonly issues: ReadonlyArray<Issue>;
1340
+ }
1341
+ interface Issue {
1342
+ readonly message: string;
1343
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
1344
+ }
1345
+ interface PathSegment {
1346
+ readonly key: PropertyKey;
1347
+ }
1348
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
1349
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
1350
+ }
1351
+ interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
1352
+ readonly '~standard': StandardJSONSchemaV1.Props<Input, Output>;
1353
+ }
1354
+ declare namespace StandardJSONSchemaV1 {
1355
+ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
1356
+ readonly jsonSchema: Converter;
1357
+ }
1358
+ interface Converter {
1359
+ readonly input: (options: Options) => Record<string, unknown>;
1360
+ readonly output: (options: Options) => Record<string, unknown>;
1361
+ }
1362
+ type Target = 'draft-2020-12' | 'draft-07' | 'openapi-3.0' | (object & string);
1363
+ interface Options {
1364
+ readonly target: Target;
1365
+ readonly libraryOptions?: Record<string, unknown> | undefined;
1366
+ }
1367
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
1368
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
1369
+ }
1370
+ /**
1371
+ * Combined interface for schemas with both validation and JSON Schema conversion —
1372
+ * the intersection of {@linkcode StandardSchemaV1} and {@linkcode StandardJSONSchemaV1}.
1373
+ *
1374
+ * This is the type accepted by `registerTool` / `registerPrompt`. The SDK needs
1375
+ * `~standard.jsonSchema` to advertise the tool's argument shape in `tools/list`, and
1376
+ * `~standard.validate` to check incoming arguments when a `tools/call` arrives.
1377
+ *
1378
+ * Zod v4, ArkType, and Valibot (via `@valibot/to-json-schema`'s `toStandardJsonSchema`)
1379
+ * all implement both interfaces.
1380
+ *
1381
+ * @see https://standardschema.dev/ for the Standard Schema specification
1382
+ */
1383
+ interface StandardSchemaWithJSON<Input = unknown, Output = Input> {
1384
+ readonly '~standard': StandardSchemaV1.Props<Input, Output> & StandardJSONSchemaV1.Props<Input, Output>;
1385
+ }
1386
+ declare namespace StandardSchemaWithJSON {
1387
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
1388
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
1389
+ }
1390
+ /**
1391
+ * Narrowing of {@linkcode StandardSchemaV1} whose `validate` is guaranteed synchronous.
1392
+ *
1393
+ * The Zod schemas backing `specTypeSchemas` contain no async refinements or transforms,
1394
+ * so every entry satisfies this interface. Consumers can call `validate()` and access
1395
+ * `.issues` / `.value` on the result without `await`.
1396
+ *
1397
+ * `StandardSchemaV1Sync` is assignable to `StandardSchemaV1` — it is a strict subtype.
1398
+ */
1399
+ interface StandardSchemaV1Sync<Input = unknown, Output = Input> extends StandardSchemaV1<Input, Output> {
1400
+ readonly '~standard': StandardSchemaV1Sync.Props<Input, Output>;
1401
+ }
1402
+ declare namespace StandardSchemaV1Sync {
1403
+ interface Props<Input = unknown, Output = Input> extends StandardSchemaV1.Props<Input, Output> {
1404
+ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<Output>;
1405
+ }
1406
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
1407
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
1408
+ }
1409
+ //#endregion
1410
+ //#region ../core-internal/src/shared/elicitation.d.ts
1411
+ /** Input accepted by `inputRequired.elicit()`: a wire-ready elicitation JSON Schema or a Standard Schema. */
1412
+ type ElicitInputParams = Omit<ElicitRequestFormParams, 'requestedSchema'> & {
1413
+ requestedSchema: ElicitRequestFormParams['requestedSchema'] | StandardSchemaWithJSON;
1414
+ };
1415
+ //#endregion
1416
+ //#region ../core-internal/src/shared/inputRequired.d.ts
1417
+ /** The shape accepted by {@linkcode inputRequired}. */
1418
+ interface InputRequiredSpec {
1419
+ /** Embedded requests the client must fulfil before retrying. */
1420
+ inputRequests?: InputRequests;
1421
+ /** Opaque server state echoed back verbatim by the client on retry. */
1422
+ requestState?: string;
1423
+ }
1424
+ interface InputRequiredBuilder {
1425
+ /**
1426
+ * Builds the input-required return value for a multi-round-trip handler.
1427
+ *
1428
+ * At least one of `inputRequests` or `requestState` must be provided
1429
+ * (spec: basic/patterns/mrtr, server requirements) — the builder throws a
1430
+ * `TypeError` otherwise, and the server seam re-checks the same rule for
1431
+ * hand-built results.
1432
+ *
1433
+ * `requestState` is opaque, server-minted state. It round-trips through
1434
+ * the client and comes back as attacker-controlled input: a server that
1435
+ * lets it influence authorization, resource access, or business logic
1436
+ * MUST integrity-protect it (e.g. HMAC or AEAD) and MUST reject state
1437
+ * that fails verification. The SDK does not do this for you.
1438
+ */
1439
+ (spec: InputRequiredSpec): InputRequiredResult;
1440
+ /**
1441
+ * Builds an embedded form-mode elicitation request (`elicitation/create`).
1442
+ *
1443
+ * A Standard Schema `requestedSchema` is converted to the restricted wire shape;
1444
+ * shapes it cannot express throw a `TypeError` before anything is sent. Responses
1445
+ * are not validated against it — pass the same schema to `acceptedContent()` on
1446
+ * re-entry for validated, typed content.
1447
+ */
1448
+ elicit(params: ElicitInputParams): InputRequest;
1449
+ /**
1450
+ * Builds an embedded URL-mode elicitation request (`elicitation/create`).
1451
+ * On the 2026-07-28 revision URL elicitation rides the multi-round-trip
1452
+ * flow — the `-32042` error of earlier revisions never appears on this
1453
+ * era's wire. The 2025-era `elicitationId` is not part of the 2026-07-28
1454
+ * URL-mode shape; correlation across retries is the server's own
1455
+ * identifier inside `requestState`.
1456
+ */
1457
+ elicitUrl(params: Omit<ElicitRequestURLParams, 'mode' | 'elicitationId'>): InputRequest;
1458
+ /** Builds an embedded sampling request (`sampling/createMessage`). */
1459
+ createMessage(params: CreateMessageRequestParams): InputRequest;
1460
+ /** Builds an embedded roots listing request (`roots/list`). */
1461
+ listRoots(): InputRequest;
1462
+ }
1463
+ /**
1464
+ * Builder for the input-required return value of multi-round-trip handlers,
1465
+ * with per-kind constructors for the embedded requests
1466
+ * (`inputRequired.elicit`, `inputRequired.elicitUrl`,
1467
+ * `inputRequired.createMessage`, `inputRequired.listRoots`).
1468
+ *
1469
+ * @example Write-once tool requesting confirmation
1470
+ * ```ts
1471
+ * server.registerTool('deploy', { inputSchema: z.object({ env: z.string() }) }, async ({ env }, ctx) => {
1472
+ * const confirmationSchema = z.object({ confirm: z.boolean() });
1473
+ * const confirmed = acceptedContent(ctx.mcpReq.inputResponses, 'confirm', confirmationSchema);
1474
+ * if (confirmed?.confirm !== true) {
1475
+ * return inputRequired({
1476
+ * inputRequests: {
1477
+ * confirm: inputRequired.elicit({
1478
+ * message: `Deploy to ${env}?`,
1479
+ * requestedSchema: confirmationSchema
1480
+ * })
1481
+ * }
1482
+ * });
1483
+ * }
1484
+ * return { content: [{ type: 'text', text: `deployed to ${env}` }] };
1485
+ * });
1486
+ * ```
1487
+ */
1488
+ declare const inputRequired: InputRequiredBuilder;
1489
+ /**
1490
+ * Reads the accepted content of a form-mode elicitation response from a
1491
+ * retried request's `inputResponses` (`ctx.mcpReq.inputResponses`).
1492
+ *
1493
+ * Returns the response's `content` for `key` when the entry is an accepted
1494
+ * elicitation result, and `undefined` otherwise (missing key, declined or
1495
+ * cancelled elicitation, or a response of another kind). The values arrive
1496
+ * from the client and are not re-validated here — treat them as untrusted
1497
+ * input.
1498
+ */
1499
+ declare function acceptedContent<T$1 extends Record<string, unknown> = Record<string, unknown>>(responses: InputResponses | Record<string, unknown> | undefined, key: string): T$1 | undefined;
1500
+ /**
1501
+ * Schema-aware overload: validates the accepted content against the given
1502
+ * schema (any Standard Schema, e.g. a zod object) before returning it, so the
1503
+ * untrusted client value arrives in the handler already validated and typed.
1504
+ *
1505
+ * Returns `undefined` when the response is missing/declined/of another kind
1506
+ * (as the two-argument form does) AND when the accepted content fails schema
1507
+ * validation — handlers treat both the same way (re-issue the request or
1508
+ * give up). Only synchronous schemas are supported (zod schemas without async
1509
+ * refinements are synchronous); an asynchronously-validating schema throws a
1510
+ * `TypeError`.
1511
+ */
1512
+ declare function acceptedContent<S extends StandardSchemaV1>(responses: InputResponses | Record<string, unknown> | undefined, key: string, schema: S): StandardSchemaV1.InferOutput<S> | undefined;
1513
+ /**
1514
+ * The discriminated view {@linkcode inputResponse} returns: which kind of
1515
+ * embedded response (if any) a retried request carried for a key. Bare
1516
+ * response objects are discriminated structurally — an `action` member means
1517
+ * an elicitation result, a `roots` array a roots listing, a `role` + `content`
1518
+ * pair a sampling result. A missing key or an entry that matches none of the
1519
+ * three shapes reads as `{ kind: 'missing' }`.
1520
+ */
1521
+ type InputResponseView = {
1522
+ kind: 'missing';
1523
+ } | {
1524
+ kind: 'elicit';
1525
+ action: 'accept' | 'decline' | 'cancel';
1526
+ content?: Record<string, unknown>;
1527
+ } | {
1528
+ kind: 'sampling';
1529
+ result: CreateMessageResult | CreateMessageResultWithTools;
1530
+ } | {
1531
+ kind: 'roots';
1532
+ roots: Root[];
1533
+ };
1534
+ /**
1535
+ * Reads one entry of a retried request's `inputResponses`
1536
+ * (`ctx.mcpReq.inputResponses`) as a discriminated view, covering
1537
+ * decline/cancel detection and the non-elicitation response kinds that
1538
+ * {@linkcode acceptedContent} does not surface.
1539
+ *
1540
+ * The values arrive from the client and are not re-validated here — treat
1541
+ * them as untrusted input (validate elicitation content with the
1542
+ * schema-aware {@linkcode acceptedContent} overload where it matters).
1543
+ */
1544
+ declare function inputResponse(responses: InputResponses | Record<string, unknown> | undefined, key: string): InputResponseView;
1545
+ //#endregion
1546
+ //#region ../core-internal/src/types/enums.d.ts
1547
+ /**
1548
+ * Error codes for protocol errors that cross the wire as JSON-RPC error responses.
1549
+ * These follow the JSON-RPC specification and MCP-specific extensions.
1550
+ */
1551
+ declare enum ProtocolErrorCode {
1552
+ ParseError = -32700,
1553
+ InvalidRequest = -32600,
1554
+ MethodNotFound = -32601,
1555
+ InvalidParams = -32602,
1556
+ InternalError = -32603,
1557
+ /**
1558
+ * Resource not found.
1559
+ *
1560
+ * Receive-tolerated only: the SDK never EMITS `-32002` — `resources/read`
1561
+ * misses answer `-32602` (Invalid Params) on every protocol revision per
1562
+ * the 2026-07-28 spec MUST, and a handler-thrown `-32002` is mapped to
1563
+ * `-32602` at the era encode seam. The member stays importable so clients
1564
+ * can recognise `-32002` from peers built on earlier SDK releases (the
1565
+ * spec's "clients SHOULD also accept `-32002`" backwards-compatibility
1566
+ * clause). Throw `ResourceNotFoundError` instead.
1567
+ */
1568
+ ResourceNotFound = -32002,
1569
+ /**
1570
+ * Processing the request requires a capability the client did not declare
1571
+ * in the request's `clientCapabilities` (protocol revision 2026-07-28).
1572
+ */
1573
+ MissingRequiredClientCapability = -32021,
1574
+ /**
1575
+ * The request's protocol version is unknown to the server or unsupported
1576
+ * by it (protocol revision 2026-07-28).
1577
+ */
1578
+ UnsupportedProtocolVersion = -32022,
1579
+ UrlElicitationRequired = -32042,
1580
+ }
1581
+ //#endregion
1582
+ //#region ../core-internal/src/types/errors.d.ts
1583
+ /**
1584
+ * Protocol errors are JSON-RPC errors that cross the wire as error responses.
1585
+ * They use numeric error codes from the {@linkcode ProtocolErrorCode} enum.
1586
+ *
1587
+ * `instanceof` on this class (and its subclasses) is brand-matched, so it works
1588
+ * across separately bundled copies of the SDK — e.g. an error constructed by
1589
+ * `@modelcontextprotocol/client` matches the class re-exported by
1590
+ * `@modelcontextprotocol/server` in the same process.
1591
+ */
1592
+ declare class ProtocolError extends Error {
1593
+ readonly code: number;
1594
+ readonly data?: unknown | undefined;
1595
+ static [Symbol.hasInstance](value: unknown): boolean;
1596
+ /**
1597
+ * Brand-based type guard: equivalent to `value instanceof this`, as an
1598
+ * explicit static predicate (the axios/AWS-SDK `isInstance` style). Reads
1599
+ * the caller's own brand via `this`, so every branded subclass gets a
1600
+ * correctly-scoped guard by inheritance. Must be invoked on the class —
1601
+ * in callback position write `v => SdkError.isInstance(v)`, not
1602
+ * `.filter(SdkError.isInstance)` (detached calls throw rather than
1603
+ * silently matching nothing).
1604
+ */
1605
+ static isInstance<T$1 extends abstract new (...args: never[]) => unknown>(this: T$1, value: unknown): value is InstanceType<T$1>;
1606
+ constructor(code: number, message: string, data?: unknown | undefined);
1607
+ /**
1608
+ * Factory method to create the appropriate error type based on the error code and data
1609
+ */
1610
+ static fromError(code: number, message: string, data?: unknown): ProtocolError;
1611
+ }
1612
+ /**
1613
+ * Error type for a `resources/read` miss: the requested resource does not
1614
+ * exist. The wire code is `-32602` (Invalid Params) on every protocol
1615
+ * revision — the spec MUST for revision 2026-07-28, and the value the v1.x
1616
+ * SDK has always emitted on earlier revisions. The error data echoes the
1617
+ * requested URI.
1618
+ *
1619
+ * Recognise this error by checking `error.data` is exactly `{ uri: string }`
1620
+ * (a `-32602` whose data carries `uri` and nothing else is resource-not-found;
1621
+ * any other `-32602` is an ordinary Invalid Params). For backwards compatibility, clients should also
1622
+ * accept `-32002` as resource not found — earlier SDK builds emitted that
1623
+ * code, and {@linkcode ProtocolError.fromError} reconstructs this class for
1624
+ * either code **when `error.data` carries `uri`** (a bare `-32002` without
1625
+ * `data.uri` stays a generic {@linkcode ProtocolError}). `instanceof` checks
1626
+ * are brand-matched and work across separately bundled copies of the SDK.
1627
+ */
1628
+ declare class ResourceNotFoundError extends ProtocolError {
1629
+ constructor(uri: string, message?: string);
1630
+ /** The URI that was requested and not found. */
1631
+ get uri(): string;
1632
+ }
1633
+ /**
1634
+ * Specialized error type when a tool requires a URL mode elicitation.
1635
+ * This makes it nicer for the client to handle since there is specific data to work with instead of just a code to check against.
1636
+ */
1637
+ declare class UrlElicitationRequiredError extends ProtocolError {
1638
+ constructor(elicitations: ElicitRequestURLParams[], message?: string);
1639
+ get elicitations(): ElicitRequestURLParams[];
1640
+ }
1641
+ /**
1642
+ * Error type for the `-32022` UnsupportedProtocolVersion protocol error (protocol
1643
+ * revision 2026-07-28): the request's protocol version is unknown to the server or
1644
+ * unsupported by it.
1645
+ *
1646
+ * The error data lists the protocol versions the receiver supports (`supported`),
1647
+ * so the sender can choose a mutually supported version and retry, and echoes the
1648
+ * version that was requested (`requested`).
1649
+ */
1650
+ declare class UnsupportedProtocolVersionError extends ProtocolError {
1651
+ constructor(data: UnsupportedProtocolVersionErrorData, message?: string);
1652
+ /**
1653
+ * Protocol versions the receiver supports.
1654
+ */
1655
+ get supported(): string[];
1656
+ /**
1657
+ * The protocol version that was requested.
1658
+ */
1659
+ get requested(): string;
1660
+ }
1661
+ /**
1662
+ * Error type for the `-32021` MissingRequiredClientCapability protocol error
1663
+ * (protocol revision 2026-07-28): processing the request requires a capability
1664
+ * the client did not declare in the request's `clientCapabilities`.
1665
+ *
1666
+ * The error data lists the missing capabilities (`requiredCapabilities`) in
1667
+ * the `ClientCapabilities` shape, so the client can see exactly what it would
1668
+ * have to declare for the request to be served. On HTTP, the response status
1669
+ * is `400 Bad Request`.
1670
+ *
1671
+ * Recognize this error by its code and `data.requiredCapabilities`, or by
1672
+ * `instanceof` — checks are brand-matched and work across separately bundled
1673
+ * copies of the SDK.
1674
+ */
1675
+ declare class MissingRequiredClientCapabilityError extends ProtocolError {
1676
+ constructor(data: MissingRequiredClientCapabilityErrorData, message?: string);
1677
+ /**
1678
+ * The capabilities the server requires from the client to process the
1679
+ * request (only the missing capabilities are listed).
1680
+ */
1681
+ get requiredCapabilities(): ClientCapabilities;
1682
+ }
1683
+ //#endregion
1684
+ //#region ../core-internal/src/types/guards.d.ts
1685
+ /**
1686
+ * Validates and parses an unknown value as a JSON-RPC message.
1687
+ *
1688
+ * Use this to validate incoming messages in custom transport implementations.
1689
+ * Throws if the value does not conform to the JSON-RPC message schema.
1690
+ *
1691
+ * @param value - The value to validate (typically a parsed JSON object).
1692
+ * @returns The validated {@linkcode JSONRPCMessage}.
1693
+ * @throws If validation fails.
1694
+ */
1695
+ declare function parseJSONRPCMessage(value: unknown): JSONRPCMessage;
1696
+ declare const isJSONRPCRequest: (value: unknown) => value is JSONRPCRequest;
1697
+ declare const isJSONRPCNotification: (value: unknown) => value is JSONRPCNotification;
1698
+ /**
1699
+ * Checks if a value is a valid {@linkcode JSONRPCResultResponse}.
1700
+ * @param value - The value to check.
1701
+ *
1702
+ * @returns True if the value is a valid {@linkcode JSONRPCResultResponse}, false otherwise.
1703
+ */
1704
+ declare const isJSONRPCResultResponse: (value: unknown) => value is JSONRPCResultResponse;
1705
+ /**
1706
+ * Checks if a value is a valid {@linkcode JSONRPCErrorResponse}.
1707
+ * @param value - The value to check.
1708
+ *
1709
+ * @returns True if the value is a valid {@linkcode JSONRPCErrorResponse}, false otherwise.
1710
+ */
1711
+ declare const isJSONRPCErrorResponse: (value: unknown) => value is JSONRPCErrorResponse;
1712
+ /**
1713
+ * Checks if a value is a valid {@linkcode JSONRPCResponse} (either a result or error response).
1714
+ * @param value - The value to check.
1715
+ *
1716
+ * @returns True if the value is a valid {@linkcode JSONRPCResponse}, false otherwise.
1717
+ */
1718
+ declare const isJSONRPCResponse: (value: unknown) => value is JSONRPCResponse;
1719
+ /**
1720
+ * Checks if a value is a valid {@linkcode CallToolResult}.
1721
+ *
1722
+ * This is a consumer-side VALUE check against the neutral model, not a wire
1723
+ * validator: a raw wire object that additionally carries wire-only members
1724
+ * (e.g. `resultType`) still passes through the loose index signature. Use a
1725
+ * transport-level parse to validate raw wire traffic.
1726
+ *
1727
+ * @param value - The value to check.
1728
+ *
1729
+ * @returns True if the value is a valid {@linkcode CallToolResult}, false otherwise.
1730
+ */
1731
+ declare const isCallToolResult: (value: unknown) => value is CallToolResult;
1732
+ /**
1733
+ * Checks whether a value is an input-required result (protocol revision
1734
+ * 2026-07-28): the multi-round-trip return shape discriminated by
1735
+ * `resultType: 'input_required'`.
1736
+ *
1737
+ * This is a discriminator check, not a full validator — the at-least-one rule
1738
+ * (`inputRequests` or `requestState`) is enforced by the `inputRequired()`
1739
+ * builder and re-checked by the server seam for hand-built values.
1740
+ *
1741
+ * @param value - The value to check.
1742
+ * @returns True if the value carries the `input_required` discriminator.
1743
+ */
1744
+ declare const isInputRequiredResult: (value: unknown) => value is InputRequiredResult;
1745
+ /**
1746
+ * Checks if a value is a valid {@linkcode TaskAugmentedRequestParams}.
1747
+ * @param value - The value to check.
1748
+ *
1749
+ * @returns True if the value is a valid {@linkcode TaskAugmentedRequestParams}, false otherwise.
1750
+ *
1751
+ * @deprecated Recognizes 2025-11-25 task wire vocabulary, which has no SDK
1752
+ * runtime; kept importable for interoperability only.
1753
+ */
1754
+ declare const isTaskAugmentedRequestParams: (value: unknown) => value is TaskAugmentedRequestParams;
1755
+ declare const isInitializeRequest: (value: unknown) => value is InitializeRequest;
1756
+ declare const isInitializedNotification: (value: unknown) => value is InitializedNotification;
1757
+ declare function assertCompleteRequestPrompt(request: CompleteRequest): asserts request is CompleteRequestPrompt;
1758
+ declare function assertCompleteRequestResourceTemplate(request: CompleteRequest): asserts request is CompleteRequestResourceTemplate;
1759
+ //#endregion
1760
+ //#region ../core-internal/src/types/specTypeSchema.d.ts
1761
+ /**
1762
+ * Explicit allowlist of protocol Zod schemas that correspond to a public spec type in `types.ts`.
1763
+ *
1764
+ * This intentionally excludes internal helper schemas exported from `schemas.ts` that have no
1765
+ * matching public type (e.g. `ListChangedOptionsBaseSchema`, `BaseRequestParamsSchema`,
1766
+ * `NotificationsParamsSchema`, `ClientTasksCapabilitySchema`, `ServerTasksCapabilitySchema`).
1767
+ * Keeping the list explicit means new public spec types must be added here deliberately, and
1768
+ * internals never leak into `SpecTypeName`.
1769
+ *
1770
+ * `ResourceTemplateSchema` is included; its public type is exported as `ResourceTemplateType`
1771
+ * (the bare name collides with the server package's `ResourceTemplate` class), so
1772
+ * `SpecTypes['ResourceTemplate']` is structurally equal to `ResourceTemplateType` rather than to
1773
+ * a type literally named `ResourceTemplate`.
1774
+ */
1775
+ declare const SPEC_SCHEMA_KEYS: readonly ["AnnotationsSchema", "AudioContentSchema", "BaseMetadataSchema", "BlobResourceContentsSchema", "BooleanSchemaSchema", "CallToolRequestSchema", "CallToolRequestParamsSchema", "CallToolResultSchema", "CancelledNotificationSchema", "CancelledNotificationParamsSchema", "CancelTaskRequestSchema", "CancelTaskResultSchema", "ClientCapabilitiesSchema", "ClientNotificationSchema", "ClientRequestSchema", "ClientResultSchema", "CompatibilityCallToolResultSchema", "CompleteRequestSchema", "CompleteRequestParamsSchema", "CompleteResultSchema", "ContentBlockSchema", "CreateMessageRequestSchema", "CreateMessageRequestParamsSchema", "CreateMessageResultSchema", "CreateMessageResultWithToolsSchema", "CreateTaskResultSchema", "CursorSchema", "DiscoverRequestSchema", "DiscoverResultSchema", "ElicitationCompleteNotificationSchema", "ElicitationCompleteNotificationParamsSchema", "ElicitRequestSchema", "ElicitRequestFormParamsSchema", "ElicitRequestParamsSchema", "ElicitRequestURLParamsSchema", "ElicitResultSchema", "EmbeddedResourceSchema", "EmptyResultSchema", "EnumSchemaSchema", "GetPromptRequestSchema", "GetPromptRequestParamsSchema", "GetPromptResultSchema", "GetTaskPayloadRequestSchema", "GetTaskPayloadResultSchema", "GetTaskRequestSchema", "GetTaskResultSchema", "IconSchema", "IconsSchema", "ImageContentSchema", "ImplementationSchema", "InitializedNotificationSchema", "InitializeRequestSchema", "InitializeRequestParamsSchema", "InitializeResultSchema", "JSONArraySchema", "JSONObjectSchema", "JSONRPCErrorResponseSchema", "JSONRPCMessageSchema", "JSONRPCNotificationSchema", "JSONRPCRequestSchema", "JSONRPCResponseSchema", "JSONRPCResultResponseSchema", "JSONValueSchema", "LegacyTitledEnumSchemaSchema", "ListPromptsRequestSchema", "ListPromptsResultSchema", "ListResourcesRequestSchema", "ListResourcesResultSchema", "ListResourceTemplatesRequestSchema", "ListResourceTemplatesResultSchema", "ListRootsRequestSchema", "ListRootsResultSchema", "ListTasksRequestSchema", "ListTasksResultSchema", "ListToolsRequestSchema", "ListToolsResultSchema", "LoggingLevelSchema", "LoggingMessageNotificationSchema", "LoggingMessageNotificationParamsSchema", "ModelHintSchema", "ModelPreferencesSchema", "MultiSelectEnumSchemaSchema", "NotificationSchema", "NumberSchemaSchema", "PaginatedRequestSchema", "PaginatedRequestParamsSchema", "PaginatedResultSchema", "PingRequestSchema", "PrimitiveSchemaDefinitionSchema", "ProgressSchema", "ProgressNotificationSchema", "ProgressNotificationParamsSchema", "ProgressTokenSchema", "PromptSchema", "PromptArgumentSchema", "PromptListChangedNotificationSchema", "PromptMessageSchema", "PromptReferenceSchema", "ReadResourceRequestSchema", "ReadResourceRequestParamsSchema", "ReadResourceResultSchema", "RelatedTaskMetadataSchema", "RequestSchema", "RequestIdSchema", "RequestMetaSchema", "ResourceSchema", "ResourceContentsSchema", "ResourceLinkSchema", "ResourceListChangedNotificationSchema", "ResourceRequestParamsSchema", "ResourceTemplateSchema", "ResourceTemplateReferenceSchema", "ResourceUpdatedNotificationSchema", "ResourceUpdatedNotificationParamsSchema", "ResultMetaObjectSchema", "ResultSchema", "RoleSchema", "RootSchema", "RootsListChangedNotificationSchema", "SamplingContentSchema", "SamplingMessageSchema", "SamplingMessageContentBlockSchema", "ServerCapabilitiesSchema", "ServerNotificationSchema", "ServerRequestSchema", "ServerResultSchema", "SetLevelRequestSchema", "SetLevelRequestParamsSchema", "SingleSelectEnumSchemaSchema", "StringSchemaSchema", "SubscribeRequestSchema", "SubscribeRequestParamsSchema", "SubscriptionFilterSchema", "SubscriptionsAcknowledgedNotificationSchema", "SubscriptionsAcknowledgedNotificationParamsSchema", "SubscriptionsListenRequestSchema", "SubscriptionsListenRequestParamsSchema", "SubscriptionsListenResultSchema", "SubscriptionsListenResultMetaSchema", "TaskAugmentedRequestParamsSchema", "TaskCreationParamsSchema", "TaskMetadataSchema", "TaskSchema", "TaskStatusSchema", "TaskStatusNotificationSchema", "TaskStatusNotificationParamsSchema", "TextContentSchema", "TextResourceContentsSchema", "TitledMultiSelectEnumSchemaSchema", "TitledSingleSelectEnumSchemaSchema", "ToolSchema", "ToolAnnotationsSchema", "ToolChoiceSchema", "ToolExecutionSchema", "ToolListChangedNotificationSchema", "ToolResultContentSchema", "ToolUseContentSchema", "UnsubscribeRequestSchema", "UnsubscribeRequestParamsSchema", "UntitledMultiSelectEnumSchemaSchema", "UntitledSingleSelectEnumSchemaSchema"];
1776
+ declare const authSchemas: {
1777
+ readonly IdJagTokenExchangeResponseSchema: any;
1778
+ readonly OAuthClientInformationFullSchema: any;
1779
+ readonly OAuthClientInformationSchema: any;
1780
+ readonly OAuthClientMetadataSchema: any;
1781
+ readonly OAuthClientRegistrationErrorSchema: any;
1782
+ readonly OAuthErrorResponseSchema: any;
1783
+ readonly OAuthMetadataSchema: any;
1784
+ readonly OAuthProtectedResourceMetadataSchema: any;
1785
+ readonly OAuthTokenRevocationRequestSchema: any;
1786
+ readonly OAuthTokensSchema: any;
1787
+ readonly OpenIdProviderDiscoveryMetadataSchema: any;
1788
+ readonly OpenIdProviderMetadataSchema: any;
1789
+ };
1790
+ type ProtocolSchemaKey = (typeof SPEC_SCHEMA_KEYS)[number];
1791
+ type AuthSchemaKey = keyof typeof authSchemas;
1792
+ type SchemaKey = ProtocolSchemaKey | AuthSchemaKey;
1793
+ type SchemaFor<K$1 extends SchemaKey> = K$1 extends ProtocolSchemaKey ? (typeof schemas_d_exports)[K$1] : K$1 extends AuthSchemaKey ? (typeof authSchemas)[K$1] : never;
1794
+ type StripSchemaSuffix<K$1> = K$1 extends `${infer N}Schema` ? N : never;
1795
+ /**
1796
+ * Union of every named type in the SDK's protocol and OAuth schemas (e.g. `'CallToolResult'`,
1797
+ * `'ContentBlock'`, `'Tool'`, `'OAuthTokens'`). Derived from the internal Zod schemas, so it stays
1798
+ * in sync with the spec.
1799
+ */
1800
+ type SpecTypeName = StripSchemaSuffix<SchemaKey>;
1801
+ /**
1802
+ * Maps each {@linkcode SpecTypeName} to its TypeScript type.
1803
+ *
1804
+ * `SpecTypes['Tool']` is equivalent to importing the `Tool` type directly.
1805
+ * These validators cover the NEUTRAL model — the consumer-facing shapes with
1806
+ * no wire-only members (`resultType`, the reserved `_meta` envelope keys).
1807
+ * Per-revision WIRE validators are deliberately not public surface; they are
1808
+ * planned to return as versioned `zod-schemas/<revision>` exports for
1809
+ * consumers who validate raw wire traffic themselves.
1810
+ */
1811
+ type SpecTypes = { [K in SchemaKey as StripSchemaSuffix<K>]: SchemaFor<K> extends z.ZodType ? z.output<SchemaFor<K>> : never };
1812
+ /**
1813
+ * Input shape for each {@linkcode SpecTypeName}. For most types this equals {@linkcode SpecTypes},
1814
+ * but a few schemas apply defaults/preprocessing, so the accepted input may be looser than the
1815
+ * resulting output type.
1816
+ */
1817
+ type SpecTypeInputs = { [K in SchemaKey as StripSchemaSuffix<K>]: SchemaFor<K> extends z.ZodType ? z.input<SchemaFor<K>> : never };
1818
+ type SchemaRecord = { readonly [K in SpecTypeName]: StandardSchemaV1Sync<SpecTypeInputs[K], SpecTypes[K]> };
1819
+ type GuardRecord = { readonly [K in SpecTypeName]: (value: unknown) => value is SpecTypeInputs[K] };
1820
+ /**
1821
+ * Runtime validators for every MCP spec type, keyed by type name.
1822
+ *
1823
+ * Use this when you need to validate a spec-defined shape at a boundary the SDK does not own, for
1824
+ * example an extension's custom-method payload that embeds a `CallToolResult`, or a value read from
1825
+ * storage that should be a `Tool`.
1826
+ *
1827
+ * Each entry implements the Standard Schema interface, so it composes with any
1828
+ * Standard-Schema-aware library. For a simple boolean check, use {@linkcode isSpecType} instead.
1829
+ *
1830
+ * @example
1831
+ * ```ts source="./specTypeSchema.examples.ts#specTypeSchemas_basicUsage"
1832
+ * const result = specTypeSchemas.CallToolResult['~standard'].validate(untrusted);
1833
+ * if (result.issues === undefined) {
1834
+ * // result.value is CallToolResult
1835
+ * }
1836
+ * ```
1837
+ */
1838
+ declare const specTypeSchemas: SchemaRecord;
1839
+ /**
1840
+ * Type predicates for every MCP spec type, keyed by type name.
1841
+ *
1842
+ * Returns `true` if the value satisfies the schema's input type (`z.input<>`, before defaults and
1843
+ * transforms are applied), and narrows to that input type. For schemas with `.default()` or
1844
+ * `.preprocess()`, this may accept values that do not structurally match the named output type;
1845
+ * for example `isSpecType.CallToolResult({})` is `true` because `content` has a default. Use
1846
+ * `specTypeSchemas.X['~standard'].validate(value)` when you need the validated output value.
1847
+ *
1848
+ * Each guard is a standalone function, so it can be passed directly as a callback.
1849
+ *
1850
+ * @example
1851
+ * ```ts source="./specTypeSchema.examples.ts#isSpecType_basicUsage"
1852
+ * if (isSpecType.ContentBlock(value)) {
1853
+ * // value is ContentBlock
1854
+ * }
1855
+ *
1856
+ * const blocks = mixed.filter(isSpecType.ContentBlock);
1857
+ * ```
1858
+ */
1859
+ declare const isSpecType: GuardRecord;
1860
+ //#endregion
1861
+ //#region ../core-internal/src/shared/transport.d.ts
1862
+ type FetchLike = (url: string | URL, init?: RequestInit) => Promise<Response>;
1863
+ /**
1864
+ * Creates a fetch function that includes base `RequestInit` options.
1865
+ * This ensures requests inherit settings like credentials, mode, headers, etc. from the base init.
1866
+ *
1867
+ * @param baseFetch - The base fetch function to wrap (defaults to global `fetch`)
1868
+ * @param baseInit - The base `RequestInit` to merge with each request
1869
+ * @returns A wrapped fetch function that merges base options with call-specific options
1870
+ */
1871
+ declare function createFetchWithInit(baseFetch?: FetchLike, baseInit?: RequestInit): FetchLike;
1872
+ /**
1873
+ * Options for sending a JSON-RPC message.
1874
+ */
1875
+ type TransportSendOptions = {
1876
+ /**
1877
+ * If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.
1878
+ */
1879
+ relatedRequestId?: RequestId | undefined;
1880
+ /**
1881
+ * The resumption token used to continue long-running requests that were interrupted.
1882
+ *
1883
+ * This allows clients to reconnect and continue from where they left off, if supported by the transport.
1884
+ */
1885
+ resumptionToken?: string | undefined;
1886
+ /**
1887
+ * A callback that is invoked when the resumption token changes, if supported by the transport.
1888
+ *
1889
+ * This allows clients to persist the latest token for potential reconnection.
1890
+ */
1891
+ onresumptiontoken?: ((token: string) => void) | undefined;
1892
+ /**
1893
+ * An abort signal for THIS outbound message's underlying request, when the
1894
+ * transport sends one outbound message per underlying request (the
1895
+ * Streamable HTTP transport's POST-per-request model). Aborting it cancels
1896
+ * the underlying request (and its SSE response stream) without closing the
1897
+ * transport. Transports that share a single channel (stdio, in-memory)
1898
+ * ignore it.
1899
+ */
1900
+ requestSignal?: AbortSignal | undefined;
1901
+ /**
1902
+ * Fired by transports that open a per-request stream (the Streamable HTTP
1903
+ * transport's POST-per-request SSE response) when that stream ends or
1904
+ * errors for any reason OTHER than a deliberate `requestSignal` abort —
1905
+ * i.e. the server closed the stream, the network dropped it, or
1906
+ * reconnection was exhausted. Transports that share a single channel
1907
+ * (stdio, in-memory) ignore it.
1908
+ */
1909
+ onRequestStreamEnd?: (() => void) | undefined;
1910
+ /**
1911
+ * Additional HTTP headers to send with THIS outbound message, when the
1912
+ * transport sends one outbound message per underlying HTTP request (the
1913
+ * Streamable HTTP transport's POST-per-request model). Transports that
1914
+ * share a single channel (stdio, in-memory) ignore it.
1915
+ *
1916
+ * The Client uses this to attach SEP-2243 `Mcp-Param-{Name}` headers to a
1917
+ * `tools/call` request on a 2026-07-28 connection. Values are sent
1918
+ * verbatim — encode anything that is not a safe RFC 9110 field value
1919
+ * before passing it here.
1920
+ */
1921
+ headers?: Readonly<Record<string, string>> | undefined;
1922
+ };
1923
+ /**
1924
+ * Describes the minimal contract for an MCP transport that a client or server can communicate over.
1925
+ */
1926
+ interface Transport {
1927
+ /**
1928
+ * Starts processing messages on the transport, including any connection steps that might need to be taken.
1929
+ *
1930
+ * This method should only be called after callbacks are installed, or else messages may be lost.
1931
+ *
1932
+ * NOTE: This method should not be called explicitly when using {@linkcode @modelcontextprotocol/client!client/client.Client | Client} or {@linkcode @modelcontextprotocol/server!server/server.Server | Server} classes, as they will implicitly call {@linkcode Transport.start | start()}.
1933
+ */
1934
+ start(): Promise<void>;
1935
+ /**
1936
+ * Sends a JSON-RPC message (request or response).
1937
+ *
1938
+ * If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.
1939
+ */
1940
+ send(message: JSONRPCMessage, options?: TransportSendOptions): Promise<void>;
1941
+ /**
1942
+ * Closes the connection.
1943
+ */
1944
+ close(): Promise<void>;
1945
+ /**
1946
+ * `true` when this transport opens one underlying request per outbound
1947
+ * JSON-RPC request (the Streamable HTTP POST-per-request model) and
1948
+ * therefore honors {@linkcode TransportSendOptions.requestSignal}. The
1949
+ * 2026-07-28 spec makes closing that per-request stream the cancellation
1950
+ * signal — the protocol layer aborts `requestSignal` instead of POSTing
1951
+ * `notifications/cancelled` when this flag is set on a 2026-era
1952
+ * connection. Transports that share a single channel (stdio, in-memory)
1953
+ * leave it `undefined`.
1954
+ */
1955
+ readonly hasPerRequestStream?: boolean;
1956
+ /**
1957
+ * Callback for when the connection is closed for any reason.
1958
+ *
1959
+ * This should be invoked when {@linkcode Transport.close | close()} is called as well.
1960
+ */
1961
+ onclose?: (() => void) | undefined;
1962
+ /**
1963
+ * Callback for when an error occurs.
1964
+ *
1965
+ * Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.
1966
+ */
1967
+ onerror?: ((error: Error) => void) | undefined;
1968
+ /**
1969
+ * Callback for when a message (request or response) is received over the connection.
1970
+ *
1971
+ * Includes the {@linkcode MessageExtraInfo.request | request} and {@linkcode MessageExtraInfo.authInfo | authInfo} if the transport is authenticated.
1972
+ *
1973
+ * The {@linkcode MessageExtraInfo.request | request} can be used to get the original request information (headers, etc.)
1974
+ */
1975
+ onmessage?: (<T$1 extends JSONRPCMessage>(message: T$1, extra?: MessageExtraInfo) => void) | undefined;
1976
+ /**
1977
+ * The session ID generated for this connection.
1978
+ */
1979
+ sessionId?: string | undefined;
1980
+ /**
1981
+ * Sets the protocol version used for the connection (called when the initialize response is received).
1982
+ */
1983
+ setProtocolVersion?: ((version: string) => void) | undefined;
1984
+ /**
1985
+ * Sets the supported protocol versions for header validation (called during connect).
1986
+ * This allows the server to pass its supported versions to the transport.
1987
+ */
1988
+ setSupportedProtocolVersions?: ((versions: string[]) => void) | undefined;
1989
+ }
1990
+ //#endregion
1991
+ //#region ../core-internal/src/shared/protocol.d.ts
1992
+ /**
1993
+ * Callback for progress notifications.
1994
+ */
1995
+ type ProgressCallback = (progress: Progress) => void;
1996
+ /**
1997
+ * Additional initialization options.
1998
+ */
1999
+ type ProtocolOptions = {
2000
+ /**
2001
+ * Protocol versions supported. The legacy `initialize` handshake offers and
2002
+ * falls back to the first 2025-era entry in the list (the client sends it,
2003
+ * the server counter-offers it); 2026-era entries are only ever selected via
2004
+ * `server/discover`. Passed to transport during {@linkcode Protocol.connect | connect()}.
2005
+ *
2006
+ * @default {@linkcode SUPPORTED_PROTOCOL_VERSIONS}
2007
+ */
2008
+ supportedProtocolVersions?: string[];
2009
+ /**
2010
+ * Whether to restrict emitted requests to only those that the remote side has indicated that they can handle, through their advertised capabilities.
2011
+ *
2012
+ * Note that this DOES NOT affect checking of _local_ side capabilities, as it is considered a logic error to mis-specify those.
2013
+ *
2014
+ * Currently this defaults to `false`, for backwards compatibility with SDK versions that did not advertise capabilities correctly. In future, this will default to `true`.
2015
+ */
2016
+ enforceStrictCapabilities?: boolean;
2017
+ /**
2018
+ * An array of notification method names that should be automatically debounced.
2019
+ * Any notifications with a method in this list will be coalesced if they
2020
+ * occur in the same tick of the event loop.
2021
+ * e.g., `['notifications/tools/list_changed']`
2022
+ */
2023
+ debouncedNotificationMethods?: string[];
2024
+ };
2025
+ /**
2026
+ * The default request timeout, in milliseconds.
2027
+ */
2028
+ declare const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
2029
+ /**
2030
+ * Options that can be given per request.
2031
+ */
2032
+ type RequestOptions = {
2033
+ /**
2034
+ * If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked.
2035
+ */
2036
+ onprogress?: ProgressCallback;
2037
+ /**
2038
+ * Can be used to cancel an in-flight request. This will cause an `AbortError` to be raised from {@linkcode Protocol.request | request()}.
2039
+ */
2040
+ signal?: AbortSignal;
2041
+ /**
2042
+ * A timeout (in milliseconds) for this request. If exceeded, an {@linkcode SdkError} with code {@linkcode SdkErrorCode.RequestTimeout} will be raised from {@linkcode Protocol.request | request()}.
2043
+ *
2044
+ * If not specified, {@linkcode DEFAULT_REQUEST_TIMEOUT_MSEC} will be used as the timeout.
2045
+ */
2046
+ timeout?: number;
2047
+ /**
2048
+ * If `true`, receiving a progress notification will reset the request timeout.
2049
+ * This is useful for long-running operations that send periodic progress updates.
2050
+ * Default: `false`
2051
+ */
2052
+ resetTimeoutOnProgress?: boolean;
2053
+ /**
2054
+ * Maximum total time (in milliseconds) to wait for a response.
2055
+ * If exceeded, an {@linkcode SdkError} with code {@linkcode SdkErrorCode.RequestTimeout} will be raised, regardless of progress notifications.
2056
+ * If not specified, there is no maximum total timeout.
2057
+ *
2058
+ * For multi-round-trip requests fulfilled by the auto-fulfilment driver
2059
+ * (protocol revision 2026-07-28), the budget bounds the WHOLE flow: every
2060
+ * retry leg is given only the time remaining.
2061
+ */
2062
+ maxTotalTimeout?: number;
2063
+ /**
2064
+ * Manual multi-round-trip mode for this call (protocol revision
2065
+ * 2026-07-28): when the response is an `input_required` result, hand it
2066
+ * back to the caller instead of auto-fulfilling it (or raising a typed
2067
+ * error). The resolved value is the neutral input-required shape
2068
+ * (`resultType: 'input_required'`, `inputRequests?`, `requestState?`);
2069
+ * wrap the result schema with `withInputRequired()` on the explicit
2070
+ * schema path to type both outcomes. The caller is then responsible for
2071
+ * gathering the requested input and retrying the original request with
2072
+ * `inputResponses` / `requestState` params and a fresh request.
2073
+ *
2074
+ * Default: `false`.
2075
+ */
2076
+ allowInputRequired?: boolean;
2077
+ } & TransportSendOptions;
2078
+ /**
2079
+ * Flow context handed to {@linkcode Protocol._resolveNonCompleteResult}: the
2080
+ * originating request, its options, the wire codec that decoded the response,
2081
+ * the timestamp the originating leg was issued at (for whole-flow timeout
2082
+ * accounting), and a `retry` closure that re-enters the request funnel with
2083
+ * fresh params on a fresh request id.
2084
+ */
2085
+ interface NonCompleteResultFlow<T$1 extends StandardSchemaV1 = StandardSchemaV1> {
2086
+ codec: WireCodec;
2087
+ request: Request$1;
2088
+ resultSchema: T$1;
2089
+ options: RequestOptions | undefined;
2090
+ flowStartedAt: number;
2091
+ /** Re-issue the originating request with the given params and per-leg options. */
2092
+ retry(params: Record<string, unknown> | undefined, legOptions: RequestOptions): Promise<unknown>;
2093
+ }
2094
+ /**
2095
+ * Options that can be given per notification.
2096
+ */
2097
+ type NotificationOptions = {
2098
+ /**
2099
+ * May be used to indicate to the transport which incoming request to associate this outgoing notification with.
2100
+ */
2101
+ relatedRequestId?: RequestId;
2102
+ };
2103
+ /**
2104
+ * The type of `ctx.mcpReq.requestState`. The type parameter is
2105
+ * caller-asserted (no validation, like the two-argument `acceptedContent<T>`)
2106
+ * — pair with `createRequestStateCodec<T>` so the claim is backed by the
2107
+ * codec's verification.
2108
+ */
2109
+ type RequestStateAccessor = <T$1 = unknown>() => T$1 | undefined;
2110
+ /**
2111
+ * Base context provided to all request handlers.
2112
+ */
2113
+ type BaseContext = {
2114
+ /**
2115
+ * The session ID from the transport, if available.
2116
+ */
2117
+ sessionId?: string;
2118
+ /**
2119
+ * Information about the MCP request being handled.
2120
+ */
2121
+ mcpReq: {
2122
+ /**
2123
+ * The JSON-RPC ID of the request being handled.
2124
+ */
2125
+ id: RequestId;
2126
+ /**
2127
+ * The method name of the request (e.g., 'tools/call', 'ping').
2128
+ */
2129
+ method: string;
2130
+ /**
2131
+ * Metadata from the original request, with the reserved
2132
+ * `io.modelcontextprotocol/*` envelope keys already lifted out
2133
+ * (readable via `ctx.mcpReq.envelope`).
2134
+ */
2135
+ _meta?: RequestMeta;
2136
+ /**
2137
+ * The per-request `_meta` envelope (protocol revision 2026-07-28):
2138
+ * the reserved `io.modelcontextprotocol/*` keys carried by the
2139
+ * request, lifted out of the `_meta` the handler sees. Surfaced as
2140
+ * received — `Partial` because only the keys the request actually
2141
+ * carried are present (envelope requiredness is enforced per request
2142
+ * at dispatch time, not by the lift); only present at all when the
2143
+ * request carried envelope keys.
2144
+ */
2145
+ envelope?: Partial<RequestMetaEnvelope>;
2146
+ /**
2147
+ * Multi-round-trip input responses carried by a retried request
2148
+ * (protocol revision 2026-07-28), lifted out of the params the
2149
+ * handler sees. Entries are the BARE response objects keyed by the
2150
+ * identifiers the server assigned in `inputRequests`; entries that do
2151
+ * not look like bare responses (e.g. a `{method, result}` wrapper)
2152
+ * are dropped and their keys recorded in `droppedInputResponseKeys`.
2153
+ *
2154
+ * The values arrive from the client and are NOT validated by the SDK
2155
+ * — treat them as untrusted input.
2156
+ */
2157
+ inputResponses?: Record<string, unknown>;
2158
+ /**
2159
+ * Keys of `inputResponses` entries the SDK dropped because they were
2160
+ * not bare response objects (for example the wrapped `{method,
2161
+ * result}` shape some peers emit). Surfaced so a handler can re-issue
2162
+ * the corresponding input request rather than hard-fail.
2163
+ */
2164
+ droppedInputResponseKeys?: string[];
2165
+ /**
2166
+ * Reads the multi-round-trip request state for the current round:
2167
+ * the value the configured `ServerOptions.requestState.verify` hook
2168
+ * resolved with (e.g. `createRequestStateCodec.verify`'s decoded
2169
+ * payload — `mint<T>`/`requestState<T>()` are the typed pair), the
2170
+ * raw wire string when no hook is configured, or `undefined` when
2171
+ * the round carried no state. The type parameter is a compile-time
2172
+ * cast only.
2173
+ *
2174
+ * SECURITY: `requestState` round-trips through the client and MUST
2175
+ * be treated as attacker-controlled input. The SDK applies no
2176
+ * integrity protection by default — servers whose state influences
2177
+ * authorization or business logic MUST integrity-protect it and
2178
+ * verify via the `requestState.verify` hook (spec:
2179
+ * basic/patterns/mrtr, server requirements 4–5).
2180
+ */
2181
+ requestState: RequestStateAccessor;
2182
+ /**
2183
+ * An abort signal used to communicate if the request was cancelled from the sender's side.
2184
+ */
2185
+ signal: AbortSignal;
2186
+ /**
2187
+ * Sends a request that relates to the current request being handled.
2188
+ *
2189
+ * This is used by certain transports to correctly associate related messages.
2190
+ *
2191
+ * For spec methods the result type is inferred from the method name.
2192
+ * For custom (non-spec) methods, pass a result schema as the second argument.
2193
+ */
2194
+ send: {
2195
+ <M$1 extends RequestMethod>(request: {
2196
+ method: M$1;
2197
+ params?: Record<string, unknown>;
2198
+ }, options?: RequestOptions): Promise<ResultTypeMap[M$1]>;
2199
+ <T$1 extends StandardSchemaV1>(request: Request$1, resultSchema: T$1, options?: RequestOptions): Promise<StandardSchemaV1.InferOutput<T$1>>;
2200
+ };
2201
+ /**
2202
+ * Sends a notification that relates to the current request being handled.
2203
+ *
2204
+ * This is used by certain transports to correctly associate related messages.
2205
+ */
2206
+ notify: (notification: Notification) => Promise<void>;
2207
+ };
2208
+ /**
2209
+ * HTTP transport information, only available when using an HTTP-based transport.
2210
+ */
2211
+ http?: {
2212
+ /**
2213
+ * Information about a validated access token, provided to request handlers.
2214
+ */
2215
+ authInfo?: AuthInfo;
2216
+ };
2217
+ };
2218
+ /**
2219
+ * Context provided to server-side request handlers, extending {@linkcode BaseContext} with server-specific fields.
2220
+ */
2221
+ type ServerContext = BaseContext & {
2222
+ mcpReq: {
2223
+ /**
2224
+ * Send a log message notification to the client.
2225
+ * Respects the client's log level filter set via logging/setLevel.
2226
+ *
2227
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
2228
+ * Remains functional during the deprecation window (at least twelve months).
2229
+ * Migrate to stderr logging (STDIO servers) or OpenTelemetry.
2230
+ */
2231
+ log: (level: LoggingLevel, data: unknown, logger?: string) => Promise<void>;
2232
+ /**
2233
+ * Send an elicitation request to the client, requesting user input.
2234
+ *
2235
+ * @deprecated Throws on a 2026-07-28-era request — return `inputRequired(...)`
2236
+ * (multi-round-trip) from the handler instead. The 2025 push-style server-to-client request model is
2237
+ * replaced by input_required results in the 2026-07-28 protocol. If your factory serves
2238
+ * both eras, this only works on the legacy path.
2239
+ */
2240
+ elicitInput: (params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions) => Promise<ElicitResult>;
2241
+ /**
2242
+ * Request LLM sampling from the client.
2243
+ *
2244
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
2245
+ * Throws on a 2026-07-28-era request — return `inputRequired(...)` (multi-round-trip)
2246
+ * from the handler instead, or migrate to calling LLM provider APIs directly. The 2025 push-style
2247
+ * server-to-client request model is replaced by input_required results in the 2026-07-28
2248
+ * protocol. If your factory serves both eras, this only works on the legacy path.
2249
+ */
2250
+ requestSampling: (params: CreateMessageRequest['params'], options?: RequestOptions) => Promise<CreateMessageResult | CreateMessageResultWithTools>;
2251
+ };
2252
+ http?: {
2253
+ /**
2254
+ * The original HTTP request.
2255
+ */
2256
+ req?: globalThis.Request;
2257
+ /**
2258
+ * Closes the SSE stream for this request, triggering client reconnection.
2259
+ * Only available when using a StreamableHTTPServerTransport with eventStore configured.
2260
+ */
2261
+ closeSSE?: () => void;
2262
+ /**
2263
+ * Closes the standalone GET SSE stream, triggering client reconnection.
2264
+ * Only available when using a StreamableHTTPServerTransport with eventStore configured.
2265
+ */
2266
+ closeStandaloneSSE?: () => void;
2267
+ };
2268
+ };
2269
+ /**
2270
+ * Context provided to client-side request handlers.
2271
+ */
2272
+ type ClientContext = BaseContext;
2273
+ /**
2274
+ * Implements MCP protocol framing on top of a pluggable transport, including
2275
+ * features like request/response linking, notifications, and progress.
2276
+ *
2277
+ * `Protocol` is abstract; `Client` and `Server` are the concrete role-specific
2278
+ * implementations most code should use.
2279
+ */
2280
+ declare abstract class Protocol<ContextT extends BaseContext> {
2281
+ private _options?;
2282
+ private _transport?;
2283
+ private _requestMessageId;
2284
+ private _requestHandlers;
2285
+ /** Methods registered with an explicit schema; the era gate in `_onrequest` reads it for the Tasks extension names. */
2286
+ private _customSchemaRequestMethods;
2287
+ private _requestHandlerAbortControllers;
2288
+ private _notificationHandlers;
2289
+ private _responseHandlers;
2290
+ private _progressHandlers;
2291
+ private _timeoutInfo;
2292
+ private _pendingDebouncedNotifications;
2293
+ /**
2294
+ * The protocol version negotiated for the current connection (`undefined`
2295
+ * before negotiation completes), which determines the wire era this
2296
+ * instance speaks. Set by the SDK's negotiation and initialize paths
2297
+ * (`Client.connect`, `Server._oninitialize`).
2298
+ */
2299
+ protected _negotiatedProtocolVersion?: string;
2300
+ protected _supportedProtocolVersions: string[];
2301
+ /**
2302
+ * Callback for when the connection is closed for any reason.
2303
+ *
2304
+ * This is invoked when {@linkcode Protocol.close | close()} is called as well.
2305
+ */
2306
+ onclose?: () => void;
2307
+ /**
2308
+ * Callback for when an error occurs.
2309
+ *
2310
+ * Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.
2311
+ */
2312
+ onerror?: (error: Error) => void;
2313
+ /**
2314
+ * A handler to invoke for any request types that do not have their own handler installed.
2315
+ */
2316
+ fallbackRequestHandler?: (request: JSONRPCRequest, ctx: ContextT) => Promise<Result$1>;
2317
+ /**
2318
+ * A handler to invoke for any notification types that do not have their own handler installed.
2319
+ */
2320
+ fallbackNotificationHandler?: (notification: Notification) => Promise<void>;
2321
+ constructor(_options?: ProtocolOptions | undefined);
2322
+ /**
2323
+ * Builds the context object for request handlers. Subclasses must override
2324
+ * to return the appropriate context type (e.g., ServerContext adds HTTP request info).
2325
+ */
2326
+ protected abstract buildContext(ctx: BaseContext, transportInfo?: MessageExtraInfo): ContextT;
2327
+ /**
2328
+ * Drop consult for inbound messages whose transport did not classify them
2329
+ * at the edge — long-lived channels such as stdio, where a role class may
2330
+ * need to decline traffic the negotiated era has no answer for (the
2331
+ * client-side inbound-request drop on modern-era connections: the
2332
+ * 2026-07-28 era has no server→client request channel, and on stdio the
2333
+ * client must never write JSON-RPC responses).
2334
+ *
2335
+ * Consulted ONLY when the transport supplied no
2336
+ * {@linkcode MessageExtraInfo.classification}: edge-classified traffic
2337
+ * never reaches the hook. Returning `'drop'` discards the message without
2338
+ * writing any response (requests are surfaced via `onerror`). The base
2339
+ * implementation returns `undefined`: unclassified traffic keeps today's
2340
+ * dispatch path unchanged. Era selection never happens here — era is
2341
+ * instance state, owned by the serving entry that constructed and
2342
+ * connected the instance.
2343
+ */
2344
+ protected _shouldDropInbound(_message: JSONRPCRequest | JSONRPCNotification): 'drop' | undefined;
2345
+ /**
2346
+ * The per-request `_meta` envelope this instance attaches to every outgoing
2347
+ * request and notification, when one applies. The base implementation
2348
+ * returns `undefined` (no envelope — the 2025-era posture, so legacy-era
2349
+ * outbound traffic is byte-identical to a build without this seam).
2350
+ * `Client` overrides it on a connection that negotiated a modern (2026-07-28+)
2351
+ * era to return the reserved protocol-version / client-info /
2352
+ * client-capabilities keys. User-supplied `_meta` keys take precedence over
2353
+ * the auto-attached ones.
2354
+ */
2355
+ protected _outboundMetaEnvelope(): Readonly<Record<string, unknown>> | undefined;
2356
+ /**
2357
+ * Attach this instance's outbound `_meta` envelope (when one is configured)
2358
+ * to a request or notification. A no-op when the seam returns `undefined`
2359
+ * — the message returns by reference, so the legacy-era wire stays
2360
+ * byte-identical. User-supplied `_meta` keys are spread last so they win
2361
+ * over the auto-attached envelope keys.
2362
+ */
2363
+ private _envelopeOutbound;
2364
+ /**
2365
+ * Extension point for non-`complete` decoded results in the response
2366
+ * funnel: a result the wire codec discriminated into a kind other than
2367
+ * `'complete'` or `'invalid'` is handed here for the role class to
2368
+ * resolve. The base default surfaces it as a typed
2369
+ * {@linkcode SdkErrorCode.UnsupportedResultType} error (no retry).
2370
+ *
2371
+ * Intended consumers (named so the seam stays accountable):
2372
+ * - the `Client`'s multi-round-trip auto-fulfilment engine, which fulfils
2373
+ * `'input_required'` results through the registered
2374
+ * elicitation/sampling/roots handlers and retries via `flow.retry`;
2375
+ * - a future client-side terminal-result handler for
2376
+ * `subscriptions/listen`, when the spec defines one.
2377
+ *
2378
+ * `Server` instances never receive `input_required` responses on their
2379
+ * outbound legs and leave the base behavior in place.
2380
+ */
2381
+ protected _resolveNonCompleteResult<T$1 extends StandardSchemaV1>(decoded: ReturnType<WireCodec['decodeResult']> & {
2382
+ kind: 'input_required';
2383
+ }, flow: NonCompleteResultFlow<T$1>): Promise<unknown>;
2384
+ /**
2385
+ * Protected accessor for a registered request handler. Used by role
2386
+ * classes that dispatch synthesized requests through the same stored
2387
+ * handler chain (e.g. the `Client` fulfilling an embedded multi-round-trip
2388
+ * input request).
2389
+ */
2390
+ protected _getRequestHandler(method: string): ((request: JSONRPCRequest, ctx: ContextT) => Promise<Result$1>) | undefined;
2391
+ private _oncancel;
2392
+ private _setupTimeout;
2393
+ private _resetTimeout;
2394
+ private _cleanupTimeout;
2395
+ /**
2396
+ * Attaches to the given transport, starts it, and starts listening for messages.
2397
+ *
2398
+ * The caller assumes ownership of the {@linkcode Transport}, replacing any callbacks that have already been set, and expects that it is the only user of the {@linkcode Transport} instance going forward.
2399
+ */
2400
+ connect(transport: Transport): Promise<void>;
2401
+ /**
2402
+ * Transport-close hook. Subclass overrides MUST call `super._onclose()`
2403
+ * after their own cleanup — base teardown (response-handler settlement,
2404
+ * timeout clearing, in-flight request abort) does not run otherwise.
2405
+ */
2406
+ protected _onclose(): void;
2407
+ private _onerror;
2408
+ /**
2409
+ * Inbound-notification dispatch. Subclass overrides MUST delegate
2410
+ * unmatched traffic to `super._onnotification(rawNotification, extra)` —
2411
+ * an override that consumes only what it owns and falls through to base
2412
+ * dispatch for everything else.
2413
+ */
2414
+ protected _onnotification(rawNotification: JSONRPCNotification, extra?: MessageExtraInfo): void;
2415
+ private _onrequest;
2416
+ private _onprogress;
2417
+ /**
2418
+ * Inbound-response dispatch. Subclass overrides MUST delegate unmatched
2419
+ * traffic to `super._onresponse(response)` — an override that consumes
2420
+ * only what it owns and falls through to base dispatch for everything
2421
+ * else.
2422
+ */
2423
+ protected _onresponse(response: JSONRPCResponse | JSONRPCErrorResponse): void;
2424
+ get transport(): Transport | undefined;
2425
+ /**
2426
+ * Closes the connection.
2427
+ */
2428
+ close(): Promise<void>;
2429
+ /**
2430
+ * A method to check if a capability is supported by the remote side, for the given method to be called.
2431
+ *
2432
+ * This should be implemented by subclasses.
2433
+ */
2434
+ protected abstract assertCapabilityForMethod(method: RequestMethod | string): void;
2435
+ /**
2436
+ * A method to check if a notification is supported by the local side, for the given method to be sent.
2437
+ *
2438
+ * This should be implemented by subclasses.
2439
+ */
2440
+ protected abstract assertNotificationCapability(method: NotificationMethod | string): void;
2441
+ /**
2442
+ * A method to check if a request handler is supported by the local side, for the given method to be handled.
2443
+ *
2444
+ * This should be implemented by subclasses.
2445
+ */
2446
+ protected abstract assertRequestHandlerCapability(method: string): void;
2447
+ /**
2448
+ * Sends a request and waits for a response.
2449
+ *
2450
+ * For spec methods the result schema is resolved automatically from the method name
2451
+ * and the return type is method-keyed. For custom (non-spec) methods, pass a
2452
+ * `resultSchema` as the second argument; the response is validated against it and
2453
+ * the return type is inferred from the schema.
2454
+ *
2455
+ * Do not use this method to emit notifications! Use {@linkcode Protocol.notification | notification()} instead.
2456
+ */
2457
+ request<M$1 extends RequestMethod>(request: {
2458
+ method: M$1;
2459
+ params?: Record<string, unknown>;
2460
+ }, options?: RequestOptions): Promise<ResultTypeMap[M$1]>;
2461
+ request<T$1 extends StandardSchemaV1>(request: Request$1, resultSchema: T$1, options?: RequestOptions): Promise<StandardSchemaV1.InferOutput<T$1>>;
2462
+ /**
2463
+ * The wire codec for this instance's negotiated era — the phase-2 truth:
2464
+ * everything an established connection sends and receives resolves
2465
+ * through it. Legacy until a version has been negotiated.
2466
+ */
2467
+ private _negotiatedWireCodec;
2468
+ /**
2469
+ * Protected accessor for the instance's negotiated wire codec, for role
2470
+ * classes (Client/Server/McpServer) routing era-dependent behavior
2471
+ * through the codec's function-only surface — `samplingResultVariant`,
2472
+ * `outboundEnvelope`, `projectCallToolResult` — instead of branching on
2473
+ * the protocol version themselves.
2474
+ */
2475
+ protected _wireCodec(): WireCodec;
2476
+ /**
2477
+ * Outbound codec resolution: while the negotiated version is still unset
2478
+ * (the negotiation window), lifecycle messages are bootstrap-pinned BY
2479
+ * METHOD — they self-identify their era (`initialize` IS the legacy
2480
+ * handshake, `server/discover` IS the modern probe). Once a version has
2481
+ * been negotiated, the instance era is authoritative for everything — a
2482
+ * negotiated session never re-routes a method onto the other era.
2483
+ */
2484
+ private _resolveOutboundCodec;
2485
+ /**
2486
+ * Era gate for outbound requests — deletions are physical in BOTH
2487
+ * directions: sending a spec method that the resolved era does not define
2488
+ * dies locally with a typed error before anything reaches the transport.
2489
+ * Methods outside the spec universe are consumer-owned extension methods
2490
+ * and stay era-blind.
2491
+ */
2492
+ private _assertOutboundRequestInEra;
2493
+ /**
2494
+ * Sends a request and waits for a response, using the provided schema for
2495
+ * validation instead of the era registry's method-keyed entry.
2496
+ *
2497
+ * This is the internal implementation used by SDK methods whose result
2498
+ * schema cannot be expressed as a method-keyed registry entry — the one
2499
+ * surviving case is `server.createMessage`, whose result schema depends
2500
+ * on the REQUEST params (tools vs no tools) — and by callers passing
2501
+ * explicit compatibility schemas. Spec methods are still era-gated here:
2502
+ * an explicit schema never smuggles a deleted method onto the wire.
2503
+ */
2504
+ protected _requestWithSchema<T$1 extends StandardSchemaV1>(request: Request$1, resultSchema: T$1, options?: RequestOptions): Promise<StandardSchemaV1.InferOutput<T$1>>;
2505
+ /**
2506
+ * The request funnel proper, keyed by the resolved era codec: the codec
2507
+ * owns result decoding (raw-first `resultType` discrimination — V-1 —
2508
+ * and the era's lift posture) before the schema validation step.
2509
+ */
2510
+ private _requestWithSchemaViaCodec;
2511
+ /**
2512
+ * Emits a notification, which is a one-way message that does not expect a response.
2513
+ */
2514
+ notification(notification: Notification, options?: NotificationOptions): Promise<void>;
2515
+ /**
2516
+ * The notification funnel proper, keyed by the resolved era codec —
2517
+ * direct sends and related notifications (`ctx.mcpReq.notify`) alike
2518
+ * resolve through the instance's negotiated era at send time.
2519
+ */
2520
+ private _notificationViaCodec;
2521
+ /**
2522
+ * Registers a handler to invoke when this protocol object receives a request with the given method.
2523
+ *
2524
+ * Note that this will replace any previous request handler for the same method.
2525
+ *
2526
+ * For spec methods, pass `(method, handler)`; the request is parsed with the spec
2527
+ * schema and the handler receives the typed `Request`. For custom (non-spec)
2528
+ * methods, pass `(method, schemas, handler)`; `params` are validated against
2529
+ * `schemas.params` and the handler receives the parsed params object directly.
2530
+ * Supplying `schemas.result` types the handler's return value.
2531
+ *
2532
+ * @example Custom request method
2533
+ * ```ts source="./protocol.examples.ts#Protocol_setRequestHandler_customMethod"
2534
+ * const SearchParams = z.object({ query: z.string(), limit: z.number().optional() });
2535
+ * const SearchResult = z.object({ hits: z.array(z.string()) });
2536
+ *
2537
+ * protocol.setRequestHandler('acme/search', { params: SearchParams, result: SearchResult }, async (params, _ctx) => {
2538
+ * return { hits: [`result for ${params.query}`] };
2539
+ * });
2540
+ * ```
2541
+ */
2542
+ setRequestHandler<M$1 extends RequestMethod>(method: M$1, handler: (request: RequestTypeMap[M$1], ctx: ContextT) => HandlerResultTypeMap[M$1] | Promise<HandlerResultTypeMap[M$1]>): void;
2543
+ setRequestHandler<P extends StandardSchemaV1, R extends StandardSchemaV1 | undefined = undefined>(method: string, schemas: {
2544
+ params: P;
2545
+ result?: R;
2546
+ }, handler: (params: StandardSchemaV1.InferOutput<P>, ctx: ContextT) => InferHandlerResult<R> | Promise<InferHandlerResult<R>>): void;
2547
+ /**
2548
+ * Hook for subclasses to wrap a registered request handler with role-specific
2549
+ * validation or behavior (e.g. `Server` validates `tools/call` results, `Client`
2550
+ * validates `elicitation/create` mode and result). Runs for both the 2-arg and
2551
+ * 3-arg registration paths. The default implementation is identity.
2552
+ *
2553
+ * Subclasses overriding this hook avoid redeclaring `setRequestHandler`'s overload set.
2554
+ */
2555
+ protected _wrapHandler(_method: string, handler: (request: JSONRPCRequest, ctx: ContextT) => Promise<Result$1>): (request: JSONRPCRequest, ctx: ContextT) => Promise<Result$1>;
2556
+ /**
2557
+ * Hook for subclasses to supply the implementation identity the 2026-era
2558
+ * encode seam stamps into outbound result `_meta` under
2559
+ * `io.modelcontextprotocol/serverInfo` (spec PR #3002: servers SHOULD
2560
+ * identify themselves on every response). The default is `undefined` — no
2561
+ * stamp. Only `Server` overrides this: the key identifies the software
2562
+ * producing a response, and the 2025-era codec never stamps anything
2563
+ * regardless (the never-stamp guarantee).
2564
+ */
2565
+ protected _outboundServerInfo(): Implementation | undefined;
2566
+ /**
2567
+ * Removes the request handler for the given method.
2568
+ */
2569
+ removeRequestHandler(method: RequestMethod | string): void;
2570
+ /**
2571
+ * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
2572
+ */
2573
+ assertCanSetRequestHandler(method: RequestMethod | string): void;
2574
+ /**
2575
+ * Registers a handler to invoke when this protocol object receives a notification with the given method.
2576
+ *
2577
+ * Note that this will replace any previous notification handler for the same method.
2578
+ *
2579
+ * For spec methods, pass `(method, handler)`; the notification is parsed with the
2580
+ * spec schema. For custom (non-spec) methods, pass `(method, schemas, handler)`;
2581
+ * `params` are validated against `schemas.params` and the handler receives the
2582
+ * parsed params object directly. The raw notification is passed as the second
2583
+ * argument; `_meta` is recoverable via `notification.params?._meta` (minus the
2584
+ * reserved `io.modelcontextprotocol/*` envelope keys, which the protocol layer
2585
+ * lifts out before dispatch).
2586
+ */
2587
+ setNotificationHandler<M$1 extends NotificationMethod>(method: M$1, handler: (notification: NotificationTypeMap[M$1]) => void | Promise<void>): void;
2588
+ setNotificationHandler<P extends StandardSchemaV1>(method: string, schemas: {
2589
+ params: P;
2590
+ }, handler: (params: StandardSchemaV1.InferOutput<P>, notification: Notification) => void | Promise<void>): void;
2591
+ /**
2592
+ * Removes the notification handler for the given method.
2593
+ */
2594
+ removeNotificationHandler(method: NotificationMethod | string): void;
2595
+ }
2596
+ /**
2597
+ * Schema bundle accepted by {@linkcode Protocol.setRequestHandler | setRequestHandler}'s 3-arg form.
2598
+ *
2599
+ * `params` is required and validates the inbound `request.params`. `result` is optional;
2600
+ * when supplied it types the handler's return value (no runtime validation is performed
2601
+ * on the result).
2602
+ */
2603
+ interface RequestHandlerSchemas<P extends StandardSchemaV1 = StandardSchemaV1, R extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> {
2604
+ params: P;
2605
+ result?: R;
2606
+ }
2607
+ type InferHandlerResult<R extends StandardSchemaV1 | undefined> = R extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<R> : Result$1;
2608
+ declare function mergeCapabilities(base: ServerCapabilities, additional: Partial<ServerCapabilities>): ServerCapabilities;
2609
+ declare function mergeCapabilities(base: ClientCapabilities, additional: Partial<ClientCapabilities>): ClientCapabilities;
2610
+ //#endregion
2611
+ //#region ../core-internal/src/shared/mediaType.d.ts
2612
+ /**
2613
+ * Whether a raw `Content-Type` header value denotes `application/json`.
2614
+ * Parameters (for example `charset=utf-8`) are allowed and ignored; malformed
2615
+ * parameter sections do not reject a header whose media type is unambiguously
2616
+ * `application/json` (see `mediaTypeEssence` for the exact grammar).
2617
+ */
2618
+ declare function isJsonContentType(header: string | null | undefined): boolean;
2619
+ //#endregion
2620
+ //#region ../core-internal/src/shared/metadataUtils.d.ts
2621
+ /**
2622
+ * Utilities for working with {@linkcode BaseMetadata} objects.
2623
+ */
2624
+ /**
2625
+ * Gets the display name for an object with {@linkcode BaseMetadata}.
2626
+ * For tools, the precedence is: `title` → {@linkcode index.ToolAnnotations | annotations}.`title` → `name`
2627
+ * For other objects: `title` → `name`
2628
+ * This implements the spec requirement: "if no title is provided, name should be used for display purposes"
2629
+ */
2630
+ declare function getDisplayName(metadata: BaseMetadata | (BaseMetadata & {
2631
+ annotations?: {
2632
+ title?: string;
2633
+ };
2634
+ })): string;
2635
+ //#endregion
2636
+ //#region ../core-internal/src/shared/protocolEras.d.ts
2637
+ /**
2638
+ * Protocol-era helpers (pure module). The MCP wire protocol splits into two eras:
2639
+ * legacy (the 2025-11-25 family and earlier; the version is negotiated via the
2640
+ * `initialize` handshake) and modern (2026-07-28 and later; no `initialize` —
2641
+ * servers advertise versions via `server/discover` and every request carries a
2642
+ * `_meta` envelope).
2643
+ *
2644
+ * An operation that belongs to one era must only ever consult that era's subset
2645
+ * of a supported-versions list: `initialize` never accepts or counter-offers a
2646
+ * modern revision, and the `server/discover` advertisement only ever contains
2647
+ * modern revisions.
2648
+ */
2649
+ /**
2650
+ * The protocol era of a connection: `'legacy'` for the 2025-11-25 family and
2651
+ * earlier (negotiated via `initialize`), `'modern'` for 2026-07-28 and later
2652
+ * (negotiated via `server/discover`; every request carries a `_meta` envelope).
2653
+ */
2654
+ type ProtocolEra = 'legacy' | 'modern';
2655
+ //#endregion
2656
+ //#region ../core-internal/src/shared/resultCacheHints.d.ts
2657
+ /**
2658
+ * Cache-hint plumbing for cacheable results (protocol revision 2026-07-28).
2659
+ *
2660
+ * The 2026-07-28 revision requires `ttlMs`/`cacheScope` on the cacheable
2661
+ * result types (SEP-2549 `CacheableResult`). The values are resolved at the
2662
+ * era-aware encode seam (the 2026 wire codec's `encodeResult`), most specific
2663
+ * author first:
2664
+ *
2665
+ * 1. fields the handler returned on the result itself (when valid),
2666
+ * 2. a configured cache hint attached by the server layer
2667
+ * (per-registration hint, then the server-level per-operation hint,
2668
+ * combined per field — see {@linkcode attachCacheHintFallback}),
2669
+ * 3. the conservative defaults `{ ttlMs: 0, cacheScope: 'private' }`.
2670
+ *
2671
+ * The configured hint travels from the (era-blind) server configuration to the
2672
+ * (era-aware) encode seam on a symbol-keyed property of the result object —
2673
+ * {@linkcode RESULT_CACHE_HINT_FALLBACK}. Symbol-keyed properties are never
2674
+ * serialized to JSON, so attaching a hint can never change what a 2025-era
2675
+ * response looks like on the wire: only the 2026-era codec reads (and removes)
2676
+ * it while filling the required fields. The 2025-era codec has no cache code
2677
+ * path at all.
2678
+ */
2679
+ /** The cache scopes defined for cacheable results (SEP-2549). */
2680
+ type CacheScope = 'public' | 'private';
2681
+ /**
2682
+ * A cache hint for a cacheable result (protocol revision 2026-07-28): the
2683
+ * values to emit for `ttlMs` / `cacheScope` when the handler does not provide
2684
+ * them itself. Absent fields fall back to the conservative defaults
2685
+ * (`ttlMs: 0`, `cacheScope: 'private'`).
2686
+ */
2687
+ interface CacheHint {
2688
+ /** Cache lifetime in milliseconds. Must be a non-negative safe integer. */
2689
+ ttlMs?: number;
2690
+ /** Whether the result may be cached by shared caches (`public`) or only by the requesting client (`private`). */
2691
+ cacheScope?: CacheScope;
2692
+ }
2693
+ /**
2694
+ * The operations whose results are cacheable on the 2026-07-28 revision (the
2695
+ * `CacheableResult` extenders). This list is closed: no other operation's
2696
+ * result ever receives cache fields from the SDK.
2697
+ */
2698
+ declare const CACHEABLE_RESULT_METHODS: readonly ["tools/list", "prompts/list", "resources/list", "resources/templates/list", "resources/read", "server/discover"];
2699
+ /** A method whose result is cacheable on the 2026-07-28 revision. */
2700
+ type CacheableResultMethod = (typeof CACHEABLE_RESULT_METHODS)[number];
2701
+ //#endregion
2702
+ //#region ../core-internal/src/shared/stdio.d.ts
2703
+ declare const STDIO_DEFAULT_MAX_BUFFER_SIZE: number;
2704
+ /**
2705
+ * Buffers a continuous stdio stream into discrete JSON-RPC messages.
2706
+ */
2707
+ declare class ReadBuffer {
2708
+ private _buffer?;
2709
+ private _maxBufferSize;
2710
+ constructor(options?: {
2711
+ maxBufferSize?: number;
2712
+ });
2713
+ append(chunk: Buffer): void;
2714
+ readMessage(): JSONRPCMessage | null;
2715
+ clear(): void;
2716
+ }
2717
+ declare function deserializeMessage(line: string): JSONRPCMessage;
2718
+ declare function serializeMessage(message: JSONRPCMessage): string;
2719
+ //#endregion
2720
+ //#region ../core-internal/src/shared/uriTemplate.d.ts
2721
+ type Variables = Record<string, string | string[]>;
2722
+ declare class UriTemplate {
2723
+ /**
2724
+ * Returns true if the given string contains any URI template expressions.
2725
+ * A template expression is a sequence of characters enclosed in curly braces,
2726
+ * like `{foo}` or `{?bar}`.
2727
+ */
2728
+ static isTemplate(str: string): boolean;
2729
+ private static validateLength;
2730
+ private readonly template;
2731
+ private readonly parts;
2732
+ get variableNames(): string[];
2733
+ constructor(template: string);
2734
+ toString(): string;
2735
+ private parse;
2736
+ private getOperator;
2737
+ private getNames;
2738
+ private encodeValue;
2739
+ private expandPart;
2740
+ expand(variables: Variables): string;
2741
+ private escapeRegExp;
2742
+ private partToRegExp;
2743
+ match(uri: string): Variables | null;
2744
+ }
2745
+ //#endregion
2746
+ //#region ../core-internal/src/util/inMemory.d.ts
2747
+ /**
2748
+ * In-memory transport for creating clients and servers that talk to each other within the same process.
2749
+ *
2750
+ * Intended for testing and development. For production in-process connections, use
2751
+ * `StreamableHTTPClientTransport` against a local server URL.
2752
+ */
2753
+ declare class InMemoryTransport implements Transport {
2754
+ private _otherTransport?;
2755
+ private _messageQueue;
2756
+ private _closed;
2757
+ onclose?: () => void;
2758
+ onerror?: (error: Error) => void;
2759
+ onmessage?: (message: JSONRPCMessage, extra?: {
2760
+ authInfo?: AuthInfo;
2761
+ }) => void;
2762
+ sessionId?: string;
2763
+ /**
2764
+ * Creates a pair of linked in-memory transports that can communicate with each other. One should be passed to a {@linkcode @modelcontextprotocol/client!client/client.Client | Client} and one to a {@linkcode @modelcontextprotocol/server!server/server.Server | Server}.
2765
+ */
2766
+ static createLinkedPair(): [InMemoryTransport, InMemoryTransport];
2767
+ start(): Promise<void>;
2768
+ close(): Promise<void>;
2769
+ /**
2770
+ * Sends a message with optional auth info.
2771
+ * This is useful for testing authentication scenarios.
2772
+ */
2773
+ send(message: JSONRPCMessage, options?: {
2774
+ relatedRequestId?: RequestId;
2775
+ authInfo?: AuthInfo;
2776
+ }): Promise<void>;
2777
+ }
2778
+ //#endregion
2779
+ //#region ../core-internal/src/wire/preload.d.ts
2780
+ /**
2781
+ * Eagerly builds every lazily-constructed wire-schema layer, so that no later
2782
+ * validation pays schema-construction cost.
2783
+ *
2784
+ * Synchronous and idempotent: every layer is a memo, so the first call does
2785
+ * all the work and subsequent calls return immediately. Reference identity is
2786
+ * unaffected — this forces the same memos every lazy consumer pulls through.
2787
+ *
2788
+ * Call it at module scope on platforms that bill per-request CPU but not
2789
+ * module evaluation (isolate-based edge/serverless runtimes), where deferring
2790
+ * construction would move it into the first request of every fresh isolate:
2791
+ *
2792
+ * ```ts
2793
+ * // from '@modelcontextprotocol/server' or '@modelcontextprotocol/client' —
2794
+ * // each package bundles its own schema copy, so warm the one(s) you import.
2795
+ * preloadSchemas(); // module scope — runs during isolate warm-up
2796
+ * ```
2797
+ *
2798
+ * On Node CLIs and other process-per-invocation runtimes, prefer the lazy
2799
+ * default — there, module-scope construction is pure added boot latency.
2800
+ */
2801
+ declare function preloadSchemas(): void;
2802
+ //#endregion
2803
+ //#region src/server/scopeChallenge.d.ts
2804
+ /** OAuth scopes to request before handling an MCP request. */
2805
+ interface ScopeChallenge {
2806
+ /** The exact, complete scope set to include in the challenge. Each scope must satisfy the OAuth `scope-token` grammar. */
2807
+ scopes: readonly [string, ...string[]];
2808
+ /** Optional human-readable detail satisfying the RFC 6750 `error-description` grammar. */
2809
+ errorDescription?: string;
2810
+ }
2811
+ /** Determines whether an MCP request needs an OAuth scope challenge. */
2812
+ type ScopeChallengeHandler = (context: {
2813
+ request: JSONRPCRequest;
2814
+ authInfo?: AuthInfo;
2815
+ }) => ScopeChallenge | undefined | Promise<ScopeChallenge | undefined>;
2816
+ /**
2817
+ * Creates a handler that requires every supplied scope exactly.
2818
+ *
2819
+ * Requests without authentication are left to the server's authentication gate.
2820
+ */
2821
+ declare function requireScopes(...scopes: readonly [string, ...string[]]): ScopeChallengeHandler;
2822
+ //#endregion
2823
+ //#region src/server/server.d.ts
2824
+ type ServerOptions = ProtocolOptions & {
2825
+ /**
2826
+ * Capabilities to advertise as being supported by this server.
2827
+ *
2828
+ * Note: per the MCP spec, a server that declares a capability MUST respond to that
2829
+ * capability's requests (e.g. `tools/list` for `tools`) — potentially with an empty
2830
+ * result — rather than with a "Method not found" error. {@linkcode server/mcp.McpServer | McpServer}
2831
+ * handles this automatically for capabilities declared here; when using the low-level
2832
+ * {@linkcode Server} directly, you are responsible for registering a request handler for
2833
+ * every capability you declare.
2834
+ */
2835
+ capabilities?: ServerCapabilities;
2836
+ /**
2837
+ * Optional instructions describing how to use the server and its features.
2838
+ */
2839
+ instructions?: string;
2840
+ /**
2841
+ * JSON Schema validator for elicitation response validation.
2842
+ *
2843
+ * The validator is used to validate user input returned from elicitation
2844
+ * requests against the requested schema.
2845
+ *
2846
+ * @default Runtime-selected validator (AJV-backed on Node.js, `@cfworker/json-schema`-backed on browser/workerd runtimes)
2847
+ */
2848
+ jsonSchemaValidator?: jsonSchemaValidator;
2849
+ /**
2850
+ * Cache hints for the cacheable results of the 2026-07-28 protocol
2851
+ * revision (`ttlMs` / `cacheScope`), keyed by operation. The cacheable
2852
+ * operations are `tools/list`, `prompts/list`, `resources/list`,
2853
+ * `resources/templates/list`, `resources/read` and `server/discover`. The
2854
+ * hint is used when the result for that operation does not provide its own
2855
+ * cache fields — most useful for the list results and `server/discover`,
2856
+ * which the SDK builds itself. A hint registered with an individual
2857
+ * resource (`registerResource(..., { cacheHint })`) takes precedence for
2858
+ * that resource's `resources/read` results, field by field: a field the
2859
+ * per-resource hint leaves unset still falls back to the per-operation
2860
+ * hint configured here.
2861
+ *
2862
+ * Absent hints (or omitting this option entirely) keep today's behavior:
2863
+ * cacheable 2026-07-28 results are emitted with `ttlMs: 0` and
2864
+ * `cacheScope: 'private'`. Responses to 2025-era requests are never
2865
+ * affected. Invalid values throw a `RangeError` at construction time.
2866
+ */
2867
+ cacheHints?: Partial<Record<CacheableResultMethod, CacheHint>>;
2868
+ /**
2869
+ * Multi-round-trip serving knobs. On 2026-era requests the client
2870
+ * fulfils `input_required` returns; on 2025-era connections the SDK's
2871
+ * legacy shim fulfils them server-side (real server→client requests +
2872
+ * handler re-entry), so handlers are written once and serve both eras.
2873
+ */
2874
+ inputRequired?: {
2875
+ /**
2876
+ * Handler re-entries per originating request before the shim fails
2877
+ * (tools/call: `isError` result; prompts/resources: JSON-RPC error).
2878
+ * @default 8
2879
+ */
2880
+ maxRounds?: number;
2881
+ /**
2882
+ * Per-leg timeout (ms) for the shim's embedded server→client
2883
+ * requests, sent with `resetTimeoutOnProgress: true`. Human-paced —
2884
+ * deliberately far above the 60s protocol default.
2885
+ * @default 600_000
2886
+ */
2887
+ roundTimeoutMs?: number;
2888
+ /**
2889
+ * `false` disables the shim: an `input_required` return on a
2890
+ * 2025-era request fails loudly (the pre-shim behavior).
2891
+ * @default true
2892
+ */
2893
+ legacyShim?: boolean;
2894
+ };
2895
+ /**
2896
+ * Multi-round-trip `requestState` integrity hook (protocol revision
2897
+ * 2026-07-28).
2898
+ */
2899
+ requestState?: {
2900
+ /**
2901
+ * Called on every multi-round-trip request round whose echoed
2902
+ * `requestState` is a string (i.e. whenever
2903
+ * `ctx.mcpReq.requestState()` would return one), BEFORE the handler
2904
+ * runs — including the legacy shim's in-process rounds. Throw or
2905
+ * reject to refuse the request: the seam answers with a wire-level
2906
+ * `-32602` Invalid Params error whose message is frozen to
2907
+ * `"Invalid or expired requestState"` and whose `data.reason` is
2908
+ * `'invalid_request_state'` — the thrown reason is surfaced via the
2909
+ * server's `onerror` callback only and never reaches the wire.
2910
+ *
2911
+ * This is the place to put HMAC or AEAD verification of
2912
+ * `requestState`. The spec MUST for integrity-protecting state that
2913
+ * influences authorization, resource access, or business logic is on
2914
+ * the server author (basic/patterns/mrtr, server requirements 4–5);
2915
+ * the SDK provides NO default verification —
2916
+ * {@linkcode server/requestStateCodec.createRequestStateCodec | createRequestStateCodec}
2917
+ * is the SDK-provided HMAC helper whose `verify` drops in here
2918
+ * directly. Leaving this option unconfigured keeps the passthrough
2919
+ * behavior — `ctx.mcpReq.requestState()` returns the raw wire string,
2920
+ * which MUST be treated as attacker-controlled input.
2921
+ *
2922
+ * The resolved value is LOAD-BEARING: when the hook resolves with a
2923
+ * non-`undefined` value — as
2924
+ * {@linkcode server/requestStateCodec.RequestStateCodec | RequestStateCodec}`.verify`
2925
+ * does (the decoded payload) — the seam hands THAT value to the
2926
+ * handler via the typed `ctx.mcpReq.requestState<T>()` accessor, so a
2927
+ * codec-using handler reads its verified state with no second decode
2928
+ * call. A verifier that is not also the decoder should resolve
2929
+ * `undefined` (return nothing) to keep the accessor on the raw wire
2930
+ * string — resolving an incidental value (e.g. a boolean
2931
+ * verification flag) would replace what the handler reads.
2932
+ */
2933
+ verify?: (state: string, ctx: ServerContext) => unknown | Promise<unknown>;
2934
+ };
2935
+ };
2936
+ /**
2937
+ * An MCP server on top of a pluggable transport.
2938
+ *
2939
+ * This server will automatically respond to the initialization flow as initiated from the client.
2940
+ *
2941
+ * @deprecated Use {@linkcode server/mcp.McpServer | McpServer} instead for the high-level API. Only use `Server` for advanced use cases.
2942
+ */
2943
+ declare class Server extends Protocol<ServerContext> {
2944
+ private _serverInfo;
2945
+ private _clientCapabilities?;
2946
+ private _clientVersion?;
2947
+ private _capabilities;
2948
+ private _instructions?;
2949
+ private _jsonSchemaValidator;
2950
+ private _cacheHints?;
2951
+ private _requestStateVerify?;
2952
+ private _inputRequiredServing;
2953
+ private _legacyShim?;
2954
+ /** Lazily-built legacy shim; the loop lives in legacyInputRequiredShim.ts behind a narrow host contract. */
2955
+ private _legacyInputRequiredShim;
2956
+ /**
2957
+ * Callback for when initialization has fully completed (i.e., the client has sent an `notifications/initialized` notification).
2958
+ */
2959
+ oninitialized?: () => void;
2960
+ /**
2961
+ * Initializes this server with the given name and version information.
2962
+ */
2963
+ constructor(_serverInfo: Implementation, options?: ServerOptions);
2964
+ /** Attaches to the given transport; rejects while this instance is connected to another one. */
2965
+ connect(transport: Transport): Promise<void>;
2966
+ /**
2967
+ * Registers the built-in `logging/setLevel` request handler.
2968
+ *
2969
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
2970
+ * Remains functional during the deprecation window (at least twelve months).
2971
+ * Migrate to stderr logging (STDIO servers) or OpenTelemetry.
2972
+ */
2973
+ private _registerLoggingHandler;
2974
+ protected buildContext(ctx: BaseContext, transportInfo?: MessageExtraInfo): ServerContext;
2975
+ private _loggingLevels;
2976
+ private readonly LOG_LEVEL_SEVERITY;
2977
+ private isMessageIgnored;
2978
+ /**
2979
+ * Registers new capabilities. This can only be called before connecting to a transport.
2980
+ *
2981
+ * The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization).
2982
+ */
2983
+ registerCapabilities(capabilities: ServerCapabilities): void;
2984
+ /**
2985
+ * Enforces server-side validation for `tools/call` results regardless of how the
2986
+ * handler was registered, attaches the configured per-operation cache hint
2987
+ * (when one exists) so the 2026-07-28 encode seam can fill `ttlMs`/`cacheScope`
2988
+ * for results that do not provide their own, and owns the multi-round-trip
2989
+ * seam: on the methods whose 2026-07-28 result vocabulary includes
2990
+ * `input_required` (`tools/call`, `prompts/get`, `resources/read`) an
2991
+ * input-required return skips result-schema validation and is checked
2992
+ * against the served era, the at-least-one rule, and the request's own
2993
+ * declared client capabilities; on every other method an input-required
2994
+ * return is a server bug and fails loudly. The hint rides a symbol-keyed
2995
+ * property that is never serialized, so 2025-era responses are unaffected.
2996
+ */
2997
+ protected _wrapHandler(method: string, handler: (request: JSONRPCRequest, ctx: ServerContext) => Promise<Result$1>): (request: JSONRPCRequest, ctx: ServerContext) => Promise<Result$1>;
2998
+ /**
2999
+ * Whether this instance is bound to a 2026-07-28-or-later protocol
3000
+ * revision. Era is instance state — a serving entry (`createMcpHandler`,
3001
+ * `serveStdio`) marks the instance modern at construction; a 2025-era
3002
+ * `initialize` handshake binds it legacy. The multi-round-trip seam reads
3003
+ * this directly: there is no per-request era consult.
3004
+ */
3005
+ private _servedModernEra;
3006
+ /**
3007
+ * Invokes a handler for one of the multi-round-trip methods and applies
3008
+ * the input-required seam:
3009
+ *
3010
+ * - a `UrlElicitationRequiredError` (or any 2025-style server→client
3011
+ * request idiom) escaping the handler on a request served on the
3012
+ * 2026-07-28 era fails LOUDLY with a clear steer to
3013
+ * `inputRequired.elicitUrl(...)` — the `-32042` error never reaches the
3014
+ * 2026-07-28 wire and the throw is not silently converted. Requests
3015
+ * served on the 2025 era keep today's `-32042` behavior byte-exact (the
3016
+ * error is rethrown unchanged).
3017
+ * - an input-required RETURN toward a 2026-07-28 request must satisfy
3018
+ * the at-least-one rule, and every embedded request must be covered by
3019
+ * the capabilities declared on the request's envelope (violations
3020
+ * answer the typed `-32021` error). Toward a 2025-era request the
3021
+ * return is fulfilled by the default-on legacy shim, whose own gate
3022
+ * consults the initialize-declared capabilities and surfaces
3023
+ * violations per family; `inputRequired.legacyShim: false` restores
3024
+ * the pre-shim loud failure.
3025
+ */
3026
+ private _invokeInputRequiredCapableHandler;
3027
+ /**
3028
+ * Runs the configured `requestState.verify` hook and returns its
3029
+ * resolved value (`undefined` when unconfigured or the hook returns
3030
+ * nothing). Deny-on-error: any hook failure answers the frozen `-32602`;
3031
+ * the reason goes to `onerror` only.
3032
+ */
3033
+ private _verifyRequestState;
3034
+ /**
3035
+ * The per-request resolved client-capabilities view: the request's own
3036
+ * `_meta` envelope on the 2026 era; the `initialize`-declared state on a
3037
+ * 2025-era connection. Per-request instances that never saw an
3038
+ * initialize (stateless legacy) hold nothing, so gates refuse there.
3039
+ */
3040
+ private _inputRequestCapabilityView;
3041
+ /**
3042
+ * Guard for the push-style server→client request APIs ({@linkcode createMessage},
3043
+ * {@linkcode elicitInput}, {@linkcode listRoots}, {@linkcode ping}) on a
3044
+ * modern-era instance: the 2026-07-28 revision has no server→client request
3045
+ * channel, so the call fails before any wire traffic with a typed error
3046
+ * whose message steers to `inputRequired(...)`. The base era gate would
3047
+ * also reject it; this guard runs first to carry the steer.
3048
+ */
3049
+ private _assertPushApiInServedEra;
3050
+ protected assertCapabilityForMethod(method: RequestMethod | string): void;
3051
+ protected assertNotificationCapability(method: NotificationMethod | string): void;
3052
+ protected assertRequestHandlerCapability(method: string): void;
3053
+ private _oninitialize;
3054
+ /**
3055
+ * Answers `server/discover` (protocol revision 2026-07-28). `supportedVersions`
3056
+ * lists only modern revisions (2025-era versions are negotiated via `initialize`);
3057
+ * the capabilities are advertised as-is, listChanged/subscribe bits included
3058
+ * (see {@linkcode discoverAdvertisedCapabilities}).
3059
+ */
3060
+ private _ondiscover;
3061
+ /**
3062
+ * The identity the 2026-era encode seam stamps into every outbound
3063
+ * result's `_meta` under `io.modelcontextprotocol/serverInfo` (spec PR
3064
+ * #3002: servers SHOULD identify themselves on every response).
3065
+ */
3066
+ protected _outboundServerInfo(): Implementation | undefined;
3067
+ /**
3068
+ * After initialization has completed, this will be populated with the client's reported capabilities.
3069
+ *
3070
+ * @deprecated Read client identity from the per-request handler context instead: on
3071
+ * 2026-07-28 (per-request envelope) requests `ctx.mcpReq.envelope` carries the client's
3072
+ * declared capabilities, while on 2025-era connections this accessor keeps returning the
3073
+ * `initialize`-scoped value. The accessor remains functional — instances serving the
3074
+ * 2026-07-28 era are backfilled per request from the validated envelope.
3075
+ */
3076
+ getClientCapabilities(): ClientCapabilities | undefined;
3077
+ /**
3078
+ * After initialization has completed, this will be populated with information about the client's name and version.
3079
+ *
3080
+ * @deprecated Read client identity from the per-request handler context instead: on
3081
+ * 2026-07-28 (per-request envelope) requests `ctx.mcpReq.envelope` carries the client's
3082
+ * name and version, while on 2025-era connections this accessor keeps returning the
3083
+ * `initialize`-scoped value. The accessor remains functional — instances serving the
3084
+ * 2026-07-28 era are backfilled per request from the validated envelope.
3085
+ */
3086
+ getClientVersion(): Implementation | undefined;
3087
+ /**
3088
+ * After initialization has completed, this will be populated with the protocol version negotiated
3089
+ * with the client (the version the server responded with during the initialize handshake), or
3090
+ * `undefined` before initialization.
3091
+ *
3092
+ * @deprecated Read the protocol revision from the per-request handler context instead: on
3093
+ * 2026-07-28 (per-request envelope) requests `ctx.mcpReq.envelope` names the revision the
3094
+ * request was sent for, while on 2025-era connections this accessor keeps returning the
3095
+ * `initialize`-negotiated version. The accessor remains functional — instances serving the
3096
+ * 2026-07-28 era report that revision.
3097
+ */
3098
+ getNegotiatedProtocolVersion(): string | undefined;
3099
+ /**
3100
+ * Project a `tools/call` result through this instance's negotiated wire
3101
+ * codec — the era-agnostic SEP-2106 §4.3 TextContent auto-append, plus on
3102
+ * the 2025 era the `{result:…}` wrap when `structuredContent` is a
3103
+ * non-object value or the advertised `outputSchema` had a non-object root.
3104
+ * Identity for object-shaped `structuredContent` on the 2026 era.
3105
+ *
3106
+ * `McpServer`'s built-in `tools/call` handler routes through this method.
3107
+ * Low-level `setRequestHandler('tools/call', …)` authors call it
3108
+ * themselves so the projection lives in one place (the codec) and the
3109
+ * server-side handler stays era-blind.
3110
+ *
3111
+ * This is the only codec function exposed on `Server` — the full
3112
+ * `WireCodec` is intentionally not part of the public surface.
3113
+ */
3114
+ projectCallToolResult(result: CallToolResult, advertisedOutputSchema: Readonly<Record<string, unknown>> | undefined): CallToolResult;
3115
+ /**
3116
+ * Returns the current server capabilities.
3117
+ */
3118
+ getCapabilities(): ServerCapabilities;
3119
+ /**
3120
+ * Sends a `ping` request to the connected client.
3121
+ *
3122
+ * @deprecated The 2026-07-28 protocol removed ping; it throws on a 2026-07-28-era instance.
3123
+ * If your factory serves both eras, this only works on the legacy path.
3124
+ */
3125
+ ping(): Promise<EmptyResult>;
3126
+ /**
3127
+ * Request LLM sampling from the client (without tools).
3128
+ * Returns single content block for backwards compatibility.
3129
+ *
3130
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
3131
+ * Throws on a 2026-07-28-era request — use {@link index.inputRequired | inputRequired} (multi-round-trip) instead,
3132
+ * or migrate to calling LLM provider APIs directly. The 2025 push-style server-to-client
3133
+ * request model is replaced by input_required results in the 2026-07-28 protocol. If your
3134
+ * factory serves both eras, this only works on the legacy path.
3135
+ */
3136
+ createMessage(params: CreateMessageRequestParamsBase, options?: RequestOptions): Promise<CreateMessageResult>;
3137
+ /**
3138
+ * Request LLM sampling from the client with tool support.
3139
+ * Returns content that may be a single block or array (for parallel tool calls).
3140
+ *
3141
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
3142
+ * Throws on a 2026-07-28-era request — use {@link index.inputRequired | inputRequired} (multi-round-trip) instead,
3143
+ * or migrate to calling LLM provider APIs directly. The 2025 push-style server-to-client
3144
+ * request model is replaced by input_required results in the 2026-07-28 protocol. If your
3145
+ * factory serves both eras, this only works on the legacy path.
3146
+ */
3147
+ createMessage(params: CreateMessageRequestParamsWithTools, options?: RequestOptions): Promise<CreateMessageResultWithTools>;
3148
+ /**
3149
+ * Request LLM sampling from the client.
3150
+ * When tools may or may not be present, returns the union type.
3151
+ *
3152
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
3153
+ * Throws on a 2026-07-28-era request — use {@link index.inputRequired | inputRequired} (multi-round-trip) instead,
3154
+ * or migrate to calling LLM provider APIs directly. The 2025 push-style server-to-client
3155
+ * request model is replaced by input_required results in the 2026-07-28 protocol. If your
3156
+ * factory serves both eras, this only works on the legacy path.
3157
+ */
3158
+ createMessage(params: CreateMessageRequest['params'], options?: RequestOptions): Promise<CreateMessageResult | CreateMessageResultWithTools>;
3159
+ /**
3160
+ * Creates an elicitation request for the given parameters.
3161
+ * For backwards compatibility, `mode` may be omitted for form requests and will default to `"form"`.
3162
+ * @param params The parameters for the elicitation request.
3163
+ * @param options Optional request options.
3164
+ * @returns The result of the elicitation request.
3165
+ *
3166
+ * @deprecated Throws on a 2026-07-28-era request — use {@link index.inputRequired | inputRequired} (multi-round-trip)
3167
+ * instead. The 2025 push-style server-to-client request model is replaced by input_required
3168
+ * results in the 2026-07-28 protocol. If your factory serves both eras, this only works on the
3169
+ * legacy path.
3170
+ */
3171
+ elicitInput(params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions): Promise<ElicitResult>;
3172
+ /**
3173
+ * The capability-check-free core of {@linkcode elicitInput}. The shim
3174
+ * uses it because its gate differs from the public checks: a bare
3175
+ * `elicitation: {}` counts as form support (the pre-mode rule), and
3176
+ * accepted content passes through unvalidated for parity with the
3177
+ * modern client driver (handlers validate via the schema-aware
3178
+ * `acceptedContent` overload and can re-ask).
3179
+ */
3180
+ private _sendElicitationLeg;
3181
+ /**
3182
+ * Creates a reusable callback that, when invoked, will send a `notifications/elicitation/complete`
3183
+ * notification for the specified elicitation ID.
3184
+ *
3185
+ * The notification (and the `elicitationId` it references) exists only on protocol revision
3186
+ * 2025-11-25 — the 2026-07-28 revision removed both. On a connection negotiated at 2026-07-28 the
3187
+ * returned callback rejects with a typed local error before anything reaches the transport
3188
+ * (the method is not part of that revision's wire registry).
3189
+ *
3190
+ * @param elicitationId The ID of the elicitation to mark as complete.
3191
+ * @param options Optional notification options. Useful when the completion notification should be related to a prior request.
3192
+ * @returns A function that emits the completion notification when awaited.
3193
+ */
3194
+ createElicitationCompletionNotifier(elicitationId: string, options?: NotificationOptions): () => Promise<void>;
3195
+ /**
3196
+ * Requests the list of roots from the client.
3197
+ *
3198
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
3199
+ * Throws on a 2026-07-28-era request — use {@link index.inputRequired | inputRequired} (multi-round-trip) instead,
3200
+ * or migrate to passing paths via tool parameters, resource URIs, or configuration. The 2025
3201
+ * push-style server-to-client request model is replaced by input_required results in the
3202
+ * 2026-07-28 protocol. If your factory serves both eras, this only works on the legacy path.
3203
+ */
3204
+ listRoots(params?: ListRootsRequest['params'], options?: RequestOptions): Promise<ListRootsResult>;
3205
+ /**
3206
+ * Sends a logging message to the client, if connected.
3207
+ * Note: You only need to send the parameters object, not the entire JSON-RPC message.
3208
+ * @see {@linkcode LoggingMessageNotification}
3209
+ * @param params
3210
+ * @param sessionId Optional for stateless transports and backward compatibility.
3211
+ *
3212
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
3213
+ * Remains functional during the deprecation window (at least twelve months).
3214
+ * Migrate to stderr logging (STDIO servers) or OpenTelemetry.
3215
+ */
3216
+ sendLoggingMessage(params: LoggingMessageNotification['params'], sessionId?: string): Promise<void>;
3217
+ sendResourceUpdated(params: ResourceUpdatedNotification['params']): Promise<void>;
3218
+ sendResourceListChanged(): Promise<void>;
3219
+ sendToolListChanged(): Promise<void>;
3220
+ sendPromptListChanged(): Promise<void>;
3221
+ }
3222
+ //#endregion
3223
+ //#region src/server/mcp.d.ts
3224
+ /**
3225
+ * Options for {@linkcode McpServer}: everything {@linkcode ServerOptions} accepts, plus `maxToolInputElements`.
3226
+ */
3227
+ type McpServerOptions = ServerOptions & {
3228
+ /**
3229
+ * Largest combined number of array elements and object members a single `tools/call` `arguments` payload may contain.
3230
+ * A number of at least 1; unset or `Infinity` means no limit.
3231
+ */
3232
+ maxToolInputElements?: number;
3233
+ };
3234
+ /**
3235
+ * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
3236
+ * For advanced usage (like sending notifications or setting custom request handlers), use the underlying
3237
+ * {@linkcode Server} instance available via the {@linkcode McpServer.server | server} property.
3238
+ *
3239
+ * @example
3240
+ * ```ts source="./mcp.examples.ts#McpServer_basicUsage"
3241
+ * const server = new McpServer({
3242
+ * name: 'my-server',
3243
+ * version: '1.0.0'
3244
+ * });
3245
+ * ```
3246
+ */
3247
+ declare class McpServer {
3248
+ /**
3249
+ * The underlying {@linkcode Server} instance, useful for advanced operations like sending notifications.
3250
+ */
3251
+ readonly server: Server;
3252
+ private readonly _maxToolInputElements;
3253
+ private _registeredResources;
3254
+ private _registeredResourceTemplates;
3255
+ private _registeredTools;
3256
+ private _registeredPrompts;
3257
+ /** Per-tool JSON-converted `inputSchema`, filled on first use by `toolInputSchemaJson()`. */
3258
+ private _toolInputSchemaJson;
3259
+ /**
3260
+ * The JSON-serialized `inputSchema` of a registered tool, or `undefined`
3261
+ * when no such tool is registered. Used by the HTTP entry's pre-dispatch
3262
+ * SEP-2243 `Mcp-Param-*` validation step (which needs the same JSON Schema
3263
+ * `tools/list` would emit, before dispatch reaches the handler).
3264
+ *
3265
+ * @internal
3266
+ */
3267
+ toolInputSchemaJson(name: string): Record<string, unknown> | undefined;
3268
+ constructor(serverInfo: Implementation, options?: McpServerOptions);
3269
+ /**
3270
+ * Attaches to the given transport, starts it, and starts listening for messages.
3271
+ *
3272
+ * The `server` object assumes ownership of the {@linkcode Transport}, replacing any callbacks that have already been set, and expects that it is the only user of the {@linkcode Transport} instance going forward.
3273
+ *
3274
+ * @example
3275
+ * ```ts source="./mcp.examples.ts#McpServer_connect_stdio"
3276
+ * const server = new McpServer({ name: 'my-server', version: '1.0.0' });
3277
+ * const transport = new StdioServerTransport();
3278
+ * await server.connect(transport);
3279
+ * ```
3280
+ */
3281
+ connect(transport: Transport): Promise<void>;
3282
+ /**
3283
+ * Closes the connection.
3284
+ */
3285
+ close(): Promise<void>;
3286
+ /** @internal */
3287
+ resolveScopeChallenge: ScopeChallengeHandler;
3288
+ private _toolHandlersInitialized;
3289
+ private setToolRequestHandlers;
3290
+ /**
3291
+ * Creates a tool error result.
3292
+ *
3293
+ * @param errorMessage - The error message.
3294
+ * @returns The tool error result.
3295
+ */
3296
+ private createToolError;
3297
+ /**
3298
+ * Validates tool input arguments against the tool's input schema.
3299
+ */
3300
+ private validateToolInput;
3301
+ /**
3302
+ * Validates tool output against the tool's output schema.
3303
+ */
3304
+ private validateToolOutput;
3305
+ /**
3306
+ * Executes a tool handler.
3307
+ */
3308
+ private executeToolHandler;
3309
+ private _completionHandlerInitialized;
3310
+ private setCompletionRequestHandler;
3311
+ private handlePromptCompletion;
3312
+ private handleResourceCompletion;
3313
+ private _resourceHandlersInitialized;
3314
+ private setResourceRequestHandlers;
3315
+ private _promptHandlersInitialized;
3316
+ private setPromptRequestHandlers;
3317
+ /**
3318
+ * Registers a resource with a config object and callback.
3319
+ * For static resources, use a URI string. For dynamic resources, use a {@linkcode ResourceTemplate}.
3320
+ *
3321
+ * @example
3322
+ * ```ts source="./mcp.examples.ts#McpServer_registerResource_static"
3323
+ * server.registerResource(
3324
+ * 'config',
3325
+ * 'config://app',
3326
+ * {
3327
+ * title: 'Application Config',
3328
+ * mimeType: 'text/plain'
3329
+ * },
3330
+ * async uri => ({
3331
+ * contents: [{ uri: uri.href, text: 'App configuration here' }]
3332
+ * })
3333
+ * );
3334
+ * ```
3335
+ */
3336
+ registerResource(name: string, uriOrTemplate: string, config: ResourceMetadata & {
3337
+ cacheHint?: CacheHint;
3338
+ scopeChallenge?: ScopeChallengeHandler;
3339
+ }, readCallback: ReadResourceCallback): RegisteredResource;
3340
+ registerResource(name: string, uriOrTemplate: ResourceTemplate, config: ResourceMetadata & {
3341
+ cacheHint?: CacheHint;
3342
+ scopeChallenge?: ScopeChallengeHandler;
3343
+ }, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate;
3344
+ private _createRegisteredResource;
3345
+ private _createRegisteredResourceTemplate;
3346
+ private _createRegisteredPrompt;
3347
+ private _createRegisteredTool;
3348
+ /**
3349
+ * Registers a tool with a config object and callback.
3350
+ *
3351
+ * @example
3352
+ * ```ts source="./mcp.examples.ts#McpServer_registerTool_basic"
3353
+ * server.registerTool(
3354
+ * 'calculate-bmi',
3355
+ * {
3356
+ * title: 'BMI Calculator',
3357
+ * description: 'Calculate Body Mass Index',
3358
+ * inputSchema: z.object({
3359
+ * weightKg: z.number(),
3360
+ * heightM: z.number()
3361
+ * }),
3362
+ * outputSchema: z.object({ bmi: z.number() })
3363
+ * },
3364
+ * async ({ weightKg, heightM }) => {
3365
+ * const output = { bmi: weightKg / (heightM * heightM) };
3366
+ * return {
3367
+ * content: [{ type: 'text', text: JSON.stringify(output) }],
3368
+ * structuredContent: output
3369
+ * };
3370
+ * }
3371
+ * );
3372
+ * ```
3373
+ */
3374
+ registerTool<OutputArgs extends StandardSchemaWithJSON, InputArgs extends StandardSchemaWithJSON | undefined = undefined>(name: string, config: {
3375
+ title?: string;
3376
+ description?: string;
3377
+ inputSchema?: InputArgs;
3378
+ outputSchema?: OutputArgs;
3379
+ annotations?: ToolAnnotations;
3380
+ icons?: Icon[];
3381
+ /** Determines whether this tool call needs an OAuth scope challenge. */
3382
+ scopeChallenge?: ScopeChallengeHandler;
3383
+ _meta?: Record<string, unknown>;
3384
+ }, cb: ToolCallback<InputArgs>): RegisteredTool;
3385
+ /** @deprecated Wrap with `z.object({...})` instead. Raw-shape form: `inputSchema`/`outputSchema` may be a plain `{ field: z.string() }` record; it is auto-wrapped with `z.object()`. */
3386
+ registerTool<InputArgs extends ZodRawShape, OutputArgs extends ZodRawShape | StandardSchemaWithJSON | undefined = undefined>(name: string, config: {
3387
+ title?: string;
3388
+ description?: string;
3389
+ inputSchema?: InputArgs;
3390
+ outputSchema?: OutputArgs;
3391
+ annotations?: ToolAnnotations;
3392
+ icons?: Icon[];
3393
+ scopeChallenge?: ScopeChallengeHandler;
3394
+ _meta?: Record<string, unknown>;
3395
+ }, cb: LegacyToolCallback<InputArgs>): RegisteredTool;
3396
+ /**
3397
+ * Registers a prompt with a config object and callback.
3398
+ *
3399
+ * @example
3400
+ * ```ts source="./mcp.examples.ts#McpServer_registerPrompt_basic"
3401
+ * server.registerPrompt(
3402
+ * 'review-code',
3403
+ * {
3404
+ * title: 'Code Review',
3405
+ * description: 'Review code for best practices',
3406
+ * argsSchema: z.object({ code: z.string() })
3407
+ * },
3408
+ * ({ code }) => ({
3409
+ * messages: [
3410
+ * {
3411
+ * role: 'user' as const,
3412
+ * content: {
3413
+ * type: 'text' as const,
3414
+ * text: `Please review this code:\n\n${code}`
3415
+ * }
3416
+ * }
3417
+ * ]
3418
+ * })
3419
+ * );
3420
+ * ```
3421
+ */
3422
+ registerPrompt(name: string, config: {
3423
+ title?: string;
3424
+ description?: string;
3425
+ argsSchema?: undefined;
3426
+ icons?: Icon[];
3427
+ /** Determines whether this prompt retrieval needs an OAuth scope challenge. */
3428
+ scopeChallenge?: ScopeChallengeHandler;
3429
+ _meta?: Record<string, unknown>;
3430
+ }, cb: PromptCallback): RegisteredPrompt;
3431
+ registerPrompt<Args extends StandardSchemaWithJSON>(name: string, config: {
3432
+ title?: string;
3433
+ description?: string;
3434
+ argsSchema?: Args;
3435
+ icons?: Icon[];
3436
+ /** Determines whether this prompt retrieval needs an OAuth scope challenge. */
3437
+ scopeChallenge?: ScopeChallengeHandler;
3438
+ _meta?: Record<string, unknown>;
3439
+ }, cb: PromptCallback<Args>): RegisteredPrompt;
3440
+ /** @deprecated Wrap with `z.object({...})` instead. Raw-shape form: `argsSchema` may be a plain `{ field: z.string() }` record; it is auto-wrapped with `z.object()`. */
3441
+ registerPrompt<Args extends ZodRawShape>(name: string, config: {
3442
+ title?: string;
3443
+ description?: string;
3444
+ argsSchema?: Args;
3445
+ icons?: Icon[];
3446
+ scopeChallenge?: ScopeChallengeHandler;
3447
+ _meta?: Record<string, unknown>;
3448
+ }, cb: LegacyPromptCallback<Args>): RegisteredPrompt;
3449
+ /**
3450
+ * Checks if the server is connected to a transport.
3451
+ * @returns `true` if the server is connected
3452
+ */
3453
+ isConnected(): boolean;
3454
+ /**
3455
+ * Sends a logging message to the client, if connected.
3456
+ * Note: You only need to send the parameters object, not the entire JSON-RPC message.
3457
+ * @see {@linkcode LoggingMessageNotification}
3458
+ * @param params
3459
+ * @param sessionId Optional for stateless transports and backward compatibility.
3460
+ *
3461
+ * @example
3462
+ * ```ts source="./mcp.examples.ts#McpServer_sendLoggingMessage_basic"
3463
+ * await server.sendLoggingMessage({
3464
+ * level: 'info',
3465
+ * data: 'Processing complete'
3466
+ * });
3467
+ * ```
3468
+ *
3469
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
3470
+ * Remains functional during the deprecation window (at least twelve months).
3471
+ * Migrate to stderr logging (STDIO servers) or OpenTelemetry.
3472
+ */
3473
+ sendLoggingMessage(params: LoggingMessageNotification['params'], sessionId?: string): Promise<void>;
3474
+ /**
3475
+ * Sends a resource list changed event to the client, if connected.
3476
+ */
3477
+ sendResourceListChanged(): void;
3478
+ /**
3479
+ * Sends a tool list changed event to the client, if connected.
3480
+ */
3481
+ sendToolListChanged(): void;
3482
+ /**
3483
+ * Sends a prompt list changed event to the client, if connected.
3484
+ */
3485
+ sendPromptListChanged(): void;
3486
+ }
3487
+ /**
3488
+ * A callback to complete one variable within a resource template's URI template.
3489
+ */
3490
+ type CompleteResourceTemplateCallback = (value: string, context?: {
3491
+ arguments?: Record<string, string>;
3492
+ }) => string[] | Promise<string[]>;
3493
+ /**
3494
+ * A resource template combines a URI pattern with optional functionality to enumerate
3495
+ * all resources matching that pattern.
3496
+ */
3497
+ declare class ResourceTemplate {
3498
+ private _callbacks;
3499
+ private _uriTemplate;
3500
+ constructor(uriTemplate: string | UriTemplate, _callbacks: {
3501
+ /**
3502
+ * A callback to list all resources matching this template. This is required to be specified, even if `undefined`, to avoid accidentally forgetting resource listing.
3503
+ */
3504
+ list: ListResourcesCallback | undefined;
3505
+ /**
3506
+ * An optional callback to autocomplete variables within the URI template. Useful for clients and users to discover possible values.
3507
+ */
3508
+ complete?: {
3509
+ [variable: string]: CompleteResourceTemplateCallback;
3510
+ };
3511
+ });
3512
+ /**
3513
+ * Gets the URI template pattern.
3514
+ */
3515
+ get uriTemplate(): UriTemplate;
3516
+ /**
3517
+ * Gets the list callback, if one was provided.
3518
+ */
3519
+ get listCallback(): ListResourcesCallback | undefined;
3520
+ /**
3521
+ * Gets the callback for completing a specific URI template variable, if one was provided.
3522
+ */
3523
+ completeCallback(variable: string): CompleteResourceTemplateCallback | undefined;
3524
+ }
3525
+ /**
3526
+ * A plain record of Zod field schemas, e.g. `{ name: z.string() }`. Accepted by
3527
+ * `registerTool`/`registerPrompt` as a shorthand; auto-wrapped with `z.object()`.
3528
+ * Zod schemas only — `z.object()` cannot wrap other Standard Schema libraries.
3529
+ */
3530
+ type ZodRawShape = Record<string, z.ZodType>;
3531
+ /** Infers the parsed-output type of a {@linkcode ZodRawShape}. */
3532
+ type InferRawShape<S extends ZodRawShape> = z.infer<z.ZodObject<S>>;
3533
+ /** {@linkcode ToolCallback} variant used when `inputSchema` is a {@linkcode ZodRawShape}. */
3534
+ type LegacyToolCallback<Args extends ZodRawShape | undefined> = Args extends ZodRawShape ? (args: InferRawShape<Args>, ctx: ServerContext) => CallToolResult | InputRequiredResult | Promise<CallToolResult | InputRequiredResult> : (ctx: ServerContext) => CallToolResult | InputRequiredResult | Promise<CallToolResult | InputRequiredResult>;
3535
+ /** {@linkcode PromptCallback} variant used when `argsSchema` is a {@linkcode ZodRawShape}. */
3536
+ type LegacyPromptCallback<Args extends ZodRawShape | undefined> = Args extends ZodRawShape ? (args: InferRawShape<Args>, ctx: ServerContext) => GetPromptResult | InputRequiredResult | Promise<GetPromptResult | InputRequiredResult> : (ctx: ServerContext) => GetPromptResult | InputRequiredResult | Promise<GetPromptResult | InputRequiredResult>;
3537
+ type BaseToolCallback<SendResultT extends Result$1, Ctx extends ServerContext, Args extends StandardSchemaWithJSON | undefined> = Args extends StandardSchemaWithJSON ? (args: StandardSchemaWithJSON.InferOutput<Args>, ctx: Ctx) => SendResultT | Promise<SendResultT> : (ctx: Ctx) => SendResultT | Promise<SendResultT>;
3538
+ /**
3539
+ * Callback for a tool handler registered with {@linkcode McpServer.registerTool}.
3540
+ */
3541
+ type ToolCallback<Args extends StandardSchemaWithJSON | undefined = undefined> = BaseToolCallback<CallToolResult | InputRequiredResult, ServerContext, Args>;
3542
+ /**
3543
+ * Tool handler callback type.
3544
+ */
3545
+ type AnyToolHandler<Args extends StandardSchemaWithJSON | undefined = undefined> = ToolCallback<Args>;
3546
+ /**
3547
+ * Internal executor type that encapsulates handler invocation with proper types.
3548
+ */
3549
+ type ToolExecutor = (args: unknown, ctx: ServerContext) => Promise<CallToolResult | InputRequiredResult>;
3550
+ type RegisteredTool = {
3551
+ title?: string;
3552
+ description?: string;
3553
+ inputSchema?: StandardSchemaWithJSON;
3554
+ outputSchema?: StandardSchemaWithJSON;
3555
+ /**
3556
+ * @hidden
3557
+ * The converted JSON Schema of `outputSchema`, memoised on first use (and on
3558
+ * `update({outputSchema})`) so the `tools/call` handler passes the SAME advertised schema
3559
+ * `tools/list` emits to the wire codec's `projectCallToolResult` — the SEP-2106 `{result:…}`
3560
+ * wrap predicate follows the schema's root, never the runtime value shape. `undefined` when
3561
+ * no `outputSchema` is registered or its conversion threw (see {@link convertOutputSchemaJson}).
3562
+ */
3563
+ outputSchemaJson?: Record<string, unknown>;
3564
+ annotations?: ToolAnnotations;
3565
+ icons?: Icon[];
3566
+ execution?: ToolExecution;
3567
+ scopeChallenge?: ScopeChallengeHandler;
3568
+ _meta?: Record<string, unknown>;
3569
+ handler: AnyToolHandler<StandardSchemaWithJSON | undefined>;
3570
+ /** @hidden */
3571
+ executor: ToolExecutor;
3572
+ enabled: boolean;
3573
+ enable(): void;
3574
+ disable(): void;
3575
+ update(updates: {
3576
+ name?: string | null;
3577
+ title?: string;
3578
+ description?: string;
3579
+ paramsSchema?: StandardSchemaWithJSON;
3580
+ outputSchema?: StandardSchemaWithJSON;
3581
+ annotations?: ToolAnnotations;
3582
+ icons?: Icon[];
3583
+ scopeChallenge?: ScopeChallengeHandler | null;
3584
+ _meta?: Record<string, unknown>;
3585
+ callback?: ToolCallback<StandardSchemaWithJSON>;
3586
+ enabled?: boolean;
3587
+ }): void;
3588
+ remove(): void;
3589
+ };
3590
+ /**
3591
+ * Additional, optional information for annotating a resource.
3592
+ */
3593
+ type ResourceMetadata = Omit<Resource, 'uri' | 'name'>;
3594
+ /**
3595
+ * Callback to list all resources matching a given template.
3596
+ */
3597
+ type ListResourcesCallback = (ctx: ServerContext) => ListResourcesResult | Promise<ListResourcesResult>;
3598
+ /**
3599
+ * Callback to read a resource at a given URI.
3600
+ */
3601
+ type ReadResourceCallback = (uri: URL, ctx: ServerContext) => ReadResourceResult | InputRequiredResult | Promise<ReadResourceResult | InputRequiredResult>;
3602
+ type RegisteredResource = {
3603
+ name: string;
3604
+ title?: string;
3605
+ metadata?: ResourceMetadata;
3606
+ /** Cache hint applied to this resource's `resources/read` results on the 2026-07-28 revision. */
3607
+ cacheHint?: CacheHint;
3608
+ scopeChallenge?: ScopeChallengeHandler;
3609
+ readCallback: ReadResourceCallback;
3610
+ enabled: boolean;
3611
+ enable(): void;
3612
+ disable(): void;
3613
+ update(updates: {
3614
+ name?: string;
3615
+ title?: string;
3616
+ uri?: string | null;
3617
+ metadata?: ResourceMetadata;
3618
+ scopeChallenge?: ScopeChallengeHandler | null;
3619
+ callback?: ReadResourceCallback;
3620
+ enabled?: boolean;
3621
+ }): void;
3622
+ remove(): void;
3623
+ };
3624
+ /**
3625
+ * Callback to read a resource at a given URI, following a filled-in URI template.
3626
+ */
3627
+ type ReadResourceTemplateCallback = (uri: URL, variables: Variables, ctx: ServerContext) => ReadResourceResult | InputRequiredResult | Promise<ReadResourceResult | InputRequiredResult>;
3628
+ type RegisteredResourceTemplate = {
3629
+ resourceTemplate: ResourceTemplate;
3630
+ title?: string;
3631
+ metadata?: ResourceMetadata;
3632
+ /** Cache hint applied to this template's `resources/read` results on the 2026-07-28 revision. */
3633
+ cacheHint?: CacheHint;
3634
+ scopeChallenge?: ScopeChallengeHandler;
3635
+ readCallback: ReadResourceTemplateCallback;
3636
+ enabled: boolean;
3637
+ enable(): void;
3638
+ disable(): void;
3639
+ update(updates: {
3640
+ name?: string | null;
3641
+ title?: string;
3642
+ template?: ResourceTemplate;
3643
+ metadata?: ResourceMetadata;
3644
+ scopeChallenge?: ScopeChallengeHandler | null;
3645
+ callback?: ReadResourceTemplateCallback;
3646
+ enabled?: boolean;
3647
+ }): void;
3648
+ remove(): void;
3649
+ };
3650
+ type PromptCallback<Args extends StandardSchemaWithJSON | undefined = undefined> = Args extends StandardSchemaWithJSON ? (args: StandardSchemaWithJSON.InferOutput<Args>, ctx: ServerContext) => GetPromptResult | InputRequiredResult | Promise<GetPromptResult | InputRequiredResult> : (ctx: ServerContext) => GetPromptResult | InputRequiredResult | Promise<GetPromptResult | InputRequiredResult>;
3651
+ /**
3652
+ * Internal handler type that encapsulates parsing and callback invocation.
3653
+ * This allows type-safe handling without runtime type assertions.
3654
+ */
3655
+ type PromptHandler = (args: Record<string, unknown> | undefined, ctx: ServerContext) => Promise<GetPromptResult | InputRequiredResult>;
3656
+ type RegisteredPrompt = {
3657
+ title?: string;
3658
+ description?: string;
3659
+ argsSchema?: StandardSchemaWithJSON;
3660
+ icons?: Icon[];
3661
+ scopeChallenge?: ScopeChallengeHandler;
3662
+ _meta?: Record<string, unknown>;
3663
+ /** @hidden */
3664
+ handler: PromptHandler;
3665
+ enabled: boolean;
3666
+ enable(): void;
3667
+ disable(): void;
3668
+ update<Args extends StandardSchemaWithJSON>(updates: {
3669
+ name?: string | null;
3670
+ title?: string;
3671
+ description?: string;
3672
+ argsSchema?: Args;
3673
+ icons?: Icon[];
3674
+ scopeChallenge?: ScopeChallengeHandler | null;
3675
+ _meta?: Record<string, unknown>;
3676
+ callback?: PromptCallback<Args>;
3677
+ enabled?: boolean;
3678
+ }): void;
3679
+ remove(): void;
3680
+ };
3681
+ //#endregion
3682
+ //#region src/server/perRequestTransport.d.ts
3683
+ /**
3684
+ * How the transport shapes its HTTP response for a request:
3685
+ *
3686
+ * - `auto` (default): answer with a single JSON body unless the handler emits
3687
+ * a related message before its result, in which case the response upgrades
3688
+ * to an SSE stream.
3689
+ * - `sse`: always answer handler output over an SSE stream. The stream opens
3690
+ * once the request has passed the pre-dispatch validation gates, so ladder
3691
+ * rejections keep their mapped HTTP status instead of being framed onto a
3692
+ * 200 stream.
3693
+ * - `json`: never stream; related messages other than the terminal response
3694
+ * are dropped.
3695
+ */
3696
+ type PerRequestResponseMode = 'auto' | 'sse' | 'json';
3697
+ /** Constructor options for {@linkcode PerRequestHTTPServerTransport}. */
3698
+ interface PerRequestHTTPServerTransportOptions {
3699
+ /** The edge classification of the message this transport will serve. */
3700
+ classification: MessageClassification;
3701
+ /** Response shaping for the exchange; defaults to `auto`. */
3702
+ responseMode?: PerRequestResponseMode;
3703
+ /** SSE keep-alive interval in milliseconds; defaults to `15000`, `0` disables. */
3704
+ keepAliveMs?: number;
3705
+ }
3706
+ /** Per-exchange context handed to {@linkcode PerRequestHTTPServerTransport.handleMessage}. */
3707
+ interface PerRequestMessageExtra {
3708
+ /**
3709
+ * The original HTTP request. Used for handler context and, when the
3710
+ * runtime provides an abort signal on it, to cancel the exchange when the
3711
+ * client disconnects.
3712
+ */
3713
+ request?: globalThis.Request;
3714
+ /**
3715
+ * Validated authentication information supplied by the caller. Strictly
3716
+ * pass-through: the transport never populates this from request headers.
3717
+ */
3718
+ authInfo?: AuthInfo;
3719
+ }
3720
+ /**
3721
+ * The per-request micro-transport: a real, connected `Transport` whose whole
3722
+ * lifetime is one HTTP exchange. See the module documentation for the
3723
+ * response shapes it produces.
3724
+ */
3725
+ declare class PerRequestHTTPServerTransport implements Transport {
3726
+ onclose?: () => void;
3727
+ onerror?: (error: Error) => void;
3728
+ onmessage?: <T$1 extends JSONRPCMessage>(message: T$1, extra?: MessageExtraInfo) => void;
3729
+ private readonly _classification;
3730
+ private readonly _responseMode;
3731
+ private _started;
3732
+ private _used;
3733
+ private _closed;
3734
+ private _terminalDelivered;
3735
+ /**
3736
+ * `true` only while the inbound message is being delivered synchronously
3737
+ * to the connected protocol layer. The pre-handler gates (the era
3738
+ * registry gate, the edge→instance handoff check, the missing-handler
3739
+ * rejection) answer inside this window; request handlers always run
3740
+ * after it (the protocol layer defers them to a microtask). An error
3741
+ * sent inside the window is therefore ladder-originated, and an error
3742
+ * sent after it is handler-produced.
3743
+ */
3744
+ private _dispatchWindowOpen;
3745
+ private _requestId?;
3746
+ private _deferredResponse?;
3747
+ private _sse?;
3748
+ private _abortCleanup?;
3749
+ private readonly _keepAliveMs;
3750
+ constructor(options: PerRequestHTTPServerTransportOptions);
3751
+ start(): Promise<void>;
3752
+ /**
3753
+ * Serves the single exchange: delivers the classified message to the
3754
+ * connected server instance and resolves with the HTTP response.
3755
+ *
3756
+ * Throws when called a second time (the transport is strictly
3757
+ * single-use), or before a server has been connected to the transport.
3758
+ * The returned promise rejects with a connection-closed error when the
3759
+ * transport is closed before a response was produced (for example because
3760
+ * the client disconnected).
3761
+ */
3762
+ handleMessage(message: JSONRPCRequest | JSONRPCNotification, extra?: PerRequestMessageExtra): Promise<Response>;
3763
+ send(message: JSONRPCMessage, options?: TransportSendOptions): Promise<void>;
3764
+ /**
3765
+ * Writes an SSE comment frame (a keep-alive heartbeat). Dropped when the
3766
+ * exchange is not currently streaming.
3767
+ */
3768
+ writeCommentFrame(comment: string): void;
3769
+ close(): Promise<void>;
3770
+ private settleResponse;
3771
+ private upgradeToSse;
3772
+ private finalizeStream;
3773
+ private writeMessageFrame;
3774
+ private writeFrame;
3775
+ }
3776
+ //#endregion
3777
+ //#region src/server/serverEventBus.d.ts
3778
+ /**
3779
+ * A change event a server publishes for delivery on open `subscriptions/listen`
3780
+ * streams. Each variant maps onto exactly one notification method:
3781
+ *
3782
+ * - `tools_list_changed` → `notifications/tools/list_changed`
3783
+ * - `prompts_list_changed` → `notifications/prompts/list_changed`
3784
+ * - `resources_list_changed` → `notifications/resources/list_changed`
3785
+ * - `resource_updated` → `notifications/resources/updated` (carries the URI)
3786
+ *
3787
+ * The bus carries the EVENT, not the wire shape — the entry's listen router
3788
+ * owns subscription-id stamping and per-stream filtering.
3789
+ */
3790
+ type ServerEvent = {
3791
+ kind: 'tools_list_changed';
3792
+ } | {
3793
+ kind: 'prompts_list_changed';
3794
+ } | {
3795
+ kind: 'resources_list_changed';
3796
+ } | {
3797
+ kind: 'resource_updated';
3798
+ uri: string;
3799
+ };
3800
+ /**
3801
+ * The server-side change-event seam for `subscriptions/listen`.
3802
+ *
3803
+ * The serving entry (`createMcpHandler`) owns the per-stream listen router:
3804
+ * each open `subscriptions/listen` stream registers a listener via
3805
+ * `subscribe()`, and consumer code (typically via `handler.notify.*` sugar)
3806
+ * publishes change events via `publish()`. In-process servers can use the
3807
+ * default {@linkcode InMemoryServerEventBus}; multi-process deployments
3808
+ * implement this interface over their own pub/sub.
3809
+ *
3810
+ * The SDK owns wire semantics (ack-first, filtering, subscription-id
3811
+ * stamping, teardown); a `ServerEventBus` only sources the events. It MUST
3812
+ * NOT echo back to the listener that published an event when called from
3813
+ * inside that listener (no surprise here — the default delivers
3814
+ * synchronously and listeners never publish).
3815
+ */
3816
+ interface ServerEventBus {
3817
+ /**
3818
+ * Publish a change event to every registered listener.
3819
+ */
3820
+ publish(event: ServerEvent): void;
3821
+ /**
3822
+ * Register a listener; returns an idempotent unsubscribe function.
3823
+ */
3824
+ subscribe(listener: (event: ServerEvent) => void): () => void;
3825
+ }
3826
+ /**
3827
+ * A `ServerEventBus` backed by an in-process listener set.
3828
+ *
3829
+ * `publish()` delivers synchronously to the live listener set (a listener
3830
+ * unsubscribing itself mid-dispatch is safe; the entry's listen-router
3831
+ * listeners never unsubscribe peers). A throwing listener does not stop
3832
+ * delivery to the others.
3833
+ */
3834
+ declare class InMemoryServerEventBus implements ServerEventBus {
3835
+ private readonly onerror?;
3836
+ private readonly _listeners;
3837
+ /**
3838
+ * @param onerror - Optional callback for errors thrown by listeners
3839
+ * during dispatch.
3840
+ */
3841
+ constructor(onerror?: ((error: Error) => void) | undefined);
3842
+ publish(event: ServerEvent): void;
3843
+ subscribe(listener: (event: ServerEvent) => void): () => void;
3844
+ /** The number of currently registered listeners (test/introspection only — the routers track capacity via their own open-subscription set). */
3845
+ get listenerCount(): number;
3846
+ }
3847
+ /**
3848
+ * Typed publish-side facade over `bus.publish` returned by `createMcpHandler`:
3849
+ * each method publishes the corresponding {@linkcode ServerEvent}. Prefer this
3850
+ * over calling `bus.publish` directly — the names match the wire methods.
3851
+ */
3852
+ interface ServerNotifier {
3853
+ /** Publish `notifications/tools/list_changed` to every open subscription that opted in. */
3854
+ toolsChanged(): void;
3855
+ /** Publish `notifications/prompts/list_changed` to every open subscription that opted in. */
3856
+ promptsChanged(): void;
3857
+ /** Publish `notifications/resources/list_changed` to every open subscription that opted in. */
3858
+ resourcesChanged(): void;
3859
+ /** Publish `notifications/resources/updated` for `uri` to every open subscription that opted in to that URI. */
3860
+ resourceUpdated(uri: string): void;
3861
+ }
3862
+ //#endregion
3863
+ //#region src/server/createMcpHandler.d.ts
3864
+ /**
3865
+ * Construction context handed to an {@linkcode McpServerFactory}.
3866
+ *
3867
+ * Both serving entries call the factory with this context whenever they need
3868
+ * a fresh instance: {@linkcode createMcpHandler} once per HTTP request, and
3869
+ * `serveStdio` (from `@modelcontextprotocol/server/stdio`) once per
3870
+ * connection — plus once for a `server/discover` probe instance that is
3871
+ * discarded again if the client falls back to `initialize`.
3872
+ *
3873
+ * Zero-argument factories remain assignable unchanged; the context exists for
3874
+ * factories that vary by principal or era (for example multi-tenant servers
3875
+ * keyed off `authInfo`, or a factory that registers extra surface only for one
3876
+ * era).
3877
+ */
3878
+ interface McpRequestContext {
3879
+ /**
3880
+ * The protocol era the constructed instance will serve: `modern` for
3881
+ * 2026-07-28 (per-request envelope) traffic, `legacy` for 2025-era
3882
+ * traffic. Under {@linkcode createMcpHandler} a `legacy` instance serves
3883
+ * one request through the stateless legacy fallback (the default —
3884
+ * `legacy: 'reject'` endpoints are strict and never construct one); under
3885
+ * `serveStdio` it serves a connection that opened with the 2025 handshake
3886
+ * and stays pinned to that era for its lifetime.
3887
+ */
3888
+ era: 'legacy' | 'modern';
3889
+ /**
3890
+ * Validated authentication information passed by the caller of the
3891
+ * handler face (pass-through; HTTP only — `serveStdio` never sets it).
3892
+ */
3893
+ authInfo?: AuthInfo;
3894
+ /** The original HTTP request being served, when available (HTTP only — `serveStdio` never sets it). */
3895
+ requestInfo?: Request;
3896
+ }
3897
+ /**
3898
+ * A factory producing a fresh {@linkcode McpServer} (or low-level
3899
+ * {@linkcode Server}) instance for one serving unit: one HTTP request under
3900
+ * {@linkcode createMcpHandler}, or one connection (or one discarded
3901
+ * `server/discover` probe) under `serveStdio`. The same factory backs every
3902
+ * era either entry serves — define your tools, resources and prompts once and
3903
+ * serve them to both eras.
3904
+ */
3905
+ type McpServerFactory = (ctx: McpRequestContext) => McpServer | Server | Promise<McpServer | Server>;
3906
+ /** Caller-provided per-request inputs for {@linkcode McpHttpHandler.fetch} and fetch-shaped legacy handlers ({@linkcode LegacyHttpHandler}). */
3907
+ interface McpHandlerRequestOptions {
3908
+ /**
3909
+ * Validated authentication information for the request. Strictly
3910
+ * pass-through: the handler never populates this from request headers and
3911
+ * performs no token verification of its own.
3912
+ */
3913
+ authInfo?: AuthInfo;
3914
+ /** A pre-parsed JSON request body (e.g. `req.body` from `express.json()`). */
3915
+ parsedBody?: unknown;
3916
+ }
3917
+ /**
3918
+ * A fetch-shaped handler serving 2025-era traffic: the shape produced by
3919
+ * {@linkcode legacyStatelessFallback}, and the shape a hand-wired composition
3920
+ * routes legacy requests to (see {@linkcode isLegacyRequest}). It is not a
3921
+ * `legacy` option value — the entry's own legacy serving is selected by the
3922
+ * `'stateless' | 'reject'` posture only.
3923
+ */
3924
+ type LegacyHttpHandler = (request: Request, options?: McpHandlerRequestOptions) => Promise<Response>;
3925
+ /** Options for {@linkcode createMcpHandler}. */
3926
+ interface CreateMcpHandlerOptions {
3927
+ /**
3928
+ * How 2025-era (non-envelope) traffic is served:
3929
+ *
3930
+ * - `'stateless'` (the default, also when the option is omitted) —
3931
+ * old-school stateless serving: each legacy request is answered by a
3932
+ * fresh instance from the same factory over a streamable HTTP transport
3933
+ * constructed with only `sessionIdGenerator: undefined` (the established
3934
+ * stateless idiom). Because serving is per-request and stateless, GET and
3935
+ * DELETE (2025 session operations) are answered with `405` /
3936
+ * `Method not allowed.`.
3937
+ * - `'reject'` — modern-only strict: legacy-classified requests are
3938
+ * rejected with the unsupported-protocol-version error naming the
3939
+ * endpoint's supported revisions (legacy-classified notifications are
3940
+ * acknowledged with `202` and dropped). **There is no 2025 serving in
3941
+ * this mode.**
3942
+ *
3943
+ * There is no handler-valued option: to keep an existing legacy deployment
3944
+ * (for example a sessionful streamable HTTP wiring) serving 2025 traffic
3945
+ * next to this entry, route in user land with {@linkcode isLegacyRequest}
3946
+ * in front of a `legacy: 'reject'` handler — see that predicate's
3947
+ * documentation for the pattern.
3948
+ */
3949
+ legacy?: 'stateless' | 'reject';
3950
+ /** Callback for out-of-band errors and rejected requests (reporting only; it never alters the response). */
3951
+ onerror?: (error: Error) => void;
3952
+ /**
3953
+ * Response shaping for modern (2026-07-28) request exchanges:
3954
+ *
3955
+ * - `'auto'` (default) — a single JSON body unless the handler emits a
3956
+ * related message before its result, in which case the response upgrades
3957
+ * to an SSE stream.
3958
+ * - `'sse'` — always stream.
3959
+ * - `'json'` — never stream. **Mid-call notifications (progress, logging,
3960
+ * any related message emitted before the result) are dropped** — only the
3961
+ * terminal result is delivered. Listen-class subscription streams are
3962
+ * always served over SSE regardless of this setting.
3963
+ */
3964
+ responseMode?: PerRequestResponseMode;
3965
+ /**
3966
+ * The change-event bus `subscriptions/listen` streams subscribe to.
3967
+ *
3968
+ * When omitted, an in-process {@link InMemoryServerEventBus} is created
3969
+ * and the returned handler's `notify` sugar publishes onto it.
3970
+ * Multi-process deployments supply their own implementation over their
3971
+ * pub/sub backend; the same instance can be shared across handlers.
3972
+ */
3973
+ bus?: ServerEventBus;
3974
+ /**
3975
+ * Reject a new `subscriptions/listen` with `-32603` 'Subscription limit
3976
+ * reached' (in-band, HTTP 200, before the ack) when this many subscription
3977
+ * streams are already open on this handler.
3978
+ * @default 1024
3979
+ */
3980
+ maxSubscriptions?: number;
3981
+ /**
3982
+ * SSE comment-frame keepalive interval for every SSE stream this handler
3983
+ * serves. In modern `auto` mode it starts after SSE upgrade. Set to `0` to disable.
3984
+ * @default 15000
3985
+ */
3986
+ keepAliveMs?: number;
3987
+ /**
3988
+ * Upper bound, in bytes, on a POST body the handler reads itself (the
3989
+ * classification step and the stateless legacy leg). A body over the bound
3990
+ * is answered `413` before anything is parsed or any server instance is
3991
+ * created. Not applied to a body supplied as `parsedBody`. Must be a
3992
+ * positive number. Hand-wired compositions routing on
3993
+ * {@linkcode isLegacyRequest} pass the same value to the predicate.
3994
+ * @default 4194304 (4 MiB)
3995
+ */
3996
+ maxRequestBodySize?: number;
3997
+ }
3998
+ /**
3999
+ * The handler returned by {@linkcode createMcpHandler}: a web-standard
4000
+ * `{ fetch, close, notify, bus }` object — the shape Workers/Bun/Deno expect
4001
+ * from `export default`. `fetch` is an arrow-assigned bound property: it can be
4002
+ * detached and passed around (`const { fetch } = handler`) without losing its
4003
+ * binding.
4004
+ *
4005
+ * Node frameworks (Express, Fastify, plain `node:http`) wrap the handler once
4006
+ * with `toNodeHandler(handler)` from `@modelcontextprotocol/node`.
4007
+ */
4008
+ interface McpHttpHandler {
4009
+ /** Web-standard face: serve one HTTP request and resolve with the response. */
4010
+ fetch: (request: Request, options?: McpHandlerRequestOptions) => Promise<Response>;
4011
+ /**
4012
+ * Tears down the modern leg: aborts in-flight modern exchanges and closes
4013
+ * their per-request instances. Legacy serving is unaffected — the
4014
+ * stateless fallback is per-request by construction and holds nothing
4015
+ * between exchanges.
4016
+ */
4017
+ close: () => Promise<void>;
4018
+ /**
4019
+ * Typed publish-side facade over the handler's `subscriptions/listen` bus:
4020
+ * each method publishes the corresponding change event to every open
4021
+ * subscription stream that opted in to that notification type.
4022
+ *
4023
+ * Safe to call when no subscription is open (no-op).
4024
+ */
4025
+ notify: ServerNotifier;
4026
+ /**
4027
+ * The change-event bus this handler's `subscriptions/listen` streams
4028
+ * subscribe to (the supplied `bus` option, or the auto-created in-process
4029
+ * default).
4030
+ */
4031
+ bus: ServerEventBus;
4032
+ }
4033
+ /** Options for {@linkcode legacyStatelessFallback}. */
4034
+ interface LegacyStatelessFallbackOptions {
4035
+ /**
4036
+ * Upper bound, in bytes, on a POST body the leg reads itself (not applied
4037
+ * to a body supplied as `parsedBody`). Must be a positive number.
4038
+ * @default 4194304 (4 MiB)
4039
+ */
4040
+ maxRequestBodySize?: number;
4041
+ }
4042
+ declare function legacyStatelessFallback(factory: McpServerFactory, onerror?: (error: Error) => void, options?: LegacyStatelessFallbackOptions): LegacyHttpHandler;
4043
+ /** Options for {@linkcode isLegacyRequest}. */
4044
+ interface IsLegacyRequestOptions {
4045
+ /**
4046
+ * The same `maxRequestBodySize` the handler the predicate routes for was
4047
+ * created with, so the two read the body under one bound (a body over it
4048
+ * classifies `false`; the modern handler answers `413`).
4049
+ * @default 4194304 (4 MiB)
4050
+ */
4051
+ maxRequestBodySize?: number;
4052
+ }
4053
+ /**
4054
+ * Whether {@linkcode createMcpHandler} would route this request to its legacy
4055
+ * (2025-era) serving rather than the modern (2026-07-28) path.
4056
+ *
4057
+ * Call it with just the request: `await isLegacyRequest(request)`. For a
4058
+ * `POST` the body is read from an internal clone, so the request you pass
4059
+ * stays fully readable for whichever handler you route it to — no second
4060
+ * argument is needed. (In a Node `(req, res)` handler, build that `Request`
4061
+ * with `toWebRequest(req)` from `@modelcontextprotocol/node`; behind a body
4062
+ * parser, which has already drained the Node stream, build it as
4063
+ * `toWebRequest(req, req.body)` so the bytes come from the parsed body —
4064
+ * either way the predicate still takes just the request.) The optional
4065
+ * `parsedBody` is a perf escape hatch for a body you already hold parsed:
4066
+ * pass it and the predicate classifies from the value directly, reading and
4067
+ * cloning nothing. It is needed, not just faster, when the request's own
4068
+ * body was already read — the internal clone is then impossible (cloning a
4069
+ * used body throws a `TypeError`), so such a single-argument call rejects
4070
+ * instead of guessing.
4071
+ *
4072
+ * This is the entry's own classification step exported as a predicate — it
4073
+ * runs exactly the code `createMcpHandler` runs to make the routing decision,
4074
+ * not a re-implementation — so a hand-wired composition that branches on it
4075
+ * can never disagree with the entry. It is classification only: hand-wired
4076
+ * compositions must validate Content-Type themselves (415 for POSTs whose
4077
+ * media type is not `application/json`, via {@linkcode isJsonContentType})
4078
+ * before dispatching either leg — routing the legacy leg into the SDK
4079
+ * transports gets their built-in check, but a custom modern leg has none. Use it to keep an existing legacy
4080
+ * deployment (for example a sessionful streamable HTTP wiring) serving 2025
4081
+ * traffic next to a strict modern endpoint, now that the entry has no
4082
+ * handler-valued `legacy` option:
4083
+ *
4084
+ * ```ts
4085
+ * import { createMcpHandler, isLegacyRequest } from '@modelcontextprotocol/server';
4086
+ *
4087
+ * const modern = createMcpHandler(factory, { legacy: 'reject' });
4088
+ *
4089
+ * export default {
4090
+ * async fetch(request: Request): Promise<Response> {
4091
+ * if (await isLegacyRequest(request)) {
4092
+ * // e.g. an existing sessionful WebStandardStreamableHTTPServerTransport wiring
4093
+ * return myExistingLegacyHandler(request);
4094
+ * }
4095
+ * return modern.fetch(request);
4096
+ * }
4097
+ * };
4098
+ * ```
4099
+ *
4100
+ * Semantics (identical to the entry's routing):
4101
+ *
4102
+ * - Returns `true` only for requests with no per-request `_meta` envelope
4103
+ * claim: claim-less POSTs (including the `initialize` handshake and 2025-era
4104
+ * notification POSTs without a modern protocol-version header), body-less
4105
+ * GET/DELETE session operations, all-legacy JSON-RPC batch arrays, posted
4106
+ * JSON-RPC responses, and POSTs whose body is empty or not valid JSON.
4107
+ * - Returns `false` for everything the modern path answers, including its
4108
+ * validation-ladder rejections: a request carrying the envelope claim (even
4109
+ * one naming a revision the endpoint does not serve — the modern path
4110
+ * answers it with the unsupported-protocol-version error), a malformed
4111
+ * envelope behind a present claim (answered `-32602`), a request whose
4112
+ * `MCP-Protocol-Version` header names a modern revision but that lacks the
4113
+ * envelope (`-32602`), header/body mismatches (`-32020`), and a POST body
4114
+ * over the size limit (413). Consumers
4115
+ * routing on the predicate must send `false` traffic to the modern handler,
4116
+ * never to a legacy handler — the modern path owns those error answers.
4117
+ * - `server/discover` probes sent by negotiating clients always carry the
4118
+ * envelope claim, so they are never legacy; a hand-built claim-less POST to
4119
+ * a method named `server/discover` has no claim and classifies legacy,
4120
+ * exactly as the entry itself routes it.
4121
+ */
4122
+ declare function isLegacyRequest(request: Request, parsedBody?: unknown, options?: IsLegacyRequestOptions): Promise<boolean>;
4123
+ /**
4124
+ * Creates an HTTP handler that serves the 2026-07-28 protocol revision from a
4125
+ * per-request server factory and, by default, falls back to old-school
4126
+ * stateless serving for 2025-era traffic. Pass `legacy: 'reject'` for a
4127
+ * modern-only strict endpoint.
4128
+ *
4129
+ * Mounting: `handler.fetch` is the web-standard face (Cloudflare Workers,
4130
+ * Deno, Bun, Hono's `c.req.raw`); for Express/Fastify/plain `node:http`, wrap
4131
+ * the handler once with `toNodeHandler(handler)` from
4132
+ * `@modelcontextprotocol/node`. When mounting bare on a fetch-native runtime,
4133
+ * put Origin/Host validation in front of the handler — the entry itself is
4134
+ * deliberately validation-free:
4135
+ *
4136
+ * ```ts
4137
+ * import { hostHeaderValidationResponse, originValidationResponse, localhostAllowedHostnames, localhostAllowedOrigins } from '@modelcontextprotocol/server';
4138
+ *
4139
+ * export default {
4140
+ * async fetch(request: Request): Promise<Response> {
4141
+ * const rejected =
4142
+ * hostHeaderValidationResponse(request, localhostAllowedHostnames()) ??
4143
+ * originValidationResponse(request, localhostAllowedOrigins());
4144
+ * return rejected ?? handler.fetch(request);
4145
+ * }
4146
+ * };
4147
+ * ```
4148
+ *
4149
+ * Use ONE factory for both legs: the same tools/resources/prompts definition
4150
+ * backs the modern path and the stateless legacy fallback, so the two eras can
4151
+ * never drift apart. To keep an existing legacy deployment (for example a
4152
+ * sessionful streamable HTTP wiring) serving 2025 traffic instead of the
4153
+ * stateless fallback, route in user land with {@linkcode isLegacyRequest} in
4154
+ * front of a strict handler — see that predicate's documentation for the
4155
+ * pattern. Power users composing transport-neutral routing can also use the
4156
+ * exported building blocks directly: {@linkcode classifyInboundRequest} for
4157
+ * the era decision and `PerRequestHTTPServerTransport` for single-exchange
4158
+ * serving — such compositions must reject POSTs whose Content-Type media type
4159
+ * is not `application/json` (415) before parsing the body, using
4160
+ * {@linkcode isJsonContentType}; neither building block performs this
4161
+ * validation itself.
4162
+ *
4163
+ * The entry performs no token verification: `authInfo` given to `fetch` is
4164
+ * passed through to handlers and the factory as-is and is never derived from
4165
+ * request headers.
4166
+ */
4167
+ declare function createMcpHandler(factory: McpServerFactory, options?: CreateMcpHandlerOptions): McpHttpHandler;
4168
+ //#endregion
4169
+ export { isJsonContentType as $, checkResourceAllowed as $a, SetLevelRequestParams as $i, HandlerResultTypeMap as $n, NotificationMethod as $r, InboundModernRoute as $t, RegisteredResource as A, UnsubscribeRequestParams as Aa, Resource as Ai, CreateMessageResult as An, ListPromptsResult as Ar, isJSONRPCResultResponse as At, requireScopes as B, INVALID_REQUEST as Ba, ResultMetaObject as Bi, ElicitResult as Bn, ListToolsResult as Br, InputResponseView as Bt, ListResourcesCallback as C, ToolAnnotations as Ca, RequestId as Ci, CompleteRequestResourceTemplate as Cn, JSONRPCResultResponse as Cr, isInitializeRequest as Ct, ReadResourceCallback as D, ToolResultContent as Da, RequestMethod as Di, CreateMessageRequestParams as Dn, ListChangedHandlers as Dr, isJSONRPCNotification as Dt, PromptCallback as E, ToolListChangedNotification as Ea, RequestMetaObject as Ei, CreateMessageRequest as En, ListChangedCallback as Er, isJSONRPCErrorResponse as Et, ToolCallback as F, CLIENT_CAPABILITIES_META_KEY as Fa, ResourceTemplateReference as Fi, DiscoverResult as Fn, ListRootsRequest as Fr, ResourceNotFoundError as Ft, ReadBuffer as G, PARSE_ERROR as Ga, SamplingContent as Gi, EnumSchema as Gn, MessageExtraInfo as Gr, StandardSchemaV1 as Gt, InMemoryTransport as H, LATEST_PROTOCOL_VERSION as Ha, Role as Hi, ElicitationCompleteNotificationParams as Hn, LoggingMessageNotification as Hr, inputRequired as Ht, Server as I, CLIENT_INFO_META_KEY as Ia, ResourceTemplateType as Ii, ElicitRequest as In, ListRootsResult as Ir, UnsupportedProtocolVersionError as It, serializeMessage as J, SERVER_INFO_META_KEY as Ja, ServerCapabilities as Ji, GetPromptResult as Jn, MissingRequiredClientCapabilityErrorData as Jr, InboundClassificationOutcome as Jt, STDIO_DEFAULT_MAX_BUFFER_SIZE as K, PROTOCOL_VERSION_META_KEY as Ka, SamplingMessage as Ki, GetPromptRequest as Kn, MetaObject as Kr, StandardSchemaV1Sync as Kt, ServerOptions as L, DEFAULT_NEGOTIATED_PROTOCOL_VERSION as La, ResourceUpdatedNotification as Li, ElicitRequestFormParams as Ln, ListTasksRequest as Lr, UrlElicitationRequiredError as Lt, RegisteredTool as M, UntitledMultiSelectEnumSchema as Ma, ResourceLink as Mi, CreateTaskResult as Mn, ListResourceTemplatesResult as Mr, parseJSONRPCMessage as Mt, ResourceMetadata as N, UntitledSingleSelectEnumSchema as Na, ResourceListChangedNotification as Ni, Cursor as Nn, ListResourcesRequest as Nr, MissingRequiredClientCapabilityError as Nt, ReadResourceTemplateCallback as O, ToolUseContent as Oa, RequestParams as Oi, CreateMessageRequestParamsBase as On, ListChangedOptions as Or, isJSONRPCRequest as Ot, ResourceTemplate as P, BAGGAGE_META_KEY as Pa, ResourceRequestParams as Pi, DiscoverRequest as Pn, ListResourcesResult as Pr, ProtocolError as Pt, getDisplayName as Q, TRACESTATE_META_KEY as Qa, SetLevelRequest as Qi, GetTaskResult as Qn, Notification as Qr, InboundLegacyRouteReason as Qt, ScopeChallenge as R, INTERNAL_ERROR as Ra, ResourceUpdatedNotificationParams as Ri, ElicitRequestParams as Rn, ListTasksResult as Rr, ProtocolErrorCode as Rt, CompleteResourceTemplateCallback as S, Tool as Sa, Request$1 as Si, CompleteRequestPrompt as Sn, StoredOAuthTokens as So, JSONRPCResponse as Sr, isCallToolResult as St, McpServerOptions as T, ToolExecution as Ta, RequestMetaEnvelope as Ti, ContentBlock as Tn, LegacyTitledEnumSchema as Tr, isInputRequiredResult as Tt, UriTemplate as U, LOG_LEVEL_META_KEY as Ua, Root as Ui, EmbeddedResource as Un, LoggingMessageNotificationParams as Ur, inputResponse as Ut, preloadSchemas as V, JSONRPC_VERSION as Va, ResultTypeMap as Vi, ElicitationCompleteNotification as Vn, LoggingLevel as Vr, acceptedContent as Vt, Variables as W, METHOD_NOT_FOUND as Wa, RootsListChangedNotification as Wi, EmptyResult as Wn, MessageClassification as Wr, ElicitInputParams as Wt, CacheScope as X, SUPPORTED_PROTOCOL_VERSIONS as Xa, ServerRequest as Xi, GetTaskPayloadResult as Xn, ModelPreferences as Xr, InboundLadderRejection as Xt, CacheHint as Y, SUBSCRIPTION_ID_META_KEY as Ya, ServerNotification as Yi, GetTaskPayloadRequest as Yn, ModelHint as Yr, InboundHttpRequest as Yt, ProtocolEra as Z, TRACEPARENT_META_KEY as Za, ServerResult as Zi, GetTaskRequest as Zn, MultiSelectEnumSchema as Zr, InboundLegacyRoute as Zt, PerRequestHTTPServerTransportOptions as _, TaskStatusNotificationParams as _a, PromptReference as _i, ClientRequest as _n, OAuthTokenRevocationRequest as _o, JSONObject as _r, SpecTypes as _t, McpHandlerRequestOptions as a, SubscriptionsAcknowledgedNotification as aa, PaginatedResult as ai, BaseMetadata as an, OAuthError as ao, InitializeRequestParams as ar, Protocol as at, AnyToolHandler as b, TitledMultiSelectEnumSchema as ba, ReadResourceResult as bi, CompleteRequest as bn, OpenIdProviderMetadata as bo, JSONRPCNotification as br, assertCompleteRequestPrompt as bt, McpServerFactory as c, SubscriptionsListenRequestParams as ca, PrimitiveSchemaDefinition as ci, CallToolRequest as cn, IdJagTokenExchangeResponse as co, InputRequest as cr, RequestOptions as ct, legacyStatelessFallback as d, Task as da, ProgressNotificationParams as di, CancelTaskRequest as dn, OAuthClientInformationMixed as do, InputResponse as dr, mergeCapabilities as dt, SingleSelectEnumSchema as ea, NotificationParams as ei, InboundValidationRung as en, resourceUrlFromServerUrl as eo, Icon as er, BaseContext as et, InMemoryServerEventBus as f, TaskAugmentedRequestParams as fa, ProgressToken as fi, CancelTaskResult as fn, OAuthClientMetadata as fo, InputResponses as fr, FetchLike as ft, PerRequestHTTPServerTransport as g, TaskStatusNotification as ga, PromptMessage as gi, ClientNotification as gn, OAuthProtectedResourceMetadata as go, JSONArray as gr, SpecTypeName as gt, ServerNotifier as h, TaskStatus as ha, PromptListChangedNotification as hi, ClientCapabilities as hn, OAuthMetadata as ho, InvalidRequestError as hr, createFetchWithInit as ht, LegacyStatelessFallbackOptions as i, SubscriptionFilter as ia, PaginatedRequestParams as ii, AuthInfo as in, SdkHttpErrorData as io, InitializeRequest as ir, ProgressCallback as it, RegisteredResourceTemplate as j, UnsupportedProtocolVersionErrorData as ja, ResourceContents as ji, CreateMessageResultWithTools as jn, ListResourceTemplatesRequest as jr, isTaskAugmentedRequestParams as jt, RegisteredPrompt as k, UnsubscribeRequest as ka, RequestTypeMap as ki, CreateMessageRequestParamsWithTools as kn, ListPromptsRequest as kr, isJSONRPCResponse as kt, createMcpHandler as l, SubscriptionsListenResult as la, Progress as li, CallToolRequestParams as ln, OAuthClientInformation as lo, InputRequests as lr, RequestStateAccessor as lt, ServerEventBus as m, TaskMetadata as ma, PromptArgument as mi, CancelledNotificationParams as mn, OAuthErrorResponse as mo, InvalidParamsError as mr, TransportSendOptions as mt, IsLegacyRequestOptions as n, SubscribeRequest as na, NumberSchema as ni, Annotations as nn, SdkErrorCode as no, ImageContent as nr, DEFAULT_REQUEST_TIMEOUT_MSEC as nt, McpHttpHandler as o, SubscriptionsAcknowledgedNotificationParams as oa, ParseError as oi, BlobResourceContents as on, OAuthErrorCode as oo, InitializeResult as or, ProtocolOptions as ot, ServerEvent as p, TaskCreationParams as pa, Prompt as pi, CancelledNotification as pn, OAuthClientRegistrationError as po, InternalError as pr, Transport as pt, deserializeMessage as q, RELATED_TASK_META_KEY as qa, SamplingMessageContentBlock as qi, GetPromptRequestParams as qn, MethodNotFoundError as qr, StandardSchemaWithJSON as qt, LegacyHttpHandler as r, SubscribeRequestParams as ra, PaginatedRequest as ri, AudioContent as rn, SdkHttpError as ro, Implementation as rr, NotificationOptions as rt, McpRequestContext as s, SubscriptionsListenRequest as sa, PingRequest as si, BooleanSchema as sn, AuthorizationServerMetadata as so, InitializedNotification as sr, RequestHandlerSchemas as st, CreateMcpHandlerOptions as t, StringSchema as ta, NotificationTypeMap as ti, classifyInboundRequest as tn, SdkError as to, Icons as tr, ClientContext as tt, isLegacyRequest as u, SubscriptionsListenResultMeta as ua, ProgressNotification as ui, CallToolResult as un, OAuthClientInformationFull as uo, InputRequiredResult as ur, ServerContext as ut, PerRequestMessageExtra as v, TextContent as va, ReadResourceRequest as vi, ClientResult as vn, OAuthTokens as vo, JSONRPCErrorResponse as vr, isSpecType as vt, McpServer as w, ToolChoice as wa, RequestMeta as wi, CompleteResult as wn, JSONValue as wr, isInitializedNotification as wt, BaseToolCallback as x, TitledSingleSelectEnumSchema as xa, RelatedTaskMetadata as xi, CompleteRequestParams as xn, StoredOAuthClientInformation as xo, JSONRPCRequest as xr, assertCompleteRequestResourceTemplate as xt, PerRequestResponseMode as y, TextResourceContents as ya, ReadResourceRequestParams as yi, CompatibilityCallToolResult as yn, OpenIdProviderDiscoveryMetadata as yo, JSONRPCMessage as yr, specTypeSchemas as yt, ScopeChallengeHandler as z, INVALID_PARAMS as za, Result$1 as zi, ElicitRequestURLParams as zn, ListToolsRequest as zr, InputRequiredSpec as zt };
4170
+ //# sourceMappingURL=createMcpHandler-DZmmlN8e.d.cts.map