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