x-m32-mcp-server 2.1.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 (929) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +281 -0
  3. package/dist/cjs/client/auth.d.ts +270 -0
  4. package/dist/cjs/client/auth.d.ts.map +1 -0
  5. package/dist/cjs/client/auth.js +747 -0
  6. package/dist/cjs/client/auth.js.map +1 -0
  7. package/dist/cjs/client/index.d.ts +913 -0
  8. package/dist/cjs/client/index.d.ts.map +1 -0
  9. package/dist/cjs/client/index.js +367 -0
  10. package/dist/cjs/client/index.js.map +1 -0
  11. package/dist/cjs/client/middleware.d.ts +169 -0
  12. package/dist/cjs/client/middleware.d.ts.map +1 -0
  13. package/dist/cjs/client/middleware.js +252 -0
  14. package/dist/cjs/client/middleware.js.map +1 -0
  15. package/dist/cjs/client/sse.d.ts +80 -0
  16. package/dist/cjs/client/sse.d.ts.map +1 -0
  17. package/dist/cjs/client/sse.js +211 -0
  18. package/dist/cjs/client/sse.js.map +1 -0
  19. package/dist/cjs/client/stdio.d.ts +78 -0
  20. package/dist/cjs/client/stdio.d.ts.map +1 -0
  21. package/dist/cjs/client/stdio.js +184 -0
  22. package/dist/cjs/client/stdio.js.map +1 -0
  23. package/dist/cjs/client/streamableHttp.d.ts +158 -0
  24. package/dist/cjs/client/streamableHttp.d.ts.map +1 -0
  25. package/dist/cjs/client/streamableHttp.js +406 -0
  26. package/dist/cjs/client/streamableHttp.js.map +1 -0
  27. package/dist/cjs/client/websocket.d.ts +17 -0
  28. package/dist/cjs/client/websocket.d.ts.map +1 -0
  29. package/dist/cjs/client/websocket.js +63 -0
  30. package/dist/cjs/client/websocket.js.map +1 -0
  31. package/dist/cjs/examples/client/multipleClientsParallel.d.ts +2 -0
  32. package/dist/cjs/examples/client/multipleClientsParallel.d.ts.map +1 -0
  33. package/dist/cjs/examples/client/multipleClientsParallel.js +134 -0
  34. package/dist/cjs/examples/client/multipleClientsParallel.js.map +1 -0
  35. package/dist/cjs/examples/client/parallelToolCallsClient.d.ts +2 -0
  36. package/dist/cjs/examples/client/parallelToolCallsClient.d.ts.map +1 -0
  37. package/dist/cjs/examples/client/parallelToolCallsClient.js +176 -0
  38. package/dist/cjs/examples/client/parallelToolCallsClient.js.map +1 -0
  39. package/dist/cjs/examples/client/simpleOAuthClient.d.ts +3 -0
  40. package/dist/cjs/examples/client/simpleOAuthClient.d.ts.map +1 -0
  41. package/dist/cjs/examples/client/simpleOAuthClient.js +376 -0
  42. package/dist/cjs/examples/client/simpleOAuthClient.js.map +1 -0
  43. package/dist/cjs/examples/client/simpleStreamableHttp.d.ts +2 -0
  44. package/dist/cjs/examples/client/simpleStreamableHttp.d.ts.map +1 -0
  45. package/dist/cjs/examples/client/simpleStreamableHttp.js +744 -0
  46. package/dist/cjs/examples/client/simpleStreamableHttp.js.map +1 -0
  47. package/dist/cjs/examples/client/streamableHttpWithSseFallbackClient.d.ts +2 -0
  48. package/dist/cjs/examples/client/streamableHttpWithSseFallbackClient.d.ts.map +1 -0
  49. package/dist/cjs/examples/client/streamableHttpWithSseFallbackClient.js +168 -0
  50. package/dist/cjs/examples/client/streamableHttpWithSseFallbackClient.js.map +1 -0
  51. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts +78 -0
  52. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -0
  53. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.js +189 -0
  54. package/dist/cjs/examples/server/demoInMemoryOAuthProvider.js.map +1 -0
  55. package/dist/cjs/examples/server/elicitationExample.d.ts +2 -0
  56. package/dist/cjs/examples/server/elicitationExample.d.ts.map +1 -0
  57. package/dist/cjs/examples/server/elicitationExample.js +435 -0
  58. package/dist/cjs/examples/server/elicitationExample.js.map +1 -0
  59. package/dist/cjs/examples/server/jsonResponseStreamableHttp.d.ts +2 -0
  60. package/dist/cjs/examples/server/jsonResponseStreamableHttp.d.ts.map +1 -0
  61. package/dist/cjs/examples/server/jsonResponseStreamableHttp.js +152 -0
  62. package/dist/cjs/examples/server/jsonResponseStreamableHttp.js.map +1 -0
  63. package/dist/cjs/examples/server/mcpServerOutputSchema.d.ts +7 -0
  64. package/dist/cjs/examples/server/mcpServerOutputSchema.d.ts.map +1 -0
  65. package/dist/cjs/examples/server/mcpServerOutputSchema.js +72 -0
  66. package/dist/cjs/examples/server/mcpServerOutputSchema.js.map +1 -0
  67. package/dist/cjs/examples/server/simpleSseServer.d.ts +2 -0
  68. package/dist/cjs/examples/server/simpleSseServer.d.ts.map +1 -0
  69. package/dist/cjs/examples/server/simpleSseServer.js +146 -0
  70. package/dist/cjs/examples/server/simpleSseServer.js.map +1 -0
  71. package/dist/cjs/examples/server/simpleStatelessStreamableHttp.d.ts +2 -0
  72. package/dist/cjs/examples/server/simpleStatelessStreamableHttp.d.ts.map +1 -0
  73. package/dist/cjs/examples/server/simpleStatelessStreamableHttp.js +147 -0
  74. package/dist/cjs/examples/server/simpleStatelessStreamableHttp.js.map +1 -0
  75. package/dist/cjs/examples/server/simpleStreamableHttp.d.ts +2 -0
  76. package/dist/cjs/examples/server/simpleStreamableHttp.d.ts.map +1 -0
  77. package/dist/cjs/examples/server/simpleStreamableHttp.js +587 -0
  78. package/dist/cjs/examples/server/simpleStreamableHttp.js.map +1 -0
  79. package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.d.ts +2 -0
  80. package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.d.ts.map +1 -0
  81. package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js +240 -0
  82. package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -0
  83. package/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.d.ts +2 -0
  84. package/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.d.ts.map +1 -0
  85. package/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js +116 -0
  86. package/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -0
  87. package/dist/cjs/examples/server/toolWithSampleServer.d.ts +2 -0
  88. package/dist/cjs/examples/server/toolWithSampleServer.d.ts.map +1 -0
  89. package/dist/cjs/examples/server/toolWithSampleServer.js +49 -0
  90. package/dist/cjs/examples/server/toolWithSampleServer.js.map +1 -0
  91. package/dist/cjs/examples/shared/inMemoryEventStore.d.ts +31 -0
  92. package/dist/cjs/examples/shared/inMemoryEventStore.d.ts.map +1 -0
  93. package/dist/cjs/examples/shared/inMemoryEventStore.js +69 -0
  94. package/dist/cjs/examples/shared/inMemoryEventStore.js.map +1 -0
  95. package/dist/cjs/inMemory.d.ts +31 -0
  96. package/dist/cjs/inMemory.d.ts.map +1 -0
  97. package/dist/cjs/inMemory.js +53 -0
  98. package/dist/cjs/inMemory.js.map +1 -0
  99. package/dist/cjs/index.d.ts +3 -0
  100. package/dist/cjs/index.d.ts.map +1 -0
  101. package/dist/cjs/index.js +85 -0
  102. package/dist/cjs/index.js.map +1 -0
  103. package/dist/cjs/package.json +1 -0
  104. package/dist/cjs/server/auth/clients.d.ts +19 -0
  105. package/dist/cjs/server/auth/clients.d.ts.map +1 -0
  106. package/dist/cjs/server/auth/clients.js +3 -0
  107. package/dist/cjs/server/auth/clients.js.map +1 -0
  108. package/dist/cjs/server/auth/errors.d.ts +141 -0
  109. package/dist/cjs/server/auth/errors.d.ts.map +1 -0
  110. package/dist/cjs/server/auth/errors.js +193 -0
  111. package/dist/cjs/server/auth/errors.js.map +1 -0
  112. package/dist/cjs/server/auth/handlers/authorize.d.ts +13 -0
  113. package/dist/cjs/server/auth/handlers/authorize.d.ts.map +1 -0
  114. package/dist/cjs/server/auth/handlers/authorize.js +144 -0
  115. package/dist/cjs/server/auth/handlers/authorize.js.map +1 -0
  116. package/dist/cjs/server/auth/handlers/metadata.d.ts +4 -0
  117. package/dist/cjs/server/auth/handlers/metadata.d.ts.map +1 -0
  118. package/dist/cjs/server/auth/handlers/metadata.js +21 -0
  119. package/dist/cjs/server/auth/handlers/metadata.js.map +1 -0
  120. package/dist/cjs/server/auth/handlers/register.d.ts +29 -0
  121. package/dist/cjs/server/auth/handlers/register.d.ts.map +1 -0
  122. package/dist/cjs/server/auth/handlers/register.js +77 -0
  123. package/dist/cjs/server/auth/handlers/register.js.map +1 -0
  124. package/dist/cjs/server/auth/handlers/revoke.d.ts +13 -0
  125. package/dist/cjs/server/auth/handlers/revoke.d.ts.map +1 -0
  126. package/dist/cjs/server/auth/handlers/revoke.js +65 -0
  127. package/dist/cjs/server/auth/handlers/revoke.js.map +1 -0
  128. package/dist/cjs/server/auth/handlers/token.d.ts +13 -0
  129. package/dist/cjs/server/auth/handlers/token.d.ts.map +1 -0
  130. package/dist/cjs/server/auth/handlers/token.js +113 -0
  131. package/dist/cjs/server/auth/handlers/token.js.map +1 -0
  132. package/dist/cjs/server/auth/middleware/allowedMethods.d.ts +9 -0
  133. package/dist/cjs/server/auth/middleware/allowedMethods.d.ts.map +1 -0
  134. package/dist/cjs/server/auth/middleware/allowedMethods.js +21 -0
  135. package/dist/cjs/server/auth/middleware/allowedMethods.js.map +1 -0
  136. package/dist/cjs/server/auth/middleware/bearerAuth.d.ts +35 -0
  137. package/dist/cjs/server/auth/middleware/bearerAuth.d.ts.map +1 -0
  138. package/dist/cjs/server/auth/middleware/bearerAuth.js +70 -0
  139. package/dist/cjs/server/auth/middleware/bearerAuth.js.map +1 -0
  140. package/dist/cjs/server/auth/middleware/clientAuth.d.ts +19 -0
  141. package/dist/cjs/server/auth/middleware/clientAuth.d.ts.map +1 -0
  142. package/dist/cjs/server/auth/middleware/clientAuth.js +52 -0
  143. package/dist/cjs/server/auth/middleware/clientAuth.js.map +1 -0
  144. package/dist/cjs/server/auth/provider.d.ts +68 -0
  145. package/dist/cjs/server/auth/provider.d.ts.map +1 -0
  146. package/dist/cjs/server/auth/provider.js +3 -0
  147. package/dist/cjs/server/auth/provider.js.map +1 -0
  148. package/dist/cjs/server/auth/providers/proxyProvider.d.ts +49 -0
  149. package/dist/cjs/server/auth/providers/proxyProvider.d.ts.map +1 -0
  150. package/dist/cjs/server/auth/providers/proxyProvider.js +161 -0
  151. package/dist/cjs/server/auth/providers/proxyProvider.js.map +1 -0
  152. package/dist/cjs/server/auth/router.d.ts +101 -0
  153. package/dist/cjs/server/auth/router.d.ts.map +1 -0
  154. package/dist/cjs/server/auth/router.js +125 -0
  155. package/dist/cjs/server/auth/router.js.map +1 -0
  156. package/dist/cjs/server/auth/types.d.ts +32 -0
  157. package/dist/cjs/server/auth/types.d.ts.map +1 -0
  158. package/dist/cjs/server/auth/types.js +3 -0
  159. package/dist/cjs/server/auth/types.js.map +1 -0
  160. package/dist/cjs/server/completable.d.ts +24 -0
  161. package/dist/cjs/server/completable.d.ts.map +1 -0
  162. package/dist/cjs/server/completable.js +65 -0
  163. package/dist/cjs/server/completable.js.map +1 -0
  164. package/dist/cjs/server/index.d.ts +191 -0
  165. package/dist/cjs/server/index.d.ts.map +1 -0
  166. package/dist/cjs/server/index.js +259 -0
  167. package/dist/cjs/server/index.js.map +1 -0
  168. package/dist/cjs/server/mcp.d.ts +331 -0
  169. package/dist/cjs/server/mcp.d.ts.map +1 -0
  170. package/dist/cjs/server/mcp.js +706 -0
  171. package/dist/cjs/server/mcp.js.map +1 -0
  172. package/dist/cjs/server/sse.d.ts +76 -0
  173. package/dist/cjs/server/sse.d.ts.map +1 -0
  174. package/dist/cjs/server/sse.js +168 -0
  175. package/dist/cjs/server/sse.js.map +1 -0
  176. package/dist/cjs/server/stdio.d.ts +28 -0
  177. package/dist/cjs/server/stdio.d.ts.map +1 -0
  178. package/dist/cjs/server/stdio.js +85 -0
  179. package/dist/cjs/server/stdio.js.map +1 -0
  180. package/dist/cjs/server/streamableHttp.d.ts +185 -0
  181. package/dist/cjs/server/streamableHttp.d.ts.map +1 -0
  182. package/dist/cjs/server/streamableHttp.js +631 -0
  183. package/dist/cjs/server/streamableHttp.js.map +1 -0
  184. package/dist/cjs/server.d.ts +3 -0
  185. package/dist/cjs/server.d.ts.map +1 -0
  186. package/dist/cjs/server.js +9 -0
  187. package/dist/cjs/server.js.map +1 -0
  188. package/dist/cjs/services/x32-connection.d.ts +87 -0
  189. package/dist/cjs/services/x32-connection.d.ts.map +1 -0
  190. package/dist/cjs/services/x32-connection.js +287 -0
  191. package/dist/cjs/services/x32-connection.js.map +1 -0
  192. package/dist/cjs/shared/auth-utils.d.ts +23 -0
  193. package/dist/cjs/shared/auth-utils.d.ts.map +1 -0
  194. package/dist/cjs/shared/auth-utils.js +48 -0
  195. package/dist/cjs/shared/auth-utils.js.map +1 -0
  196. package/dist/cjs/shared/auth.d.ts +626 -0
  197. package/dist/cjs/shared/auth.d.ts.map +1 -0
  198. package/dist/cjs/shared/auth.js +203 -0
  199. package/dist/cjs/shared/auth.js.map +1 -0
  200. package/dist/cjs/shared/metadataUtils.d.ts +16 -0
  201. package/dist/cjs/shared/metadataUtils.d.ts.map +1 -0
  202. package/dist/cjs/shared/metadataUtils.js +26 -0
  203. package/dist/cjs/shared/metadataUtils.js.map +1 -0
  204. package/dist/cjs/shared/protocol.d.ts +230 -0
  205. package/dist/cjs/shared/protocol.d.ts.map +1 -0
  206. package/dist/cjs/shared/protocol.js +428 -0
  207. package/dist/cjs/shared/protocol.js.map +1 -0
  208. package/dist/cjs/shared/stdio.d.ts +13 -0
  209. package/dist/cjs/shared/stdio.d.ts.map +1 -0
  210. package/dist/cjs/shared/stdio.js +37 -0
  211. package/dist/cjs/shared/stdio.js.map +1 -0
  212. package/dist/cjs/shared/toolNameValidation.d.ts +31 -0
  213. package/dist/cjs/shared/toolNameValidation.d.ts.map +1 -0
  214. package/dist/cjs/shared/toolNameValidation.js +97 -0
  215. package/dist/cjs/shared/toolNameValidation.js.map +1 -0
  216. package/dist/cjs/shared/transport.d.ts +75 -0
  217. package/dist/cjs/shared/transport.d.ts.map +1 -0
  218. package/dist/cjs/shared/transport.js +3 -0
  219. package/dist/cjs/shared/transport.js.map +1 -0
  220. package/dist/cjs/shared/uriTemplate.d.ts +25 -0
  221. package/dist/cjs/shared/uriTemplate.d.ts.map +1 -0
  222. package/dist/cjs/shared/uriTemplate.js +243 -0
  223. package/dist/cjs/shared/uriTemplate.js.map +1 -0
  224. package/dist/cjs/spec.types.d.ts +1687 -0
  225. package/dist/cjs/spec.types.d.ts.map +1 -0
  226. package/dist/cjs/spec.types.js +29 -0
  227. package/dist/cjs/spec.types.js.map +1 -0
  228. package/dist/cjs/tools/channel.d.ts +7 -0
  229. package/dist/cjs/tools/channel.d.ts.map +1 -0
  230. package/dist/cjs/tools/channel.js +536 -0
  231. package/dist/cjs/tools/channel.js.map +1 -0
  232. package/dist/cjs/tools/connection.d.ts +7 -0
  233. package/dist/cjs/tools/connection.d.ts.map +1 -0
  234. package/dist/cjs/tools/connection.js +230 -0
  235. package/dist/cjs/tools/connection.js.map +1 -0
  236. package/dist/cjs/tools/index.d.ts +8 -0
  237. package/dist/cjs/tools/index.d.ts.map +1 -0
  238. package/dist/cjs/tools/index.js +14 -0
  239. package/dist/cjs/tools/index.js.map +1 -0
  240. package/dist/cjs/tools/parameter.d.ts +7 -0
  241. package/dist/cjs/tools/parameter.d.ts.map +1 -0
  242. package/dist/cjs/tools/parameter.js +129 -0
  243. package/dist/cjs/tools/parameter.js.map +1 -0
  244. package/dist/cjs/types/index.d.ts +4 -0
  245. package/dist/cjs/types/index.d.ts.map +1 -0
  246. package/dist/cjs/types/index.js +20 -0
  247. package/dist/cjs/types/index.js.map +1 -0
  248. package/dist/cjs/types/osc.d.ts +36 -0
  249. package/dist/cjs/types/osc.d.ts.map +1 -0
  250. package/dist/cjs/types/osc.js +7 -0
  251. package/dist/cjs/types/osc.js.map +1 -0
  252. package/dist/cjs/types/x32.d.ts +94 -0
  253. package/dist/cjs/types/x32.d.ts.map +1 -0
  254. package/dist/cjs/types/x32.js +3 -0
  255. package/dist/cjs/types/x32.js.map +1 -0
  256. package/dist/cjs/types.d.ts +24615 -0
  257. package/dist/cjs/types.d.ts.map +1 -0
  258. package/dist/cjs/types.js +1434 -0
  259. package/dist/cjs/types.js.map +1 -0
  260. package/dist/cjs/utils/color-converter.d.ts +54 -0
  261. package/dist/cjs/utils/color-converter.d.ts.map +1 -0
  262. package/dist/cjs/utils/color-converter.js +86 -0
  263. package/dist/cjs/utils/color-converter.js.map +1 -0
  264. package/dist/cjs/utils/db-converter.d.ts +58 -0
  265. package/dist/cjs/utils/db-converter.d.ts.map +1 -0
  266. package/dist/cjs/utils/db-converter.js +150 -0
  267. package/dist/cjs/utils/db-converter.js.map +1 -0
  268. package/dist/cjs/utils/pan-converter.d.ts +56 -0
  269. package/dist/cjs/utils/pan-converter.d.ts.map +1 -0
  270. package/dist/cjs/utils/pan-converter.js +135 -0
  271. package/dist/cjs/utils/pan-converter.js.map +1 -0
  272. package/dist/cjs/validation/ajv-provider.d.ts +53 -0
  273. package/dist/cjs/validation/ajv-provider.d.ts.map +1 -0
  274. package/dist/cjs/validation/ajv-provider.js +95 -0
  275. package/dist/cjs/validation/ajv-provider.js.map +1 -0
  276. package/dist/cjs/validation/cfworker-provider.d.ts +52 -0
  277. package/dist/cjs/validation/cfworker-provider.d.ts.map +1 -0
  278. package/dist/cjs/validation/cfworker-provider.js +71 -0
  279. package/dist/cjs/validation/cfworker-provider.js.map +1 -0
  280. package/dist/cjs/validation/index.d.ts +29 -0
  281. package/dist/cjs/validation/index.d.ts.map +1 -0
  282. package/dist/cjs/validation/index.js +30 -0
  283. package/dist/cjs/validation/index.js.map +1 -0
  284. package/dist/cjs/validation/types.d.ts +55 -0
  285. package/dist/cjs/validation/types.d.ts.map +1 -0
  286. package/dist/cjs/validation/types.js +3 -0
  287. package/dist/cjs/validation/types.js.map +1 -0
  288. package/dist/cjs/x32-server/index.d.ts +3 -0
  289. package/dist/cjs/x32-server/index.d.ts.map +1 -0
  290. package/dist/cjs/x32-server/index.js +73 -0
  291. package/dist/cjs/x32-server/index.js.map +1 -0
  292. package/dist/cjs/x32-server/tools/channel.tool.d.ts +8 -0
  293. package/dist/cjs/x32-server/tools/channel.tool.d.ts.map +1 -0
  294. package/dist/cjs/x32-server/tools/channel.tool.js +82 -0
  295. package/dist/cjs/x32-server/tools/channel.tool.js.map +1 -0
  296. package/dist/cjs/x32-server/tools/connect.tool.d.ts +8 -0
  297. package/dist/cjs/x32-server/tools/connect.tool.d.ts.map +1 -0
  298. package/dist/cjs/x32-server/tools/connect.tool.js +54 -0
  299. package/dist/cjs/x32-server/tools/connect.tool.js.map +1 -0
  300. package/dist/cjs/x32-server/tools/get-parameter.tool.d.ts +8 -0
  301. package/dist/cjs/x32-server/tools/get-parameter.tool.d.ts.map +1 -0
  302. package/dist/cjs/x32-server/tools/get-parameter.tool.js +54 -0
  303. package/dist/cjs/x32-server/tools/get-parameter.tool.js.map +1 -0
  304. package/dist/cjs/x32-server/tools/index.d.ts +11 -0
  305. package/dist/cjs/x32-server/tools/index.d.ts.map +1 -0
  306. package/dist/cjs/x32-server/tools/index.js +20 -0
  307. package/dist/cjs/x32-server/tools/index.js.map +1 -0
  308. package/dist/cjs/x32-server/tools/info.tool.d.ts +8 -0
  309. package/dist/cjs/x32-server/tools/info.tool.d.ts.map +1 -0
  310. package/dist/cjs/x32-server/tools/info.tool.js +57 -0
  311. package/dist/cjs/x32-server/tools/info.tool.js.map +1 -0
  312. package/dist/cjs/x32-server/tools/set-parameter.tool.d.ts +8 -0
  313. package/dist/cjs/x32-server/tools/set-parameter.tool.d.ts.map +1 -0
  314. package/dist/cjs/x32-server/tools/set-parameter.tool.js +55 -0
  315. package/dist/cjs/x32-server/tools/set-parameter.tool.js.map +1 -0
  316. package/dist/cjs/x32-server/tools/status.tool.d.ts +8 -0
  317. package/dist/cjs/x32-server/tools/status.tool.d.ts.map +1 -0
  318. package/dist/cjs/x32-server/tools/status.tool.js +52 -0
  319. package/dist/cjs/x32-server/tools/status.tool.js.map +1 -0
  320. package/dist/cjs/x32-server/types.d.ts +94 -0
  321. package/dist/cjs/x32-server/types.d.ts.map +1 -0
  322. package/dist/cjs/x32-server/types.js +3 -0
  323. package/dist/cjs/x32-server/types.js.map +1 -0
  324. package/dist/cjs/x32-server/x32-connection.d.ts +87 -0
  325. package/dist/cjs/x32-server/x32-connection.d.ts.map +1 -0
  326. package/dist/cjs/x32-server/x32-connection.js +277 -0
  327. package/dist/cjs/x32-server/x32-connection.js.map +1 -0
  328. package/dist/esm/client/auth.d.ts +270 -0
  329. package/dist/esm/client/auth.d.ts.map +1 -0
  330. package/dist/esm/client/auth.js +726 -0
  331. package/dist/esm/client/auth.js.map +1 -0
  332. package/dist/esm/client/index.d.ts +913 -0
  333. package/dist/esm/client/index.d.ts.map +1 -0
  334. package/dist/esm/client/index.js +363 -0
  335. package/dist/esm/client/index.js.map +1 -0
  336. package/dist/esm/client/middleware.d.ts +169 -0
  337. package/dist/esm/client/middleware.d.ts.map +1 -0
  338. package/dist/esm/client/middleware.js +245 -0
  339. package/dist/esm/client/middleware.js.map +1 -0
  340. package/dist/esm/client/sse.d.ts +80 -0
  341. package/dist/esm/client/sse.d.ts.map +1 -0
  342. package/dist/esm/client/sse.js +206 -0
  343. package/dist/esm/client/sse.js.map +1 -0
  344. package/dist/esm/client/stdio.d.ts +78 -0
  345. package/dist/esm/client/stdio.d.ts.map +1 -0
  346. package/dist/esm/client/stdio.js +176 -0
  347. package/dist/esm/client/stdio.js.map +1 -0
  348. package/dist/esm/client/streamableHttp.d.ts +158 -0
  349. package/dist/esm/client/streamableHttp.d.ts.map +1 -0
  350. package/dist/esm/client/streamableHttp.js +401 -0
  351. package/dist/esm/client/streamableHttp.js.map +1 -0
  352. package/dist/esm/client/websocket.d.ts +17 -0
  353. package/dist/esm/client/websocket.d.ts.map +1 -0
  354. package/dist/esm/client/websocket.js +59 -0
  355. package/dist/esm/client/websocket.js.map +1 -0
  356. package/dist/esm/examples/client/multipleClientsParallel.d.ts +2 -0
  357. package/dist/esm/examples/client/multipleClientsParallel.d.ts.map +1 -0
  358. package/dist/esm/examples/client/multipleClientsParallel.js +132 -0
  359. package/dist/esm/examples/client/multipleClientsParallel.js.map +1 -0
  360. package/dist/esm/examples/client/parallelToolCallsClient.d.ts +2 -0
  361. package/dist/esm/examples/client/parallelToolCallsClient.d.ts.map +1 -0
  362. package/dist/esm/examples/client/parallelToolCallsClient.js +174 -0
  363. package/dist/esm/examples/client/parallelToolCallsClient.js.map +1 -0
  364. package/dist/esm/examples/client/simpleOAuthClient.d.ts +3 -0
  365. package/dist/esm/examples/client/simpleOAuthClient.d.ts.map +1 -0
  366. package/dist/esm/examples/client/simpleOAuthClient.js +374 -0
  367. package/dist/esm/examples/client/simpleOAuthClient.js.map +1 -0
  368. package/dist/esm/examples/client/simpleStreamableHttp.d.ts +2 -0
  369. package/dist/esm/examples/client/simpleStreamableHttp.d.ts.map +1 -0
  370. package/dist/esm/examples/client/simpleStreamableHttp.js +742 -0
  371. package/dist/esm/examples/client/simpleStreamableHttp.js.map +1 -0
  372. package/dist/esm/examples/client/streamableHttpWithSseFallbackClient.d.ts +2 -0
  373. package/dist/esm/examples/client/streamableHttpWithSseFallbackClient.d.ts.map +1 -0
  374. package/dist/esm/examples/client/streamableHttpWithSseFallbackClient.js +166 -0
  375. package/dist/esm/examples/client/streamableHttpWithSseFallbackClient.js.map +1 -0
  376. package/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts +78 -0
  377. package/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -0
  378. package/dist/esm/examples/server/demoInMemoryOAuthProvider.js +180 -0
  379. package/dist/esm/examples/server/demoInMemoryOAuthProvider.js.map +1 -0
  380. package/dist/esm/examples/server/elicitationExample.d.ts +2 -0
  381. package/dist/esm/examples/server/elicitationExample.d.ts.map +1 -0
  382. package/dist/esm/examples/server/elicitationExample.js +430 -0
  383. package/dist/esm/examples/server/elicitationExample.js.map +1 -0
  384. package/dist/esm/examples/server/jsonResponseStreamableHttp.d.ts +2 -0
  385. package/dist/esm/examples/server/jsonResponseStreamableHttp.d.ts.map +1 -0
  386. package/dist/esm/examples/server/jsonResponseStreamableHttp.js +147 -0
  387. package/dist/esm/examples/server/jsonResponseStreamableHttp.js.map +1 -0
  388. package/dist/esm/examples/server/mcpServerOutputSchema.d.ts +7 -0
  389. package/dist/esm/examples/server/mcpServerOutputSchema.d.ts.map +1 -0
  390. package/dist/esm/examples/server/mcpServerOutputSchema.js +70 -0
  391. package/dist/esm/examples/server/mcpServerOutputSchema.js.map +1 -0
  392. package/dist/esm/examples/server/simpleSseServer.d.ts +2 -0
  393. package/dist/esm/examples/server/simpleSseServer.d.ts.map +1 -0
  394. package/dist/esm/examples/server/simpleSseServer.js +141 -0
  395. package/dist/esm/examples/server/simpleSseServer.js.map +1 -0
  396. package/dist/esm/examples/server/simpleStatelessStreamableHttp.d.ts +2 -0
  397. package/dist/esm/examples/server/simpleStatelessStreamableHttp.d.ts.map +1 -0
  398. package/dist/esm/examples/server/simpleStatelessStreamableHttp.js +142 -0
  399. package/dist/esm/examples/server/simpleStatelessStreamableHttp.js.map +1 -0
  400. package/dist/esm/examples/server/simpleStreamableHttp.d.ts +2 -0
  401. package/dist/esm/examples/server/simpleStreamableHttp.d.ts.map +1 -0
  402. package/dist/esm/examples/server/simpleStreamableHttp.js +582 -0
  403. package/dist/esm/examples/server/simpleStreamableHttp.js.map +1 -0
  404. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.d.ts +2 -0
  405. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.d.ts.map +1 -0
  406. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js +235 -0
  407. package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -0
  408. package/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.d.ts +2 -0
  409. package/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.d.ts.map +1 -0
  410. package/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js +111 -0
  411. package/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -0
  412. package/dist/esm/examples/server/toolWithSampleServer.d.ts +2 -0
  413. package/dist/esm/examples/server/toolWithSampleServer.d.ts.map +1 -0
  414. package/dist/esm/examples/server/toolWithSampleServer.js +47 -0
  415. package/dist/esm/examples/server/toolWithSampleServer.js.map +1 -0
  416. package/dist/esm/examples/shared/inMemoryEventStore.d.ts +31 -0
  417. package/dist/esm/examples/shared/inMemoryEventStore.d.ts.map +1 -0
  418. package/dist/esm/examples/shared/inMemoryEventStore.js +65 -0
  419. package/dist/esm/examples/shared/inMemoryEventStore.js.map +1 -0
  420. package/dist/esm/inMemory.d.ts +31 -0
  421. package/dist/esm/inMemory.d.ts.map +1 -0
  422. package/dist/esm/inMemory.js +49 -0
  423. package/dist/esm/inMemory.js.map +1 -0
  424. package/dist/esm/index.d.ts +3 -0
  425. package/dist/esm/index.d.ts.map +1 -0
  426. package/dist/esm/index.js +83 -0
  427. package/dist/esm/index.js.map +1 -0
  428. package/dist/esm/mcp/completable.d.ts +24 -0
  429. package/dist/esm/mcp/completable.d.ts.map +1 -0
  430. package/dist/esm/mcp/completable.js +60 -0
  431. package/dist/esm/mcp/completable.js.map +1 -0
  432. package/dist/esm/mcp/index.d.ts +124 -0
  433. package/dist/esm/mcp/index.d.ts.map +1 -0
  434. package/dist/esm/mcp/index.js +255 -0
  435. package/dist/esm/mcp/index.js.map +1 -0
  436. package/dist/esm/mcp/mcp.d.ts +331 -0
  437. package/dist/esm/mcp/mcp.d.ts.map +1 -0
  438. package/dist/esm/mcp/mcp.js +701 -0
  439. package/dist/esm/mcp/mcp.js.map +1 -0
  440. package/dist/esm/mcp/shared/metadataUtils.d.ts +16 -0
  441. package/dist/esm/mcp/shared/metadataUtils.d.ts.map +1 -0
  442. package/dist/esm/mcp/shared/metadataUtils.js +23 -0
  443. package/dist/esm/mcp/shared/metadataUtils.js.map +1 -0
  444. package/dist/esm/mcp/shared/protocol.d.ts +231 -0
  445. package/dist/esm/mcp/shared/protocol.d.ts.map +1 -0
  446. package/dist/esm/mcp/shared/protocol.js +423 -0
  447. package/dist/esm/mcp/shared/protocol.js.map +1 -0
  448. package/dist/esm/mcp/shared/stdio.d.ts +13 -0
  449. package/dist/esm/mcp/shared/stdio.d.ts.map +1 -0
  450. package/dist/esm/mcp/shared/stdio.js +31 -0
  451. package/dist/esm/mcp/shared/stdio.js.map +1 -0
  452. package/dist/esm/mcp/shared/toolNameValidation.d.ts +31 -0
  453. package/dist/esm/mcp/shared/toolNameValidation.d.ts.map +1 -0
  454. package/dist/esm/mcp/shared/toolNameValidation.js +92 -0
  455. package/dist/esm/mcp/shared/toolNameValidation.js.map +1 -0
  456. package/dist/esm/mcp/shared/transport.d.ts +75 -0
  457. package/dist/esm/mcp/shared/transport.d.ts.map +1 -0
  458. package/dist/esm/mcp/shared/transport.js +2 -0
  459. package/dist/esm/mcp/shared/transport.js.map +1 -0
  460. package/dist/esm/mcp/shared/uriTemplate.d.ts +25 -0
  461. package/dist/esm/mcp/shared/uriTemplate.d.ts.map +1 -0
  462. package/dist/esm/mcp/shared/uriTemplate.js +239 -0
  463. package/dist/esm/mcp/shared/uriTemplate.js.map +1 -0
  464. package/dist/esm/mcp/stdio.d.ts +28 -0
  465. package/dist/esm/mcp/stdio.d.ts.map +1 -0
  466. package/dist/esm/mcp/stdio.js +78 -0
  467. package/dist/esm/mcp/stdio.js.map +1 -0
  468. package/dist/esm/mcp/validation/ajv-provider.d.ts +53 -0
  469. package/dist/esm/mcp/validation/ajv-provider.d.ts.map +1 -0
  470. package/dist/esm/mcp/validation/ajv-provider.js +88 -0
  471. package/dist/esm/mcp/validation/ajv-provider.js.map +1 -0
  472. package/dist/esm/mcp/validation/index.d.ts +29 -0
  473. package/dist/esm/mcp/validation/index.d.ts.map +1 -0
  474. package/dist/esm/mcp/validation/index.js +29 -0
  475. package/dist/esm/mcp/validation/index.js.map +1 -0
  476. package/dist/esm/mcp/validation/types.d.ts +55 -0
  477. package/dist/esm/mcp/validation/types.d.ts.map +1 -0
  478. package/dist/esm/mcp/validation/types.js +2 -0
  479. package/dist/esm/mcp/validation/types.js.map +1 -0
  480. package/dist/esm/package.json +1 -0
  481. package/dist/esm/server/auth/clients.d.ts +19 -0
  482. package/dist/esm/server/auth/clients.d.ts.map +1 -0
  483. package/dist/esm/server/auth/clients.js +2 -0
  484. package/dist/esm/server/auth/clients.js.map +1 -0
  485. package/dist/esm/server/auth/errors.d.ts +141 -0
  486. package/dist/esm/server/auth/errors.d.ts.map +1 -0
  487. package/dist/esm/server/auth/errors.js +172 -0
  488. package/dist/esm/server/auth/errors.js.map +1 -0
  489. package/dist/esm/server/auth/handlers/authorize.d.ts +13 -0
  490. package/dist/esm/server/auth/handlers/authorize.d.ts.map +1 -0
  491. package/dist/esm/server/auth/handlers/authorize.js +138 -0
  492. package/dist/esm/server/auth/handlers/authorize.js.map +1 -0
  493. package/dist/esm/server/auth/handlers/metadata.d.ts +4 -0
  494. package/dist/esm/server/auth/handlers/metadata.d.ts.map +1 -0
  495. package/dist/esm/server/auth/handlers/metadata.js +15 -0
  496. package/dist/esm/server/auth/handlers/metadata.js.map +1 -0
  497. package/dist/esm/server/auth/handlers/register.d.ts +29 -0
  498. package/dist/esm/server/auth/handlers/register.d.ts.map +1 -0
  499. package/dist/esm/server/auth/handlers/register.js +71 -0
  500. package/dist/esm/server/auth/handlers/register.js.map +1 -0
  501. package/dist/esm/server/auth/handlers/revoke.d.ts +13 -0
  502. package/dist/esm/server/auth/handlers/revoke.d.ts.map +1 -0
  503. package/dist/esm/server/auth/handlers/revoke.js +59 -0
  504. package/dist/esm/server/auth/handlers/revoke.js.map +1 -0
  505. package/dist/esm/server/auth/handlers/token.d.ts +13 -0
  506. package/dist/esm/server/auth/handlers/token.d.ts.map +1 -0
  507. package/dist/esm/server/auth/handlers/token.js +107 -0
  508. package/dist/esm/server/auth/handlers/token.js.map +1 -0
  509. package/dist/esm/server/auth/middleware/allowedMethods.d.ts +9 -0
  510. package/dist/esm/server/auth/middleware/allowedMethods.d.ts.map +1 -0
  511. package/dist/esm/server/auth/middleware/allowedMethods.js +18 -0
  512. package/dist/esm/server/auth/middleware/allowedMethods.js.map +1 -0
  513. package/dist/esm/server/auth/middleware/bearerAuth.d.ts +35 -0
  514. package/dist/esm/server/auth/middleware/bearerAuth.d.ts.map +1 -0
  515. package/dist/esm/server/auth/middleware/bearerAuth.js +67 -0
  516. package/dist/esm/server/auth/middleware/bearerAuth.js.map +1 -0
  517. package/dist/esm/server/auth/middleware/clientAuth.d.ts +19 -0
  518. package/dist/esm/server/auth/middleware/clientAuth.d.ts.map +1 -0
  519. package/dist/esm/server/auth/middleware/clientAuth.js +49 -0
  520. package/dist/esm/server/auth/middleware/clientAuth.js.map +1 -0
  521. package/dist/esm/server/auth/provider.d.ts +68 -0
  522. package/dist/esm/server/auth/provider.d.ts.map +1 -0
  523. package/dist/esm/server/auth/provider.js +2 -0
  524. package/dist/esm/server/auth/provider.js.map +1 -0
  525. package/dist/esm/server/auth/providers/proxyProvider.d.ts +49 -0
  526. package/dist/esm/server/auth/providers/proxyProvider.d.ts.map +1 -0
  527. package/dist/esm/server/auth/providers/proxyProvider.js +157 -0
  528. package/dist/esm/server/auth/providers/proxyProvider.js.map +1 -0
  529. package/dist/esm/server/auth/router.d.ts +101 -0
  530. package/dist/esm/server/auth/router.d.ts.map +1 -0
  531. package/dist/esm/server/auth/router.js +115 -0
  532. package/dist/esm/server/auth/router.js.map +1 -0
  533. package/dist/esm/server/auth/types.d.ts +32 -0
  534. package/dist/esm/server/auth/types.d.ts.map +1 -0
  535. package/dist/esm/server/auth/types.js +2 -0
  536. package/dist/esm/server/auth/types.js.map +1 -0
  537. package/dist/esm/server/completable.d.ts +24 -0
  538. package/dist/esm/server/completable.d.ts.map +1 -0
  539. package/dist/esm/server/completable.js +60 -0
  540. package/dist/esm/server/completable.js.map +1 -0
  541. package/dist/esm/server/index.d.ts +191 -0
  542. package/dist/esm/server/index.d.ts.map +1 -0
  543. package/dist/esm/server/index.js +255 -0
  544. package/dist/esm/server/index.js.map +1 -0
  545. package/dist/esm/server/mcp.d.ts +331 -0
  546. package/dist/esm/server/mcp.d.ts.map +1 -0
  547. package/dist/esm/server/mcp.js +701 -0
  548. package/dist/esm/server/mcp.js.map +1 -0
  549. package/dist/esm/server/sse.d.ts +76 -0
  550. package/dist/esm/server/sse.d.ts.map +1 -0
  551. package/dist/esm/server/sse.js +161 -0
  552. package/dist/esm/server/sse.js.map +1 -0
  553. package/dist/esm/server/stdio.d.ts +28 -0
  554. package/dist/esm/server/stdio.d.ts.map +1 -0
  555. package/dist/esm/server/stdio.js +78 -0
  556. package/dist/esm/server/stdio.js.map +1 -0
  557. package/dist/esm/server/streamableHttp.d.ts +185 -0
  558. package/dist/esm/server/streamableHttp.d.ts.map +1 -0
  559. package/dist/esm/server/streamableHttp.js +624 -0
  560. package/dist/esm/server/streamableHttp.js.map +1 -0
  561. package/dist/esm/server.d.ts +3 -0
  562. package/dist/esm/server.d.ts.map +1 -0
  563. package/dist/esm/server.js +4 -0
  564. package/dist/esm/server.js.map +1 -0
  565. package/dist/esm/services/x32-connection.d.ts +87 -0
  566. package/dist/esm/services/x32-connection.d.ts.map +1 -0
  567. package/dist/esm/services/x32-connection.js +280 -0
  568. package/dist/esm/services/x32-connection.js.map +1 -0
  569. package/dist/esm/shared/auth-utils.d.ts +23 -0
  570. package/dist/esm/shared/auth-utils.d.ts.map +1 -0
  571. package/dist/esm/shared/auth-utils.js +44 -0
  572. package/dist/esm/shared/auth-utils.js.map +1 -0
  573. package/dist/esm/shared/auth.d.ts +626 -0
  574. package/dist/esm/shared/auth.d.ts.map +1 -0
  575. package/dist/esm/shared/auth.js +200 -0
  576. package/dist/esm/shared/auth.js.map +1 -0
  577. package/dist/esm/shared/metadataUtils.d.ts +16 -0
  578. package/dist/esm/shared/metadataUtils.d.ts.map +1 -0
  579. package/dist/esm/shared/metadataUtils.js +23 -0
  580. package/dist/esm/shared/metadataUtils.js.map +1 -0
  581. package/dist/esm/shared/protocol.d.ts +230 -0
  582. package/dist/esm/shared/protocol.d.ts.map +1 -0
  583. package/dist/esm/shared/protocol.js +423 -0
  584. package/dist/esm/shared/protocol.js.map +1 -0
  585. package/dist/esm/shared/stdio.d.ts +13 -0
  586. package/dist/esm/shared/stdio.d.ts.map +1 -0
  587. package/dist/esm/shared/stdio.js +31 -0
  588. package/dist/esm/shared/stdio.js.map +1 -0
  589. package/dist/esm/shared/toolNameValidation.d.ts +31 -0
  590. package/dist/esm/shared/toolNameValidation.d.ts.map +1 -0
  591. package/dist/esm/shared/toolNameValidation.js +92 -0
  592. package/dist/esm/shared/toolNameValidation.js.map +1 -0
  593. package/dist/esm/shared/transport.d.ts +75 -0
  594. package/dist/esm/shared/transport.d.ts.map +1 -0
  595. package/dist/esm/shared/transport.js +2 -0
  596. package/dist/esm/shared/transport.js.map +1 -0
  597. package/dist/esm/shared/uriTemplate.d.ts +25 -0
  598. package/dist/esm/shared/uriTemplate.d.ts.map +1 -0
  599. package/dist/esm/shared/uriTemplate.js +239 -0
  600. package/dist/esm/shared/uriTemplate.js.map +1 -0
  601. package/dist/esm/spec.types.d.ts +1429 -0
  602. package/dist/esm/spec.types.d.ts.map +1 -0
  603. package/dist/esm/spec.types.js +17 -0
  604. package/dist/esm/spec.types.js.map +1 -0
  605. package/dist/esm/src/index.d.ts +3 -0
  606. package/dist/esm/src/index.d.ts.map +1 -0
  607. package/dist/esm/src/index.js +68 -0
  608. package/dist/esm/src/index.js.map +1 -0
  609. package/dist/esm/src/mcp/completable.d.ts +24 -0
  610. package/dist/esm/src/mcp/completable.d.ts.map +1 -0
  611. package/dist/esm/src/mcp/completable.js +60 -0
  612. package/dist/esm/src/mcp/completable.js.map +1 -0
  613. package/dist/esm/src/mcp/index.d.ts +124 -0
  614. package/dist/esm/src/mcp/index.d.ts.map +1 -0
  615. package/dist/esm/src/mcp/index.js +255 -0
  616. package/dist/esm/src/mcp/index.js.map +1 -0
  617. package/dist/esm/src/mcp/mcp.d.ts +331 -0
  618. package/dist/esm/src/mcp/mcp.d.ts.map +1 -0
  619. package/dist/esm/src/mcp/mcp.js +701 -0
  620. package/dist/esm/src/mcp/mcp.js.map +1 -0
  621. package/dist/esm/src/mcp/shared/metadataUtils.d.ts +16 -0
  622. package/dist/esm/src/mcp/shared/metadataUtils.d.ts.map +1 -0
  623. package/dist/esm/src/mcp/shared/metadataUtils.js +23 -0
  624. package/dist/esm/src/mcp/shared/metadataUtils.js.map +1 -0
  625. package/dist/esm/src/mcp/shared/protocol.d.ts +231 -0
  626. package/dist/esm/src/mcp/shared/protocol.d.ts.map +1 -0
  627. package/dist/esm/src/mcp/shared/protocol.js +423 -0
  628. package/dist/esm/src/mcp/shared/protocol.js.map +1 -0
  629. package/dist/esm/src/mcp/shared/stdio.d.ts +13 -0
  630. package/dist/esm/src/mcp/shared/stdio.d.ts.map +1 -0
  631. package/dist/esm/src/mcp/shared/stdio.js +31 -0
  632. package/dist/esm/src/mcp/shared/stdio.js.map +1 -0
  633. package/dist/esm/src/mcp/shared/toolNameValidation.d.ts +31 -0
  634. package/dist/esm/src/mcp/shared/toolNameValidation.d.ts.map +1 -0
  635. package/dist/esm/src/mcp/shared/toolNameValidation.js +92 -0
  636. package/dist/esm/src/mcp/shared/toolNameValidation.js.map +1 -0
  637. package/dist/esm/src/mcp/shared/transport.d.ts +75 -0
  638. package/dist/esm/src/mcp/shared/transport.d.ts.map +1 -0
  639. package/dist/esm/src/mcp/shared/transport.js +2 -0
  640. package/dist/esm/src/mcp/shared/transport.js.map +1 -0
  641. package/dist/esm/src/mcp/shared/uriTemplate.d.ts +25 -0
  642. package/dist/esm/src/mcp/shared/uriTemplate.d.ts.map +1 -0
  643. package/dist/esm/src/mcp/shared/uriTemplate.js +239 -0
  644. package/dist/esm/src/mcp/shared/uriTemplate.js.map +1 -0
  645. package/dist/esm/src/mcp/stdio.d.ts +28 -0
  646. package/dist/esm/src/mcp/stdio.d.ts.map +1 -0
  647. package/dist/esm/src/mcp/stdio.js +78 -0
  648. package/dist/esm/src/mcp/stdio.js.map +1 -0
  649. package/dist/esm/src/mcp/validation/ajv-provider.d.ts +53 -0
  650. package/dist/esm/src/mcp/validation/ajv-provider.d.ts.map +1 -0
  651. package/dist/esm/src/mcp/validation/ajv-provider.js +88 -0
  652. package/dist/esm/src/mcp/validation/ajv-provider.js.map +1 -0
  653. package/dist/esm/src/mcp/validation/index.d.ts +29 -0
  654. package/dist/esm/src/mcp/validation/index.d.ts.map +1 -0
  655. package/dist/esm/src/mcp/validation/index.js +29 -0
  656. package/dist/esm/src/mcp/validation/index.js.map +1 -0
  657. package/dist/esm/src/mcp/validation/types.d.ts +55 -0
  658. package/dist/esm/src/mcp/validation/types.d.ts.map +1 -0
  659. package/dist/esm/src/mcp/validation/types.js +2 -0
  660. package/dist/esm/src/mcp/validation/types.js.map +1 -0
  661. package/dist/esm/src/server.d.ts +3 -0
  662. package/dist/esm/src/server.d.ts.map +1 -0
  663. package/dist/esm/src/server.js +4 -0
  664. package/dist/esm/src/server.js.map +1 -0
  665. package/dist/esm/src/services/x32-connection.d.ts +87 -0
  666. package/dist/esm/src/services/x32-connection.d.ts.map +1 -0
  667. package/dist/esm/src/services/x32-connection.js +279 -0
  668. package/dist/esm/src/services/x32-connection.js.map +1 -0
  669. package/dist/esm/src/tools/channel.d.ts +7 -0
  670. package/dist/esm/src/tools/channel.d.ts.map +1 -0
  671. package/dist/esm/src/tools/channel.js +441 -0
  672. package/dist/esm/src/tools/channel.js.map +1 -0
  673. package/dist/esm/src/tools/connection.d.ts +7 -0
  674. package/dist/esm/src/tools/connection.d.ts.map +1 -0
  675. package/dist/esm/src/tools/connection.js +227 -0
  676. package/dist/esm/src/tools/connection.js.map +1 -0
  677. package/dist/esm/src/tools/index.d.ts +8 -0
  678. package/dist/esm/src/tools/index.d.ts.map +1 -0
  679. package/dist/esm/src/tools/index.js +8 -0
  680. package/dist/esm/src/tools/index.js.map +1 -0
  681. package/dist/esm/src/tools/parameter.d.ts +7 -0
  682. package/dist/esm/src/tools/parameter.d.ts.map +1 -0
  683. package/dist/esm/src/tools/parameter.js +120 -0
  684. package/dist/esm/src/tools/parameter.js.map +1 -0
  685. package/dist/esm/src/types/index.d.ts +4 -0
  686. package/dist/esm/src/types/index.d.ts.map +1 -0
  687. package/dist/esm/src/types/index.js +4 -0
  688. package/dist/esm/src/types/index.js.map +1 -0
  689. package/dist/esm/src/types/osc.d.ts +35 -0
  690. package/dist/esm/src/types/osc.d.ts.map +1 -0
  691. package/dist/esm/src/types/osc.js +6 -0
  692. package/dist/esm/src/types/osc.js.map +1 -0
  693. package/dist/esm/src/types/x32.d.ts +94 -0
  694. package/dist/esm/src/types/x32.d.ts.map +1 -0
  695. package/dist/esm/src/types/x32.js +2 -0
  696. package/dist/esm/src/types/x32.js.map +1 -0
  697. package/dist/esm/tools/channel.d.ts +7 -0
  698. package/dist/esm/tools/channel.d.ts.map +1 -0
  699. package/dist/esm/tools/channel.js +533 -0
  700. package/dist/esm/tools/channel.js.map +1 -0
  701. package/dist/esm/tools/channel.tool.d.ts +8 -0
  702. package/dist/esm/tools/channel.tool.d.ts.map +1 -0
  703. package/dist/esm/tools/channel.tool.js +79 -0
  704. package/dist/esm/tools/channel.tool.js.map +1 -0
  705. package/dist/esm/tools/connect.tool.d.ts +8 -0
  706. package/dist/esm/tools/connect.tool.d.ts.map +1 -0
  707. package/dist/esm/tools/connect.tool.js +51 -0
  708. package/dist/esm/tools/connect.tool.js.map +1 -0
  709. package/dist/esm/tools/connection.d.ts +7 -0
  710. package/dist/esm/tools/connection.d.ts.map +1 -0
  711. package/dist/esm/tools/connection.js +227 -0
  712. package/dist/esm/tools/connection.js.map +1 -0
  713. package/dist/esm/tools/get-parameter.tool.d.ts +8 -0
  714. package/dist/esm/tools/get-parameter.tool.d.ts.map +1 -0
  715. package/dist/esm/tools/get-parameter.tool.js +51 -0
  716. package/dist/esm/tools/get-parameter.tool.js.map +1 -0
  717. package/dist/esm/tools/index.d.ts +8 -0
  718. package/dist/esm/tools/index.d.ts.map +1 -0
  719. package/dist/esm/tools/index.js +8 -0
  720. package/dist/esm/tools/index.js.map +1 -0
  721. package/dist/esm/tools/info.tool.d.ts +8 -0
  722. package/dist/esm/tools/info.tool.d.ts.map +1 -0
  723. package/dist/esm/tools/info.tool.js +54 -0
  724. package/dist/esm/tools/info.tool.js.map +1 -0
  725. package/dist/esm/tools/parameter.d.ts +7 -0
  726. package/dist/esm/tools/parameter.d.ts.map +1 -0
  727. package/dist/esm/tools/parameter.js +126 -0
  728. package/dist/esm/tools/parameter.js.map +1 -0
  729. package/dist/esm/tools/set-parameter.tool.d.ts +8 -0
  730. package/dist/esm/tools/set-parameter.tool.d.ts.map +1 -0
  731. package/dist/esm/tools/set-parameter.tool.js +52 -0
  732. package/dist/esm/tools/set-parameter.tool.js.map +1 -0
  733. package/dist/esm/tools/status.tool.d.ts +8 -0
  734. package/dist/esm/tools/status.tool.d.ts.map +1 -0
  735. package/dist/esm/tools/status.tool.js +49 -0
  736. package/dist/esm/tools/status.tool.js.map +1 -0
  737. package/dist/esm/types/index.d.ts +4 -0
  738. package/dist/esm/types/index.d.ts.map +1 -0
  739. package/dist/esm/types/index.js +4 -0
  740. package/dist/esm/types/index.js.map +1 -0
  741. package/dist/esm/types/osc.d.ts +36 -0
  742. package/dist/esm/types/osc.d.ts.map +1 -0
  743. package/dist/esm/types/osc.js +6 -0
  744. package/dist/esm/types/osc.js.map +1 -0
  745. package/dist/esm/types/x32.d.ts +94 -0
  746. package/dist/esm/types/x32.d.ts.map +1 -0
  747. package/dist/esm/types/x32.js +2 -0
  748. package/dist/esm/types/x32.js.map +1 -0
  749. package/dist/esm/types.d.ts +24615 -0
  750. package/dist/esm/types.d.ts.map +1 -0
  751. package/dist/esm/types.js +1420 -0
  752. package/dist/esm/types.js.map +1 -0
  753. package/dist/esm/utils/color-converter.d.ts +54 -0
  754. package/dist/esm/utils/color-converter.d.ts.map +1 -0
  755. package/dist/esm/utils/color-converter.js +79 -0
  756. package/dist/esm/utils/color-converter.js.map +1 -0
  757. package/dist/esm/utils/db-converter.d.ts +58 -0
  758. package/dist/esm/utils/db-converter.d.ts.map +1 -0
  759. package/dist/esm/utils/db-converter.js +143 -0
  760. package/dist/esm/utils/db-converter.js.map +1 -0
  761. package/dist/esm/utils/pan-converter.d.ts +56 -0
  762. package/dist/esm/utils/pan-converter.d.ts.map +1 -0
  763. package/dist/esm/utils/pan-converter.js +127 -0
  764. package/dist/esm/utils/pan-converter.js.map +1 -0
  765. package/dist/esm/validation/ajv-provider.d.ts +53 -0
  766. package/dist/esm/validation/ajv-provider.d.ts.map +1 -0
  767. package/dist/esm/validation/ajv-provider.js +88 -0
  768. package/dist/esm/validation/ajv-provider.js.map +1 -0
  769. package/dist/esm/validation/cfworker-provider.d.ts +52 -0
  770. package/dist/esm/validation/cfworker-provider.d.ts.map +1 -0
  771. package/dist/esm/validation/cfworker-provider.js +67 -0
  772. package/dist/esm/validation/cfworker-provider.js.map +1 -0
  773. package/dist/esm/validation/index.d.ts +29 -0
  774. package/dist/esm/validation/index.d.ts.map +1 -0
  775. package/dist/esm/validation/index.js +29 -0
  776. package/dist/esm/validation/index.js.map +1 -0
  777. package/dist/esm/validation/types.d.ts +55 -0
  778. package/dist/esm/validation/types.d.ts.map +1 -0
  779. package/dist/esm/validation/types.js +2 -0
  780. package/dist/esm/validation/types.js.map +1 -0
  781. package/dist/esm/x32-server/index.d.ts +3 -0
  782. package/dist/esm/x32-server/index.d.ts.map +1 -0
  783. package/dist/esm/x32-server/index.js +71 -0
  784. package/dist/esm/x32-server/index.js.map +1 -0
  785. package/dist/esm/x32-server/tools/channel.tool.d.ts +8 -0
  786. package/dist/esm/x32-server/tools/channel.tool.d.ts.map +1 -0
  787. package/dist/esm/x32-server/tools/channel.tool.js +79 -0
  788. package/dist/esm/x32-server/tools/channel.tool.js.map +1 -0
  789. package/dist/esm/x32-server/tools/connect.tool.d.ts +8 -0
  790. package/dist/esm/x32-server/tools/connect.tool.d.ts.map +1 -0
  791. package/dist/esm/x32-server/tools/connect.tool.js +51 -0
  792. package/dist/esm/x32-server/tools/connect.tool.js.map +1 -0
  793. package/dist/esm/x32-server/tools/get-parameter.tool.d.ts +8 -0
  794. package/dist/esm/x32-server/tools/get-parameter.tool.d.ts.map +1 -0
  795. package/dist/esm/x32-server/tools/get-parameter.tool.js +51 -0
  796. package/dist/esm/x32-server/tools/get-parameter.tool.js.map +1 -0
  797. package/dist/esm/x32-server/tools/index.d.ts +11 -0
  798. package/dist/esm/x32-server/tools/index.d.ts.map +1 -0
  799. package/dist/esm/x32-server/tools/index.js +11 -0
  800. package/dist/esm/x32-server/tools/index.js.map +1 -0
  801. package/dist/esm/x32-server/tools/info.tool.d.ts +8 -0
  802. package/dist/esm/x32-server/tools/info.tool.d.ts.map +1 -0
  803. package/dist/esm/x32-server/tools/info.tool.js +54 -0
  804. package/dist/esm/x32-server/tools/info.tool.js.map +1 -0
  805. package/dist/esm/x32-server/tools/set-parameter.tool.d.ts +8 -0
  806. package/dist/esm/x32-server/tools/set-parameter.tool.d.ts.map +1 -0
  807. package/dist/esm/x32-server/tools/set-parameter.tool.js +52 -0
  808. package/dist/esm/x32-server/tools/set-parameter.tool.js.map +1 -0
  809. package/dist/esm/x32-server/tools/status.tool.d.ts +8 -0
  810. package/dist/esm/x32-server/tools/status.tool.d.ts.map +1 -0
  811. package/dist/esm/x32-server/tools/status.tool.js +49 -0
  812. package/dist/esm/x32-server/tools/status.tool.js.map +1 -0
  813. package/dist/esm/x32-server/types.d.ts +94 -0
  814. package/dist/esm/x32-server/types.d.ts.map +1 -0
  815. package/dist/esm/x32-server/types.js +2 -0
  816. package/dist/esm/x32-server/types.js.map +1 -0
  817. package/dist/esm/x32-server/x32-connection.d.ts +87 -0
  818. package/dist/esm/x32-server/x32-connection.d.ts.map +1 -0
  819. package/dist/esm/x32-server/x32-connection.js +270 -0
  820. package/dist/esm/x32-server/x32-connection.js.map +1 -0
  821. package/dist/index.d.ts +3 -0
  822. package/dist/index.d.ts.map +1 -0
  823. package/dist/index.js +81 -0
  824. package/dist/index.js.map +1 -0
  825. package/dist/mcp/completable.d.ts +24 -0
  826. package/dist/mcp/completable.d.ts.map +1 -0
  827. package/dist/mcp/completable.js +59 -0
  828. package/dist/mcp/completable.js.map +1 -0
  829. package/dist/mcp/index.d.ts +124 -0
  830. package/dist/mcp/index.d.ts.map +1 -0
  831. package/dist/mcp/index.js +262 -0
  832. package/dist/mcp/index.js.map +1 -0
  833. package/dist/mcp/mcp.d.ts +331 -0
  834. package/dist/mcp/mcp.d.ts.map +1 -0
  835. package/dist/mcp/mcp.js +706 -0
  836. package/dist/mcp/mcp.js.map +1 -0
  837. package/dist/mcp/shared/metadataUtils.d.ts +16 -0
  838. package/dist/mcp/shared/metadataUtils.d.ts.map +1 -0
  839. package/dist/mcp/shared/metadataUtils.js +22 -0
  840. package/dist/mcp/shared/metadataUtils.js.map +1 -0
  841. package/dist/mcp/shared/protocol.d.ts +231 -0
  842. package/dist/mcp/shared/protocol.d.ts.map +1 -0
  843. package/dist/mcp/shared/protocol.js +436 -0
  844. package/dist/mcp/shared/protocol.js.map +1 -0
  845. package/dist/mcp/shared/stdio.d.ts +13 -0
  846. package/dist/mcp/shared/stdio.d.ts.map +1 -0
  847. package/dist/mcp/shared/stdio.js +32 -0
  848. package/dist/mcp/shared/stdio.js.map +1 -0
  849. package/dist/mcp/shared/toolNameValidation.d.ts +31 -0
  850. package/dist/mcp/shared/toolNameValidation.d.ts.map +1 -0
  851. package/dist/mcp/shared/toolNameValidation.js +92 -0
  852. package/dist/mcp/shared/toolNameValidation.js.map +1 -0
  853. package/dist/mcp/shared/transport.d.ts +75 -0
  854. package/dist/mcp/shared/transport.d.ts.map +1 -0
  855. package/dist/mcp/shared/transport.js +2 -0
  856. package/dist/mcp/shared/transport.js.map +1 -0
  857. package/dist/mcp/shared/uriTemplate.d.ts +25 -0
  858. package/dist/mcp/shared/uriTemplate.d.ts.map +1 -0
  859. package/dist/mcp/shared/uriTemplate.js +241 -0
  860. package/dist/mcp/shared/uriTemplate.js.map +1 -0
  861. package/dist/mcp/stdio.d.ts +28 -0
  862. package/dist/mcp/stdio.d.ts.map +1 -0
  863. package/dist/mcp/stdio.js +80 -0
  864. package/dist/mcp/stdio.js.map +1 -0
  865. package/dist/mcp/validation/ajv-provider.d.ts +53 -0
  866. package/dist/mcp/validation/ajv-provider.d.ts.map +1 -0
  867. package/dist/mcp/validation/ajv-provider.js +88 -0
  868. package/dist/mcp/validation/ajv-provider.js.map +1 -0
  869. package/dist/mcp/validation/index.d.ts +29 -0
  870. package/dist/mcp/validation/index.d.ts.map +1 -0
  871. package/dist/mcp/validation/index.js +29 -0
  872. package/dist/mcp/validation/index.js.map +1 -0
  873. package/dist/mcp/validation/types.d.ts +55 -0
  874. package/dist/mcp/validation/types.d.ts.map +1 -0
  875. package/dist/mcp/validation/types.js +2 -0
  876. package/dist/mcp/validation/types.js.map +1 -0
  877. package/dist/server.d.ts +3 -0
  878. package/dist/server.d.ts.map +1 -0
  879. package/dist/server.js +4 -0
  880. package/dist/server.js.map +1 -0
  881. package/dist/services/x32-connection.d.ts +87 -0
  882. package/dist/services/x32-connection.d.ts.map +1 -0
  883. package/dist/services/x32-connection.js +279 -0
  884. package/dist/services/x32-connection.js.map +1 -0
  885. package/dist/simple-server.d.ts +3 -0
  886. package/dist/simple-server.d.ts.map +1 -0
  887. package/dist/simple-server.js +243 -0
  888. package/dist/simple-server.js.map +1 -0
  889. package/dist/tools/channel.d.ts +7 -0
  890. package/dist/tools/channel.d.ts.map +1 -0
  891. package/dist/tools/channel.js +534 -0
  892. package/dist/tools/channel.js.map +1 -0
  893. package/dist/tools/connection.d.ts +7 -0
  894. package/dist/tools/connection.d.ts.map +1 -0
  895. package/dist/tools/connection.js +227 -0
  896. package/dist/tools/connection.js.map +1 -0
  897. package/dist/tools/index.d.ts +8 -0
  898. package/dist/tools/index.d.ts.map +1 -0
  899. package/dist/tools/index.js +8 -0
  900. package/dist/tools/index.js.map +1 -0
  901. package/dist/tools/parameter.d.ts +7 -0
  902. package/dist/tools/parameter.d.ts.map +1 -0
  903. package/dist/tools/parameter.js +120 -0
  904. package/dist/tools/parameter.js.map +1 -0
  905. package/dist/types/index.d.ts +4 -0
  906. package/dist/types/index.d.ts.map +1 -0
  907. package/dist/types/index.js +4 -0
  908. package/dist/types/index.js.map +1 -0
  909. package/dist/types/osc.d.ts +35 -0
  910. package/dist/types/osc.d.ts.map +1 -0
  911. package/dist/types/osc.js +6 -0
  912. package/dist/types/osc.js.map +1 -0
  913. package/dist/types/x32.d.ts +94 -0
  914. package/dist/types/x32.d.ts.map +1 -0
  915. package/dist/types/x32.js +2 -0
  916. package/dist/types/x32.js.map +1 -0
  917. package/dist/utils/color-converter.d.ts +54 -0
  918. package/dist/utils/color-converter.d.ts.map +1 -0
  919. package/dist/utils/color-converter.js +79 -0
  920. package/dist/utils/color-converter.js.map +1 -0
  921. package/dist/utils/db-converter.d.ts +58 -0
  922. package/dist/utils/db-converter.d.ts.map +1 -0
  923. package/dist/utils/db-converter.js +143 -0
  924. package/dist/utils/db-converter.js.map +1 -0
  925. package/dist/utils/pan-converter.d.ts +56 -0
  926. package/dist/utils/pan-converter.d.ts.map +1 -0
  927. package/dist/utils/pan-converter.js +127 -0
  928. package/dist/utils/pan-converter.js.map +1 -0
  929. package/package.json +145 -0
@@ -0,0 +1,1420 @@
1
+ import { z } from 'zod';
2
+ export const LATEST_PROTOCOL_VERSION = '2025-06-18';
3
+ export const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = '2025-03-26';
4
+ export const SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, '2025-03-26', '2024-11-05', '2024-10-07'];
5
+ /* JSON-RPC types */
6
+ export const JSONRPC_VERSION = '2.0';
7
+ /**
8
+ * Assert 'object' type schema.
9
+ *
10
+ * @internal
11
+ */
12
+ const AssertObjectSchema = z.custom((v) => v !== null && (typeof v === 'object' || typeof v === 'function'));
13
+ /**
14
+ * A progress token, used to associate progress notifications with the original request.
15
+ */
16
+ export const ProgressTokenSchema = z.union([z.string(), z.number().int()]);
17
+ /**
18
+ * An opaque token used to represent a cursor for pagination.
19
+ */
20
+ export const CursorSchema = z.string();
21
+ const RequestMetaSchema = z
22
+ .object({
23
+ /**
24
+ * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
25
+ */
26
+ progressToken: ProgressTokenSchema.optional()
27
+ })
28
+ /**
29
+ * Passthrough required here because we want to allow any additional fields to be added to the request meta.
30
+ */
31
+ .passthrough();
32
+ /**
33
+ * Common params for any request.
34
+ */
35
+ const BaseRequestParamsSchema = z.object({
36
+ /**
37
+ * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
38
+ */
39
+ _meta: RequestMetaSchema.optional()
40
+ });
41
+ export const RequestSchema = z.object({
42
+ method: z.string(),
43
+ params: BaseRequestParamsSchema.passthrough().optional()
44
+ });
45
+ const NotificationsParamsSchema = z.object({
46
+ /**
47
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
48
+ * for notes on _meta usage.
49
+ */
50
+ _meta: z.record(z.string(), z.unknown()).optional()
51
+ });
52
+ export const NotificationSchema = z.object({
53
+ method: z.string(),
54
+ params: NotificationsParamsSchema.passthrough().optional()
55
+ });
56
+ export const ResultSchema = z
57
+ .object({
58
+ /**
59
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
60
+ * for notes on _meta usage.
61
+ */
62
+ _meta: z.record(z.string(), z.unknown()).optional()
63
+ })
64
+ /**
65
+ * Passthrough required here because we want to allow any additional fields to be added to the result.
66
+ */
67
+ .passthrough();
68
+ /**
69
+ * A uniquely identifying ID for a request in JSON-RPC.
70
+ */
71
+ export const RequestIdSchema = z.union([z.string(), z.number().int()]);
72
+ /**
73
+ * A request that expects a response.
74
+ */
75
+ export const JSONRPCRequestSchema = z
76
+ .object({
77
+ jsonrpc: z.literal(JSONRPC_VERSION),
78
+ id: RequestIdSchema
79
+ })
80
+ .merge(RequestSchema)
81
+ .strict();
82
+ export const isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value).success;
83
+ /**
84
+ * A notification which does not expect a response.
85
+ */
86
+ export const JSONRPCNotificationSchema = z
87
+ .object({
88
+ jsonrpc: z.literal(JSONRPC_VERSION)
89
+ })
90
+ .merge(NotificationSchema)
91
+ .strict();
92
+ export const isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(value).success;
93
+ /**
94
+ * A successful (non-error) response to a request.
95
+ */
96
+ export const JSONRPCResponseSchema = z
97
+ .object({
98
+ jsonrpc: z.literal(JSONRPC_VERSION),
99
+ id: RequestIdSchema,
100
+ result: ResultSchema
101
+ })
102
+ .strict();
103
+ export const isJSONRPCResponse = (value) => JSONRPCResponseSchema.safeParse(value).success;
104
+ /**
105
+ * Error codes defined by the JSON-RPC specification.
106
+ */
107
+ export var ErrorCode;
108
+ (function (ErrorCode) {
109
+ // SDK error codes
110
+ ErrorCode[ErrorCode["ConnectionClosed"] = -32000] = "ConnectionClosed";
111
+ ErrorCode[ErrorCode["RequestTimeout"] = -32001] = "RequestTimeout";
112
+ // Standard JSON-RPC error codes
113
+ ErrorCode[ErrorCode["ParseError"] = -32700] = "ParseError";
114
+ ErrorCode[ErrorCode["InvalidRequest"] = -32600] = "InvalidRequest";
115
+ ErrorCode[ErrorCode["MethodNotFound"] = -32601] = "MethodNotFound";
116
+ ErrorCode[ErrorCode["InvalidParams"] = -32602] = "InvalidParams";
117
+ ErrorCode[ErrorCode["InternalError"] = -32603] = "InternalError";
118
+ })(ErrorCode || (ErrorCode = {}));
119
+ /**
120
+ * A response to a request that indicates an error occurred.
121
+ */
122
+ export const JSONRPCErrorSchema = z
123
+ .object({
124
+ jsonrpc: z.literal(JSONRPC_VERSION),
125
+ id: RequestIdSchema,
126
+ error: z.object({
127
+ /**
128
+ * The error type that occurred.
129
+ */
130
+ code: z.number().int(),
131
+ /**
132
+ * A short description of the error. The message SHOULD be limited to a concise single sentence.
133
+ */
134
+ message: z.string(),
135
+ /**
136
+ * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
137
+ */
138
+ data: z.optional(z.unknown())
139
+ })
140
+ })
141
+ .strict();
142
+ export const isJSONRPCError = (value) => JSONRPCErrorSchema.safeParse(value).success;
143
+ export const JSONRPCMessageSchema = z.union([JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResponseSchema, JSONRPCErrorSchema]);
144
+ /* Empty result */
145
+ /**
146
+ * A response that indicates success but carries no data.
147
+ */
148
+ export const EmptyResultSchema = ResultSchema.strict();
149
+ export const CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
150
+ /**
151
+ * The ID of the request to cancel.
152
+ *
153
+ * This MUST correspond to the ID of a request previously issued in the same direction.
154
+ */
155
+ requestId: RequestIdSchema,
156
+ /**
157
+ * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
158
+ */
159
+ reason: z.string().optional()
160
+ });
161
+ /* Cancellation */
162
+ /**
163
+ * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
164
+ *
165
+ * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.
166
+ *
167
+ * This notification indicates that the result will be unused, so any associated processing SHOULD cease.
168
+ *
169
+ * A client MUST NOT attempt to cancel its `initialize` request.
170
+ */
171
+ export const CancelledNotificationSchema = NotificationSchema.extend({
172
+ method: z.literal('notifications/cancelled'),
173
+ params: CancelledNotificationParamsSchema
174
+ });
175
+ /* Base Metadata */
176
+ /**
177
+ * Icon schema for use in tools, prompts, resources, and implementations.
178
+ */
179
+ export const IconSchema = z.object({
180
+ /**
181
+ * URL or data URI for the icon.
182
+ */
183
+ src: z.string(),
184
+ /**
185
+ * Optional MIME type for the icon.
186
+ */
187
+ mimeType: z.string().optional(),
188
+ /**
189
+ * Optional array of strings that specify sizes at which the icon can be used.
190
+ * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
191
+ *
192
+ * If not provided, the client should assume that the icon can be used at any size.
193
+ */
194
+ sizes: z.array(z.string()).optional()
195
+ });
196
+ /**
197
+ * Base schema to add `icons` property.
198
+ *
199
+ */
200
+ export const IconsSchema = z.object({
201
+ /**
202
+ * Optional set of sized icons that the client can display in a user interface.
203
+ *
204
+ * Clients that support rendering icons MUST support at least the following MIME types:
205
+ * - `image/png` - PNG images (safe, universal compatibility)
206
+ * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
207
+ *
208
+ * Clients that support rendering icons SHOULD also support:
209
+ * - `image/svg+xml` - SVG images (scalable but requires security precautions)
210
+ * - `image/webp` - WebP images (modern, efficient format)
211
+ */
212
+ icons: z.array(IconSchema).optional()
213
+ });
214
+ /**
215
+ * Base metadata interface for common properties across resources, tools, prompts, and implementations.
216
+ */
217
+ export const BaseMetadataSchema = z.object({
218
+ /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
219
+ name: z.string(),
220
+ /**
221
+ * Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
222
+ * even by those unfamiliar with domain-specific terminology.
223
+ *
224
+ * If not provided, the name should be used for display (except for Tool,
225
+ * where `annotations.title` should be given precedence over using `name`,
226
+ * if present).
227
+ */
228
+ title: z.string().optional()
229
+ });
230
+ /* Initialization */
231
+ /**
232
+ * Describes the name and version of an MCP implementation.
233
+ */
234
+ export const ImplementationSchema = BaseMetadataSchema.extend({
235
+ version: z.string(),
236
+ /**
237
+ * An optional URL of the website for this implementation.
238
+ */
239
+ websiteUrl: z.string().optional()
240
+ }).merge(IconsSchema);
241
+ /**
242
+ * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
243
+ */
244
+ export const ClientCapabilitiesSchema = z.object({
245
+ /**
246
+ * Experimental, non-standard capabilities that the client supports.
247
+ */
248
+ experimental: z.record(z.string(), AssertObjectSchema).optional(),
249
+ /**
250
+ * Present if the client supports sampling from an LLM.
251
+ */
252
+ sampling: AssertObjectSchema.optional(),
253
+ /**
254
+ * Present if the client supports eliciting user input.
255
+ */
256
+ elicitation: z.intersection(z
257
+ .object({
258
+ /**
259
+ * Whether the client should apply defaults to the user input.
260
+ */
261
+ applyDefaults: z.boolean().optional()
262
+ })
263
+ .optional(), z.record(z.string(), z.unknown()).optional()),
264
+ /**
265
+ * Present if the client supports listing roots.
266
+ */
267
+ roots: z
268
+ .object({
269
+ /**
270
+ * Whether the client supports issuing notifications for changes to the roots list.
271
+ */
272
+ listChanged: z.boolean().optional()
273
+ })
274
+ .optional()
275
+ });
276
+ export const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
277
+ /**
278
+ * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
279
+ */
280
+ protocolVersion: z.string(),
281
+ capabilities: ClientCapabilitiesSchema,
282
+ clientInfo: ImplementationSchema
283
+ });
284
+ /**
285
+ * This request is sent from the client to the server when it first connects, asking it to begin initialization.
286
+ */
287
+ export const InitializeRequestSchema = RequestSchema.extend({
288
+ method: z.literal('initialize'),
289
+ params: InitializeRequestParamsSchema
290
+ });
291
+ export const isInitializeRequest = (value) => InitializeRequestSchema.safeParse(value).success;
292
+ /**
293
+ * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
294
+ */
295
+ export const ServerCapabilitiesSchema = z.object({
296
+ /**
297
+ * Experimental, non-standard capabilities that the server supports.
298
+ */
299
+ experimental: z.record(z.string(), AssertObjectSchema).optional(),
300
+ /**
301
+ * Present if the server supports sending log messages to the client.
302
+ */
303
+ logging: AssertObjectSchema.optional(),
304
+ /**
305
+ * Present if the server supports sending completions to the client.
306
+ */
307
+ completions: AssertObjectSchema.optional(),
308
+ /**
309
+ * Present if the server offers any prompt templates.
310
+ */
311
+ prompts: z.optional(z.object({
312
+ /**
313
+ * Whether this server supports issuing notifications for changes to the prompt list.
314
+ */
315
+ listChanged: z.optional(z.boolean())
316
+ })),
317
+ /**
318
+ * Present if the server offers any resources to read.
319
+ */
320
+ resources: z
321
+ .object({
322
+ /**
323
+ * Whether this server supports clients subscribing to resource updates.
324
+ */
325
+ subscribe: z.boolean().optional(),
326
+ /**
327
+ * Whether this server supports issuing notifications for changes to the resource list.
328
+ */
329
+ listChanged: z.boolean().optional()
330
+ })
331
+ .optional(),
332
+ /**
333
+ * Present if the server offers any tools to call.
334
+ */
335
+ tools: z
336
+ .object({
337
+ /**
338
+ * Whether this server supports issuing notifications for changes to the tool list.
339
+ */
340
+ listChanged: z.boolean().optional()
341
+ })
342
+ .optional()
343
+ });
344
+ /**
345
+ * After receiving an initialize request from the client, the server sends this response.
346
+ */
347
+ export const InitializeResultSchema = ResultSchema.extend({
348
+ /**
349
+ * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.
350
+ */
351
+ protocolVersion: z.string(),
352
+ capabilities: ServerCapabilitiesSchema,
353
+ serverInfo: ImplementationSchema,
354
+ /**
355
+ * Instructions describing how to use the server and its features.
356
+ *
357
+ * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.
358
+ */
359
+ instructions: z.string().optional()
360
+ });
361
+ /**
362
+ * This notification is sent from the client to the server after initialization has finished.
363
+ */
364
+ export const InitializedNotificationSchema = NotificationSchema.extend({
365
+ method: z.literal('notifications/initialized')
366
+ });
367
+ export const isInitializedNotification = (value) => InitializedNotificationSchema.safeParse(value).success;
368
+ /* Ping */
369
+ /**
370
+ * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
371
+ */
372
+ export const PingRequestSchema = RequestSchema.extend({
373
+ method: z.literal('ping')
374
+ });
375
+ /* Progress notifications */
376
+ export const ProgressSchema = z.object({
377
+ /**
378
+ * The progress thus far. This should increase every time progress is made, even if the total is unknown.
379
+ */
380
+ progress: z.number(),
381
+ /**
382
+ * Total number of items to process (or total progress required), if known.
383
+ */
384
+ total: z.optional(z.number()),
385
+ /**
386
+ * An optional message describing the current progress.
387
+ */
388
+ message: z.optional(z.string())
389
+ });
390
+ export const ProgressNotificationParamsSchema = NotificationsParamsSchema.merge(ProgressSchema).extend({
391
+ /**
392
+ * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
393
+ */
394
+ progressToken: ProgressTokenSchema
395
+ });
396
+ /**
397
+ * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
398
+ *
399
+ * @category notifications/progress
400
+ */
401
+ export const ProgressNotificationSchema = NotificationSchema.extend({
402
+ method: z.literal('notifications/progress'),
403
+ params: ProgressNotificationParamsSchema
404
+ });
405
+ export const PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({
406
+ /**
407
+ * An opaque token representing the current pagination position.
408
+ * If provided, the server should return results starting after this cursor.
409
+ */
410
+ cursor: CursorSchema.optional()
411
+ });
412
+ /* Pagination */
413
+ export const PaginatedRequestSchema = RequestSchema.extend({
414
+ params: PaginatedRequestParamsSchema.optional()
415
+ });
416
+ export const PaginatedResultSchema = ResultSchema.extend({
417
+ /**
418
+ * An opaque token representing the pagination position after the last returned result.
419
+ * If present, there may be more results available.
420
+ */
421
+ nextCursor: z.optional(CursorSchema)
422
+ });
423
+ /* Resources */
424
+ /**
425
+ * The contents of a specific resource or sub-resource.
426
+ */
427
+ export const ResourceContentsSchema = z.object({
428
+ /**
429
+ * The URI of this resource.
430
+ */
431
+ uri: z.string(),
432
+ /**
433
+ * The MIME type of this resource, if known.
434
+ */
435
+ mimeType: z.optional(z.string()),
436
+ /**
437
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
438
+ * for notes on _meta usage.
439
+ */
440
+ _meta: z.record(z.string(), z.unknown()).optional()
441
+ });
442
+ export const TextResourceContentsSchema = ResourceContentsSchema.extend({
443
+ /**
444
+ * The text of the item. This must only be set if the item can actually be represented as text (not binary data).
445
+ */
446
+ text: z.string()
447
+ });
448
+ /**
449
+ * A Zod schema for validating Base64 strings that is more performant and
450
+ * robust for very large inputs than the default regex-based check. It avoids
451
+ * stack overflows by using the native `atob` function for validation.
452
+ */
453
+ const Base64Schema = z.string().refine(val => {
454
+ try {
455
+ // atob throws a DOMException if the string contains characters
456
+ // that are not part of the Base64 character set.
457
+ atob(val);
458
+ return true;
459
+ }
460
+ catch (_a) {
461
+ return false;
462
+ }
463
+ }, { message: 'Invalid Base64 string' });
464
+ export const BlobResourceContentsSchema = ResourceContentsSchema.extend({
465
+ /**
466
+ * A base64-encoded string representing the binary data of the item.
467
+ */
468
+ blob: Base64Schema
469
+ });
470
+ /**
471
+ * A known resource that the server is capable of reading.
472
+ */
473
+ export const ResourceSchema = BaseMetadataSchema.extend({
474
+ /**
475
+ * The URI of this resource.
476
+ */
477
+ uri: z.string(),
478
+ /**
479
+ * A description of what this resource represents.
480
+ *
481
+ * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
482
+ */
483
+ description: z.optional(z.string()),
484
+ /**
485
+ * The MIME type of this resource, if known.
486
+ */
487
+ mimeType: z.optional(z.string()),
488
+ /**
489
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
490
+ * for notes on _meta usage.
491
+ */
492
+ _meta: z.optional(z.object({}).passthrough())
493
+ }).merge(IconsSchema);
494
+ /**
495
+ * A template description for resources available on the server.
496
+ */
497
+ export const ResourceTemplateSchema = BaseMetadataSchema.extend({
498
+ /**
499
+ * A URI template (according to RFC 6570) that can be used to construct resource URIs.
500
+ */
501
+ uriTemplate: z.string(),
502
+ /**
503
+ * A description of what this template is for.
504
+ *
505
+ * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
506
+ */
507
+ description: z.optional(z.string()),
508
+ /**
509
+ * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
510
+ */
511
+ mimeType: z.optional(z.string()),
512
+ /**
513
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
514
+ * for notes on _meta usage.
515
+ */
516
+ _meta: z.optional(z.object({}).passthrough())
517
+ }).merge(IconsSchema);
518
+ /**
519
+ * Sent from the client to request a list of resources the server has.
520
+ */
521
+ export const ListResourcesRequestSchema = PaginatedRequestSchema.extend({
522
+ method: z.literal('resources/list')
523
+ });
524
+ /**
525
+ * The server's response to a resources/list request from the client.
526
+ */
527
+ export const ListResourcesResultSchema = PaginatedResultSchema.extend({
528
+ resources: z.array(ResourceSchema)
529
+ });
530
+ /**
531
+ * Sent from the client to request a list of resource templates the server has.
532
+ */
533
+ export const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({
534
+ method: z.literal('resources/templates/list')
535
+ });
536
+ /**
537
+ * The server's response to a resources/templates/list request from the client.
538
+ */
539
+ export const ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({
540
+ resourceTemplates: z.array(ResourceTemplateSchema)
541
+ });
542
+ export const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
543
+ /**
544
+ * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
545
+ *
546
+ * @format uri
547
+ */
548
+ uri: z.string()
549
+ });
550
+ /**
551
+ * Parameters for a `resources/read` request.
552
+ */
553
+ export const ReadResourceRequestParamsSchema = ResourceRequestParamsSchema;
554
+ /**
555
+ * Sent from the client to the server, to read a specific resource URI.
556
+ */
557
+ export const ReadResourceRequestSchema = RequestSchema.extend({
558
+ method: z.literal('resources/read'),
559
+ params: ReadResourceRequestParamsSchema
560
+ });
561
+ /**
562
+ * The server's response to a resources/read request from the client.
563
+ */
564
+ export const ReadResourceResultSchema = ResultSchema.extend({
565
+ contents: z.array(z.union([TextResourceContentsSchema, BlobResourceContentsSchema]))
566
+ });
567
+ /**
568
+ * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.
569
+ */
570
+ export const ResourceListChangedNotificationSchema = NotificationSchema.extend({
571
+ method: z.literal('notifications/resources/list_changed')
572
+ });
573
+ export const SubscribeRequestParamsSchema = ResourceRequestParamsSchema;
574
+ /**
575
+ * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
576
+ */
577
+ export const SubscribeRequestSchema = RequestSchema.extend({
578
+ method: z.literal('resources/subscribe'),
579
+ params: SubscribeRequestParamsSchema
580
+ });
581
+ export const UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema;
582
+ /**
583
+ * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
584
+ */
585
+ export const UnsubscribeRequestSchema = RequestSchema.extend({
586
+ method: z.literal('resources/unsubscribe'),
587
+ params: UnsubscribeRequestParamsSchema
588
+ });
589
+ /**
590
+ * Parameters for a `notifications/resources/updated` notification.
591
+ */
592
+ export const ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({
593
+ /**
594
+ * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
595
+ */
596
+ uri: z.string()
597
+ });
598
+ /**
599
+ * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.
600
+ */
601
+ export const ResourceUpdatedNotificationSchema = NotificationSchema.extend({
602
+ method: z.literal('notifications/resources/updated'),
603
+ params: ResourceUpdatedNotificationParamsSchema
604
+ });
605
+ /* Prompts */
606
+ /**
607
+ * Describes an argument that a prompt can accept.
608
+ */
609
+ export const PromptArgumentSchema = z.object({
610
+ /**
611
+ * The name of the argument.
612
+ */
613
+ name: z.string(),
614
+ /**
615
+ * A human-readable description of the argument.
616
+ */
617
+ description: z.optional(z.string()),
618
+ /**
619
+ * Whether this argument must be provided.
620
+ */
621
+ required: z.optional(z.boolean())
622
+ });
623
+ /**
624
+ * A prompt or prompt template that the server offers.
625
+ */
626
+ export const PromptSchema = BaseMetadataSchema.extend({
627
+ /**
628
+ * An optional description of what this prompt provides
629
+ */
630
+ description: z.optional(z.string()),
631
+ /**
632
+ * A list of arguments to use for templating the prompt.
633
+ */
634
+ arguments: z.optional(z.array(PromptArgumentSchema)),
635
+ /**
636
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
637
+ * for notes on _meta usage.
638
+ */
639
+ _meta: z.optional(z.object({}).passthrough())
640
+ }).merge(IconsSchema);
641
+ /**
642
+ * Sent from the client to request a list of prompts and prompt templates the server has.
643
+ */
644
+ export const ListPromptsRequestSchema = PaginatedRequestSchema.extend({
645
+ method: z.literal('prompts/list')
646
+ });
647
+ /**
648
+ * The server's response to a prompts/list request from the client.
649
+ */
650
+ export const ListPromptsResultSchema = PaginatedResultSchema.extend({
651
+ prompts: z.array(PromptSchema)
652
+ });
653
+ /**
654
+ * Parameters for a `prompts/get` request.
655
+ */
656
+ export const GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({
657
+ /**
658
+ * The name of the prompt or prompt template.
659
+ */
660
+ name: z.string(),
661
+ /**
662
+ * Arguments to use for templating the prompt.
663
+ */
664
+ arguments: z.record(z.string(), z.string()).optional()
665
+ });
666
+ /**
667
+ * Used by the client to get a prompt provided by the server.
668
+ */
669
+ export const GetPromptRequestSchema = RequestSchema.extend({
670
+ method: z.literal('prompts/get'),
671
+ params: GetPromptRequestParamsSchema
672
+ });
673
+ /**
674
+ * Text provided to or from an LLM.
675
+ */
676
+ export const TextContentSchema = z.object({
677
+ type: z.literal('text'),
678
+ /**
679
+ * The text content of the message.
680
+ */
681
+ text: z.string(),
682
+ /**
683
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
684
+ * for notes on _meta usage.
685
+ */
686
+ _meta: z.record(z.string(), z.unknown()).optional()
687
+ });
688
+ /**
689
+ * An image provided to or from an LLM.
690
+ */
691
+ export const ImageContentSchema = z.object({
692
+ type: z.literal('image'),
693
+ /**
694
+ * The base64-encoded image data.
695
+ */
696
+ data: Base64Schema,
697
+ /**
698
+ * The MIME type of the image. Different providers may support different image types.
699
+ */
700
+ mimeType: z.string(),
701
+ /**
702
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
703
+ * for notes on _meta usage.
704
+ */
705
+ _meta: z.record(z.string(), z.unknown()).optional()
706
+ });
707
+ /**
708
+ * An Audio provided to or from an LLM.
709
+ */
710
+ export const AudioContentSchema = z.object({
711
+ type: z.literal('audio'),
712
+ /**
713
+ * The base64-encoded audio data.
714
+ */
715
+ data: Base64Schema,
716
+ /**
717
+ * The MIME type of the audio. Different providers may support different audio types.
718
+ */
719
+ mimeType: z.string(),
720
+ /**
721
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
722
+ * for notes on _meta usage.
723
+ */
724
+ _meta: z.record(z.string(), z.unknown()).optional()
725
+ });
726
+ /**
727
+ * The contents of a resource, embedded into a prompt or tool call result.
728
+ */
729
+ export const EmbeddedResourceSchema = z.object({
730
+ type: z.literal('resource'),
731
+ resource: z.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
732
+ /**
733
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
734
+ * for notes on _meta usage.
735
+ */
736
+ _meta: z.record(z.string(), z.unknown()).optional()
737
+ });
738
+ /**
739
+ * A resource that the server is capable of reading, included in a prompt or tool call result.
740
+ *
741
+ * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
742
+ */
743
+ export const ResourceLinkSchema = ResourceSchema.extend({
744
+ type: z.literal('resource_link')
745
+ });
746
+ /**
747
+ * A content block that can be used in prompts and tool results.
748
+ */
749
+ export const ContentBlockSchema = z.union([
750
+ TextContentSchema,
751
+ ImageContentSchema,
752
+ AudioContentSchema,
753
+ ResourceLinkSchema,
754
+ EmbeddedResourceSchema
755
+ ]);
756
+ /**
757
+ * Describes a message returned as part of a prompt.
758
+ */
759
+ export const PromptMessageSchema = z.object({
760
+ role: z.enum(['user', 'assistant']),
761
+ content: ContentBlockSchema
762
+ });
763
+ /**
764
+ * The server's response to a prompts/get request from the client.
765
+ */
766
+ export const GetPromptResultSchema = ResultSchema.extend({
767
+ /**
768
+ * An optional description for the prompt.
769
+ */
770
+ description: z.optional(z.string()),
771
+ messages: z.array(PromptMessageSchema)
772
+ });
773
+ /**
774
+ * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.
775
+ */
776
+ export const PromptListChangedNotificationSchema = NotificationSchema.extend({
777
+ method: z.literal('notifications/prompts/list_changed')
778
+ });
779
+ /* Tools */
780
+ /**
781
+ * Additional properties describing a Tool to clients.
782
+ *
783
+ * NOTE: all properties in ToolAnnotations are **hints**.
784
+ * They are not guaranteed to provide a faithful description of
785
+ * tool behavior (including descriptive properties like `title`).
786
+ *
787
+ * Clients should never make tool use decisions based on ToolAnnotations
788
+ * received from untrusted servers.
789
+ */
790
+ export const ToolAnnotationsSchema = z.object({
791
+ /**
792
+ * A human-readable title for the tool.
793
+ */
794
+ title: z.string().optional(),
795
+ /**
796
+ * If true, the tool does not modify its environment.
797
+ *
798
+ * Default: false
799
+ */
800
+ readOnlyHint: z.boolean().optional(),
801
+ /**
802
+ * If true, the tool may perform destructive updates to its environment.
803
+ * If false, the tool performs only additive updates.
804
+ *
805
+ * (This property is meaningful only when `readOnlyHint == false`)
806
+ *
807
+ * Default: true
808
+ */
809
+ destructiveHint: z.boolean().optional(),
810
+ /**
811
+ * If true, calling the tool repeatedly with the same arguments
812
+ * will have no additional effect on the its environment.
813
+ *
814
+ * (This property is meaningful only when `readOnlyHint == false`)
815
+ *
816
+ * Default: false
817
+ */
818
+ idempotentHint: z.boolean().optional(),
819
+ /**
820
+ * If true, this tool may interact with an "open world" of external
821
+ * entities. If false, the tool's domain of interaction is closed.
822
+ * For example, the world of a web search tool is open, whereas that
823
+ * of a memory tool is not.
824
+ *
825
+ * Default: true
826
+ */
827
+ openWorldHint: z.boolean().optional()
828
+ });
829
+ /**
830
+ * Definition for a tool the client can call.
831
+ */
832
+ export const ToolSchema = BaseMetadataSchema.extend({
833
+ /**
834
+ * A human-readable description of the tool.
835
+ */
836
+ description: z.string().optional(),
837
+ /**
838
+ * A JSON Schema object defining the expected parameters for the tool.
839
+ */
840
+ inputSchema: z.object({
841
+ type: z.literal('object'),
842
+ properties: z.record(z.string(), AssertObjectSchema).optional(),
843
+ required: z.optional(z.array(z.string()))
844
+ }),
845
+ /**
846
+ * An optional JSON Schema object defining the structure of the tool's output returned in
847
+ * the structuredContent field of a CallToolResult.
848
+ */
849
+ outputSchema: z
850
+ .object({
851
+ type: z.literal('object'),
852
+ properties: z.record(z.string(), AssertObjectSchema).optional(),
853
+ required: z.optional(z.array(z.string())),
854
+ /**
855
+ * Not in the MCP specification, but added to support the Ajv validator while removing .passthrough() which previously allowed additionalProperties to be passed through.
856
+ */
857
+ additionalProperties: z.optional(z.boolean())
858
+ })
859
+ .optional(),
860
+ /**
861
+ * Optional additional tool information.
862
+ */
863
+ annotations: z.optional(ToolAnnotationsSchema),
864
+ /**
865
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
866
+ * for notes on _meta usage.
867
+ */
868
+ _meta: z.record(z.string(), z.unknown()).optional()
869
+ }).merge(IconsSchema);
870
+ /**
871
+ * Sent from the client to request a list of tools the server has.
872
+ */
873
+ export const ListToolsRequestSchema = PaginatedRequestSchema.extend({
874
+ method: z.literal('tools/list')
875
+ });
876
+ /**
877
+ * The server's response to a tools/list request from the client.
878
+ */
879
+ export const ListToolsResultSchema = PaginatedResultSchema.extend({
880
+ tools: z.array(ToolSchema)
881
+ });
882
+ /**
883
+ * The server's response to a tool call.
884
+ */
885
+ export const CallToolResultSchema = ResultSchema.extend({
886
+ /**
887
+ * A list of content objects that represent the result of the tool call.
888
+ *
889
+ * If the Tool does not define an outputSchema, this field MUST be present in the result.
890
+ * For backwards compatibility, this field is always present, but it may be empty.
891
+ */
892
+ content: z.array(ContentBlockSchema).default([]),
893
+ /**
894
+ * An object containing structured tool output.
895
+ *
896
+ * If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.
897
+ */
898
+ structuredContent: z.record(z.string(), z.unknown()).optional(),
899
+ /**
900
+ * Whether the tool call ended in an error.
901
+ *
902
+ * If not set, this is assumed to be false (the call was successful).
903
+ *
904
+ * Any errors that originate from the tool SHOULD be reported inside the result
905
+ * object, with `isError` set to true, _not_ as an MCP protocol-level error
906
+ * response. Otherwise, the LLM would not be able to see that an error occurred
907
+ * and self-correct.
908
+ *
909
+ * However, any errors in _finding_ the tool, an error indicating that the
910
+ * server does not support tool calls, or any other exceptional conditions,
911
+ * should be reported as an MCP error response.
912
+ */
913
+ isError: z.optional(z.boolean())
914
+ });
915
+ /**
916
+ * CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07.
917
+ */
918
+ export const CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({
919
+ toolResult: z.unknown()
920
+ }));
921
+ /**
922
+ * Parameters for a `tools/call` request.
923
+ */
924
+ export const CallToolRequestParamsSchema = BaseRequestParamsSchema.extend({
925
+ /**
926
+ * The name of the tool to call.
927
+ */
928
+ name: z.string(),
929
+ /**
930
+ * Arguments to pass to the tool.
931
+ */
932
+ arguments: z.optional(z.record(z.string(), z.unknown()))
933
+ });
934
+ /**
935
+ * Used by the client to invoke a tool provided by the server.
936
+ */
937
+ export const CallToolRequestSchema = RequestSchema.extend({
938
+ method: z.literal('tools/call'),
939
+ params: CallToolRequestParamsSchema
940
+ });
941
+ /**
942
+ * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.
943
+ */
944
+ export const ToolListChangedNotificationSchema = NotificationSchema.extend({
945
+ method: z.literal('notifications/tools/list_changed')
946
+ });
947
+ /* Logging */
948
+ /**
949
+ * The severity of a log message.
950
+ */
951
+ export const LoggingLevelSchema = z.enum(['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency']);
952
+ /**
953
+ * Parameters for a `logging/setLevel` request.
954
+ */
955
+ export const SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({
956
+ /**
957
+ * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message.
958
+ */
959
+ level: LoggingLevelSchema
960
+ });
961
+ /**
962
+ * A request from the client to the server, to enable or adjust logging.
963
+ */
964
+ export const SetLevelRequestSchema = RequestSchema.extend({
965
+ method: z.literal('logging/setLevel'),
966
+ params: SetLevelRequestParamsSchema
967
+ });
968
+ /**
969
+ * Parameters for a `notifications/message` notification.
970
+ */
971
+ export const LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({
972
+ /**
973
+ * The severity of this log message.
974
+ */
975
+ level: LoggingLevelSchema,
976
+ /**
977
+ * An optional name of the logger issuing this message.
978
+ */
979
+ logger: z.string().optional(),
980
+ /**
981
+ * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
982
+ */
983
+ data: z.unknown()
984
+ });
985
+ /**
986
+ * Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.
987
+ */
988
+ export const LoggingMessageNotificationSchema = NotificationSchema.extend({
989
+ method: z.literal('notifications/message'),
990
+ params: LoggingMessageNotificationParamsSchema
991
+ });
992
+ /* Sampling */
993
+ /**
994
+ * Hints to use for model selection.
995
+ */
996
+ export const ModelHintSchema = z.object({
997
+ /**
998
+ * A hint for a model name.
999
+ */
1000
+ name: z.string().optional()
1001
+ });
1002
+ /**
1003
+ * The server's preferences for model selection, requested of the client during sampling.
1004
+ */
1005
+ export const ModelPreferencesSchema = z.object({
1006
+ /**
1007
+ * Optional hints to use for model selection.
1008
+ */
1009
+ hints: z.optional(z.array(ModelHintSchema)),
1010
+ /**
1011
+ * How much to prioritize cost when selecting a model.
1012
+ */
1013
+ costPriority: z.optional(z.number().min(0).max(1)),
1014
+ /**
1015
+ * How much to prioritize sampling speed (latency) when selecting a model.
1016
+ */
1017
+ speedPriority: z.optional(z.number().min(0).max(1)),
1018
+ /**
1019
+ * How much to prioritize intelligence and capabilities when selecting a model.
1020
+ */
1021
+ intelligencePriority: z.optional(z.number().min(0).max(1))
1022
+ });
1023
+ /**
1024
+ * Describes a message issued to or received from an LLM API.
1025
+ */
1026
+ export const SamplingMessageSchema = z.object({
1027
+ role: z.enum(['user', 'assistant']),
1028
+ content: z.union([TextContentSchema, ImageContentSchema, AudioContentSchema])
1029
+ });
1030
+ /**
1031
+ * Parameters for a `sampling/createMessage` request.
1032
+ */
1033
+ export const CreateMessageRequestParamsSchema = BaseRequestParamsSchema.extend({
1034
+ messages: z.array(SamplingMessageSchema),
1035
+ /**
1036
+ * The server's preferences for which model to select. The client MAY modify or omit this request.
1037
+ */
1038
+ modelPreferences: ModelPreferencesSchema.optional(),
1039
+ /**
1040
+ * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
1041
+ */
1042
+ systemPrompt: z.string().optional(),
1043
+ /**
1044
+ * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
1045
+ */
1046
+ includeContext: z.enum(['none', 'thisServer', 'allServers']).optional(),
1047
+ temperature: z.number().optional(),
1048
+ /**
1049
+ * The requested maximum number of tokens to sample (to prevent runaway completions).
1050
+ *
1051
+ * The client MAY choose to sample fewer tokens than the requested maximum.
1052
+ */
1053
+ maxTokens: z.number().int(),
1054
+ stopSequences: z.array(z.string()).optional(),
1055
+ /**
1056
+ * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
1057
+ */
1058
+ metadata: AssertObjectSchema.optional()
1059
+ });
1060
+ /**
1061
+ * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.
1062
+ */
1063
+ export const CreateMessageRequestSchema = RequestSchema.extend({
1064
+ method: z.literal('sampling/createMessage'),
1065
+ params: CreateMessageRequestParamsSchema
1066
+ });
1067
+ /**
1068
+ * The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
1069
+ */
1070
+ export const CreateMessageResultSchema = ResultSchema.extend({
1071
+ /**
1072
+ * The name of the model that generated the message.
1073
+ */
1074
+ model: z.string(),
1075
+ /**
1076
+ * The reason why sampling stopped.
1077
+ */
1078
+ stopReason: z.optional(z.enum(['endTurn', 'stopSequence', 'maxTokens']).or(z.string())),
1079
+ role: z.enum(['user', 'assistant']),
1080
+ content: z.discriminatedUnion('type', [TextContentSchema, ImageContentSchema, AudioContentSchema])
1081
+ });
1082
+ /* Elicitation */
1083
+ /**
1084
+ * Primitive schema definition for boolean fields.
1085
+ */
1086
+ export const BooleanSchemaSchema = z.object({
1087
+ type: z.literal('boolean'),
1088
+ title: z.string().optional(),
1089
+ description: z.string().optional(),
1090
+ default: z.boolean().optional()
1091
+ });
1092
+ /**
1093
+ * Primitive schema definition for string fields.
1094
+ */
1095
+ export const StringSchemaSchema = z.object({
1096
+ type: z.literal('string'),
1097
+ title: z.string().optional(),
1098
+ description: z.string().optional(),
1099
+ minLength: z.number().optional(),
1100
+ maxLength: z.number().optional(),
1101
+ format: z.enum(['email', 'uri', 'date', 'date-time']).optional(),
1102
+ default: z.string().optional()
1103
+ });
1104
+ /**
1105
+ * Primitive schema definition for number fields.
1106
+ */
1107
+ export const NumberSchemaSchema = z.object({
1108
+ type: z.enum(['number', 'integer']),
1109
+ title: z.string().optional(),
1110
+ description: z.string().optional(),
1111
+ minimum: z.number().optional(),
1112
+ maximum: z.number().optional(),
1113
+ default: z.number().optional()
1114
+ });
1115
+ /**
1116
+ * Schema for single-selection enumeration without display titles for options.
1117
+ */
1118
+ export const UntitledSingleSelectEnumSchemaSchema = z.object({
1119
+ type: z.literal('string'),
1120
+ title: z.string().optional(),
1121
+ description: z.string().optional(),
1122
+ enum: z.array(z.string()),
1123
+ default: z.string().optional()
1124
+ });
1125
+ /**
1126
+ * Schema for single-selection enumeration with display titles for each option.
1127
+ */
1128
+ export const TitledSingleSelectEnumSchemaSchema = z.object({
1129
+ type: z.literal('string'),
1130
+ title: z.string().optional(),
1131
+ description: z.string().optional(),
1132
+ oneOf: z.array(z.object({
1133
+ const: z.string(),
1134
+ title: z.string()
1135
+ })),
1136
+ default: z.string().optional()
1137
+ });
1138
+ /**
1139
+ * Use TitledSingleSelectEnumSchema instead.
1140
+ * This interface will be removed in a future version.
1141
+ */
1142
+ export const LegacyTitledEnumSchemaSchema = z.object({
1143
+ type: z.literal('string'),
1144
+ title: z.string().optional(),
1145
+ description: z.string().optional(),
1146
+ enum: z.array(z.string()),
1147
+ enumNames: z.array(z.string()).optional(),
1148
+ default: z.string().optional()
1149
+ });
1150
+ // Combined single selection enumeration
1151
+ export const SingleSelectEnumSchemaSchema = z.union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);
1152
+ /**
1153
+ * Schema for multiple-selection enumeration without display titles for options.
1154
+ */
1155
+ export const UntitledMultiSelectEnumSchemaSchema = z.object({
1156
+ type: z.literal('array'),
1157
+ title: z.string().optional(),
1158
+ description: z.string().optional(),
1159
+ minItems: z.number().optional(),
1160
+ maxItems: z.number().optional(),
1161
+ items: z.object({
1162
+ type: z.literal('string'),
1163
+ enum: z.array(z.string())
1164
+ }),
1165
+ default: z.array(z.string()).optional()
1166
+ });
1167
+ /**
1168
+ * Schema for multiple-selection enumeration with display titles for each option.
1169
+ */
1170
+ export const TitledMultiSelectEnumSchemaSchema = z.object({
1171
+ type: z.literal('array'),
1172
+ title: z.string().optional(),
1173
+ description: z.string().optional(),
1174
+ minItems: z.number().optional(),
1175
+ maxItems: z.number().optional(),
1176
+ items: z.object({
1177
+ anyOf: z.array(z.object({
1178
+ const: z.string(),
1179
+ title: z.string()
1180
+ }))
1181
+ }),
1182
+ default: z.array(z.string()).optional()
1183
+ });
1184
+ /**
1185
+ * Combined schema for multiple-selection enumeration
1186
+ */
1187
+ export const MultiSelectEnumSchemaSchema = z.union([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]);
1188
+ /**
1189
+ * Primitive schema definition for enum fields.
1190
+ */
1191
+ export const EnumSchemaSchema = z.union([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]);
1192
+ /**
1193
+ * Union of all primitive schema definitions.
1194
+ */
1195
+ export const PrimitiveSchemaDefinitionSchema = z.union([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]);
1196
+ /**
1197
+ * Parameters for an `elicitation/create` request.
1198
+ */
1199
+ export const ElicitRequestParamsSchema = BaseRequestParamsSchema.extend({
1200
+ /**
1201
+ * The message to present to the user.
1202
+ */
1203
+ message: z.string(),
1204
+ /**
1205
+ * A restricted subset of JSON Schema.
1206
+ * Only top-level properties are allowed, without nesting.
1207
+ */
1208
+ requestedSchema: z.object({
1209
+ type: z.literal('object'),
1210
+ properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),
1211
+ required: z.array(z.string()).optional()
1212
+ })
1213
+ });
1214
+ /**
1215
+ * A request from the server to elicit user input via the client.
1216
+ * The client should present the message and form fields to the user.
1217
+ */
1218
+ export const ElicitRequestSchema = RequestSchema.extend({
1219
+ method: z.literal('elicitation/create'),
1220
+ params: ElicitRequestParamsSchema
1221
+ });
1222
+ /**
1223
+ * The client's response to an elicitation/create request from the server.
1224
+ */
1225
+ export const ElicitResultSchema = ResultSchema.extend({
1226
+ /**
1227
+ * The user action in response to the elicitation.
1228
+ * - "accept": User submitted the form/confirmed the action
1229
+ * - "decline": User explicitly decline the action
1230
+ * - "cancel": User dismissed without making an explicit choice
1231
+ */
1232
+ action: z.enum(['accept', 'decline', 'cancel']),
1233
+ /**
1234
+ * The submitted form data, only present when action is "accept".
1235
+ * Contains values matching the requested schema.
1236
+ */
1237
+ content: z.record(z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])).optional()
1238
+ });
1239
+ /* Autocomplete */
1240
+ /**
1241
+ * A reference to a resource or resource template definition.
1242
+ */
1243
+ export const ResourceTemplateReferenceSchema = z.object({
1244
+ type: z.literal('ref/resource'),
1245
+ /**
1246
+ * The URI or URI template of the resource.
1247
+ */
1248
+ uri: z.string()
1249
+ });
1250
+ /**
1251
+ * @deprecated Use ResourceTemplateReferenceSchema instead
1252
+ */
1253
+ export const ResourceReferenceSchema = ResourceTemplateReferenceSchema;
1254
+ /**
1255
+ * Identifies a prompt.
1256
+ */
1257
+ export const PromptReferenceSchema = z.object({
1258
+ type: z.literal('ref/prompt'),
1259
+ /**
1260
+ * The name of the prompt or prompt template
1261
+ */
1262
+ name: z.string()
1263
+ });
1264
+ /**
1265
+ * Parameters for a `completion/complete` request.
1266
+ */
1267
+ export const CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({
1268
+ ref: z.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),
1269
+ /**
1270
+ * The argument's information
1271
+ */
1272
+ argument: z.object({
1273
+ /**
1274
+ * The name of the argument
1275
+ */
1276
+ name: z.string(),
1277
+ /**
1278
+ * The value of the argument to use for completion matching.
1279
+ */
1280
+ value: z.string()
1281
+ }),
1282
+ context: z
1283
+ .object({
1284
+ /**
1285
+ * Previously-resolved variables in a URI template or prompt.
1286
+ */
1287
+ arguments: z.record(z.string(), z.string()).optional()
1288
+ })
1289
+ .optional()
1290
+ });
1291
+ /**
1292
+ * A request from the client to the server, to ask for completion options.
1293
+ */
1294
+ export const CompleteRequestSchema = RequestSchema.extend({
1295
+ method: z.literal('completion/complete'),
1296
+ params: CompleteRequestParamsSchema
1297
+ });
1298
+ export function assertCompleteRequestPrompt(request) {
1299
+ if (request.params.ref.type !== 'ref/prompt') {
1300
+ throw new TypeError(`Expected CompleteRequestPrompt, but got ${request.params.ref.type}`);
1301
+ }
1302
+ }
1303
+ export function assertCompleteRequestResourceTemplate(request) {
1304
+ if (request.params.ref.type !== 'ref/resource') {
1305
+ throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${request.params.ref.type}`);
1306
+ }
1307
+ }
1308
+ /**
1309
+ * The server's response to a completion/complete request
1310
+ */
1311
+ export const CompleteResultSchema = ResultSchema.extend({
1312
+ completion: z
1313
+ .object({
1314
+ /**
1315
+ * An array of completion values. Must not exceed 100 items.
1316
+ */
1317
+ values: z.array(z.string()).max(100),
1318
+ /**
1319
+ * The total number of completion options available. This can exceed the number of values actually sent in the response.
1320
+ */
1321
+ total: z.optional(z.number().int()),
1322
+ /**
1323
+ * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
1324
+ */
1325
+ hasMore: z.optional(z.boolean())
1326
+ })
1327
+ .passthrough()
1328
+ });
1329
+ /* Roots */
1330
+ /**
1331
+ * Represents a root directory or file that the server can operate on.
1332
+ */
1333
+ export const RootSchema = z.object({
1334
+ /**
1335
+ * The URI identifying the root. This *must* start with file:// for now.
1336
+ */
1337
+ uri: z.string().startsWith('file://'),
1338
+ /**
1339
+ * An optional name for the root.
1340
+ */
1341
+ name: z.string().optional(),
1342
+ /**
1343
+ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
1344
+ * for notes on _meta usage.
1345
+ */
1346
+ _meta: z.record(z.string(), z.unknown()).optional()
1347
+ });
1348
+ /**
1349
+ * Sent from the server to request a list of root URIs from the client.
1350
+ */
1351
+ export const ListRootsRequestSchema = RequestSchema.extend({
1352
+ method: z.literal('roots/list')
1353
+ });
1354
+ /**
1355
+ * The client's response to a roots/list request from the server.
1356
+ */
1357
+ export const ListRootsResultSchema = ResultSchema.extend({
1358
+ roots: z.array(RootSchema)
1359
+ });
1360
+ /**
1361
+ * A notification from the client to the server, informing it that the list of roots has changed.
1362
+ */
1363
+ export const RootsListChangedNotificationSchema = NotificationSchema.extend({
1364
+ method: z.literal('notifications/roots/list_changed')
1365
+ });
1366
+ /* Client messages */
1367
+ export const ClientRequestSchema = z.union([
1368
+ PingRequestSchema,
1369
+ InitializeRequestSchema,
1370
+ CompleteRequestSchema,
1371
+ SetLevelRequestSchema,
1372
+ GetPromptRequestSchema,
1373
+ ListPromptsRequestSchema,
1374
+ ListResourcesRequestSchema,
1375
+ ListResourceTemplatesRequestSchema,
1376
+ ReadResourceRequestSchema,
1377
+ SubscribeRequestSchema,
1378
+ UnsubscribeRequestSchema,
1379
+ CallToolRequestSchema,
1380
+ ListToolsRequestSchema
1381
+ ]);
1382
+ export const ClientNotificationSchema = z.union([
1383
+ CancelledNotificationSchema,
1384
+ ProgressNotificationSchema,
1385
+ InitializedNotificationSchema,
1386
+ RootsListChangedNotificationSchema
1387
+ ]);
1388
+ export const ClientResultSchema = z.union([EmptyResultSchema, CreateMessageResultSchema, ElicitResultSchema, ListRootsResultSchema]);
1389
+ /* Server messages */
1390
+ export const ServerRequestSchema = z.union([PingRequestSchema, CreateMessageRequestSchema, ElicitRequestSchema, ListRootsRequestSchema]);
1391
+ export const ServerNotificationSchema = z.union([
1392
+ CancelledNotificationSchema,
1393
+ ProgressNotificationSchema,
1394
+ LoggingMessageNotificationSchema,
1395
+ ResourceUpdatedNotificationSchema,
1396
+ ResourceListChangedNotificationSchema,
1397
+ ToolListChangedNotificationSchema,
1398
+ PromptListChangedNotificationSchema
1399
+ ]);
1400
+ export const ServerResultSchema = z.union([
1401
+ EmptyResultSchema,
1402
+ InitializeResultSchema,
1403
+ CompleteResultSchema,
1404
+ GetPromptResultSchema,
1405
+ ListPromptsResultSchema,
1406
+ ListResourcesResultSchema,
1407
+ ListResourceTemplatesResultSchema,
1408
+ ReadResourceResultSchema,
1409
+ CallToolResultSchema,
1410
+ ListToolsResultSchema
1411
+ ]);
1412
+ export class McpError extends Error {
1413
+ constructor(code, message, data) {
1414
+ super(`MCP error ${code}: ${message}`);
1415
+ this.code = code;
1416
+ this.data = data;
1417
+ this.name = 'McpError';
1418
+ }
1419
+ }
1420
+ //# sourceMappingURL=types.js.map