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