mcp-use 2.0.0-beta.4 → 2.0.0-beta.41

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 (1202) hide show
  1. package/dist/bin.js +1 -179
  2. package/dist/branding.d.ts +81 -0
  3. package/dist/chunk-GX6PGIEO.js +630 -0
  4. package/dist/chunk-JMDHTN6N.js +1 -0
  5. package/dist/chunk-OJF6B5EU.js +1 -0
  6. package/dist/chunk-PSKSL567.js +1 -0
  7. package/dist/chunk-WYBJYZJB.js +1 -0
  8. package/dist/chunk-Y26DNVWA.js +3 -0
  9. package/dist/chunk-YBGMCISI.js +2 -0
  10. package/dist/chunk-ZMU5USAZ.js +1 -0
  11. package/dist/completable.d.ts +9 -1
  12. package/dist/config.d.ts +134 -73
  13. package/dist/context.d.ts +147 -11
  14. package/dist/fetch-app.d.ts +26 -8
  15. package/dist/index.d.ts +39 -11
  16. package/dist/index.js +32 -1818
  17. package/dist/internal/resource-completion.js +1 -0
  18. package/dist/internal/usage.js +1 -0
  19. package/dist/landing-handler-TG6LVQBI.js +1 -0
  20. package/dist/landing-handler.d.ts +23 -0
  21. package/dist/landing.d.ts +66 -0
  22. package/dist/landing.js +1 -0
  23. package/dist/listen-address.d.ts +8 -0
  24. package/dist/logging.d.ts +0 -1
  25. package/dist/mcp-proxy-NETCUGUD.js +2 -0
  26. package/dist/mcp-proxy.d.ts +158 -0
  27. package/dist/middleware/cors.d.ts +10 -0
  28. package/dist/middleware/mcp-middleware.d.ts +183 -0
  29. package/dist/mount-mcp.d.ts +0 -5
  30. package/dist/next/config.d.ts +38 -0
  31. package/dist/next/handler.d.ts +16 -0
  32. package/dist/next/index.d.ts +4 -0
  33. package/dist/next/index.js +1 -0
  34. package/dist/node-bridge.d.ts +0 -1
  35. package/dist/node-bridge.js +1 -151
  36. package/dist/oauth/adapters.d.ts +0 -1
  37. package/dist/oauth/auth0.d.ts +0 -1
  38. package/dist/oauth/auth0.js +1 -61
  39. package/dist/oauth/better-auth.d.ts +28 -0
  40. package/dist/oauth/better-auth.js +1 -0
  41. package/dist/oauth/clerk.d.ts +0 -1
  42. package/dist/oauth/clerk.js +1 -70
  43. package/dist/oauth/guards.d.ts +0 -1
  44. package/dist/oauth/index.d.ts +0 -1
  45. package/dist/oauth/index.js +1 -27
  46. package/dist/oauth/internal.d.ts +0 -1
  47. package/dist/oauth/jwt.d.ts +0 -1
  48. package/dist/oauth/keycloak.d.ts +0 -1
  49. package/dist/oauth/keycloak.js +1 -94
  50. package/dist/oauth/provider.d.ts +0 -1
  51. package/dist/oauth/supabase.d.ts +0 -1
  52. package/dist/oauth/supabase.js +1 -101
  53. package/dist/oauth/workos.d.ts +0 -1
  54. package/dist/oauth/workos.js +1 -77
  55. package/dist/openapi/index.d.ts +0 -1
  56. package/dist/openapi/index.js +1 -7
  57. package/dist/openapi/types.d.ts +0 -1
  58. package/dist/prompts.d.ts +7 -4
  59. package/dist/public-route-DAQJGS6K.js +1 -0
  60. package/dist/react/components/error-boundary.d.ts +0 -1
  61. package/dist/react/components/image.d.ts +0 -1
  62. package/dist/react/components/model-context.d.ts +9 -15
  63. package/dist/react/components/theme-provider.d.ts +3 -1
  64. package/dist/react/components/view-controls.d.ts +0 -1
  65. package/dist/react/hooks/use-call-tool.d.ts +29 -12
  66. package/dist/react/hooks/use-display-mode.d.ts +0 -1
  67. package/dist/react/hooks/use-files.d.ts +24 -0
  68. package/dist/react/hooks/use-host-context.d.ts +5 -1
  69. package/dist/react/hooks/use-open-external.d.ts +0 -1
  70. package/dist/react/hooks/use-send-follow-up.d.ts +0 -1
  71. package/dist/react/hooks/use-send-size-changed.d.ts +0 -1
  72. package/dist/react/hooks/use-tool-context.d.ts +0 -1
  73. package/dist/react/hooks/use-view-state.d.ts +23 -0
  74. package/dist/react/hooks/use-view-theme.d.ts +0 -1
  75. package/dist/react/hooks/use-view-tool.d.ts +0 -1
  76. package/dist/react/index.d.ts +4 -2
  77. package/dist/react/index.js +346 -85
  78. package/dist/react/public-assets.d.ts +0 -1
  79. package/dist/react/runtime/bootstrap-view.d.ts +0 -1
  80. package/dist/react/runtime/model-context-store.d.ts +34 -69
  81. package/dist/react/runtime/view-config.d.ts +0 -1
  82. package/dist/react/runtime/view-runtime-context.d.ts +0 -1
  83. package/dist/react/runtime/view-runtime.d.ts +25 -3
  84. package/dist/react/types/file-types.d.ts +15 -0
  85. package/dist/react/types/host-types.d.ts +0 -1
  86. package/dist/react/types/register.d.ts +11 -4
  87. package/dist/react/types/result-types.d.ts +0 -1
  88. package/dist/resource-completion.d.ts +11 -0
  89. package/dist/resources.d.ts +72 -9
  90. package/dist/response-conversion.d.ts +25 -0
  91. package/dist/response-helpers.d.ts +223 -0
  92. package/dist/server.d.ts +166 -34
  93. package/dist/tools.d.ts +26 -15
  94. package/dist/usage.d.ts +11 -0
  95. package/dist/views/capabilities.d.ts +0 -1
  96. package/dist/views/constants.d.ts +1 -2
  97. package/dist/views/csp-env.d.ts +0 -1
  98. package/dist/views/document.d.ts +9 -11
  99. package/dist/views/index.d.ts +0 -1
  100. package/dist/views/origin.d.ts +0 -1
  101. package/dist/views/public-route.d.ts +10 -5
  102. package/dist/views/register.d.ts +1 -2
  103. package/dist/views/routes.d.ts +6 -3
  104. package/dist/views/types.d.ts +19 -15
  105. package/dist/views/wire.d.ts +14 -10
  106. package/package.json +34 -20
  107. package/dist/.tsbuildinfo +0 -1
  108. package/dist/bin/args.d.ts +0 -61
  109. package/dist/bin/args.d.ts.map +0 -1
  110. package/dist/bin/main.d.ts +0 -32
  111. package/dist/bin/main.d.ts.map +0 -1
  112. package/dist/bin/start.d.ts +0 -40
  113. package/dist/bin/start.d.ts.map +0 -1
  114. package/dist/bin.d.ts +0 -3
  115. package/dist/bin.d.ts.map +0 -1
  116. package/dist/bin.js.map +0 -1
  117. package/dist/chunk-AATFAERC.js +0 -384
  118. package/dist/chunk-AATFAERC.js.map +0 -1
  119. package/dist/chunk-AQ2ZZM2P.js +0 -193
  120. package/dist/chunk-AQ2ZZM2P.js.map +0 -1
  121. package/dist/chunk-DPL7OEXC.js +0 -518
  122. package/dist/chunk-DPL7OEXC.js.map +0 -1
  123. package/dist/chunk-IG2BCCMU.js +0 -98
  124. package/dist/chunk-IG2BCCMU.js.map +0 -1
  125. package/dist/chunk-RQRT27Q3.js +0 -454
  126. package/dist/chunk-RQRT27Q3.js.map +0 -1
  127. package/dist/chunk-SFI2T6TE.js +0 -171
  128. package/dist/chunk-SFI2T6TE.js.map +0 -1
  129. package/dist/chunk-VV2P4ZFZ.js +0 -187
  130. package/dist/chunk-VV2P4ZFZ.js.map +0 -1
  131. package/dist/chunk-XUD22N3Y.js +0 -156
  132. package/dist/chunk-XUD22N3Y.js.map +0 -1
  133. package/dist/chunk-ZMIKQPSO.js +0 -151
  134. package/dist/chunk-ZMIKQPSO.js.map +0 -1
  135. package/dist/cli/build.d.ts +0 -61
  136. package/dist/cli/build.d.ts.map +0 -1
  137. package/dist/cli/dev-api.d.ts +0 -49
  138. package/dist/cli/dev-api.d.ts.map +0 -1
  139. package/dist/cli/dev.d.ts +0 -101
  140. package/dist/cli/dev.d.ts.map +0 -1
  141. package/dist/cli/entry.d.ts +0 -31
  142. package/dist/cli/entry.d.ts.map +0 -1
  143. package/dist/cli/index.d.ts +0 -17
  144. package/dist/cli/index.d.ts.map +0 -1
  145. package/dist/cli/port.d.ts +0 -30
  146. package/dist/cli/port.d.ts.map +0 -1
  147. package/dist/cli/tunnel.d.ts +0 -46
  148. package/dist/cli/tunnel.d.ts.map +0 -1
  149. package/dist/cli/views-bindings.d.ts +0 -30
  150. package/dist/cli/views-bindings.d.ts.map +0 -1
  151. package/dist/cli/views-plugin.d.ts +0 -47
  152. package/dist/cli/views-plugin.d.ts.map +0 -1
  153. package/dist/cli/views.d.ts +0 -75
  154. package/dist/cli/views.d.ts.map +0 -1
  155. package/dist/cli/vite-config.d.ts +0 -21
  156. package/dist/cli/vite-config.d.ts.map +0 -1
  157. package/dist/cli/workspace.d.ts +0 -107
  158. package/dist/cli/workspace.d.ts.map +0 -1
  159. package/dist/commands/build.d.ts +0 -8
  160. package/dist/commands/build.d.ts.map +0 -1
  161. package/dist/commands/build.js +0 -363
  162. package/dist/commands/build.js.map +0 -1
  163. package/dist/commands/client.d.ts +0 -22
  164. package/dist/commands/client.d.ts.map +0 -1
  165. package/dist/commands/client.js +0 -14
  166. package/dist/commands/client.js.map +0 -1
  167. package/dist/commands/cloud-api.d.ts +0 -70
  168. package/dist/commands/cloud-api.d.ts.map +0 -1
  169. package/dist/commands/deploy.d.ts +0 -3
  170. package/dist/commands/deploy.d.ts.map +0 -1
  171. package/dist/commands/deploy.js +0 -242
  172. package/dist/commands/deploy.js.map +0 -1
  173. package/dist/commands/deployments.d.ts +0 -3
  174. package/dist/commands/deployments.d.ts.map +0 -1
  175. package/dist/commands/deployments.js +0 -213
  176. package/dist/commands/deployments.js.map +0 -1
  177. package/dist/commands/dev.d.ts +0 -8
  178. package/dist/commands/dev.d.ts.map +0 -1
  179. package/dist/commands/dev.js +0 -652
  180. package/dist/commands/dev.js.map +0 -1
  181. package/dist/commands/identity.d.ts +0 -3
  182. package/dist/commands/identity.d.ts.map +0 -1
  183. package/dist/commands/identity.js +0 -192
  184. package/dist/commands/identity.js.map +0 -1
  185. package/dist/commands/load-client.d.ts +0 -11
  186. package/dist/commands/load-client.d.ts.map +0 -1
  187. package/dist/commands/organizations.d.ts +0 -3
  188. package/dist/commands/organizations.d.ts.map +0 -1
  189. package/dist/commands/organizations.js +0 -97
  190. package/dist/commands/organizations.js.map +0 -1
  191. package/dist/commands/screenshot.d.ts +0 -3
  192. package/dist/commands/screenshot.d.ts.map +0 -1
  193. package/dist/commands/screenshot.js +0 -463
  194. package/dist/commands/screenshot.js.map +0 -1
  195. package/dist/commands/servers.d.ts +0 -3
  196. package/dist/commands/servers.d.ts.map +0 -1
  197. package/dist/commands/servers.js +0 -278
  198. package/dist/commands/servers.js.map +0 -1
  199. package/dist/commands/shared.d.ts +0 -44
  200. package/dist/commands/shared.d.ts.map +0 -1
  201. package/dist/commands/skills.d.ts +0 -3
  202. package/dist/commands/skills.d.ts.map +0 -1
  203. package/dist/commands/skills.js +0 -84
  204. package/dist/commands/skills.js.map +0 -1
  205. package/dist/commands/start.d.ts +0 -8
  206. package/dist/commands/start.d.ts.map +0 -1
  207. package/dist/commands/start.js +0 -72
  208. package/dist/commands/start.js.map +0 -1
  209. package/dist/completable.d.ts.map +0 -1
  210. package/dist/config.d.ts.map +0 -1
  211. package/dist/context.d.ts.map +0 -1
  212. package/dist/fetch-app.d.ts.map +0 -1
  213. package/dist/index.d.ts.map +0 -1
  214. package/dist/index.js.map +0 -1
  215. package/dist/inspector-shell.d.ts +0 -81
  216. package/dist/inspector-shell.d.ts.map +0 -1
  217. package/dist/logging.d.ts.map +0 -1
  218. package/dist/mount-mcp.d.ts.map +0 -1
  219. package/dist/node-bridge.d.ts.map +0 -1
  220. package/dist/node-bridge.js.map +0 -1
  221. package/dist/oauth/adapters.d.ts.map +0 -1
  222. package/dist/oauth/auth0.d.ts.map +0 -1
  223. package/dist/oauth/auth0.js.map +0 -1
  224. package/dist/oauth/clerk.d.ts.map +0 -1
  225. package/dist/oauth/clerk.js.map +0 -1
  226. package/dist/oauth/guards.d.ts.map +0 -1
  227. package/dist/oauth/index.d.ts.map +0 -1
  228. package/dist/oauth/index.js.map +0 -1
  229. package/dist/oauth/internal.d.ts.map +0 -1
  230. package/dist/oauth/jwt.d.ts.map +0 -1
  231. package/dist/oauth/keycloak.d.ts.map +0 -1
  232. package/dist/oauth/keycloak.js.map +0 -1
  233. package/dist/oauth/provider.d.ts.map +0 -1
  234. package/dist/oauth/supabase.d.ts.map +0 -1
  235. package/dist/oauth/supabase.js.map +0 -1
  236. package/dist/oauth/workos.d.ts.map +0 -1
  237. package/dist/oauth/workos.js.map +0 -1
  238. package/dist/openapi/index.d.ts.map +0 -1
  239. package/dist/openapi/index.js.map +0 -1
  240. package/dist/openapi/types.d.ts.map +0 -1
  241. package/dist/prompts.d.ts.map +0 -1
  242. package/dist/public-route-7IK5D7V7.js +0 -60
  243. package/dist/public-route-7IK5D7V7.js.map +0 -1
  244. package/dist/react/components/error-boundary.d.ts.map +0 -1
  245. package/dist/react/components/image.d.ts.map +0 -1
  246. package/dist/react/components/model-context.d.ts.map +0 -1
  247. package/dist/react/components/theme-provider.d.ts.map +0 -1
  248. package/dist/react/components/view-controls.d.ts.map +0 -1
  249. package/dist/react/hooks/use-call-tool.d.ts.map +0 -1
  250. package/dist/react/hooks/use-display-mode.d.ts.map +0 -1
  251. package/dist/react/hooks/use-host-context.d.ts.map +0 -1
  252. package/dist/react/hooks/use-open-external.d.ts.map +0 -1
  253. package/dist/react/hooks/use-send-follow-up.d.ts.map +0 -1
  254. package/dist/react/hooks/use-send-size-changed.d.ts.map +0 -1
  255. package/dist/react/hooks/use-tool-context.d.ts.map +0 -1
  256. package/dist/react/hooks/use-view-theme.d.ts.map +0 -1
  257. package/dist/react/hooks/use-view-tool.d.ts.map +0 -1
  258. package/dist/react/index.d.ts.map +0 -1
  259. package/dist/react/index.js.map +0 -1
  260. package/dist/react/public-assets.d.ts.map +0 -1
  261. package/dist/react/runtime/bootstrap-view.d.ts.map +0 -1
  262. package/dist/react/runtime/model-context-store.d.ts.map +0 -1
  263. package/dist/react/runtime/view-config.d.ts.map +0 -1
  264. package/dist/react/runtime/view-runtime-context.d.ts.map +0 -1
  265. package/dist/react/runtime/view-runtime.d.ts.map +0 -1
  266. package/dist/react/types/host-types.d.ts.map +0 -1
  267. package/dist/react/types/register.d.ts.map +0 -1
  268. package/dist/react/types/result-types.d.ts.map +0 -1
  269. package/dist/resources.d.ts.map +0 -1
  270. package/dist/server.d.ts.map +0 -1
  271. package/dist/tools.d.ts.map +0 -1
  272. package/dist/views/capabilities.d.ts.map +0 -1
  273. package/dist/views/constants.d.ts.map +0 -1
  274. package/dist/views/csp-env.d.ts.map +0 -1
  275. package/dist/views/document.d.ts.map +0 -1
  276. package/dist/views/index.d.ts.map +0 -1
  277. package/dist/views/origin.d.ts.map +0 -1
  278. package/dist/views/public-route.d.ts.map +0 -1
  279. package/dist/views/register.d.ts.map +0 -1
  280. package/dist/views/routes.d.ts.map +0 -1
  281. package/dist/views/types.d.ts.map +0 -1
  282. package/dist/views/wire.d.ts.map +0 -1
  283. package/node_modules/@modelcontextprotocol/client/LICENSE +0 -216
  284. package/node_modules/@modelcontextprotocol/client/README.md +0 -26
  285. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-Asx17_Co.mjs +0 -7069
  286. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-Asx17_Co.mjs.map +0 -1
  287. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-B7GnTXYx.d.mts +0 -1054
  288. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-B7GnTXYx.d.mts.map +0 -1
  289. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-B_4czhCS.d.cts +0 -1054
  290. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-B_4czhCS.d.cts.map +0 -1
  291. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-DNzBrkxq.cjs +0 -7086
  292. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-DNzBrkxq.cjs.map +0 -1
  293. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-D9GAttn8.d.cts +0 -59
  294. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-D9GAttn8.d.cts.map +0 -1
  295. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-DbU8BxXO.mjs +0 -970
  296. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-DbU8BxXO.mjs.map +0 -1
  297. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-Djgwc46-.cjs +0 -976
  298. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-Djgwc46-.cjs.map +0 -1
  299. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-Xtj52JOa.d.mts +0 -59
  300. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-Xtj52JOa.d.mts.map +0 -1
  301. package/node_modules/@modelcontextprotocol/client/dist/chunk-Bnu9O96Y.cjs +0 -60
  302. package/node_modules/@modelcontextprotocol/client/dist/chunk-Br0eD_fh.mjs +0 -42
  303. package/node_modules/@modelcontextprotocol/client/dist/index-ZagFkUbt.d.mts +0 -2675
  304. package/node_modules/@modelcontextprotocol/client/dist/index-ZagFkUbt.d.mts.map +0 -1
  305. package/node_modules/@modelcontextprotocol/client/dist/index-gN3EXmil.d.cts +0 -2678
  306. package/node_modules/@modelcontextprotocol/client/dist/index-gN3EXmil.d.cts.map +0 -1
  307. package/node_modules/@modelcontextprotocol/client/dist/index.cjs +0 -5427
  308. package/node_modules/@modelcontextprotocol/client/dist/index.cjs.map +0 -1
  309. package/node_modules/@modelcontextprotocol/client/dist/index.d.cts +0 -3196
  310. package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +0 -1
  311. package/node_modules/@modelcontextprotocol/client/dist/index.d.mts +0 -3196
  312. package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +0 -1
  313. package/node_modules/@modelcontextprotocol/client/dist/index.mjs +0 -5224
  314. package/node_modules/@modelcontextprotocol/client/dist/index.mjs.map +0 -1
  315. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.cjs +0 -14
  316. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.cjs.map +0 -1
  317. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.cts +0 -13
  318. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.cts.map +0 -1
  319. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.mts +0 -13
  320. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.mts.map +0 -1
  321. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.mjs +0 -13
  322. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.mjs.map +0 -1
  323. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.cjs +0 -14
  324. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.cjs.map +0 -1
  325. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.cts +0 -13
  326. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.cts.map +0 -1
  327. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.mts +0 -13
  328. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.mts.map +0 -1
  329. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.mjs +0 -13
  330. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.mjs.map +0 -1
  331. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +0 -21
  332. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs.map +0 -1
  333. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.cts +0 -13
  334. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.cts.map +0 -1
  335. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.mts +0 -13
  336. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.mts.map +0 -1
  337. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +0 -20
  338. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs.map +0 -1
  339. package/node_modules/@modelcontextprotocol/client/dist/src-BzzZSQyL.cjs +0 -7331
  340. package/node_modules/@modelcontextprotocol/client/dist/src-BzzZSQyL.cjs.map +0 -1
  341. package/node_modules/@modelcontextprotocol/client/dist/src-DGeA9On3.mjs +0 -6963
  342. package/node_modules/@modelcontextprotocol/client/dist/src-DGeA9On3.mjs.map +0 -1
  343. package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +0 -181
  344. package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs.map +0 -1
  345. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts +0 -87
  346. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts.map +0 -1
  347. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts +0 -87
  348. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts.map +0 -1
  349. package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +0 -176
  350. package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs.map +0 -1
  351. package/node_modules/@modelcontextprotocol/client/dist/types-BDNQEPSs.d.mts +0 -1099
  352. package/node_modules/@modelcontextprotocol/client/dist/types-BDNQEPSs.d.mts.map +0 -1
  353. package/node_modules/@modelcontextprotocol/client/dist/types-DsbMXNFL.d.cts +0 -1099
  354. package/node_modules/@modelcontextprotocol/client/dist/types-DsbMXNFL.d.cts.map +0 -1
  355. package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.cjs +0 -5
  356. package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.d.cts +0 -2
  357. package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.d.mts +0 -2
  358. package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.mjs +0 -3
  359. package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.cjs +0 -3
  360. package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.d.cts +0 -2
  361. package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.d.mts +0 -2
  362. package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.mjs +0 -3
  363. package/node_modules/@modelcontextprotocol/client/package.json +0 -166
  364. package/node_modules/@modelcontextprotocol/core/LICENSE +0 -216
  365. package/node_modules/@modelcontextprotocol/core/README.md +0 -40
  366. package/node_modules/@modelcontextprotocol/core/dist/auth-BUWfrB3C.d.cts +0 -8198
  367. package/node_modules/@modelcontextprotocol/core/dist/auth-BUWfrB3C.d.cts.map +0 -1
  368. package/node_modules/@modelcontextprotocol/core/dist/auth-CEFpHq32.cjs +0 -2862
  369. package/node_modules/@modelcontextprotocol/core/dist/auth-CEFpHq32.cjs.map +0 -1
  370. package/node_modules/@modelcontextprotocol/core/dist/auth-CNbu4K4a.d.mts +0 -8198
  371. package/node_modules/@modelcontextprotocol/core/dist/auth-CNbu4K4a.d.mts.map +0 -1
  372. package/node_modules/@modelcontextprotocol/core/dist/auth-DFgbUATV.mjs +0 -1653
  373. package/node_modules/@modelcontextprotocol/core/dist/auth-DFgbUATV.mjs.map +0 -1
  374. package/node_modules/@modelcontextprotocol/core/dist/index.cjs +0 -174
  375. package/node_modules/@modelcontextprotocol/core/dist/index.d.cts +0 -2
  376. package/node_modules/@modelcontextprotocol/core/dist/index.d.mts +0 -2
  377. package/node_modules/@modelcontextprotocol/core/dist/index.mjs +0 -3
  378. package/node_modules/@modelcontextprotocol/core/dist/internal.cjs +0 -199
  379. package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts +0 -87
  380. package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts.map +0 -1
  381. package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts +0 -87
  382. package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts.map +0 -1
  383. package/node_modules/@modelcontextprotocol/core/dist/internal.mjs +0 -3
  384. package/node_modules/@modelcontextprotocol/core/package.json +0 -85
  385. package/node_modules/jose/LICENSE.md +0 -21
  386. package/node_modules/jose/README.md +0 -153
  387. package/node_modules/jose/dist/types/index.d.ts +0 -55
  388. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +0 -31
  389. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +0 -65
  390. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +0 -31
  391. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +0 -83
  392. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +0 -31
  393. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +0 -74
  394. package/node_modules/jose/dist/types/jwk/embedded.d.ts +0 -17
  395. package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +0 -32
  396. package/node_modules/jose/dist/types/jwks/local.d.ts +0 -29
  397. package/node_modules/jose/dist/types/jwks/remote.d.ts +0 -237
  398. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +0 -36
  399. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +0 -33
  400. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +0 -42
  401. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +0 -33
  402. package/node_modules/jose/dist/types/jws/general/sign.d.ts +0 -53
  403. package/node_modules/jose/dist/types/jws/general/verify.d.ts +0 -33
  404. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +0 -35
  405. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +0 -91
  406. package/node_modules/jose/dist/types/jwt/sign.d.ts +0 -43
  407. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +0 -43
  408. package/node_modules/jose/dist/types/jwt/verify.d.ts +0 -37
  409. package/node_modules/jose/dist/types/key/export.d.ts +0 -33
  410. package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +0 -47
  411. package/node_modules/jose/dist/types/key/generate_secret.d.ts +0 -35
  412. package/node_modules/jose/dist/types/key/import.d.ts +0 -83
  413. package/node_modules/jose/dist/types/types.d.ts +0 -841
  414. package/node_modules/jose/dist/types/util/base64url.d.ts +0 -9
  415. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +0 -18
  416. package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +0 -17
  417. package/node_modules/jose/dist/types/util/errors.d.ts +0 -213
  418. package/node_modules/jose/dist/webapi/index.js +0 -32
  419. package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +0 -27
  420. package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +0 -27
  421. package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +0 -165
  422. package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +0 -169
  423. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +0 -31
  424. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +0 -187
  425. package/node_modules/jose/dist/webapi/jwk/embedded.js +0 -17
  426. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +0 -68
  427. package/node_modules/jose/dist/webapi/jwks/local.js +0 -119
  428. package/node_modules/jose/dist/webapi/jwks/remote.js +0 -179
  429. package/node_modules/jose/dist/webapi/jws/compact/sign.js +0 -18
  430. package/node_modules/jose/dist/webapi/jws/compact/verify.js +0 -21
  431. package/node_modules/jose/dist/webapi/jws/flattened/sign.js +0 -92
  432. package/node_modules/jose/dist/webapi/jws/flattened/verify.js +0 -120
  433. package/node_modules/jose/dist/webapi/jws/general/sign.js +0 -73
  434. package/node_modules/jose/dist/webapi/jws/general/verify.js +0 -24
  435. package/node_modules/jose/dist/webapi/jwt/decrypt.js +0 -23
  436. package/node_modules/jose/dist/webapi/jwt/encrypt.js +0 -108
  437. package/node_modules/jose/dist/webapi/jwt/sign.js +0 -52
  438. package/node_modules/jose/dist/webapi/jwt/unsecured.js +0 -63
  439. package/node_modules/jose/dist/webapi/jwt/verify.js +0 -15
  440. package/node_modules/jose/dist/webapi/key/export.js +0 -11
  441. package/node_modules/jose/dist/webapi/key/generate_key_pair.js +0 -97
  442. package/node_modules/jose/dist/webapi/key/generate_secret.js +0 -40
  443. package/node_modules/jose/dist/webapi/key/import.js +0 -57
  444. package/node_modules/jose/dist/webapi/lib/aesgcmkw.js +0 -16
  445. package/node_modules/jose/dist/webapi/lib/aeskw.js +0 -25
  446. package/node_modules/jose/dist/webapi/lib/asn1.js +0 -243
  447. package/node_modules/jose/dist/webapi/lib/base64.js +0 -22
  448. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +0 -43
  449. package/node_modules/jose/dist/webapi/lib/cek.js +0 -19
  450. package/node_modules/jose/dist/webapi/lib/check_cek_length.js +0 -7
  451. package/node_modules/jose/dist/webapi/lib/check_iv_length.js +0 -7
  452. package/node_modules/jose/dist/webapi/lib/check_key_length.js +0 -8
  453. package/node_modules/jose/dist/webapi/lib/check_key_type.js +0 -122
  454. package/node_modules/jose/dist/webapi/lib/crypto_key.js +0 -143
  455. package/node_modules/jose/dist/webapi/lib/decrypt.js +0 -106
  456. package/node_modules/jose/dist/webapi/lib/decrypt_key_management.js +0 -127
  457. package/node_modules/jose/dist/webapi/lib/digest.js +0 -4
  458. package/node_modules/jose/dist/webapi/lib/ecdhes.js +0 -52
  459. package/node_modules/jose/dist/webapi/lib/encrypt.js +0 -74
  460. package/node_modules/jose/dist/webapi/lib/encrypt_key_management.js +0 -92
  461. package/node_modules/jose/dist/webapi/lib/get_sign_verify_key.js +0 -12
  462. package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +0 -27
  463. package/node_modules/jose/dist/webapi/lib/is_disjoint.js +0 -21
  464. package/node_modules/jose/dist/webapi/lib/is_jwk.js +0 -6
  465. package/node_modules/jose/dist/webapi/lib/is_key_like.js +0 -17
  466. package/node_modules/jose/dist/webapi/lib/is_object.js +0 -14
  467. package/node_modules/jose/dist/webapi/lib/iv.js +0 -19
  468. package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +0 -109
  469. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +0 -238
  470. package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +0 -31
  471. package/node_modules/jose/dist/webapi/lib/normalize_key.js +0 -176
  472. package/node_modules/jose/dist/webapi/lib/pbes2kw.js +0 -39
  473. package/node_modules/jose/dist/webapi/lib/private_symbols.js +0 -1
  474. package/node_modules/jose/dist/webapi/lib/rsaes.js +0 -24
  475. package/node_modules/jose/dist/webapi/lib/sign.js +0 -9
  476. package/node_modules/jose/dist/webapi/lib/subtle_dsa.js +0 -31
  477. package/node_modules/jose/dist/webapi/lib/validate_algorithms.js +0 -10
  478. package/node_modules/jose/dist/webapi/lib/validate_crit.js +0 -33
  479. package/node_modules/jose/dist/webapi/lib/verify.js +0 -14
  480. package/node_modules/jose/dist/webapi/util/base64url.js +0 -30
  481. package/node_modules/jose/dist/webapi/util/decode_jwt.js +0 -32
  482. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +0 -34
  483. package/node_modules/jose/dist/webapi/util/errors.js +0 -99
  484. package/node_modules/jose/package.json +0 -200
  485. package/node_modules/zod/LICENSE +0 -21
  486. package/node_modules/zod/README.md +0 -191
  487. package/node_modules/zod/index.cjs +0 -33
  488. package/node_modules/zod/index.d.cts +0 -4
  489. package/node_modules/zod/index.d.ts +0 -4
  490. package/node_modules/zod/index.js +0 -4
  491. package/node_modules/zod/locales/index.cjs +0 -17
  492. package/node_modules/zod/locales/index.d.cts +0 -1
  493. package/node_modules/zod/locales/index.d.ts +0 -1
  494. package/node_modules/zod/locales/index.js +0 -1
  495. package/node_modules/zod/locales/package.json +0 -7
  496. package/node_modules/zod/mini/index.cjs +0 -32
  497. package/node_modules/zod/mini/index.d.cts +0 -3
  498. package/node_modules/zod/mini/index.d.ts +0 -3
  499. package/node_modules/zod/mini/index.js +0 -3
  500. package/node_modules/zod/mini/package.json +0 -7
  501. package/node_modules/zod/package.json +0 -135
  502. package/node_modules/zod/src/index.ts +0 -4
  503. package/node_modules/zod/src/locales/index.ts +0 -1
  504. package/node_modules/zod/src/mini/index.ts +0 -3
  505. package/node_modules/zod/src/v3/ZodError.ts +0 -330
  506. package/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
  507. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
  508. package/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
  509. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
  510. package/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
  511. package/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
  512. package/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
  513. package/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
  514. package/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
  515. package/node_modules/zod/src/v3/errors.ts +0 -13
  516. package/node_modules/zod/src/v3/external.ts +0 -6
  517. package/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
  518. package/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
  519. package/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
  520. package/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
  521. package/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
  522. package/node_modules/zod/src/v3/helpers/util.ts +0 -224
  523. package/node_modules/zod/src/v3/index.ts +0 -4
  524. package/node_modules/zod/src/v3/locales/en.ts +0 -124
  525. package/node_modules/zod/src/v3/standard-schema.ts +0 -113
  526. package/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
  527. package/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
  528. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
  529. package/node_modules/zod/src/v3/tests/array.test.ts +0 -71
  530. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
  531. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
  532. package/node_modules/zod/src/v3/tests/base.test.ts +0 -29
  533. package/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
  534. package/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
  535. package/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
  536. package/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
  537. package/node_modules/zod/src/v3/tests/complex.test.ts +0 -70
  538. package/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
  539. package/node_modules/zod/src/v3/tests/date.test.ts +0 -32
  540. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
  541. package/node_modules/zod/src/v3/tests/default.test.ts +0 -112
  542. package/node_modules/zod/src/v3/tests/description.test.ts +0 -33
  543. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
  544. package/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
  545. package/node_modules/zod/src/v3/tests/error.test.ts +0 -551
  546. package/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
  547. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
  548. package/node_modules/zod/src/v3/tests/function.test.ts +0 -261
  549. package/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
  550. package/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
  551. package/node_modules/zod/src/v3/tests/intersection.test.ts +0 -110
  552. package/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
  553. package/node_modules/zod/src/v3/tests/language-server.test.ts +0 -207
  554. package/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
  555. package/node_modules/zod/src/v3/tests/map.test.ts +0 -110
  556. package/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
  557. package/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
  558. package/node_modules/zod/src/v3/tests/nan.test.ts +0 -24
  559. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
  560. package/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
  561. package/node_modules/zod/src/v3/tests/number.test.ts +0 -176
  562. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
  563. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
  564. package/node_modules/zod/src/v3/tests/object.test.ts +0 -434
  565. package/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
  566. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
  567. package/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
  568. package/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
  569. package/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
  570. package/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
  571. package/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
  572. package/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
  573. package/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
  574. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -194
  575. package/node_modules/zod/src/v3/tests/record.test.ts +0 -171
  576. package/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
  577. package/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
  578. package/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
  579. package/node_modules/zod/src/v3/tests/set.test.ts +0 -142
  580. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
  581. package/node_modules/zod/src/v3/tests/string.test.ts +0 -916
  582. package/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
  583. package/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
  584. package/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
  585. package/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
  586. package/node_modules/zod/src/v3/tests/void.test.ts +0 -15
  587. package/node_modules/zod/src/v3/types.ts +0 -5138
  588. package/node_modules/zod/src/v4/classic/checks.ts +0 -32
  589. package/node_modules/zod/src/v4/classic/coerce.ts +0 -27
  590. package/node_modules/zod/src/v4/classic/compat.ts +0 -70
  591. package/node_modules/zod/src/v4/classic/errors.ts +0 -82
  592. package/node_modules/zod/src/v4/classic/external.ts +0 -52
  593. package/node_modules/zod/src/v4/classic/from-json-schema.ts +0 -659
  594. package/node_modules/zod/src/v4/classic/index.ts +0 -5
  595. package/node_modules/zod/src/v4/classic/iso.ts +0 -90
  596. package/node_modules/zod/src/v4/classic/parse.ts +0 -82
  597. package/node_modules/zod/src/v4/classic/schemas.ts +0 -2672
  598. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
  599. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +0 -59
  600. package/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
  601. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -216
  602. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
  603. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
  604. package/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
  605. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
  606. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -106
  607. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -326
  608. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
  609. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +0 -573
  610. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +0 -703
  611. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
  612. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -374
  613. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
  614. package/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -62
  615. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -302
  616. package/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -409
  617. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +0 -27
  618. package/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
  619. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +0 -197
  620. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -694
  621. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
  622. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -807
  623. package/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
  624. package/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -96
  625. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -179
  626. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +0 -26
  627. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +0 -895
  628. package/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -360
  629. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
  630. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +0 -39
  631. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +0 -68
  632. package/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -939
  633. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -60
  634. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -198
  635. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +0 -46
  636. package/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -109
  637. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
  638. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -117
  639. package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +0 -29
  640. package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +0 -24
  641. package/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -330
  642. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
  643. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
  644. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -101
  645. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
  646. package/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -325
  647. package/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -717
  648. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -333
  649. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -450
  650. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -211
  651. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -101
  652. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -74
  653. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +0 -26
  654. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -351
  655. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
  656. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
  657. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
  658. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
  659. package/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -717
  660. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -631
  661. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -633
  662. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -243
  663. package/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -181
  664. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -134
  665. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -125
  666. package/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -1224
  667. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -106
  668. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -771
  669. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +0 -438
  670. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -3125
  671. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -378
  672. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -496
  673. package/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -273
  674. package/node_modules/zod/src/v4/classic/tests/url.test.ts +0 -13
  675. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
  676. package/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
  677. package/node_modules/zod/src/v4/core/api.ts +0 -1823
  678. package/node_modules/zod/src/v4/core/checks.ts +0 -1293
  679. package/node_modules/zod/src/v4/core/config.ts +0 -15
  680. package/node_modules/zod/src/v4/core/core.ts +0 -153
  681. package/node_modules/zod/src/v4/core/doc.ts +0 -44
  682. package/node_modules/zod/src/v4/core/errors.ts +0 -455
  683. package/node_modules/zod/src/v4/core/index.ts +0 -16
  684. package/node_modules/zod/src/v4/core/json-schema-generator.ts +0 -126
  685. package/node_modules/zod/src/v4/core/json-schema-processors.ts +0 -666
  686. package/node_modules/zod/src/v4/core/json-schema.ts +0 -147
  687. package/node_modules/zod/src/v4/core/parse.ts +0 -195
  688. package/node_modules/zod/src/v4/core/regexes.ts +0 -190
  689. package/node_modules/zod/src/v4/core/registries.ts +0 -105
  690. package/node_modules/zod/src/v4/core/schemas.ts +0 -4730
  691. package/node_modules/zod/src/v4/core/standard-schema.ts +0 -159
  692. package/node_modules/zod/src/v4/core/tests/extend.test.ts +0 -59
  693. package/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
  694. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
  695. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +0 -215
  696. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
  697. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +0 -181
  698. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +0 -72
  699. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +0 -379
  700. package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +0 -163
  701. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +0 -46
  702. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
  703. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
  704. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +0 -105
  705. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +0 -125
  706. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +0 -45
  707. package/node_modules/zod/src/v4/core/to-json-schema.ts +0 -622
  708. package/node_modules/zod/src/v4/core/util.ts +0 -983
  709. package/node_modules/zod/src/v4/core/versions.ts +0 -5
  710. package/node_modules/zod/src/v4/core/zsf.ts +0 -323
  711. package/node_modules/zod/src/v4/index.ts +0 -4
  712. package/node_modules/zod/src/v4/locales/ar.ts +0 -115
  713. package/node_modules/zod/src/v4/locales/az.ts +0 -111
  714. package/node_modules/zod/src/v4/locales/be.ts +0 -176
  715. package/node_modules/zod/src/v4/locales/bg.ts +0 -128
  716. package/node_modules/zod/src/v4/locales/ca.ts +0 -116
  717. package/node_modules/zod/src/v4/locales/cs.ts +0 -118
  718. package/node_modules/zod/src/v4/locales/da.ts +0 -123
  719. package/node_modules/zod/src/v4/locales/de.ts +0 -116
  720. package/node_modules/zod/src/v4/locales/el.ts +0 -121
  721. package/node_modules/zod/src/v4/locales/en.ts +0 -123
  722. package/node_modules/zod/src/v4/locales/eo.ts +0 -118
  723. package/node_modules/zod/src/v4/locales/es.ts +0 -141
  724. package/node_modules/zod/src/v4/locales/fa.ts +0 -126
  725. package/node_modules/zod/src/v4/locales/fi.ts +0 -121
  726. package/node_modules/zod/src/v4/locales/fr-CA.ts +0 -116
  727. package/node_modules/zod/src/v4/locales/fr.ts +0 -132
  728. package/node_modules/zod/src/v4/locales/he.ts +0 -246
  729. package/node_modules/zod/src/v4/locales/hr.ts +0 -131
  730. package/node_modules/zod/src/v4/locales/hu.ts +0 -117
  731. package/node_modules/zod/src/v4/locales/hy.ts +0 -164
  732. package/node_modules/zod/src/v4/locales/id.ts +0 -115
  733. package/node_modules/zod/src/v4/locales/index.ts +0 -52
  734. package/node_modules/zod/src/v4/locales/is.ts +0 -119
  735. package/node_modules/zod/src/v4/locales/it.ts +0 -116
  736. package/node_modules/zod/src/v4/locales/ja.ts +0 -114
  737. package/node_modules/zod/src/v4/locales/ka.ts +0 -123
  738. package/node_modules/zod/src/v4/locales/kh.ts +0 -7
  739. package/node_modules/zod/src/v4/locales/km.ts +0 -119
  740. package/node_modules/zod/src/v4/locales/ko.ts +0 -121
  741. package/node_modules/zod/src/v4/locales/lt.ts +0 -239
  742. package/node_modules/zod/src/v4/locales/mk.ts +0 -118
  743. package/node_modules/zod/src/v4/locales/ms.ts +0 -115
  744. package/node_modules/zod/src/v4/locales/nl.ts +0 -121
  745. package/node_modules/zod/src/v4/locales/no.ts +0 -116
  746. package/node_modules/zod/src/v4/locales/ota.ts +0 -117
  747. package/node_modules/zod/src/v4/locales/pl.ts +0 -118
  748. package/node_modules/zod/src/v4/locales/ps.ts +0 -126
  749. package/node_modules/zod/src/v4/locales/pt.ts +0 -116
  750. package/node_modules/zod/src/v4/locales/ro.ts +0 -129
  751. package/node_modules/zod/src/v4/locales/ru.ts +0 -176
  752. package/node_modules/zod/src/v4/locales/sl.ts +0 -118
  753. package/node_modules/zod/src/v4/locales/sv.ts +0 -119
  754. package/node_modules/zod/src/v4/locales/ta.ts +0 -118
  755. package/node_modules/zod/src/v4/locales/th.ts +0 -119
  756. package/node_modules/zod/src/v4/locales/tr.ts +0 -111
  757. package/node_modules/zod/src/v4/locales/ua.ts +0 -7
  758. package/node_modules/zod/src/v4/locales/uk.ts +0 -117
  759. package/node_modules/zod/src/v4/locales/ur.ts +0 -119
  760. package/node_modules/zod/src/v4/locales/uz.ts +0 -117
  761. package/node_modules/zod/src/v4/locales/vi.ts +0 -117
  762. package/node_modules/zod/src/v4/locales/yo.ts +0 -124
  763. package/node_modules/zod/src/v4/locales/zh-CN.ts +0 -116
  764. package/node_modules/zod/src/v4/locales/zh-TW.ts +0 -115
  765. package/node_modules/zod/src/v4/mini/checks.ts +0 -32
  766. package/node_modules/zod/src/v4/mini/coerce.ts +0 -27
  767. package/node_modules/zod/src/v4/mini/external.ts +0 -41
  768. package/node_modules/zod/src/v4/mini/index.ts +0 -3
  769. package/node_modules/zod/src/v4/mini/iso.ts +0 -66
  770. package/node_modules/zod/src/v4/mini/parse.ts +0 -14
  771. package/node_modules/zod/src/v4/mini/schemas.ts +0 -1947
  772. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +0 -24
  773. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
  774. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -94
  775. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
  776. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +0 -548
  777. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
  778. package/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
  779. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -5
  780. package/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -993
  781. package/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
  782. package/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -227
  783. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
  784. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -325
  785. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +0 -50
  786. package/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -352
  787. package/node_modules/zod/src/v4-mini/index.ts +0 -3
  788. package/node_modules/zod/v3/ZodError.cjs +0 -138
  789. package/node_modules/zod/v3/ZodError.d.cts +0 -164
  790. package/node_modules/zod/v3/ZodError.d.ts +0 -164
  791. package/node_modules/zod/v3/ZodError.js +0 -133
  792. package/node_modules/zod/v3/errors.cjs +0 -17
  793. package/node_modules/zod/v3/errors.d.cts +0 -5
  794. package/node_modules/zod/v3/errors.d.ts +0 -5
  795. package/node_modules/zod/v3/errors.js +0 -9
  796. package/node_modules/zod/v3/external.cjs +0 -22
  797. package/node_modules/zod/v3/external.d.cts +0 -6
  798. package/node_modules/zod/v3/external.d.ts +0 -6
  799. package/node_modules/zod/v3/external.js +0 -6
  800. package/node_modules/zod/v3/helpers/enumUtil.cjs +0 -2
  801. package/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
  802. package/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
  803. package/node_modules/zod/v3/helpers/enumUtil.js +0 -1
  804. package/node_modules/zod/v3/helpers/errorUtil.cjs +0 -9
  805. package/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
  806. package/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
  807. package/node_modules/zod/v3/helpers/errorUtil.js +0 -6
  808. package/node_modules/zod/v3/helpers/parseUtil.cjs +0 -124
  809. package/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
  810. package/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
  811. package/node_modules/zod/v3/helpers/parseUtil.js +0 -109
  812. package/node_modules/zod/v3/helpers/partialUtil.cjs +0 -2
  813. package/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
  814. package/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
  815. package/node_modules/zod/v3/helpers/partialUtil.js +0 -1
  816. package/node_modules/zod/v3/helpers/typeAliases.cjs +0 -2
  817. package/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
  818. package/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
  819. package/node_modules/zod/v3/helpers/typeAliases.js +0 -1
  820. package/node_modules/zod/v3/helpers/util.cjs +0 -137
  821. package/node_modules/zod/v3/helpers/util.d.cts +0 -85
  822. package/node_modules/zod/v3/helpers/util.d.ts +0 -85
  823. package/node_modules/zod/v3/helpers/util.js +0 -133
  824. package/node_modules/zod/v3/index.cjs +0 -33
  825. package/node_modules/zod/v3/index.d.cts +0 -4
  826. package/node_modules/zod/v3/index.d.ts +0 -4
  827. package/node_modules/zod/v3/index.js +0 -4
  828. package/node_modules/zod/v3/locales/en.cjs +0 -112
  829. package/node_modules/zod/v3/locales/en.d.cts +0 -3
  830. package/node_modules/zod/v3/locales/en.d.ts +0 -3
  831. package/node_modules/zod/v3/locales/en.js +0 -109
  832. package/node_modules/zod/v3/package.json +0 -7
  833. package/node_modules/zod/v3/standard-schema.cjs +0 -2
  834. package/node_modules/zod/v3/standard-schema.d.cts +0 -102
  835. package/node_modules/zod/v3/standard-schema.d.ts +0 -102
  836. package/node_modules/zod/v3/standard-schema.js +0 -1
  837. package/node_modules/zod/v3/types.cjs +0 -3777
  838. package/node_modules/zod/v3/types.d.cts +0 -1034
  839. package/node_modules/zod/v3/types.d.ts +0 -1034
  840. package/node_modules/zod/v3/types.js +0 -3695
  841. package/node_modules/zod/v4/classic/checks.cjs +0 -33
  842. package/node_modules/zod/v4/classic/checks.d.cts +0 -1
  843. package/node_modules/zod/v4/classic/checks.d.ts +0 -1
  844. package/node_modules/zod/v4/classic/checks.js +0 -1
  845. package/node_modules/zod/v4/classic/coerce.cjs +0 -47
  846. package/node_modules/zod/v4/classic/coerce.d.cts +0 -17
  847. package/node_modules/zod/v4/classic/coerce.d.ts +0 -17
  848. package/node_modules/zod/v4/classic/coerce.js +0 -17
  849. package/node_modules/zod/v4/classic/compat.cjs +0 -61
  850. package/node_modules/zod/v4/classic/compat.d.cts +0 -50
  851. package/node_modules/zod/v4/classic/compat.d.ts +0 -50
  852. package/node_modules/zod/v4/classic/compat.js +0 -31
  853. package/node_modules/zod/v4/classic/errors.cjs +0 -74
  854. package/node_modules/zod/v4/classic/errors.d.cts +0 -30
  855. package/node_modules/zod/v4/classic/errors.d.ts +0 -30
  856. package/node_modules/zod/v4/classic/errors.js +0 -48
  857. package/node_modules/zod/v4/classic/external.cjs +0 -73
  858. package/node_modules/zod/v4/classic/external.d.cts +0 -16
  859. package/node_modules/zod/v4/classic/external.d.ts +0 -16
  860. package/node_modules/zod/v4/classic/external.js +0 -20
  861. package/node_modules/zod/v4/classic/from-json-schema.cjs +0 -625
  862. package/node_modules/zod/v4/classic/from-json-schema.d.cts +0 -12
  863. package/node_modules/zod/v4/classic/from-json-schema.d.ts +0 -12
  864. package/node_modules/zod/v4/classic/from-json-schema.js +0 -599
  865. package/node_modules/zod/v4/classic/index.cjs +0 -33
  866. package/node_modules/zod/v4/classic/index.d.cts +0 -4
  867. package/node_modules/zod/v4/classic/index.d.ts +0 -4
  868. package/node_modules/zod/v4/classic/index.js +0 -4
  869. package/node_modules/zod/v4/classic/iso.cjs +0 -60
  870. package/node_modules/zod/v4/classic/iso.d.cts +0 -22
  871. package/node_modules/zod/v4/classic/iso.d.ts +0 -22
  872. package/node_modules/zod/v4/classic/iso.js +0 -30
  873. package/node_modules/zod/v4/classic/package.json +0 -7
  874. package/node_modules/zod/v4/classic/parse.cjs +0 -41
  875. package/node_modules/zod/v4/classic/parse.d.cts +0 -31
  876. package/node_modules/zod/v4/classic/parse.d.ts +0 -31
  877. package/node_modules/zod/v4/classic/parse.js +0 -15
  878. package/node_modules/zod/v4/classic/schemas.cjs +0 -1511
  879. package/node_modules/zod/v4/classic/schemas.d.cts +0 -767
  880. package/node_modules/zod/v4/classic/schemas.d.ts +0 -767
  881. package/node_modules/zod/v4/classic/schemas.js +0 -1395
  882. package/node_modules/zod/v4/core/api.cjs +0 -1227
  883. package/node_modules/zod/v4/core/api.d.cts +0 -325
  884. package/node_modules/zod/v4/core/api.d.ts +0 -325
  885. package/node_modules/zod/v4/core/api.js +0 -1087
  886. package/node_modules/zod/v4/core/checks.cjs +0 -601
  887. package/node_modules/zod/v4/core/checks.d.cts +0 -278
  888. package/node_modules/zod/v4/core/checks.d.ts +0 -278
  889. package/node_modules/zod/v4/core/checks.js +0 -575
  890. package/node_modules/zod/v4/core/core.cjs +0 -85
  891. package/node_modules/zod/v4/core/core.d.cts +0 -70
  892. package/node_modules/zod/v4/core/core.d.ts +0 -70
  893. package/node_modules/zod/v4/core/core.js +0 -78
  894. package/node_modules/zod/v4/core/doc.cjs +0 -39
  895. package/node_modules/zod/v4/core/doc.d.cts +0 -14
  896. package/node_modules/zod/v4/core/doc.d.ts +0 -14
  897. package/node_modules/zod/v4/core/doc.js +0 -35
  898. package/node_modules/zod/v4/core/errors.cjs +0 -216
  899. package/node_modules/zod/v4/core/errors.d.cts +0 -221
  900. package/node_modules/zod/v4/core/errors.d.ts +0 -221
  901. package/node_modules/zod/v4/core/errors.js +0 -185
  902. package/node_modules/zod/v4/core/index.cjs +0 -47
  903. package/node_modules/zod/v4/core/index.d.cts +0 -16
  904. package/node_modules/zod/v4/core/index.d.ts +0 -16
  905. package/node_modules/zod/v4/core/index.js +0 -16
  906. package/node_modules/zod/v4/core/json-schema-generator.cjs +0 -99
  907. package/node_modules/zod/v4/core/json-schema-generator.d.cts +0 -65
  908. package/node_modules/zod/v4/core/json-schema-generator.d.ts +0 -65
  909. package/node_modules/zod/v4/core/json-schema-generator.js +0 -95
  910. package/node_modules/zod/v4/core/json-schema-processors.cjs +0 -644
  911. package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -49
  912. package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -49
  913. package/node_modules/zod/v4/core/json-schema-processors.js +0 -601
  914. package/node_modules/zod/v4/core/json-schema.cjs +0 -2
  915. package/node_modules/zod/v4/core/json-schema.d.cts +0 -88
  916. package/node_modules/zod/v4/core/json-schema.d.ts +0 -88
  917. package/node_modules/zod/v4/core/json-schema.js +0 -1
  918. package/node_modules/zod/v4/core/package.json +0 -7
  919. package/node_modules/zod/v4/core/parse.cjs +0 -131
  920. package/node_modules/zod/v4/core/parse.d.cts +0 -49
  921. package/node_modules/zod/v4/core/parse.d.ts +0 -49
  922. package/node_modules/zod/v4/core/parse.js +0 -93
  923. package/node_modules/zod/v4/core/regexes.cjs +0 -172
  924. package/node_modules/zod/v4/core/regexes.d.cts +0 -85
  925. package/node_modules/zod/v4/core/regexes.d.ts +0 -85
  926. package/node_modules/zod/v4/core/regexes.js +0 -139
  927. package/node_modules/zod/v4/core/registries.cjs +0 -56
  928. package/node_modules/zod/v4/core/registries.d.cts +0 -35
  929. package/node_modules/zod/v4/core/registries.d.ts +0 -35
  930. package/node_modules/zod/v4/core/registries.js +0 -51
  931. package/node_modules/zod/v4/core/schemas.cjs +0 -2270
  932. package/node_modules/zod/v4/core/schemas.d.cts +0 -1184
  933. package/node_modules/zod/v4/core/schemas.d.ts +0 -1184
  934. package/node_modules/zod/v4/core/schemas.js +0 -2239
  935. package/node_modules/zod/v4/core/standard-schema.cjs +0 -2
  936. package/node_modules/zod/v4/core/standard-schema.d.cts +0 -126
  937. package/node_modules/zod/v4/core/standard-schema.d.ts +0 -126
  938. package/node_modules/zod/v4/core/standard-schema.js +0 -1
  939. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -457
  940. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -114
  941. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -114
  942. package/node_modules/zod/v4/core/to-json-schema.js +0 -448
  943. package/node_modules/zod/v4/core/util.cjs +0 -734
  944. package/node_modules/zod/v4/core/util.d.cts +0 -200
  945. package/node_modules/zod/v4/core/util.d.ts +0 -200
  946. package/node_modules/zod/v4/core/util.js +0 -674
  947. package/node_modules/zod/v4/core/versions.cjs +0 -8
  948. package/node_modules/zod/v4/core/versions.d.cts +0 -5
  949. package/node_modules/zod/v4/core/versions.d.ts +0 -5
  950. package/node_modules/zod/v4/core/versions.js +0 -5
  951. package/node_modules/zod/v4/index.cjs +0 -22
  952. package/node_modules/zod/v4/index.d.cts +0 -3
  953. package/node_modules/zod/v4/index.d.ts +0 -3
  954. package/node_modules/zod/v4/index.js +0 -3
  955. package/node_modules/zod/v4/locales/ar.cjs +0 -133
  956. package/node_modules/zod/v4/locales/ar.d.cts +0 -5
  957. package/node_modules/zod/v4/locales/ar.d.ts +0 -4
  958. package/node_modules/zod/v4/locales/ar.js +0 -106
  959. package/node_modules/zod/v4/locales/az.cjs +0 -132
  960. package/node_modules/zod/v4/locales/az.d.cts +0 -5
  961. package/node_modules/zod/v4/locales/az.d.ts +0 -4
  962. package/node_modules/zod/v4/locales/az.js +0 -105
  963. package/node_modules/zod/v4/locales/be.cjs +0 -183
  964. package/node_modules/zod/v4/locales/be.d.cts +0 -5
  965. package/node_modules/zod/v4/locales/be.d.ts +0 -4
  966. package/node_modules/zod/v4/locales/be.js +0 -156
  967. package/node_modules/zod/v4/locales/bg.cjs +0 -147
  968. package/node_modules/zod/v4/locales/bg.d.cts +0 -5
  969. package/node_modules/zod/v4/locales/bg.d.ts +0 -4
  970. package/node_modules/zod/v4/locales/bg.js +0 -120
  971. package/node_modules/zod/v4/locales/ca.cjs +0 -134
  972. package/node_modules/zod/v4/locales/ca.d.cts +0 -5
  973. package/node_modules/zod/v4/locales/ca.d.ts +0 -4
  974. package/node_modules/zod/v4/locales/ca.js +0 -107
  975. package/node_modules/zod/v4/locales/cs.cjs +0 -138
  976. package/node_modules/zod/v4/locales/cs.d.cts +0 -5
  977. package/node_modules/zod/v4/locales/cs.d.ts +0 -4
  978. package/node_modules/zod/v4/locales/cs.js +0 -111
  979. package/node_modules/zod/v4/locales/da.cjs +0 -142
  980. package/node_modules/zod/v4/locales/da.d.cts +0 -5
  981. package/node_modules/zod/v4/locales/da.d.ts +0 -4
  982. package/node_modules/zod/v4/locales/da.js +0 -115
  983. package/node_modules/zod/v4/locales/de.cjs +0 -135
  984. package/node_modules/zod/v4/locales/de.d.cts +0 -5
  985. package/node_modules/zod/v4/locales/de.d.ts +0 -4
  986. package/node_modules/zod/v4/locales/de.js +0 -108
  987. package/node_modules/zod/v4/locales/el.cjs +0 -136
  988. package/node_modules/zod/v4/locales/el.d.cts +0 -5
  989. package/node_modules/zod/v4/locales/el.d.ts +0 -4
  990. package/node_modules/zod/v4/locales/el.js +0 -109
  991. package/node_modules/zod/v4/locales/en.cjs +0 -140
  992. package/node_modules/zod/v4/locales/en.d.cts +0 -5
  993. package/node_modules/zod/v4/locales/en.d.ts +0 -4
  994. package/node_modules/zod/v4/locales/en.js +0 -113
  995. package/node_modules/zod/v4/locales/eo.cjs +0 -136
  996. package/node_modules/zod/v4/locales/eo.d.cts +0 -5
  997. package/node_modules/zod/v4/locales/eo.d.ts +0 -4
  998. package/node_modules/zod/v4/locales/eo.js +0 -109
  999. package/node_modules/zod/v4/locales/es.cjs +0 -159
  1000. package/node_modules/zod/v4/locales/es.d.cts +0 -5
  1001. package/node_modules/zod/v4/locales/es.d.ts +0 -4
  1002. package/node_modules/zod/v4/locales/es.js +0 -132
  1003. package/node_modules/zod/v4/locales/fa.cjs +0 -141
  1004. package/node_modules/zod/v4/locales/fa.d.cts +0 -5
  1005. package/node_modules/zod/v4/locales/fa.d.ts +0 -4
  1006. package/node_modules/zod/v4/locales/fa.js +0 -114
  1007. package/node_modules/zod/v4/locales/fi.cjs +0 -139
  1008. package/node_modules/zod/v4/locales/fi.d.cts +0 -5
  1009. package/node_modules/zod/v4/locales/fi.d.ts +0 -4
  1010. package/node_modules/zod/v4/locales/fi.js +0 -112
  1011. package/node_modules/zod/v4/locales/fr-CA.cjs +0 -134
  1012. package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -5
  1013. package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  1014. package/node_modules/zod/v4/locales/fr-CA.js +0 -107
  1015. package/node_modules/zod/v4/locales/fr.cjs +0 -152
  1016. package/node_modules/zod/v4/locales/fr.d.cts +0 -5
  1017. package/node_modules/zod/v4/locales/fr.d.ts +0 -4
  1018. package/node_modules/zod/v4/locales/fr.js +0 -125
  1019. package/node_modules/zod/v4/locales/he.cjs +0 -241
  1020. package/node_modules/zod/v4/locales/he.d.cts +0 -5
  1021. package/node_modules/zod/v4/locales/he.d.ts +0 -4
  1022. package/node_modules/zod/v4/locales/he.js +0 -214
  1023. package/node_modules/zod/v4/locales/hr.cjs +0 -149
  1024. package/node_modules/zod/v4/locales/hr.d.cts +0 -5
  1025. package/node_modules/zod/v4/locales/hr.d.ts +0 -4
  1026. package/node_modules/zod/v4/locales/hr.js +0 -122
  1027. package/node_modules/zod/v4/locales/hu.cjs +0 -135
  1028. package/node_modules/zod/v4/locales/hu.d.cts +0 -5
  1029. package/node_modules/zod/v4/locales/hu.d.ts +0 -4
  1030. package/node_modules/zod/v4/locales/hu.js +0 -108
  1031. package/node_modules/zod/v4/locales/hy.cjs +0 -174
  1032. package/node_modules/zod/v4/locales/hy.d.cts +0 -5
  1033. package/node_modules/zod/v4/locales/hy.d.ts +0 -4
  1034. package/node_modules/zod/v4/locales/hy.js +0 -147
  1035. package/node_modules/zod/v4/locales/id.cjs +0 -133
  1036. package/node_modules/zod/v4/locales/id.d.cts +0 -5
  1037. package/node_modules/zod/v4/locales/id.d.ts +0 -4
  1038. package/node_modules/zod/v4/locales/id.js +0 -106
  1039. package/node_modules/zod/v4/locales/index.cjs +0 -111
  1040. package/node_modules/zod/v4/locales/index.d.cts +0 -52
  1041. package/node_modules/zod/v4/locales/index.d.ts +0 -52
  1042. package/node_modules/zod/v4/locales/index.js +0 -52
  1043. package/node_modules/zod/v4/locales/is.cjs +0 -136
  1044. package/node_modules/zod/v4/locales/is.d.cts +0 -5
  1045. package/node_modules/zod/v4/locales/is.d.ts +0 -4
  1046. package/node_modules/zod/v4/locales/is.js +0 -109
  1047. package/node_modules/zod/v4/locales/it.cjs +0 -135
  1048. package/node_modules/zod/v4/locales/it.d.cts +0 -5
  1049. package/node_modules/zod/v4/locales/it.d.ts +0 -4
  1050. package/node_modules/zod/v4/locales/it.js +0 -108
  1051. package/node_modules/zod/v4/locales/ja.cjs +0 -134
  1052. package/node_modules/zod/v4/locales/ja.d.cts +0 -5
  1053. package/node_modules/zod/v4/locales/ja.d.ts +0 -4
  1054. package/node_modules/zod/v4/locales/ja.js +0 -107
  1055. package/node_modules/zod/v4/locales/ka.cjs +0 -139
  1056. package/node_modules/zod/v4/locales/ka.d.cts +0 -5
  1057. package/node_modules/zod/v4/locales/ka.d.ts +0 -4
  1058. package/node_modules/zod/v4/locales/ka.js +0 -112
  1059. package/node_modules/zod/v4/locales/kh.cjs +0 -12
  1060. package/node_modules/zod/v4/locales/kh.d.cts +0 -5
  1061. package/node_modules/zod/v4/locales/kh.d.ts +0 -5
  1062. package/node_modules/zod/v4/locales/kh.js +0 -5
  1063. package/node_modules/zod/v4/locales/km.cjs +0 -137
  1064. package/node_modules/zod/v4/locales/km.d.cts +0 -5
  1065. package/node_modules/zod/v4/locales/km.d.ts +0 -4
  1066. package/node_modules/zod/v4/locales/km.js +0 -110
  1067. package/node_modules/zod/v4/locales/ko.cjs +0 -138
  1068. package/node_modules/zod/v4/locales/ko.d.cts +0 -5
  1069. package/node_modules/zod/v4/locales/ko.d.ts +0 -4
  1070. package/node_modules/zod/v4/locales/ko.js +0 -111
  1071. package/node_modules/zod/v4/locales/lt.cjs +0 -230
  1072. package/node_modules/zod/v4/locales/lt.d.cts +0 -5
  1073. package/node_modules/zod/v4/locales/lt.d.ts +0 -4
  1074. package/node_modules/zod/v4/locales/lt.js +0 -203
  1075. package/node_modules/zod/v4/locales/mk.cjs +0 -136
  1076. package/node_modules/zod/v4/locales/mk.d.cts +0 -5
  1077. package/node_modules/zod/v4/locales/mk.d.ts +0 -4
  1078. package/node_modules/zod/v4/locales/mk.js +0 -109
  1079. package/node_modules/zod/v4/locales/ms.cjs +0 -134
  1080. package/node_modules/zod/v4/locales/ms.d.cts +0 -5
  1081. package/node_modules/zod/v4/locales/ms.d.ts +0 -4
  1082. package/node_modules/zod/v4/locales/ms.js +0 -107
  1083. package/node_modules/zod/v4/locales/nl.cjs +0 -137
  1084. package/node_modules/zod/v4/locales/nl.d.cts +0 -5
  1085. package/node_modules/zod/v4/locales/nl.d.ts +0 -4
  1086. package/node_modules/zod/v4/locales/nl.js +0 -110
  1087. package/node_modules/zod/v4/locales/no.cjs +0 -135
  1088. package/node_modules/zod/v4/locales/no.d.cts +0 -5
  1089. package/node_modules/zod/v4/locales/no.d.ts +0 -4
  1090. package/node_modules/zod/v4/locales/no.js +0 -108
  1091. package/node_modules/zod/v4/locales/ota.cjs +0 -136
  1092. package/node_modules/zod/v4/locales/ota.d.cts +0 -5
  1093. package/node_modules/zod/v4/locales/ota.d.ts +0 -4
  1094. package/node_modules/zod/v4/locales/ota.js +0 -109
  1095. package/node_modules/zod/v4/locales/package.json +0 -7
  1096. package/node_modules/zod/v4/locales/pl.cjs +0 -136
  1097. package/node_modules/zod/v4/locales/pl.d.cts +0 -5
  1098. package/node_modules/zod/v4/locales/pl.d.ts +0 -4
  1099. package/node_modules/zod/v4/locales/pl.js +0 -109
  1100. package/node_modules/zod/v4/locales/ps.cjs +0 -141
  1101. package/node_modules/zod/v4/locales/ps.d.cts +0 -5
  1102. package/node_modules/zod/v4/locales/ps.d.ts +0 -4
  1103. package/node_modules/zod/v4/locales/ps.js +0 -114
  1104. package/node_modules/zod/v4/locales/pt.cjs +0 -135
  1105. package/node_modules/zod/v4/locales/pt.d.cts +0 -5
  1106. package/node_modules/zod/v4/locales/pt.d.ts +0 -4
  1107. package/node_modules/zod/v4/locales/pt.js +0 -108
  1108. package/node_modules/zod/v4/locales/ro.cjs +0 -146
  1109. package/node_modules/zod/v4/locales/ro.d.cts +0 -5
  1110. package/node_modules/zod/v4/locales/ro.d.ts +0 -4
  1111. package/node_modules/zod/v4/locales/ro.js +0 -119
  1112. package/node_modules/zod/v4/locales/ru.cjs +0 -183
  1113. package/node_modules/zod/v4/locales/ru.d.cts +0 -5
  1114. package/node_modules/zod/v4/locales/ru.d.ts +0 -4
  1115. package/node_modules/zod/v4/locales/ru.js +0 -156
  1116. package/node_modules/zod/v4/locales/sl.cjs +0 -136
  1117. package/node_modules/zod/v4/locales/sl.d.cts +0 -5
  1118. package/node_modules/zod/v4/locales/sl.d.ts +0 -4
  1119. package/node_modules/zod/v4/locales/sl.js +0 -109
  1120. package/node_modules/zod/v4/locales/sv.cjs +0 -137
  1121. package/node_modules/zod/v4/locales/sv.d.cts +0 -5
  1122. package/node_modules/zod/v4/locales/sv.d.ts +0 -4
  1123. package/node_modules/zod/v4/locales/sv.js +0 -110
  1124. package/node_modules/zod/v4/locales/ta.cjs +0 -137
  1125. package/node_modules/zod/v4/locales/ta.d.cts +0 -5
  1126. package/node_modules/zod/v4/locales/ta.d.ts +0 -4
  1127. package/node_modules/zod/v4/locales/ta.js +0 -110
  1128. package/node_modules/zod/v4/locales/th.cjs +0 -137
  1129. package/node_modules/zod/v4/locales/th.d.cts +0 -5
  1130. package/node_modules/zod/v4/locales/th.d.ts +0 -4
  1131. package/node_modules/zod/v4/locales/th.js +0 -110
  1132. package/node_modules/zod/v4/locales/tr.cjs +0 -132
  1133. package/node_modules/zod/v4/locales/tr.d.cts +0 -5
  1134. package/node_modules/zod/v4/locales/tr.d.ts +0 -4
  1135. package/node_modules/zod/v4/locales/tr.js +0 -105
  1136. package/node_modules/zod/v4/locales/ua.cjs +0 -12
  1137. package/node_modules/zod/v4/locales/ua.d.cts +0 -5
  1138. package/node_modules/zod/v4/locales/ua.d.ts +0 -5
  1139. package/node_modules/zod/v4/locales/ua.js +0 -5
  1140. package/node_modules/zod/v4/locales/uk.cjs +0 -135
  1141. package/node_modules/zod/v4/locales/uk.d.cts +0 -5
  1142. package/node_modules/zod/v4/locales/uk.d.ts +0 -4
  1143. package/node_modules/zod/v4/locales/uk.js +0 -108
  1144. package/node_modules/zod/v4/locales/ur.cjs +0 -137
  1145. package/node_modules/zod/v4/locales/ur.d.cts +0 -5
  1146. package/node_modules/zod/v4/locales/ur.d.ts +0 -4
  1147. package/node_modules/zod/v4/locales/ur.js +0 -110
  1148. package/node_modules/zod/v4/locales/uz.cjs +0 -137
  1149. package/node_modules/zod/v4/locales/uz.d.cts +0 -5
  1150. package/node_modules/zod/v4/locales/uz.d.ts +0 -4
  1151. package/node_modules/zod/v4/locales/uz.js +0 -110
  1152. package/node_modules/zod/v4/locales/vi.cjs +0 -135
  1153. package/node_modules/zod/v4/locales/vi.d.cts +0 -5
  1154. package/node_modules/zod/v4/locales/vi.d.ts +0 -4
  1155. package/node_modules/zod/v4/locales/vi.js +0 -108
  1156. package/node_modules/zod/v4/locales/yo.cjs +0 -134
  1157. package/node_modules/zod/v4/locales/yo.d.cts +0 -5
  1158. package/node_modules/zod/v4/locales/yo.d.ts +0 -4
  1159. package/node_modules/zod/v4/locales/yo.js +0 -107
  1160. package/node_modules/zod/v4/locales/zh-CN.cjs +0 -136
  1161. package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -5
  1162. package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  1163. package/node_modules/zod/v4/locales/zh-CN.js +0 -109
  1164. package/node_modules/zod/v4/locales/zh-TW.cjs +0 -134
  1165. package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -5
  1166. package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
  1167. package/node_modules/zod/v4/locales/zh-TW.js +0 -107
  1168. package/node_modules/zod/v4/mini/checks.cjs +0 -34
  1169. package/node_modules/zod/v4/mini/checks.d.cts +0 -1
  1170. package/node_modules/zod/v4/mini/checks.d.ts +0 -1
  1171. package/node_modules/zod/v4/mini/checks.js +0 -1
  1172. package/node_modules/zod/v4/mini/coerce.cjs +0 -52
  1173. package/node_modules/zod/v4/mini/coerce.d.cts +0 -7
  1174. package/node_modules/zod/v4/mini/coerce.d.ts +0 -7
  1175. package/node_modules/zod/v4/mini/coerce.js +0 -22
  1176. package/node_modules/zod/v4/mini/external.cjs +0 -63
  1177. package/node_modules/zod/v4/mini/external.d.cts +0 -13
  1178. package/node_modules/zod/v4/mini/external.d.ts +0 -13
  1179. package/node_modules/zod/v4/mini/external.js +0 -14
  1180. package/node_modules/zod/v4/mini/index.cjs +0 -32
  1181. package/node_modules/zod/v4/mini/index.d.cts +0 -3
  1182. package/node_modules/zod/v4/mini/index.d.ts +0 -3
  1183. package/node_modules/zod/v4/mini/index.js +0 -3
  1184. package/node_modules/zod/v4/mini/iso.cjs +0 -64
  1185. package/node_modules/zod/v4/mini/iso.d.cts +0 -22
  1186. package/node_modules/zod/v4/mini/iso.d.ts +0 -22
  1187. package/node_modules/zod/v4/mini/iso.js +0 -34
  1188. package/node_modules/zod/v4/mini/package.json +0 -7
  1189. package/node_modules/zod/v4/mini/parse.cjs +0 -16
  1190. package/node_modules/zod/v4/mini/parse.d.cts +0 -1
  1191. package/node_modules/zod/v4/mini/parse.d.ts +0 -1
  1192. package/node_modules/zod/v4/mini/parse.js +0 -1
  1193. package/node_modules/zod/v4/mini/schemas.cjs +0 -1083
  1194. package/node_modules/zod/v4/mini/schemas.d.cts +0 -445
  1195. package/node_modules/zod/v4/mini/schemas.d.ts +0 -445
  1196. package/node_modules/zod/v4/mini/schemas.js +0 -961
  1197. package/node_modules/zod/v4/package.json +0 -7
  1198. package/node_modules/zod/v4-mini/index.cjs +0 -32
  1199. package/node_modules/zod/v4-mini/index.d.cts +0 -3
  1200. package/node_modules/zod/v4-mini/index.d.ts +0 -3
  1201. package/node_modules/zod/v4-mini/index.js +0 -3
  1202. package/node_modules/zod/v4-mini/package.json +0 -7
package/dist/index.js CHANGED
@@ -1,1818 +1,32 @@
1
- import {
2
- hasExplicitAssetsBase,
3
- originFromAssetsBase,
4
- resolveAssetsBase,
5
- resolveServerOrigin,
6
- synthesizeViewDocument
7
- } from "./chunk-VV2P4ZFZ.js";
8
- import {
9
- authInfoFromRequest,
10
- composeFetch,
11
- getOAuthProtectedResourceMetadataUrl,
12
- getRequestBag,
13
- hostValidationMiddleware,
14
- jsonBodyMiddleware,
15
- matchesPath,
16
- matchesPathPrefix,
17
- oauthMetadata,
18
- originValidationMiddleware,
19
- pathnameOf,
20
- requireBearerAuth,
21
- routeFetch
22
- } from "./chunk-SFI2T6TE.js";
23
- import {
24
- getOAuthProviderOptions,
25
- resolveConfiguredOAuthResource,
26
- resolveLocalOAuthResource,
27
- wrapOAuthTokenVerifier
28
- } from "./chunk-DPL7OEXC.js";
29
- import {
30
- registerOpenAPITools
31
- } from "./chunk-AATFAERC.js";
32
-
33
- // src/server.ts
34
- import {
35
- localhostAllowedHostnames,
36
- localhostAllowedOrigins,
37
- McpServer as SdkMcpServer,
38
- ResourceTemplate,
39
- isInputRequiredResult
40
- } from "@modelcontextprotocol/server";
41
-
42
- // src/config.ts
43
- function assertServerConfig(config) {
44
- if (config.basePath !== void 0) {
45
- if (typeof config.basePath !== "string") {
46
- throw new TypeError(
47
- "basePath must be an absolute URL pathname without empty segments, trailing slash, query, fragment, or whitespace"
48
- );
49
- }
50
- const { basePath } = config;
51
- if (!basePath.startsWith("/") || basePath.includes("?") || basePath.includes("#") || /\s/.test(basePath) || basePath.includes("//") || basePath.length > 1 && basePath.endsWith("/")) {
52
- throw new TypeError(
53
- "basePath must be an absolute URL pathname without empty segments, trailing slash, query, fragment, or whitespace"
54
- );
55
- }
56
- }
57
- }
58
-
59
- // src/context.ts
60
- import {
61
- CLIENT_CAPABILITIES_META_KEY as CLIENT_CAPABILITIES_META_KEY2,
62
- inputRequired,
63
- inputResponse
64
- } from "@modelcontextprotocol/server";
65
-
66
- // src/views/capabilities.ts
67
- import {
68
- CLIENT_CAPABILITIES_META_KEY
69
- } from "@modelcontextprotocol/server";
70
-
71
- // src/views/constants.ts
72
- var UI_EXTENSION_ID = "io.modelcontextprotocol/ui";
73
- var UI_MIME_TYPE = "text/html;profile=mcp-app";
74
- var UI_RESOURCE_URI_PREFIX = "ui://views/";
75
- var UI_META_KEY = "ui";
76
- var UI_RESOURCE_URI_META_KEY = "ui/resourceUri";
77
- function viewResourceUri(viewName) {
78
- return `${UI_RESOURCE_URI_PREFIX}${viewName}.html`;
79
- }
80
-
81
- // src/views/capabilities.ts
82
- var clientCapabilitiesByRequest = /* @__PURE__ */ new WeakMap();
83
- function stashClientCapabilities(request, capabilities) {
84
- clientCapabilitiesByRequest.set(request, capabilities);
85
- }
86
- function extractClientCapabilitiesFromBody(body) {
87
- if (typeof body !== "object" || body === null) {
88
- return void 0;
89
- }
90
- const params = body["params"];
91
- if (typeof params !== "object" || params === null) {
92
- return void 0;
93
- }
94
- const meta = params["_meta"];
95
- if (typeof meta !== "object" || meta === null) {
96
- return void 0;
97
- }
98
- const capabilities = meta[CLIENT_CAPABILITIES_META_KEY];
99
- if (typeof capabilities !== "object" || capabilities === null) {
100
- return void 0;
101
- }
102
- return capabilities;
103
- }
104
- function supportsViews(capabilities) {
105
- const extensions = capabilities?.extensions;
106
- if (extensions === void 0) {
107
- return false;
108
- }
109
- const uiExtension = extensions[UI_EXTENSION_ID];
110
- if (typeof uiExtension !== "object" || uiExtension === null) {
111
- return false;
112
- }
113
- const mimeTypes = uiExtension["mimeTypes"];
114
- if (!Array.isArray(mimeTypes)) {
115
- return false;
116
- }
117
- return mimeTypes.includes(UI_MIME_TYPE);
118
- }
119
-
120
- // src/context.ts
121
- function requireOAuthAuthInfo(authInfo) {
122
- if (authInfo === void 0 || authInfo.extra === void 0 || authInfo.expiresAt === void 0) {
123
- throw new Error("OAuth callback did not receive mapped AuthInfo.extra");
124
- }
125
- }
126
- function toClientContext(ctx) {
127
- const envelopeCaps = ctx.mcpReq.envelope?.[CLIENT_CAPABILITIES_META_KEY2];
128
- return {
129
- supportsViews() {
130
- return supportsViews(envelopeCaps);
131
- }
132
- };
133
- }
134
- function createElicit(inputResponses) {
135
- return async function elicit(key, message, schemaOrUrl) {
136
- let request;
137
- let formSchema;
138
- if (typeof schemaOrUrl === "string") {
139
- request = inputRequired.elicitUrl({
140
- message,
141
- url: schemaOrUrl
142
- });
143
- } else if (schemaOrUrl !== void 0) {
144
- formSchema = schemaOrUrl;
145
- request = inputRequired.elicit({
146
- message,
147
- requestedSchema: schemaOrUrl
148
- });
149
- } else {
150
- throw new TypeError(
151
- "ctx.elicit(key, message, value) requires a form schema or URL string"
152
- );
153
- }
154
- const response = inputResponse(inputResponses, key);
155
- if (response.kind === "elicit") {
156
- if (response.action !== "accept") {
157
- return { status: response.action };
158
- }
159
- if (formSchema === void 0) {
160
- return { status: "accept" };
161
- }
162
- if (response.content !== void 0) {
163
- const outcome = await formSchema["~standard"].validate(
164
- response.content
165
- );
166
- if (outcome.issues === void 0) {
167
- return { status: "accept", data: outcome.value };
168
- }
169
- }
170
- }
171
- return {
172
- status: "required",
173
- result: inputRequired({ inputRequests: { [key]: request } })
174
- };
175
- };
176
- }
177
- function toRequestContext(ctx) {
178
- const request = ctx.http?.req;
179
- return {
180
- signal: ctx.mcpReq.signal,
181
- ...request !== void 0 && { request },
182
- ...ctx.mcpReq.inputResponses !== void 0 && {
183
- inputResponses: ctx.mcpReq.inputResponses
184
- },
185
- client: toClientContext(ctx),
186
- elicit: createElicit(ctx.mcpReq.inputResponses),
187
- requestState: () => ctx.mcpReq.requestState(),
188
- async reportProgress(progress, total, message) {
189
- const progressToken = ctx.mcpReq._meta?.progressToken;
190
- if (progressToken === void 0) return false;
191
- await ctx.mcpReq.notify({
192
- method: "notifications/progress",
193
- params: {
194
- progressToken,
195
- progress,
196
- ...total !== void 0 && { total },
197
- ...message !== void 0 && { message }
198
- }
199
- });
200
- return true;
201
- },
202
- async sendLog(level, data, logger) {
203
- await ctx.mcpReq.notify({
204
- method: "notifications/message",
205
- params: {
206
- level,
207
- data,
208
- ...logger !== void 0 && { logger }
209
- }
210
- });
211
- }
212
- };
213
- }
214
- function toAuthenticatedRequestContext(ctx) {
215
- const authInfo = ctx.http?.authInfo;
216
- requireOAuthAuthInfo(authInfo);
217
- return {
218
- ...toRequestContext(ctx),
219
- auth: {
220
- user: authInfo.extra.user,
221
- payload: authInfo.extra.payload,
222
- accessToken: authInfo.token,
223
- scopes: [...authInfo.scopes],
224
- permissions: [...authInfo.extra.permissions],
225
- ...authInfo.clientId.length > 0 && { clientId: authInfo.clientId },
226
- expiresAt: authInfo.expiresAt,
227
- ...authInfo.resource !== void 0 && { resource: authInfo.resource }
228
- }
229
- };
230
- }
231
-
232
- // src/inspector-shell.ts
233
- var INSPECTOR_TAG = "beta";
234
- var DEFAULT_INSPECTOR_ASSETS_URL = `https://cdn.jsdelivr.net/npm/@mcp-use/inspector@${INSPECTOR_TAG}/dist/cdn/inspector.js`;
235
- function inspectorStylesUrl(assetsUrl) {
236
- return assetsUrl.replace(/\.js(?=$|[?#])/, ".css");
237
- }
238
- function escapeHtml(value) {
239
- return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
240
- }
241
- function serializeForInlineScript(value) {
242
- return JSON.stringify(value).replaceAll("<", "\\u003c");
243
- }
244
- function renderInspectorShell(options) {
245
- const { serverName, basePath, assetsUrl, manufactChatUrl } = options;
246
- const serializedBasePath = serializeForInlineScript(basePath);
247
- const serializedManufactChatUrl = manufactChatUrl ? serializeForInlineScript(manufactChatUrl) : null;
248
- const bundleUrl = assetsUrl ?? DEFAULT_INSPECTOR_ASSETS_URL;
249
- const scriptSrc = escapeHtml(bundleUrl);
250
- const stylesHref = escapeHtml(inspectorStylesUrl(bundleUrl));
251
- return `<!doctype html>
252
- <html lang="en">
253
- <head>
254
- <meta charset="utf-8" />
255
- <meta name="viewport" content="width=device-width, initial-scale=1" />
256
- <title>${escapeHtml(serverName)} \u2014 MCP Inspector</title>
257
- <link rel="preconnect" href="https://fonts.googleapis.com" />
258
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
259
- <link
260
- href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&display=swap"
261
- rel="stylesheet"
262
- />
263
- <link rel="stylesheet" href="${stylesHref}" />
264
- <style>
265
- :root { color-scheme: light dark; }
266
- html, body { height: 100%; margin: 0; background-color: #f3f3f3; }
267
- </style>
268
- </head>
269
- <body>
270
- <div id="root"></div>
271
- <script>
272
- (function () {
273
- var basePath = ${serializedBasePath};
274
- // The connect URL is derived from the page's own origin: the server
275
- // never guesses the hostname a browser reached it by.
276
- window.__MCP_USE_INSPECTOR__ = {
277
- autoConnectUrl: window.location.origin + basePath,
278
- basePath: basePath,
279
- };
280
- // Read by the current inspector bundle to derive its own URLs.
281
- window.__MCP_BASE_PATH__ = basePath;
282
- ${serializedManufactChatUrl ? `window.__MANUFACT_CHAT_URL__ = ${serializedManufactChatUrl};` : ""}
283
- // The bundle carries Node-flavored dependencies that touch \`process\`
284
- // at module scope; give them the same browser polyfill the v1
285
- // inspector shell provides, or the bundle throws on load.
286
- if (typeof window.process === "undefined") {
287
- window.process = {
288
- env: {},
289
- platform: "browser",
290
- browser: true,
291
- version: "v18.0.0",
292
- versions: { node: "18.0.0" },
293
- cwd: function () { return "/"; },
294
- nextTick: function (fn) {
295
- var args = Array.prototype.slice.call(arguments, 1);
296
- queueMicrotask(function () { fn.apply(null, args); });
297
- },
298
- };
299
- }
300
- })();
301
- </script>
302
- <script type="module" src="${scriptSrc}"></script>
303
- </body>
304
- </html>
305
- `;
306
- }
307
- function createInspectorHandler(inspector, options) {
308
- if (inspector?.enabled === false) {
309
- return void 0;
310
- }
311
- const { assetsUrl: configAssetsUrl, manufactChatUrl: configManufactChatUrl } = inspector ?? {};
312
- const assetsUrl = configAssetsUrl ?? process.env["MCP_USE_INSPECTOR_ASSETS_URL"] ?? void 0;
313
- const manufactChatUrl = configManufactChatUrl ?? process.env["MANUFACT_CHAT_URL"] ?? void 0;
314
- const html = renderInspectorShell({
315
- serverName: options.serverName,
316
- basePath: options.basePath,
317
- assetsUrl,
318
- manufactChatUrl
319
- });
320
- const path = `${options.basePath}/inspector`;
321
- const slashPath = `${path}/`;
322
- return async (request) => {
323
- if (request.method !== "GET" && request.method !== "HEAD") {
324
- return new Response("Method Not Allowed", { status: 405 });
325
- }
326
- const pathname = new URL(request.url).pathname;
327
- if (pathname !== path && pathname !== slashPath) {
328
- return new Response("Not Found", { status: 404 });
329
- }
330
- return new Response(request.method === "HEAD" ? null : html, {
331
- status: 200,
332
- headers: { "content-type": "text/html; charset=utf-8" }
333
- });
334
- };
335
- }
336
-
337
- // src/logging.ts
338
- import {
339
- CLIENT_INFO_META_KEY,
340
- isJSONRPCRequest
341
- } from "@modelcontextprotocol/server";
342
- function colorsEnabled() {
343
- if (typeof process === "undefined") return false;
344
- if (process.env?.["NO_COLOR"] !== void 0) return false;
345
- return process.stdout?.isTTY === true;
346
- }
347
- function ansi(open, close) {
348
- return (text) => colorsEnabled() ? `\x1B[${open}m${text}\x1B[${close}m` : text;
349
- }
350
- var bold = ansi(1, 22);
351
- var dim = ansi(2, 22);
352
- var red = ansi(31, 39);
353
- var green = ansi(32, 39);
354
- var yellow = ansi(33, 39);
355
- var blue = ansi(34, 39);
356
- var magenta = ansi(35, 39);
357
- var cyan = ansi(36, 39);
358
- var gray = ansi(90, 39);
359
- function resolveLogLevel(configured) {
360
- const raw = typeof process === "undefined" ? void 0 : process.env?.["MCP_USE_LOG_LEVEL"]?.toLowerCase();
361
- if (raw === "info" || raw === "debug" || raw === "trace") return raw;
362
- return configured ?? "info";
363
- }
364
- function formatClientInfo(info) {
365
- if (info === void 0) return void 0;
366
- return typeof info.version === "string" && info.version !== "" ? `${info.name}/${info.version}` : info.name;
367
- }
368
- var detailFormatters = {
369
- initialize: (p) => ({ subject: formatClientInfo(p.clientInfo) }),
370
- ping: () => ({}),
371
- "server/discover": () => ({}),
372
- "completion/complete": (p) => ({
373
- subject: p.ref.type === "ref/prompt" ? p.ref.name : p.ref.uri,
374
- input: p.argument
375
- }),
376
- "logging/setLevel": (p) => ({ subject: p.level }),
377
- "prompts/get": (p) => ({ subject: p.name, input: p.arguments }),
378
- "prompts/list": () => ({}),
379
- "resources/list": () => ({}),
380
- "resources/templates/list": () => ({}),
381
- "resources/read": (p) => ({ subject: p.uri }),
382
- "resources/subscribe": (p) => ({ subject: p.uri }),
383
- "resources/unsubscribe": (p) => ({ subject: p.uri }),
384
- "subscriptions/listen": () => ({}),
385
- "tools/call": (p) => ({ subject: p.name, input: p.arguments }),
386
- "tools/list": () => ({}),
387
- "sampling/createMessage": () => ({}),
388
- "elicitation/create": () => ({}),
389
- "roots/list": () => ({})
390
- };
391
- function isKnownMethod(method) {
392
- return Object.prototype.hasOwnProperty.call(detailFormatters, method);
393
- }
394
- function formatDetail(message) {
395
- if (!isKnownMethod(message.method)) return {};
396
- try {
397
- const formatter = detailFormatters[message.method];
398
- const detail = formatter(message.params);
399
- return typeof detail.subject === "string" || detail.subject === void 0 ? detail : {};
400
- } catch {
401
- return {};
402
- }
403
- }
404
- var INLINE_JSON_MAX_LENGTH = 80;
405
- function inlineJson(value) {
406
- let text;
407
- try {
408
- text = JSON.stringify(value) ?? String(value);
409
- } catch {
410
- text = String(value);
411
- }
412
- return text.length > INLINE_JSON_MAX_LENGTH ? `${text.slice(0, INLINE_JSON_MAX_LENGTH)}...` : text;
413
- }
414
- function formatClientIdentity(message) {
415
- const meta = message.params?._meta;
416
- if (meta === void 0) return void 0;
417
- const info = meta[CLIENT_INFO_META_KEY];
418
- if (typeof info !== "object" || info === null || typeof info.name !== "string") {
419
- return void 0;
420
- }
421
- return formatClientInfo(info);
422
- }
423
- function sanitize(text) {
424
- return text.replace(/[\u0000-\u001F\u007F-\u009F]+/g, " ");
425
- }
426
- function methodStyle(method) {
427
- if (method.startsWith("tools/")) return cyan;
428
- if (method.startsWith("resources/")) return green;
429
- if (method.startsWith("prompts/")) return magenta;
430
- if (method === "initialize" || method === "ping") return gray;
431
- return blue;
432
- }
433
- var REDACTED_HEADERS = /* @__PURE__ */ new Set([
434
- "authorization",
435
- "proxy-authorization",
436
- "cookie",
437
- "set-cookie",
438
- "x-api-key"
439
- ]);
440
- function redactHeaders(headers) {
441
- return Object.fromEntries(
442
- Object.entries(headers).map(([name, value]) => [
443
- name,
444
- REDACTED_HEADERS.has(name.toLowerCase()) ? "[REDACTED]" : value
445
- ])
446
- );
447
- }
448
- async function extractResponseOutcome(res) {
449
- if (!res.body) return { errorMessage: null };
450
- let text;
451
- try {
452
- text = await res.clone().text();
453
- } catch {
454
- return { errorMessage: null };
455
- }
456
- if (!text) return { errorMessage: null };
457
- const isSse = (res.headers.get("content-type") ?? "").includes(
458
- "text/event-stream"
459
- );
460
- const payloads = [];
461
- const tryParse = (raw) => {
462
- try {
463
- payloads.push(JSON.parse(raw));
464
- } catch {
465
- }
466
- };
467
- if (isSse) {
468
- for (const line of text.split(/\r?\n/)) {
469
- if (line.startsWith("data:")) {
470
- const data = line.slice(5).trim();
471
- if (data) tryParse(data);
472
- }
473
- }
474
- } else {
475
- tryParse(text);
476
- }
477
- let result;
478
- for (const payload of payloads) {
479
- if (payload === null || typeof payload !== "object") continue;
480
- const message = payload;
481
- if (typeof message.error?.message === "string") {
482
- return { errorMessage: message.error.message };
483
- }
484
- if (message.result?.isError === true) {
485
- const blocks = Array.isArray(message.result.content) ? message.result.content : [];
486
- const textBlock = blocks.find(
487
- (b) => b?.type === "text" && typeof b.text === "string"
488
- );
489
- return {
490
- errorMessage: textBlock ? String(textBlock.text) : "tool error"
491
- };
492
- }
493
- if ("result" in message) result = message.result;
494
- }
495
- return { errorMessage: null, result };
496
- }
497
- function compactToolResult(result) {
498
- if (result === null || typeof result !== "object") return result;
499
- const { structuredContent, content } = result;
500
- if (structuredContent !== void 0) return structuredContent;
501
- if (Array.isArray(content)) {
502
- const [block] = content;
503
- if (content.length === 1 && block?.type === "text") return block.text;
504
- }
505
- return content;
506
- }
507
- function formatForDump(value) {
508
- function truncate(val) {
509
- if (typeof val === "string" && val.length > 100) {
510
- return `${val.slice(0, 100)}...`;
511
- }
512
- if (Array.isArray(val)) return val.map(truncate);
513
- if (val !== null && typeof val === "object") {
514
- return Object.fromEntries(
515
- Object.entries(val).map(([k, v]) => [
516
- k,
517
- truncate(v)
518
- ])
519
- );
520
- }
521
- return val;
522
- }
523
- try {
524
- return JSON.stringify(truncate(value), null, 2);
525
- } catch {
526
- return String(value);
527
- }
528
- }
529
- var DUMP_BODY_MAX_LENGTH = 1e4;
530
- async function printTraceDump(response, requestHeaders, requestBody, readResponseBody) {
531
- console.log(`
532
- ${cyan("=".repeat(80))}`);
533
- console.log(bold(cyan("[TRACE] Request Details")));
534
- console.log(cyan("-".repeat(80)));
535
- if (Object.keys(requestHeaders).length > 0) {
536
- console.log(yellow("Request Headers:"));
537
- console.log(formatForDump(redactHeaders(requestHeaders)));
538
- }
539
- if (requestBody !== void 0) {
540
- console.log(yellow("Request Body:"));
541
- console.log(
542
- typeof requestBody === "string" ? requestBody : formatForDump(requestBody)
543
- );
544
- }
545
- const responseHeaders = {};
546
- response.headers.forEach((value, key) => {
547
- responseHeaders[key] = value;
548
- });
549
- if (Object.keys(responseHeaders).length > 0) {
550
- console.log(yellow("Response Headers:"));
551
- console.log(formatForDump(redactHeaders(responseHeaders)));
552
- }
553
- if (!readResponseBody) {
554
- console.log(`${yellow("Response Body:")} (streaming \u2014 not dumped)`);
555
- } else if (response.body === null) {
556
- console.log(`${yellow("Response Body:")} (no body)`);
557
- } else {
558
- try {
559
- const text = await response.clone().text();
560
- if (text.length === 0) {
561
- console.log(`${yellow("Response Body:")} (empty)`);
562
- } else {
563
- console.log(yellow("Response Body:"));
564
- try {
565
- console.log(formatForDump(JSON.parse(text)));
566
- } catch {
567
- console.log(
568
- text.length > DUMP_BODY_MAX_LENGTH ? `${text.slice(0, DUMP_BODY_MAX_LENGTH)}
569
- ... (truncated, ${text.length - DUMP_BODY_MAX_LENGTH} more characters)` : text
570
- );
571
- }
572
- }
573
- } catch {
574
- console.log(`${yellow("Response Body:")} (unable to read)`);
575
- }
576
- }
577
- console.log(`${cyan("=".repeat(80))}
578
- `);
579
- }
580
- function styleStatus(status) {
581
- const text = String(status);
582
- if (status >= 500) return magenta(text);
583
- if (status >= 400) return red(text);
584
- if (status >= 300) return yellow(text);
585
- return green(text);
586
- }
587
- function isNoisyRequest(httpMethod, pathname) {
588
- if (httpMethod !== "GET" && httpMethod !== "HEAD") return false;
589
- return pathname.includes("/inspector") || pathname.endsWith("/favicon.ico");
590
- }
591
- function requestLogger(options = {}) {
592
- if (options.enabled === false) {
593
- return (_request, next) => next();
594
- }
595
- return async (request, next) => {
596
- const level = resolveLogLevel(options.level);
597
- const startedAt = Date.now();
598
- const httpMethod = request.method;
599
- const pathname = new URL(request.url).pathname;
600
- if (isNoisyRequest(httpMethod, pathname)) {
601
- return next();
602
- }
603
- const requestHeaders = {};
604
- if (level === "trace") {
605
- request.headers.forEach((value, key) => {
606
- requestHeaders[key] = value;
607
- });
608
- }
609
- let requestBody;
610
- if (httpMethod !== "GET" && httpMethod !== "HEAD") {
611
- const parsedBody = getRequestBag(request).parsedBody;
612
- if (parsedBody !== void 0) {
613
- requestBody = parsedBody;
614
- } else {
615
- try {
616
- requestBody = await request.clone().json();
617
- } catch {
618
- }
619
- }
620
- }
621
- const response = await next();
622
- const durationMs = Date.now() - startedAt;
623
- const timestamp = (/* @__PURE__ */ new Date()).toISOString().substring(11, 19);
624
- const mcpRequest = isJSONRPCRequest(requestBody) ? requestBody : void 0;
625
- const isStreamingMethod = mcpRequest?.method === "subscriptions/listen";
626
- const lines = [
627
- [
628
- dim(timestamp),
629
- bold(httpMethod),
630
- pathname,
631
- styleStatus(response.status),
632
- dim(`in ${durationMs}ms`)
633
- ].join(" ")
634
- ];
635
- if (mcpRequest !== void 0) {
636
- const method = sanitize(mcpRequest.method);
637
- const parts = [` ${methodStyle(method)(method)}`];
638
- const detail = formatDetail(mcpRequest);
639
- if (detail.subject !== void 0) {
640
- parts.push(bold(sanitize(detail.subject)));
641
- }
642
- const echoPayloads = level !== "info";
643
- if (echoPayloads && detail.input !== void 0) {
644
- parts.push(inlineJson(detail.input));
645
- }
646
- const outcome = isStreamingMethod ? { errorMessage: null } : await extractResponseOutcome(response);
647
- if (echoPayloads && mcpRequest.method === "tools/call" && outcome.errorMessage === null && outcome.result !== void 0) {
648
- parts.push(dim("->"), inlineJson(compactToolResult(outcome.result)));
649
- }
650
- if (mcpRequest.method !== "initialize") {
651
- const client = formatClientIdentity(mcpRequest);
652
- if (client !== void 0) parts.push(dim(sanitize(client)));
653
- }
654
- if (outcome.errorMessage !== null) {
655
- parts.push(red(`ERROR ${sanitize(outcome.errorMessage)}`));
656
- } else if (response.status >= 400) {
657
- parts.push(red(`ERROR (HTTP ${response.status})`));
658
- }
659
- lines.push(parts.join(" "));
660
- }
661
- console.log(lines.join("\n"));
662
- if (level === "trace") {
663
- await printTraceDump(
664
- response,
665
- requestHeaders,
666
- requestBody,
667
- !isStreamingMethod
668
- );
669
- }
670
- return response;
671
- };
672
- }
673
-
674
- // src/mount-mcp.ts
675
- import {
676
- createMcpHandler
677
- } from "@modelcontextprotocol/server";
678
- function createMcpMount(factory, options = {}) {
679
- const {
680
- path = "/mcp",
681
- handler: handlerOptions,
682
- authInfo: getAuthInfo
683
- } = options;
684
- const legacyMode = handlerOptions?.legacy ?? "stateless";
685
- const handler = createMcpHandler(factory, {
686
- legacy: "stateless",
687
- ...handlerOptions
688
- });
689
- const fetch = async (request) => {
690
- if (!matchesPath(request, path)) {
691
- return new Response("Not Found", { status: 404 });
692
- }
693
- if (legacyMode === "stateless") {
694
- const method = request.method.toUpperCase();
695
- if (method === "GET" || method === "DELETE" || method === "HEAD") {
696
- return new Response(null, { status: 204 });
697
- }
698
- }
699
- const bag = getRequestBag(request);
700
- let parsedBody = bag.parsedBody;
701
- if (parsedBody === void 0) {
702
- try {
703
- parsedBody = await request.clone().json();
704
- } catch {
705
- }
706
- }
707
- const capabilities = extractClientCapabilitiesFromBody(parsedBody);
708
- if (capabilities !== void 0) {
709
- stashClientCapabilities(request, capabilities);
710
- }
711
- const authInfo = getAuthInfo?.(request) ?? bag.authInfo;
712
- return handler.fetch(request, {
713
- ...parsedBody !== void 0 && { parsedBody },
714
- ...authInfo !== void 0 && { authInfo }
715
- });
716
- };
717
- return { handler, fetch };
718
- }
719
- function mountMcp(factory, options = {}) {
720
- return createMcpMount(factory, options);
721
- }
722
-
723
- // src/tools.ts
724
- function resolveToolInputSchema(definition) {
725
- return definition.inputSchema ?? definition.schema;
726
- }
727
-
728
- // src/views/register.ts
729
- var registerViews = /* @__PURE__ */ Symbol("mcp-use/registerViews");
730
-
731
- // src/views/csp-env.ts
732
- var CATEGORY_ENV = {
733
- connectDomains: "CSP_CONNECT_DOMAINS",
734
- resourceDomains: "CSP_RESOURCE_DOMAINS",
735
- frameDomains: "CSP_FRAME_DOMAINS",
736
- baseUriDomains: "CSP_BASE_URI_DOMAINS"
737
- };
738
- function parseDomainList(raw) {
739
- if (raw === void 0 || raw.trim() === "") {
740
- return [];
741
- }
742
- return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
743
- }
744
- function readEnvDomains(name) {
745
- if (typeof process === "undefined") {
746
- return void 0;
747
- }
748
- const raw = process.env[name];
749
- if (raw === void 0 || raw.trim() === "") {
750
- return void 0;
751
- }
752
- return parseDomainList(raw);
753
- }
754
- function readCspUrlsShortcut() {
755
- return readEnvDomains("CSP_URLS") ?? [];
756
- }
757
- function readEnvDomainsForCategory(category) {
758
- const perCategory = readEnvDomains(CATEGORY_ENV[category]);
759
- if (perCategory !== void 0) {
760
- return perCategory;
761
- }
762
- return readCspUrlsShortcut();
763
- }
764
- function mergeDomainLists(...segments) {
765
- const seen = /* @__PURE__ */ new Set();
766
- const out = [];
767
- for (const segment of segments) {
768
- for (const domain of segment) {
769
- if (!seen.has(domain)) {
770
- seen.add(domain);
771
- out.push(domain);
772
- }
773
- }
774
- }
775
- return out;
776
- }
777
- function toWebSocketOrigin(serverOrigin) {
778
- if (serverOrigin.startsWith("https://")) {
779
- return `wss://${serverOrigin.slice("https://".length)}`;
780
- }
781
- if (serverOrigin.startsWith("http://")) {
782
- return `ws://${serverOrigin.slice("http://".length)}`;
783
- }
784
- return serverOrigin;
785
- }
786
- function buildMergedResourceCsp(authorFacts, options) {
787
- const author = authorFacts?.csp;
788
- const mcpConnectAuto = [];
789
- if (options.serverOrigin !== "") {
790
- mcpConnectAuto.push(options.serverOrigin);
791
- if (options.hmrWs === true) {
792
- mcpConnectAuto.push(toWebSocketOrigin(options.serverOrigin));
793
- }
794
- }
795
- const mcpResourceAuto = [];
796
- const resourceOrigin = options.explicitAssetsBase ? options.assetsOrigin : options.serverOrigin;
797
- if (resourceOrigin !== "") {
798
- mcpResourceAuto.push(resourceOrigin);
799
- }
800
- const connectDomains = mergeDomainLists(
801
- author?.connectDomains ?? [],
802
- readEnvDomainsForCategory("connectDomains"),
803
- mcpConnectAuto
804
- );
805
- const resourceDomains = mergeDomainLists(
806
- author?.resourceDomains ?? [],
807
- readEnvDomainsForCategory("resourceDomains"),
808
- mcpResourceAuto
809
- );
810
- const frameDomains = mergeDomainLists(
811
- author?.frameDomains ?? [],
812
- readEnvDomainsForCategory("frameDomains")
813
- );
814
- const baseUriDomains = mergeDomainLists(
815
- author?.baseUriDomains ?? [],
816
- readEnvDomainsForCategory("baseUriDomains")
817
- );
818
- return {
819
- ...author,
820
- connectDomains,
821
- resourceDomains,
822
- frameDomains,
823
- baseUriDomains
824
- };
825
- }
826
-
827
- // src/views/routes.ts
828
- var PUBLIC_BUILD_DIR = ".mcp-use/build/views/public";
829
- var PUBLIC_DEV_DIR = "public";
830
- var VIEW_ASSETS_BUILD_ROOT = ".mcp-use/build/views";
831
- function createViewAssetsHandler(basePath, views, options) {
832
- if (views.size === 0) {
833
- return void 0;
834
- }
835
- const assetsPrefix = `${basePath}/_mcp-use/views`;
836
- const projectRoot = options?.projectRoot ?? process.cwd();
837
- return async (request) => {
838
- if (request.method !== "GET" && request.method !== "HEAD") {
839
- return new Response("Method Not Allowed", { status: 405 });
840
- }
841
- if (!matchesPathPrefix(request, assetsPrefix)) {
842
- return new Response("Not Found", { status: 404 });
843
- }
844
- const pathname = pathnameOf(request);
845
- const remainder = pathname.slice(assetsPrefix.length + 1);
846
- const slash = remainder.indexOf("/");
847
- if (slash <= 0 || slash === remainder.length - 1) {
848
- return new Response("Not Found", { status: 404 });
849
- }
850
- const viewName = remainder.slice(0, slash);
851
- const subpath = remainder.slice(slash + 1);
852
- const entry = views.get(viewName);
853
- if (entry === void 0 || entry.kind !== "external") {
854
- return new Response("Not Found", { status: 404 });
855
- }
856
- const [{ join }, { resolvePublicFilePath, servePublicFile }] = await Promise.all([import("path"), import("./public-route-7IK5D7V7.js")]);
857
- const viewRoot = join(projectRoot, VIEW_ASSETS_BUILD_ROOT, viewName);
858
- const diskPath = await resolvePublicFilePath(viewRoot, subpath);
859
- if (diskPath === null) {
860
- return new Response("Not Found", { status: 404 });
861
- }
862
- return await servePublicFile(diskPath);
863
- };
864
- }
865
- function createViewPublicHandler(basePath, views, options) {
866
- if (views.size === 0) {
867
- return void 0;
868
- }
869
- const publicPrefix = `${basePath}/_mcp-use/public`;
870
- const subdir = options?.dev === true ? PUBLIC_DEV_DIR : PUBLIC_BUILD_DIR;
871
- const projectRoot = options?.projectRoot ?? process.cwd();
872
- return async (request) => {
873
- if (request.method !== "GET" && request.method !== "HEAD") {
874
- return new Response("Method Not Allowed", { status: 405 });
875
- }
876
- if (!matchesPathPrefix(request, publicPrefix)) {
877
- return new Response("Not Found", { status: 404 });
878
- }
879
- const pathname = pathnameOf(request);
880
- const subpath = pathname.slice(publicPrefix.length + 1);
881
- if (subpath.length === 0) {
882
- return new Response("Not Found", { status: 404 });
883
- }
884
- const [{ join }, { resolvePublicFilePath, servePublicFile }] = await Promise.all([import("path"), import("./public-route-7IK5D7V7.js")]);
885
- const publicRoot = join(projectRoot, subdir);
886
- const diskPath = await resolvePublicFilePath(publicRoot, subpath);
887
- if (diskPath === null) {
888
- return new Response("Not Found", { status: 404 });
889
- }
890
- return await servePublicFile(diskPath);
891
- };
892
- }
893
-
894
- // src/views/wire.ts
895
- function buildToolUiMeta(viewName, visibility) {
896
- if (viewName === void 0 && visibility === void 0) {
897
- return void 0;
898
- }
899
- const ui = {};
900
- const meta = { [UI_META_KEY]: ui };
901
- if (viewName !== void 0) {
902
- const resourceUri = viewResourceUri(viewName);
903
- ui["resourceUri"] = resourceUri;
904
- meta[UI_RESOURCE_URI_META_KEY] = resourceUri;
905
- }
906
- if (visibility !== void 0) {
907
- ui["visibility"] = [visibility];
908
- }
909
- return meta;
910
- }
911
- function buildToolResultUiMeta(viewName) {
912
- const resourceUri = viewResourceUri(viewName);
913
- return {
914
- [UI_META_KEY]: { resourceUri },
915
- [UI_RESOURCE_URI_META_KEY]: resourceUri
916
- };
917
- }
918
- function resolveCspOptions(options) {
919
- const request = options?.request;
920
- const serverOrigin = options?.serverOrigin ?? (request !== void 0 ? resolveServerOrigin(request) : "");
921
- const assetsBase = options?.assetsBase ?? (request !== void 0 ? resolveAssetsBase(request) : serverOrigin);
922
- return {
923
- serverOrigin,
924
- assetsOrigin: originFromAssetsBase(assetsBase),
925
- explicitAssetsBase: hasExplicitAssetsBase(),
926
- ...options?.hmrWs === true ? { hmrWs: true } : {}
927
- };
928
- }
929
- function buildResourceUiMeta(authorFacts, options) {
930
- const csp = buildMergedResourceCsp(authorFacts, resolveCspOptions(options));
931
- const ui = { csp };
932
- if (authorFacts?.permissions !== void 0) {
933
- ui["permissions"] = authorFacts.permissions;
934
- }
935
- if (authorFacts?.domain !== void 0) {
936
- ui["domain"] = authorFacts.domain;
937
- }
938
- if (authorFacts?.prefersBorder !== void 0) {
939
- ui["prefersBorder"] = authorFacts.prefersBorder;
940
- }
941
- return { [UI_META_KEY]: ui };
942
- }
943
- function viewResourceConfig(_viewName, _entry, authorFacts, options) {
944
- return {
945
- mimeType: UI_MIME_TYPE,
946
- ...authorFacts?.description !== void 0 && {
947
- description: authorFacts.description
948
- },
949
- _meta: buildResourceUiMeta(authorFacts, options)
950
- };
951
- }
952
-
953
- // src/server.ts
954
- var MCPServer = class _MCPServer {
955
- #config;
956
- #tools = /* @__PURE__ */ new Map();
957
- #resources = /* @__PURE__ */ new Map();
958
- #resourceTemplates = /* @__PURE__ */ new Map();
959
- #prompts = /* @__PURE__ */ new Map();
960
- #views = /* @__PURE__ */ new Map();
961
- /**
962
- * One-to-one tool→view bindings. Each view name maps to the single tool
963
- * that bound it; that tool's `view:` config is the sole source of
964
- * resource facts for the primed view resource.
965
- */
966
- #viewBindings = /* @__PURE__ */ new Map();
967
- #viewsPrimed = false;
968
- /** When true, resource CSP emission includes the HMR websocket origin. */
969
- #viewsDevMode = false;
970
- /** Project root for filesystem-backed view routes (dev `public/`). */
971
- #viewsProjectRoot = process.cwd();
972
- #fetchHandler;
973
- #handler;
974
- #httpServer;
975
- #oauthResource;
976
- #oauthResourceResolved = false;
977
- #oauthResourceConfigurationAbsent = false;
978
- /** Whether the mounted app validates Host headers (fixed at first mount). */
979
- #hostValidated = false;
980
- /**
981
- * Create an MCP server from a parsed, bundled OpenAPI document.
982
- *
983
- * Each included OpenAPI operation becomes a tool that validates its input,
984
- * calls the matching upstream HTTP endpoint, and returns the response using
985
- * the SDK's raw tool-result shape. External `$ref` values are not fetched;
986
- * bundle the document before passing it in.
987
- *
988
- * @param options - OpenAPI document, operation filters, upstream URL, and
989
- * request authentication options.
990
- * @returns An unauthenticated MCP server populated with generated tools.
991
- *
992
- * @example
993
- * ```ts
994
- * const spec = await fetch("https://api.example.com/openapi.json")
995
- * .then((response) => response.json());
996
- * const server = MCPServer.fromOpenAPI({ spec });
997
- * await server.listen(3000);
998
- * ```
999
- */
1000
- static fromOpenAPI(options) {
1001
- const server = new _MCPServer({
1002
- name: options.name ?? options.spec.info.title,
1003
- version: options.version ?? options.spec.info.version ?? "1.0.0"
1004
- });
1005
- registerOpenAPITools(server, options);
1006
- return server;
1007
- }
1008
- /**
1009
- * Create a server. `config.name` and `config.version` identify the server
1010
- * to clients during initialization. `config.basePath` (default `"/mcp"`)
1011
- * is both the MCP route and the path of the OAuth protected-resource
1012
- * identity, so any explicit OAuth resource URL must use that exact path.
1013
- * Nothing binds or listens until {@link MCPServer.listen} or
1014
- * {@link MCPServer.getHandler} is called.
1015
- */
1016
- constructor(config) {
1017
- assertServerConfig(config);
1018
- this.#config = config;
1019
- if (config.oauth !== void 0) {
1020
- const mcpUrl = typeof process === "undefined" ? void 0 : process.env["MCP_URL"];
1021
- const resource = resolveConfiguredOAuthResource({
1022
- provider: config.oauth,
1023
- basePath: this.#basePath(),
1024
- ...mcpUrl !== void 0 && { mcpUrl }
1025
- });
1026
- this.#oauthResource = resource;
1027
- this.#oauthResourceResolved = resource !== void 0;
1028
- this.#oauthResourceConfigurationAbsent = resource === void 0;
1029
- }
1030
- }
1031
- /**
1032
- * The URL path prefix the MCP endpoint is mounted at.
1033
- *
1034
- * Reflects `config.basePath` (default `"/mcp"`). Exposed so tooling that
1035
- * imports the entry module — `mcp-use dev`'s startup log, for example —
1036
- * can build the endpoint and inspector URLs without assuming the default.
1037
- */
1038
- get basePath() {
1039
- return this.#basePath();
1040
- }
1041
- /**
1042
- * Register a tool. Input is validated against `inputSchema` before the callback
1043
- * runs; results carrying `structuredContent` are type-checked against
1044
- * `outputSchema` at the callback's return position.
1045
- *
1046
- * @returns A {@link ToolRef} carrying the tool name and phantom types for
1047
- * inference-based view typing.
1048
- */
1049
- tool(definition, callback) {
1050
- this.#assertNotStarted("tool", definition.name);
1051
- this.#validateToolViewBinding(definition);
1052
- this.#tools.set(definition.name, {
1053
- definition,
1054
- callback
1055
- });
1056
- return Object.freeze({
1057
- name: definition.name
1058
- });
1059
- }
1060
- /**
1061
- * Prime the views registry from a build/dev manifest.
1062
- *
1063
- * @param views - Manifest map keyed by view directory name.
1064
- * @param options - Priming options. When `dev` is true, resource CSP
1065
- * emission appends the serving origin's websocket variant to
1066
- * `connectDomains` so Vite HMR passes host-enforced CSP. Pass
1067
- * `projectRoot` in dev so the `public/` route resolves against the user's
1068
- * project directory rather than the CLI process cwd.
1069
- * @throws If views are already primed, or after the server has started.
1070
- *
1071
- * @internal
1072
- */
1073
- [registerViews](views, options) {
1074
- if (this.#viewsPrimed) {
1075
- throw new Error(
1076
- "Cannot prime views: the views registry is already primed on this server instance."
1077
- );
1078
- }
1079
- this.#assertNotStarted("views", "manifest");
1080
- this.#viewsDevMode = options?.dev === true;
1081
- if (options?.projectRoot !== void 0) {
1082
- this.#viewsProjectRoot = options.projectRoot;
1083
- }
1084
- for (const [name, entry] of Object.entries(views)) {
1085
- this.#views.set(name, entry);
1086
- }
1087
- this.#viewsPrimed = true;
1088
- }
1089
- /**
1090
- * Prime the views registry — string-keyed alias for {@link registerViews}
1091
- * used by the CLI when the symbol export cannot be shared across duplicate
1092
- * module copies (dev module runner with an externalized package).
1093
- *
1094
- * @param views - Manifest map keyed by view directory name.
1095
- * @param options - Priming options forwarded to {@link registerViews}.
1096
- * @throws If views are already primed, or after the server has started.
1097
- *
1098
- * @internal
1099
- */
1100
- __primeViews(views, options) {
1101
- this[registerViews](views, options);
1102
- }
1103
- /** Register a static resource readable at `definition.uri`. */
1104
- resource(definition, callback) {
1105
- this.#assertNotStarted("resource", definition.name);
1106
- this.#resources.set(definition.name, { definition, callback });
1107
- return this;
1108
- }
1109
- /**
1110
- * Register a parameterized resource. Reads matching `uriTemplate` invoke
1111
- * the callback with the extracted variables.
1112
- *
1113
- * The `const` type parameter keeps `uriTemplate` a string literal during
1114
- * inference (plain generic inference widens object-literal properties to
1115
- * `string`), which is what lets `InferTemplateParams` type the callback's
1116
- * `params` from the template's variables.
1117
- */
1118
- resourceTemplate(definition, callback) {
1119
- this.#assertNotStarted("resourceTemplate", definition.name);
1120
- this.#resourceTemplates.set(definition.name, {
1121
- definition,
1122
- callback
1123
- });
1124
- return this;
1125
- }
1126
- /**
1127
- * Register a prompt template. Schema fields wrapped with `completable()`
1128
- * gain autocomplete via `completion/complete`.
1129
- */
1130
- prompt(definition, callback) {
1131
- this.#assertNotStarted("prompt", definition.name);
1132
- this.#prompts.set(definition.name, {
1133
- definition,
1134
- callback
1135
- });
1136
- return this;
1137
- }
1138
- /**
1139
- * Web-standard request handler for the whole app (MCP endpoint included) —
1140
- * usable directly on serverless/edge runtimes or in tests.
1141
- *
1142
- * The handler never binds a socket, so no Host/Origin validation applies
1143
- * by default: DNS rebinding targets locally bound servers, and platform
1144
- * edges (Vercel, Cloudflare, …) only route hostnames assigned to the
1145
- * deployment. Set `allowedHosts`/`allowedOrigins` to opt into validation
1146
- * (additive — localhost-class values stay allowed).
1147
- *
1148
- * Pass the same `bus` to multiple server instances when their handlers
1149
- * replace one another while existing `subscriptions/listen` streams remain
1150
- * open. The bus is fixed when this instance first mounts.
1151
- *
1152
- * @param options - Optional handler wiring.
1153
- *
1154
- * @example
1155
- * ```ts
1156
- * const handler = server.getHandler();
1157
- * export default { fetch: handler };
1158
- * ```
1159
- */
1160
- getHandler(options = {}) {
1161
- const { fetch } = this.#ensureMounted("handler", void 0, options.bus);
1162
- return fetch;
1163
- }
1164
- /**
1165
- * Publish a tools-list change to v2 clients with active subscriptions.
1166
- *
1167
- * @example
1168
- * ```ts
1169
- * await server.notifyToolsChanged();
1170
- * ```
1171
- */
1172
- async notifyToolsChanged() {
1173
- await this.#ensureMounted("handler").handler.notify.toolsChanged();
1174
- }
1175
- /**
1176
- * Publish a prompts-list change to v2 clients with active subscriptions.
1177
- *
1178
- * @example
1179
- * ```ts
1180
- * await server.notifyPromptsChanged();
1181
- * ```
1182
- */
1183
- async notifyPromptsChanged() {
1184
- await this.#ensureMounted("handler").handler.notify.promptsChanged();
1185
- }
1186
- /**
1187
- * Publish a resources-list change to v2 clients with active subscriptions.
1188
- *
1189
- * @example
1190
- * ```ts
1191
- * await server.notifyResourcesChanged();
1192
- * ```
1193
- */
1194
- async notifyResourcesChanged() {
1195
- await this.#ensureMounted("handler").handler.notify.resourcesChanged();
1196
- }
1197
- /**
1198
- * Publish a resource update to subscribed v2 clients.
1199
- *
1200
- * @param uri - Resource URI whose representation changed.
1201
- *
1202
- * @example
1203
- * ```ts
1204
- * await server.notifyResourceUpdated("config://settings");
1205
- * ```
1206
- */
1207
- async notifyResourceUpdated(uri) {
1208
- await this.#ensureMounted("handler").handler.notify.resourceUpdated(uri);
1209
- }
1210
- /**
1211
- * Serve over HTTP on Node. Pass port `0` for an ephemeral port.
1212
- *
1213
- * Binds `config.host` (default `127.0.0.1`). Localhost-class binds get
1214
- * DNS-rebinding protection automatically: `Host` on every request,
1215
- * `Origin` only on non-GET/HEAD (sandboxed view iframes send
1216
- * `Origin: null` on asset GETs). To serve publicly set `host: "0.0.0.0"`;
1217
- * behind a platform edge that is all that's needed, and `allowedHosts`
1218
- * restricts direct exposure (additive — localhost-class values stay allowed).
1219
- *
1220
- * With OAuth and no explicit resource or `MCP_URL`, a localhost listener
1221
- * derives its protected-resource URL from the actual bound port. Mounting
1222
- * therefore waits for the listener callback (especially for port `0`), and
1223
- * requests accepted before then are queued. Public/wildcard listeners must
1224
- * configure the resource before calling this method.
1225
- *
1226
- * @throws If called on a localhost-class bind after {@link MCPServer.getHandler}
1227
- * already mounted the app without Host validation.
1228
- */
1229
- async listen(port = 3e3) {
1230
- this.#assertListenOAuthConfiguration();
1231
- const { createServer } = await import("http");
1232
- const { toNodeHandler } = await import("./node-bridge.js");
1233
- const host = this.#config.host ?? "127.0.0.1";
1234
- return new Promise((resolve, reject) => {
1235
- let resolveFetch;
1236
- let rejectFetch;
1237
- const fetchReady = new Promise(
1238
- (resolveFetchPromise, rejectFetchPromise) => {
1239
- resolveFetch = resolveFetchPromise;
1240
- rejectFetch = rejectFetchPromise;
1241
- }
1242
- );
1243
- void fetchReady.catch(() => void 0);
1244
- let settled = false;
1245
- const rejectAndClose = (error) => {
1246
- if (!settled) {
1247
- settled = true;
1248
- reject(error);
1249
- }
1250
- rejectFetch?.(error);
1251
- void new Promise(
1252
- (closeResolve) => server.close(() => closeResolve())
1253
- ).catch(() => void 0).finally(() => {
1254
- if (this.#httpServer === server) {
1255
- this.#httpServer = void 0;
1256
- }
1257
- });
1258
- };
1259
- const nodeHandler = toNodeHandler({
1260
- fetch: async (request) => (await fetchReady)(request)
1261
- });
1262
- const server = createServer((req, res) => {
1263
- void nodeHandler(req, res);
1264
- });
1265
- server.once("error", rejectAndClose);
1266
- server.listen(port, host, () => {
1267
- try {
1268
- const address = server.address();
1269
- const boundPort = typeof address === "object" && address !== null ? address.port : port;
1270
- const { fetch } = this.#ensureMounted("listen", boundPort);
1271
- resolveFetch?.(fetch);
1272
- if (!settled) {
1273
- settled = true;
1274
- resolve({
1275
- port: boundPort,
1276
- url: `http://localhost:${boundPort}${this.#basePath()}`
1277
- });
1278
- }
1279
- } catch (error) {
1280
- rejectAndClose(error);
1281
- }
1282
- });
1283
- this.#httpServer = server;
1284
- });
1285
- }
1286
- /**
1287
- * Abort in-flight MCP exchanges and stop the HTTP listener.
1288
- *
1289
- * A closed server is done for good — the underlying MCP handler stays
1290
- * closed, so `listen()`/`getHandler()` cannot revive it. Create a new
1291
- * instance to serve again.
1292
- */
1293
- async close() {
1294
- await this.#handler?.close();
1295
- const httpServer = this.#httpServer;
1296
- if (httpServer !== void 0) {
1297
- await new Promise((resolve, reject) => {
1298
- httpServer.close((err) => err ? reject(err) : resolve());
1299
- });
1300
- this.#httpServer = void 0;
1301
- }
1302
- }
1303
- #basePath() {
1304
- return this.#config.basePath ?? "/mcp";
1305
- }
1306
- #resolveOAuthResource(mode, listenPort) {
1307
- if (this.#config.oauth === void 0) {
1308
- return void 0;
1309
- }
1310
- if (this.#oauthResourceResolved) {
1311
- return this.#oauthResource;
1312
- }
1313
- const host = this.#config.host ?? "127.0.0.1";
1314
- const localListen = mode === "listen" && listenPort !== void 0 && ["127.0.0.1", "localhost", "::1"].includes(host);
1315
- if (this.#oauthResourceConfigurationAbsent && localListen) {
1316
- this.#oauthResource = resolveLocalOAuthResource(
1317
- `http://localhost:${listenPort}`,
1318
- this.#basePath()
1319
- );
1320
- this.#oauthResourceResolved = true;
1321
- return this.#oauthResource;
1322
- }
1323
- throw new Error(
1324
- "OAuth requires an explicit resource or MCP_URL when using getHandler() or listening on a non-local host"
1325
- );
1326
- }
1327
- #assertListenOAuthConfiguration() {
1328
- if (this.#config.oauth === void 0) {
1329
- return;
1330
- }
1331
- const host = this.#config.host ?? "127.0.0.1";
1332
- if (["127.0.0.1", "localhost", "::1"].includes(host)) {
1333
- return;
1334
- }
1335
- if (!this.#oauthResourceResolved) {
1336
- throw new Error(
1337
- "OAuth listen() on a public or wildcard host requires an explicit provider resource or valid MCP_URL."
1338
- );
1339
- }
1340
- }
1341
- #assertNotStarted(kind, name) {
1342
- if (this.#handler !== void 0) {
1343
- throw new Error(
1344
- `Cannot register ${kind} "${name}" after the server has started: registrations are replayed per request from the registry, so register everything before listen()/getHandler().`
1345
- );
1346
- }
1347
- }
1348
- /**
1349
- * Effective Host/Origin allowlists for a mount mode; `undefined` means the
1350
- * corresponding validation is off.
1351
- *
1352
- * Configured lists are additive to the localhost-class allowlists, so local
1353
- * runs keep working when a deployment hostname is added. With nothing
1354
- * configured, `listen()` on a localhost-class bind validates against the
1355
- * localhost lists (the DNS-rebinding threat model), while `getHandler()` —
1356
- * which never binds — applies no validation. `allowedOrigins` defaults to
1357
- * mirroring the effective Host allowlist. Origin validation runs only on
1358
- * non-GET/HEAD requests.
1359
- */
1360
- #validationPolicy(mode) {
1361
- const { host = "127.0.0.1", allowedHosts, allowedOrigins } = this.#config;
1362
- const localhostBind = ["127.0.0.1", "localhost", "::1"].includes(host);
1363
- const hosts = allowedHosts !== void 0 ? [.../* @__PURE__ */ new Set([...localhostAllowedHostnames(), ...allowedHosts])] : mode === "listen" && localhostBind ? localhostAllowedHostnames() : void 0;
1364
- const origins = allowedOrigins !== void 0 ? [.../* @__PURE__ */ new Set([...localhostAllowedOrigins(), ...allowedOrigins])] : hosts;
1365
- return { hosts, origins };
1366
- }
1367
- #ensureMounted(mode, listenPort, bus) {
1368
- if (this.#fetchHandler === void 0 || this.#handler === void 0) {
1369
- const { hosts, origins } = this.#validationPolicy(mode);
1370
- const basePath = this.#basePath();
1371
- const middlewares = [
1372
- jsonBodyMiddleware(),
1373
- requestLogger(this.#config.logging)
1374
- ];
1375
- if (hosts !== void 0) {
1376
- middlewares.unshift(hostValidationMiddleware(hosts));
1377
- middlewares.push(originValidationMiddleware(origins ?? hosts));
1378
- } else {
1379
- if (origins !== void 0) {
1380
- middlewares.push(originValidationMiddleware(origins));
1381
- }
1382
- if (mode === "listen") {
1383
- console.warn(
1384
- `[mcp-use] listen() is serving on ${this.#config.host} without Host validation. Behind a platform edge that only routes your own domains this is expected; if this process is reachable directly, set allowedHosts to restrict it.`
1385
- );
1386
- }
1387
- }
1388
- this.#validateViewBindingsAtMount();
1389
- const resource = this.#resolveOAuthResource(mode, listenPort);
1390
- if (resource !== void 0) {
1391
- const provider = this.#config.oauth;
1392
- middlewares.push(oauthMetadata(provider, resource));
1393
- }
1394
- const { handler, fetch: mcpFetch } = createMcpMount(
1395
- (ctx) => this.#buildSdkServer(ctx),
1396
- {
1397
- path: basePath,
1398
- ...(this.#config.legacy !== void 0 || bus !== void 0) && {
1399
- handler: {
1400
- ...this.#config.legacy !== void 0 && {
1401
- legacy: this.#config.legacy
1402
- },
1403
- ...bus !== void 0 && { bus }
1404
- }
1405
- },
1406
- ...resource !== void 0 && {
1407
- authInfo: (request) => authInfoFromRequest(request)
1408
- }
1409
- }
1410
- );
1411
- let mcpRouteHandler = mcpFetch;
1412
- if (resource !== void 0) {
1413
- const provider = this.#config.oauth;
1414
- const providerOptions = getOAuthProviderOptions(provider);
1415
- const gate = requireBearerAuth({
1416
- verifier: wrapOAuthTokenVerifier(provider, resource),
1417
- resourceMetadataUrl: getOAuthProtectedResourceMetadataUrl(resource),
1418
- ...providerOptions.requiredScopes !== void 0 && {
1419
- requiredScopes: providerOptions.requiredScopes
1420
- }
1421
- });
1422
- mcpRouteHandler = async (request) => {
1423
- const result = await gate(request);
1424
- if (result instanceof Response) {
1425
- return result;
1426
- }
1427
- const bag = getRequestBag(request);
1428
- bag.authInfo = result;
1429
- return mcpFetch(request);
1430
- };
1431
- }
1432
- const routes = [];
1433
- const viewHandler = createViewPublicHandler(basePath, this.#views, {
1434
- dev: this.#viewsDevMode,
1435
- projectRoot: this.#viewsProjectRoot
1436
- });
1437
- if (viewHandler !== void 0) {
1438
- routes.push({
1439
- match: (request) => request.method === "GET" || request.method === "HEAD" ? new URL(request.url).pathname.startsWith(
1440
- `${basePath}/_mcp-use/public/`
1441
- ) : false,
1442
- handler: viewHandler
1443
- });
1444
- }
1445
- if (!this.#viewsDevMode) {
1446
- const viewAssetsHandler = createViewAssetsHandler(
1447
- basePath,
1448
- this.#views,
1449
- { projectRoot: this.#viewsProjectRoot }
1450
- );
1451
- if (viewAssetsHandler !== void 0) {
1452
- routes.push({
1453
- match: (request) => request.method === "GET" || request.method === "HEAD" ? new URL(request.url).pathname.startsWith(
1454
- `${basePath}/_mcp-use/views/`
1455
- ) : false,
1456
- handler: viewAssetsHandler
1457
- });
1458
- }
1459
- }
1460
- const inspectorHandler = createInspectorHandler(this.#config.inspector, {
1461
- serverName: this.#config.name,
1462
- basePath
1463
- });
1464
- if (inspectorHandler !== void 0) {
1465
- routes.push({
1466
- match: (request) => {
1467
- if (request.method !== "GET" && request.method !== "HEAD") {
1468
- return false;
1469
- }
1470
- const pathname = new URL(request.url).pathname;
1471
- return pathname === `${basePath}/inspector` || pathname === `${basePath}/inspector/`;
1472
- },
1473
- handler: inspectorHandler
1474
- });
1475
- }
1476
- routes.push({
1477
- match: (request) => matchesPath(request, basePath),
1478
- handler: mcpRouteHandler
1479
- });
1480
- const terminal = routeFetch(routes);
1481
- this.#fetchHandler = composeFetch(terminal, ...middlewares);
1482
- this.#handler = handler;
1483
- this.#hostValidated = hosts !== void 0;
1484
- } else if (bus !== void 0 && this.#handler.bus !== bus) {
1485
- throw new Error(
1486
- "Cannot change the MCP event bus after the server has started."
1487
- );
1488
- } else if (mode === "listen" && !this.#hostValidated && this.#validationPolicy("listen").hosts !== void 0) {
1489
- throw new Error(
1490
- "Cannot listen() on a localhost bind after getHandler(): the app is already mounted without Host validation (getHandler() expects a platform edge in front). Call listen() first, or set allowedHosts."
1491
- );
1492
- }
1493
- return { fetch: this.#fetchHandler, handler: this.#handler };
1494
- }
1495
- #validateToolViewBinding(definition) {
1496
- const view = definition.view;
1497
- if (view === void 0) {
1498
- return;
1499
- }
1500
- if (definition.outputSchema === void 0) {
1501
- throw new Error(
1502
- `Tool "${definition.name}" declares view "${view.name}" but has no outputSchema. View-bound tools require an outputSchema \u2014 the view reads structuredContent typed from it. Use outputSchema: z.object({}) for a view that takes no structured output.`
1503
- );
1504
- }
1505
- const existing = this.#viewBindings.get(view.name);
1506
- if (existing !== void 0) {
1507
- throw new Error(
1508
- `View "${view.name}" is already bound to tool "${existing.toolName}"; tool "${definition.name}" cannot bind the same view. Each view may be bound to one tool.`
1509
- );
1510
- }
1511
- this.#viewBindings.set(view.name, {
1512
- toolName: definition.name,
1513
- config: view
1514
- });
1515
- }
1516
- #validateViewBindingsAtMount() {
1517
- if (this.#viewBindings.size > 0 && !this.#viewsPrimed) {
1518
- const first = [...this.#tools.values()].find(
1519
- (entry) => entry.definition.view !== void 0
1520
- );
1521
- const viewName = first?.definition.view?.name ?? "unknown";
1522
- throw new Error(
1523
- `Tool "${first?.definition.name ?? "unknown"}" is bound to view "${viewName}" but no views were primed. Run \`mcp-use build\` and deploy the built entry, or in dev let the CLI prime views automatically.`
1524
- );
1525
- }
1526
- for (const entry of this.#tools.values()) {
1527
- const viewName = entry.definition.view?.name;
1528
- if (viewName !== void 0 && !this.#views.has(viewName)) {
1529
- throw new Error(
1530
- `Tool "${entry.definition.name}" is bound to view "${viewName}" which is not in the primed views registry. Run \`mcp-use build\` and deploy the built entry, or in dev let the CLI prime views automatically.`
1531
- );
1532
- }
1533
- }
1534
- for (const viewName of this.#views.keys()) {
1535
- if (!this.#viewBindings.has(viewName)) {
1536
- console.warn(
1537
- `[mcp-use] View "${viewName}" is registered but no tool binds it.`
1538
- );
1539
- }
1540
- }
1541
- }
1542
- /** Build a fresh SDK server from the registry (runs once per request). */
1543
- #buildSdkServer(ctx) {
1544
- const { name, version, title, description, instructions } = this.#config;
1545
- const authInfo = ctx.authInfo;
1546
- const server = new SdkMcpServer(
1547
- {
1548
- name,
1549
- version,
1550
- ...title !== void 0 && { title },
1551
- ...description !== void 0 && { description }
1552
- },
1553
- {
1554
- capabilities: {
1555
- tools: { listChanged: true },
1556
- prompts: { listChanged: true },
1557
- resources: { listChanged: true, subscribe: true }
1558
- },
1559
- ...instructions !== void 0 && { instructions },
1560
- ...authInfo !== void 0 && { authInfo },
1561
- ...this.#config.requestState !== void 0 && {
1562
- requestState: this.#config.requestState
1563
- }
1564
- }
1565
- );
1566
- const request = ctx.requestInfo;
1567
- const viewMetaOptions = request !== void 0 ? { request, hmrWs: this.#viewsDevMode } : { hmrWs: this.#viewsDevMode };
1568
- const basePath = this.#basePath();
1569
- for (const entry of this.#tools.values()) {
1570
- this.#registerTool(server, entry);
1571
- }
1572
- for (const entry of this.#resources.values()) {
1573
- this.#registerResource(server, entry);
1574
- }
1575
- for (const entry of this.#resourceTemplates.values()) {
1576
- this.#registerResourceTemplate(server, entry);
1577
- }
1578
- for (const entry of this.#prompts.values()) {
1579
- this.#registerPrompt(server, entry);
1580
- }
1581
- for (const [viewName, viewEntry] of this.#views.entries()) {
1582
- this.#registerViewResource(
1583
- server,
1584
- viewName,
1585
- viewEntry,
1586
- viewMetaOptions,
1587
- basePath
1588
- );
1589
- }
1590
- return server;
1591
- }
1592
- #registerTool(server, { definition, callback }) {
1593
- const view = definition.view;
1594
- const toolUiMeta = buildToolUiMeta(view?.name, definition.visibility);
1595
- const config = {
1596
- ...definition.title !== void 0 && { title: definition.title },
1597
- ...definition.description !== void 0 && {
1598
- description: definition.description
1599
- },
1600
- ...definition.annotations !== void 0 && {
1601
- annotations: definition.annotations
1602
- },
1603
- ...definition.outputSchema !== void 0 && {
1604
- outputSchema: definition.outputSchema
1605
- },
1606
- ...toolUiMeta !== void 0 && { _meta: toolUiMeta }
1607
- };
1608
- const wireResultMeta = view !== void 0 ? buildToolResultUiMeta(view.name) : void 0;
1609
- const inputSchema = resolveToolInputSchema(definition);
1610
- if (inputSchema !== void 0) {
1611
- server.registerTool(
1612
- definition.name,
1613
- { ...config, inputSchema },
1614
- async (args, ctx) => {
1615
- const params = args;
1616
- const result = await callback(params, this.#toRequestContext(ctx));
1617
- if (isInputRequiredResult(result) || wireResultMeta === void 0 || result.isError === true) {
1618
- return result;
1619
- }
1620
- return {
1621
- ...result,
1622
- _meta: { ...result._meta, ...wireResultMeta }
1623
- };
1624
- }
1625
- );
1626
- } else {
1627
- server.registerTool(definition.name, config, async (ctx) => {
1628
- const result = await callback({}, this.#toRequestContext(ctx));
1629
- if (isInputRequiredResult(result) || wireResultMeta === void 0 || result.isError === true) {
1630
- return result;
1631
- }
1632
- return {
1633
- ...result,
1634
- _meta: { ...result._meta, ...wireResultMeta }
1635
- };
1636
- });
1637
- }
1638
- }
1639
- #registerViewResource(server, viewName, entry, metaOptions, basePath) {
1640
- const uri = viewResourceUri(viewName);
1641
- const authorFacts = this.#viewResourceFacts(
1642
- this.#viewBindings.get(viewName)?.config
1643
- );
1644
- const resourceConfig = viewResourceConfig(
1645
- viewName,
1646
- entry,
1647
- authorFacts,
1648
- metaOptions
1649
- );
1650
- server.registerResource(
1651
- viewName,
1652
- uri,
1653
- resourceConfig,
1654
- async (readUri, ctx) => {
1655
- const req = ctx.http?.req;
1656
- const readOptions = req !== void 0 ? {
1657
- request: req,
1658
- ...metaOptions.hmrWs === true ? { hmrWs: true } : {}
1659
- } : metaOptions.hmrWs === true ? { hmrWs: true } : {};
1660
- const assetsBase = req !== void 0 ? resolveAssetsBase(req) : metaOptions.request !== void 0 ? resolveAssetsBase(metaOptions.request) : "";
1661
- const html = synthesizeViewDocument(
1662
- entry,
1663
- assetsBase,
1664
- basePath,
1665
- viewName
1666
- );
1667
- return {
1668
- contents: [
1669
- {
1670
- uri: readUri.href,
1671
- mimeType: resourceConfig.mimeType,
1672
- text: html,
1673
- _meta: buildResourceUiMeta(authorFacts, readOptions)
1674
- }
1675
- ]
1676
- };
1677
- }
1678
- );
1679
- }
1680
- #registerResource(server, { definition, callback }) {
1681
- server.registerResource(
1682
- definition.name,
1683
- definition.uri,
1684
- {
1685
- ...definition.title !== void 0 && { title: definition.title },
1686
- ...definition.description !== void 0 && {
1687
- description: definition.description
1688
- },
1689
- ...definition.mimeType !== void 0 && {
1690
- mimeType: definition.mimeType
1691
- }
1692
- },
1693
- async (uri, ctx) => callback(uri, this.#toRequestContext(ctx))
1694
- );
1695
- }
1696
- #registerResourceTemplate(server, { definition, callback }) {
1697
- const template = new ResourceTemplate(definition.uriTemplate, {
1698
- list: void 0
1699
- });
1700
- server.registerResource(
1701
- definition.name,
1702
- template,
1703
- {
1704
- ...definition.title !== void 0 && { title: definition.title },
1705
- ...definition.description !== void 0 && {
1706
- description: definition.description
1707
- },
1708
- ...definition.mimeType !== void 0 && {
1709
- mimeType: definition.mimeType
1710
- }
1711
- },
1712
- async (uri, variables, ctx) => callback(
1713
- uri,
1714
- variables,
1715
- this.#toRequestContext(ctx)
1716
- )
1717
- );
1718
- }
1719
- #viewResourceFacts(viewConfig) {
1720
- if (viewConfig === void 0) {
1721
- return void 0;
1722
- }
1723
- return {
1724
- ...viewConfig.description !== void 0 && {
1725
- description: viewConfig.description
1726
- },
1727
- ...viewConfig.csp !== void 0 && { csp: viewConfig.csp },
1728
- ...viewConfig.permissions !== void 0 && {
1729
- permissions: viewConfig.permissions
1730
- },
1731
- ...viewConfig.domain !== void 0 && { domain: viewConfig.domain },
1732
- ...viewConfig.prefersBorder !== void 0 && {
1733
- prefersBorder: viewConfig.prefersBorder
1734
- }
1735
- };
1736
- }
1737
- #registerPrompt(server, { definition, callback }) {
1738
- const config = {
1739
- ...definition.title !== void 0 && { title: definition.title },
1740
- ...definition.description !== void 0 && {
1741
- description: definition.description
1742
- }
1743
- };
1744
- if (definition.schema !== void 0) {
1745
- server.registerPrompt(
1746
- definition.name,
1747
- { ...config, argsSchema: definition.schema },
1748
- async (args, ctx) => {
1749
- const params = args;
1750
- return callback(params, this.#toRequestContext(ctx));
1751
- }
1752
- );
1753
- } else {
1754
- const handler = async (ctx) => callback({}, this.#toRequestContext(ctx));
1755
- server.registerPrompt(
1756
- definition.name,
1757
- config,
1758
- handler
1759
- );
1760
- }
1761
- }
1762
- #toRequestContext(ctx) {
1763
- if (this.#config.oauth === void 0) {
1764
- return toRequestContext(ctx);
1765
- }
1766
- return toAuthenticatedRequestContext(ctx);
1767
- }
1768
- };
1769
-
1770
- // src/index.ts
1771
- import {
1772
- acceptedContent,
1773
- createRequestStateCodec,
1774
- inputRequired as inputRequired2,
1775
- inputResponse as inputResponse2,
1776
- isInputRequiredResult as isInputRequiredResult2
1777
- } from "@modelcontextprotocol/server";
1778
-
1779
- // src/completable.ts
1780
- import {
1781
- completable as sdkCompletable
1782
- } from "@modelcontextprotocol/server";
1783
- function completable(schema, complete) {
1784
- if (typeof complete === "function") {
1785
- return sdkCompletable(
1786
- schema,
1787
- (value, context) => complete(String(value ?? ""), context)
1788
- );
1789
- }
1790
- const values = complete.map(String);
1791
- return sdkCompletable(schema, (value) => {
1792
- const prefix = String(value ?? "").toLowerCase();
1793
- return values.filter((v) => v.toLowerCase().startsWith(prefix));
1794
- });
1795
- }
1796
- export {
1797
- MCPServer,
1798
- acceptedContent,
1799
- completable,
1800
- composeFetch,
1801
- createMcpMount,
1802
- createRequestStateCodec,
1803
- getRequestBag,
1804
- hostValidationMiddleware,
1805
- inputRequired2 as inputRequired,
1806
- inputResponse2 as inputResponse,
1807
- isInputRequiredResult2 as isInputRequiredResult,
1808
- jsonBodyMiddleware,
1809
- matchesPath,
1810
- matchesPathPrefix,
1811
- mountMcp,
1812
- originValidationMiddleware,
1813
- pathnameOf,
1814
- registerViews,
1815
- requestLogger,
1816
- routeFetch
1817
- };
1818
- //# sourceMappingURL=index.js.map
1
+ import{hasExplicitAssetsBase,originFromAssetsBase,resolveAssetsBase,resolveServerOrigin}from"./chunk-PSKSL567.js";import{registerOpenAPITools}from"./chunk-Y26DNVWA.js";import{completable,normalizeCompletions}from"./chunk-OJF6B5EU.js";import{recordUsage}from"./chunk-YBGMCISI.js";import{resolvePublicFilePath,servePublicFile}from"./chunk-ZMU5USAZ.js";import{authInfoFromRequest,composeFetch,getOAuthProtectedResourceMetadataUrl,getRequestBag,hostValidationMiddleware,isHtmlNavigationRequest,jsonBodyMiddleware,matchesPath,matchesPathPrefix,oauthMetadata,originValidationMiddleware,pathUnderBase,pathnameOf,requireBearerAuth}from"./chunk-WYBJYZJB.js";import{getOAuthProviderOptions,resolveConfiguredOAuthResource,resolveLocalOAuthResource,wrapOAuthTokenVerifier}from"./chunk-JMDHTN6N.js";import{localhostAllowedHostnames,localhostAllowedOrigins,McpServer as SdkMcpServer,ResourceTemplate,CLIENT_CAPABILITIES_META_KEY as CLIENT_CAPABILITIES_META_KEY3,CLIENT_INFO_META_KEY as CLIENT_INFO_META_KEY3,PROTOCOL_VERSION_META_KEY,isJSONRPCRequest as isJSONRPCRequest2,isInputRequiredResult as isInputRequiredResult2}from"@modelcontextprotocol/server";import{Hono}from"hono";var FAVICON_CACHE_CONTROL="public, max-age=31536000, immutable",FAVICON_REDIRECT_CACHE_CONTROL="public, max-age=300";function protocolOf(value){return/^([a-z][a-z\d+.-]*):/i.exec(value)?.[1]?.toLowerCase()}function publicAssetPath(basePath,source){return`${basePath==="/"?"":basePath}/_mcp-use/public/${source.split("/").map(segment=>encodeURIComponent(segment)).join("/")}`}function isLocalPublicSource(source){return protocolOf(source)===void 0}function selectFaviconFromIcons(icons){return icons[0]}function assertLocalPublicSource(source,field){if(source.startsWith("/")||source.includes("\\")||source.includes("?")||source.includes("#")||source.split("/").some(segment=>segment===""||segment===".."))throw new TypeError(`${field} must be an http(s) URL, image data URL, or safe path relative to public/`)}function parseDataImage(source,field){let comma=source.indexOf(",");if(comma<0)throw new TypeError(`${field} must be a valid image data URL`);let metadata=source.slice(5,comma),payload=source.slice(comma+1),parts=metadata.split(";"),mimeType=parts[0]?.toLowerCase()??"";if(!mimeType.startsWith("image/"))throw new TypeError(`${field} data URL must use an image MIME type`);try{if(parts.includes("base64")){let binary2=atob(payload);return{mimeType,bytes:Uint8Array.from(binary2,character=>character.charCodeAt(0))}}return{mimeType,bytes:new TextEncoder().encode(decodeURIComponent(payload))}}catch{throw new TypeError(`${field} must be a valid image data URL`)}}function assertBrandingSource(source,field){if(typeof source!="string"||source.length===0)throw new TypeError(`${field} must be a non-empty string`);let protocol=protocolOf(source);if(protocol===void 0)return assertLocalPublicSource(source,field),source;if(protocol==="data")return parseDataImage(source,field),source;if(protocol!=="http"&&protocol!=="https")throw new TypeError(`${field} must be an http(s) URL, image data URL, or safe path relative to public/`);try{new URL(source)}catch{throw new TypeError(`${field} must be a valid absolute http(s) URL`)}return source}function normalizeServerBranding(config){let websiteUrl;if(config.websiteUrl!==void 0){if(typeof config.websiteUrl!="string"||config.websiteUrl.length===0)throw new TypeError("websiteUrl must be a non-empty absolute http(s) URL");let parsed;try{parsed=new URL(config.websiteUrl)}catch{throw new TypeError("websiteUrl must be a non-empty absolute http(s) URL")}if(parsed.protocol!=="http:"&&parsed.protocol!=="https:")throw new TypeError("websiteUrl must be a non-empty absolute http(s) URL");websiteUrl=config.websiteUrl}let icons;if(config.icons!==void 0){if(!Array.isArray(config.icons))throw new TypeError("icons must be an array of MCP Icon objects");icons=Object.freeze(config.icons.map((value,index)=>{if(typeof value!="object"||value===null)throw new TypeError(`icons[${index}] must be an MCP Icon object`);let icon=value,src=assertBrandingSource(icon.src,`icons[${index}].src`),mimeType=icon.mimeType;if(mimeType!==void 0&&(typeof mimeType!="string"||!mimeType.toLowerCase().startsWith("image/")))throw new TypeError(`icons[${index}].mimeType must be an image MIME type when provided`);let sizes=icon.sizes;if(sizes!==void 0&&(!Array.isArray(sizes)||sizes.some(size=>typeof size!="string"||size.length===0)))throw new TypeError(`icons[${index}].sizes must be an array of non-empty strings when provided`);let normalizedSizes=sizes===void 0?void 0:sizes.map(size=>size),theme=icon.theme;if(theme!==void 0&&theme!=="light"&&theme!=="dark")throw new TypeError(`icons[${index}].theme must be "light" or "dark" when provided`);return Object.freeze({src,...mimeType!==void 0&&{mimeType},...normalizedSizes!==void 0&&{sizes:Object.freeze(normalizedSizes)},...theme!==void 0&&{theme}})}))}let explicitFavicon=config.favicon===void 0?void 0:assertBrandingSource(config.favicon,"favicon"),inferred=explicitFavicon===void 0?selectFaviconFromIcons(icons??[]):void 0,favicon=explicitFavicon??inferred?.src,faviconMimeType=inferred?.mimeType??icons?.find(icon=>icon.src===explicitFavicon)?.mimeType;return Object.freeze({...favicon!==void 0&&{favicon},...faviconMimeType!==void 0&&{faviconMimeType},...icons!==void 0&&{icons},...websiteUrl!==void 0&&{websiteUrl}})}function resolveImplementationIcons(icons,request,basePath){if(icons!==void 0)return icons.map(icon=>({...icon,src:request!==void 0&&isLocalPublicSource(icon.src)?`${resolveAssetsBase(request)}${publicAssetPath(basePath,icon.src)}`:icon.src,...icon.sizes!==void 0&&{sizes:[...icon.sizes]}}))}function hasLocalBrandingAsset(branding){return branding.favicon!==void 0&&isLocalPublicSource(branding.favicon)||branding.icons?.some(icon=>isLocalPublicSource(icon.src))===!0}function createFaviconHandler(branding,options){let source=branding.favicon;if(source!==void 0)return async request=>{if(request.method!=="GET"&&request.method!=="HEAD")return new Response("Method Not Allowed",{status:405,headers:{Allow:"GET, HEAD"}});if(new URL(request.url).pathname!=="/favicon.ico")return new Response("Not Found",{status:404});let protocol=protocolOf(source);if(protocol==="http"||protocol==="https")return new Response(null,{status:307,headers:{Location:source,"Cache-Control":FAVICON_REDIRECT_CACHE_CONTROL}});if(protocol==="data"){let data=parseDataImage(source,"favicon");return new Response(request.method==="HEAD"?null:data.bytes.buffer,{status:200,headers:{"Content-Type":branding.faviconMimeType??data.mimeType,"Cache-Control":FAVICON_CACHE_CONTROL,"X-Content-Type-Options":"nosniff"}})}let{join}=await import("path"),publicRoot=options.dev?join(options.projectRoot,"public"):join(options.projectRoot,".mcp-use/build/views/public"),diskPath=await resolvePublicFilePath(publicRoot,source);if(diskPath===null)return new Response("Not Found",{status:404,headers:{"Cache-Control":"no-store"}});let response=await servePublicFile(diskPath,{...options.deferCors===!0&&{deferCors:!0},...request.method==="HEAD"&&{head:!0}});return response.headers.set("Cache-Control",FAVICON_CACHE_CONTROL),response.headers.set("X-Content-Type-Options","nosniff"),branding.faviconMimeType!==void 0&&response.headers.set("Content-Type",branding.faviconMimeType),response}}function assertServerConfig(config){if(config.basePath!==void 0){if(typeof config.basePath!="string")throw new TypeError("basePath must be an absolute URL pathname without empty segments, trailing slash, query, fragment, or whitespace");let{basePath}=config;if(!basePath.startsWith("/")||basePath.includes("?")||basePath.includes("#")||/\s/.test(basePath)||basePath.includes("//")||basePath.length>1&&basePath.endsWith("/"))throw new TypeError("basePath must be an absolute URL pathname without empty segments, trailing slash, query, fragment, or whitespace")}if(config.port!==void 0&&(typeof config.port!="number"||!Number.isInteger(config.port)||config.port<0||config.port>65535))throw new TypeError("port must be an integer between 0 and 65535")}var DEFAULT_LISTEN_HOST="127.0.0.1";function resolveListenHost(explicitHost,configuredHost,env=process.env){if(explicitHost!==void 0)return explicitHost;let envHost=env.HOST?.trim();return envHost!==void 0&&envHost!==""?envHost:configuredHost??DEFAULT_LISTEN_HOST}function resolveListenPort(explicitPort,configuredPort,env=process.env){if(explicitPort!==void 0)return explicitPort;let envPort=parsePort(env.PORT);return envPort!==void 0?envPort:configuredPort??3e3}function parsePort(value){if(value===void 0||value.trim()==="")return;let port=Number(value);return Number.isInteger(port)&&port>=0&&port<=65535?port:void 0}import{CLIENT_CAPABILITIES_META_KEY as CLIENT_CAPABILITIES_META_KEY2,CLIENT_INFO_META_KEY,inputRequired,inputResponse}from"@modelcontextprotocol/server";import{HonoRequest}from"hono/request";import{CLIENT_CAPABILITIES_META_KEY}from"@modelcontextprotocol/server";var UI_EXTENSION_ID="io.modelcontextprotocol/ui",UI_MIME_TYPE="text/html;profile=mcp-app",UI_RESOURCE_URI_PREFIX="ui://views/";var UI_RESOURCE_URI_META_KEY="ui/resourceUri";function viewResourceUri(viewName){return`${UI_RESOURCE_URI_PREFIX}${viewName}.html`}var clientCapabilitiesByRequest=new WeakMap;function stashClientCapabilities(request,capabilities){clientCapabilitiesByRequest.set(request,capabilities)}function extractClientCapabilitiesFromBody(body){if(typeof body!="object"||body===null)return;let params=body.params;if(typeof params!="object"||params===null)return;let meta=params._meta;if(typeof meta!="object"||meta===null)return;let capabilities=meta[CLIENT_CAPABILITIES_META_KEY];if(!(typeof capabilities!="object"||capabilities===null))return capabilities}function supportsViews(capabilities){let extensions=capabilities?.extensions;if(extensions===void 0)return!1;let uiExtension=extensions[UI_EXTENSION_ID];if(typeof uiExtension!="object"||uiExtension===null)return!1;let mimeTypes=uiExtension.mimeTypes;return Array.isArray(mimeTypes)?mimeTypes.includes(UI_MIME_TYPE):!1}function requireOAuthAuthInfo(authInfo){if(authInfo===void 0||authInfo.extra===void 0||authInfo.expiresAt===void 0)throw new Error("OAuth callback did not receive mapped AuthInfo.extra")}function stringValue(value){return typeof value=="string"?value:void 0}function coordinateValue(value){return typeof value=="string"||typeof value=="number"&&Number.isFinite(value)?value:void 0}function normalizeUserContext(meta){if(meta===void 0)return;let locale=stringValue(meta["openai/locale"])??stringValue(meta["webplus/i18n"]),userAgent=stringValue(meta["openai/userAgent"]),subject=stringValue(meta["openai/subject"]),conversationId=stringValue(meta["openai/session"]),organizationId=stringValue(meta["openai/organization"]),rawLocation=meta["openai/userLocation"],location;if(typeof rawLocation=="object"&&rawLocation!==null&&!Array.isArray(rawLocation)){let values=rawLocation,normalized={city:stringValue(values.city),region:stringValue(values.region),country:stringValue(values.country),timezone:stringValue(values.timezone),latitude:coordinateValue(values.latitude),longitude:coordinateValue(values.longitude)},entries=Object.entries(normalized).filter(entry=>entry[1]!==void 0);entries.length>0&&(location=Object.fromEntries(entries))}if(!(locale===void 0&&userAgent===void 0&&location===void 0&&subject===void 0&&conversationId===void 0&&organizationId===void 0))return{...locale!==void 0&&{locale},...userAgent!==void 0&&{userAgent},...location!==void 0&&{location},...subject!==void 0&&{subject},...conversationId!==void 0&&{conversationId},...organizationId!==void 0&&{organizationId}}}function toClientContext(ctx){let envelope=ctx.mcpReq.envelope,capabilities={...envelope?.[CLIENT_CAPABILITIES_META_KEY2]??{}},info={...envelope?.[CLIENT_INFO_META_KEY]??{}},user=normalizeUserContext(ctx.mcpReq._meta);return{can(capability){return Object.hasOwn(capabilities,capability)},capabilities(){return{...capabilities}},extension(id){let settings=capabilities.extensions?.[id];return settings===void 0?void 0:{...settings}},info(){return{...info}},user(){return user===void 0?void 0:{...user,...user.location!==void 0&&{location:{...user.location}}}},supportsViews(){return supportsViews(capabilities)}}}function createElicit(inputResponses){return async function(key,message,schemaOrUrl){let request,formSchema;if(typeof schemaOrUrl=="string")request=inputRequired.elicitUrl({message,url:schemaOrUrl});else if(schemaOrUrl!==void 0)formSchema=schemaOrUrl,request=inputRequired.elicit({message,requestedSchema:schemaOrUrl});else throw new TypeError("ctx.elicit(key, message, value) requires a form schema or URL string");let response=inputResponse(inputResponses,key);if(response.kind==="elicit"){if(response.action!=="accept")return{status:response.action};if(formSchema===void 0)return{status:"accept"};if(response.content!==void 0){let outcome=await formSchema["~standard"].validate(response.content);if(outcome.issues===void 0)return{status:"accept",data:outcome.value}}}return{status:"required",result:inputRequired({inputRequests:{[key]:request}})}}}function toRequestContext(ctx){let rawRequest=ctx.http?.req,http=rawRequest===void 0?void 0:getRequestBag(rawRequest).honoContext,request=http?.req??(rawRequest===void 0?void 0:new HonoRequest(rawRequest)),additions={signal:ctx.mcpReq.signal,...request!==void 0&&{request},...ctx.mcpReq.inputResponses!==void 0&&{inputResponses:ctx.mcpReq.inputResponses},client:toClientContext(ctx),elicit:createElicit(ctx.mcpReq.inputResponses),requestState:()=>ctx.mcpReq.requestState(),async sendNotification(method,params){await ctx.mcpReq.notify({method,...params!==void 0&&{params}})},async reportProgress(progress,total,message){let progressToken=ctx.mcpReq._meta?.progressToken;return progressToken===void 0?!1:(await ctx.mcpReq.notify({method:"notifications/progress",params:{progressToken,progress,...total!==void 0&&{total},...message!==void 0&&{message}}}),!0)},async sendLog(level,data,logger){await ctx.mcpReq.notify({method:"notifications/message",params:{level,data,...logger!==void 0&&{logger}}})}};return http!==void 0?Object.assign(http,additions):{...additions,...request!==void 0&&{req:request}}}function toAuthenticatedRequestContext(ctx){let authInfo=ctx.http?.authInfo;return requireOAuthAuthInfo(authInfo),Object.assign(toRequestContext(ctx),{auth:{user:authInfo.extra.user,payload:authInfo.extra.payload,accessToken:authInfo.token,scopes:[...authInfo.scopes],permissions:[...authInfo.extra.permissions],...authInfo.clientId.length>0&&{clientId:authInfo.clientId},expiresAt:authInfo.expiresAt,...authInfo.resource!==void 0&&{resource:authInfo.resource}}})}function isReadResourceResult(result){return"contents"in result&&Array.isArray(result.contents)}function isGetPromptResult(result){return"messages"in result&&Array.isArray(result.messages)}function toResourceResult(result,uri){if(isReadResourceResult(result))return result;let mime=result._meta&&typeof result._meta=="object"&&typeof result._meta.mimeType=="string"?result._meta.mimeType:void 0,contents=[];for(let block of result.content??[]){let mapped=contentBlockToResourceContents(block,uri,mime);mapped!==void 0&&contents.push(mapped)}return contents.length===0&&result.structuredContent!==void 0&&contents.push({uri,mimeType:"application/json",text:JSON.stringify(result.structuredContent)}),contents.length===0&&contents.push({uri,mimeType:"text/plain",text:""}),{contents}}function contentBlockToResourceContents(block,uri,mimeHint){if(block.type==="text")return{uri,mimeType:mimeHint??"text/plain",text:block.text};if(block.type==="image"||block.type==="audio")return{uri,mimeType:block.mimeType,blob:block.data};if(block.type==="resource")return{...block.resource}}function toPromptResult(result){if(isGetPromptResult(result))return result;let messages=(result.content??[]).map(content=>({role:"user",content}));return messages.length===0&&result.structuredContent!==void 0&&messages.push({role:"user",content:{type:"text",text:JSON.stringify(result.structuredContent)}}),messages.length===0&&messages.push({role:"user",content:{type:"text",text:""}}),{messages}}var DEFAULT_METHODS=["GET","HEAD","POST","OPTIONS"],DEFAULT_ALLOWED_HEADERS=["Content-Type","Authorization","mcp-protocol-version","mcp-method","mcp-name"];function resolveAllowedOrigin(origin,requestOrigin){return origin===void 0?requestOrigin:typeof origin=="function"?origin(requestOrigin):origin==="*"?"*":Array.isArray(origin)?requestOrigin!==null&&origin.includes(requestOrigin)?requestOrigin:null:origin}function corsHeaders(options,request){if(request.headers.has("Access-Control-Allow-Origin"))return;let requestOrigin=request.headers.get("Origin"),allowedOrigin=resolveAllowedOrigin(options.origin,requestOrigin);if(allowedOrigin===null)return;let headers={"Access-Control-Allow-Origin":allowedOrigin,"Access-Control-Allow-Methods":options.methods.join(", "),"Access-Control-Allow-Headers":options.allowedHeaders.join(", ")};return options.credentials&&(headers["Access-Control-Allow-Credentials"]="true"),allowedOrigin!=="*"&&(headers.Vary="Origin"),headers}function mergeCorsHeaders(response,headers){if(response.headers.has("Access-Control-Allow-Origin"))return response;let merged=new Headers(response.headers);return new Headers(headers).forEach((value,key)=>{merged.set(key,value)}),new Response(response.body,{status:response.status,statusText:response.statusText,headers:merged})}function corsFetchMiddleware(options){if(!(options.enabled!==!1))return async(_request,next)=>next();let resolved={...options.origin!==void 0&&{origin:options.origin},methods:options.methods??DEFAULT_METHODS,allowedHeaders:options.allowedHeaders??DEFAULT_ALLOWED_HEADERS,credentials:options.credentials??!1};return async(request,next)=>{let headers=corsHeaders(resolved,request);if(headers===void 0)return next();if(request.method==="OPTIONS")return new Response(null,{status:204,headers});let response=await next();return mergeCorsHeaders(response,headers)}}function isGlobalCorsEnabled(cors){return cors!==void 0&&cors.enabled!==!1}import{CallToolResultSchema,GetPromptResultSchema,ListPromptsResultSchema,ListResourcesResultSchema,ListToolsResultSchema,ReadResourceResultSchema}from"@modelcontextprotocol/core";import{isInputRequiredResult}from"@modelcontextprotocol/server";var MCP_MIDDLEWARE_METHODS=["tools/call","tools/list","resources/read","resources/list","prompts/get","prompts/list"];function withMcpMiddlewareParams(request,params){if(typeof request!="object"||request===null||Array.isArray(request))throw new TypeError("[mcp-use] MCP middleware received an invalid downstream request");return{...request,params}}function createMcpMiddlewareEntry(pattern,handler){let normalizedPattern=normalizeMcpMiddlewarePattern(pattern),invoke=handler;if(normalizedPattern!=="*"&&!isMcpMiddlewareMethod(normalizedPattern))throw new TypeError(`Unsupported MCP middleware pattern "${pattern}". Use an exact MCP method or "mcp:*".`);return normalizedPattern==="*"?{pattern:normalizedPattern,handler:async(ctx,next)=>{let downstreamCalled=!1,downstreamResult;if(await invoke(ctx,async()=>{downstreamResult=await next(),downstreamCalled=!0}),!downstreamCalled)throw new Error(`Wildcard MCP middleware "${normalizedPattern}" must call next()`);return downstreamResult}}:{pattern:normalizedPattern,handler:(ctx,next)=>invoke(ctx,next)}}function createMcpEventListenerEntry(pattern,handler){let{pattern:normalizedPattern,phase}=parseMcpPattern(pattern),invoke=handler;return{pattern:normalizedPattern,phase,handler:(ctx,result)=>invoke(ctx,result)}}function matchesPattern(pattern,method){if(pattern==="*")return!0;if(pattern.endsWith("/*")){let prefix=pattern.slice(0,-1);return method.startsWith(prefix)}return pattern===method}function isMcpMiddlewareMethod(value){return MCP_MIDDLEWARE_METHODS.some(method=>method===value)}function composeMiddleware(entries,method,innerFn){let matching=entries.filter(entry=>matchesPattern(entry.pattern,method));return matching.length===0?_ctx=>innerFn():ctx=>{let index=-1,dispatch=i=>i<=index?Promise.reject(new Error("next() called multiple times")):(index=i,i===matching.length?innerFn():matching[i].handler(ctx,()=>dispatch(i+1)));return dispatch(0)}}function freezeMiddlewareContext(ctx){return Object.freeze({method:ctx.method,params:Object.freeze({...ctx.params}),...ctx.request!==void 0&&{request:ctx.request},...ctx.req!==void 0&&{req:ctx.req},...ctx.session!==void 0&&{session:Object.freeze({...ctx.session})},...ctx.auth!==void 0&&{auth:ctx.auth},state:new Map(ctx.state)})}async function runMcpOperation(middlewares,events,method,ctx,innerFn){dispatchMcpEvents(events,method,"before",ctx);let result=await composeMiddleware(middlewares,method,innerFn)(ctx);return assertValidMiddlewareResult(method,result),dispatchMcpEvents(events,method,"complete",ctx,result),result}function assertValidMiddlewareResult(method,result){if((method==="tools/call"||method==="resources/read"||method==="prompts/get")&&isInputRequiredResult(result))return;let validation=(()=>{switch(method){case"tools/call":return assertArrayProperty(method,result,"content"),CallToolResultSchema.safeParse(result);case"tools/list":return assertArrayResult(method,result),ListToolsResultSchema.safeParse({tools:result});case"resources/read":return assertArrayProperty(method,result,"contents"),ReadResourceResultSchema.safeParse(result);case"resources/list":return assertArrayResult(method,result),ListResourcesResultSchema.safeParse({resources:result});case"prompts/get":return assertArrayProperty(method,result,"messages"),GetPromptResultSchema.safeParse(result);case"prompts/list":return assertArrayResult(method,result),ListPromptsResultSchema.safeParse({prompts:result});default:throw new TypeError(`Unsupported MCP middleware method "${method}"`)}})();if(!validation.success)throw new TypeError(`[mcp-use] ${method} middleware returned an invalid result: ${validation.error.message}`)}function assertArrayResult(method,result){if(!Array.isArray(result))throw new TypeError(`[mcp-use] ${method} middleware returned an invalid result: expected an array`)}function assertArrayProperty(method,result,property){if(typeof result!="object"||result===null||!Array.isArray(result[property]))throw new TypeError(`[mcp-use] ${method} middleware returned an invalid result: expected a ${property} array`)}function dispatchMcpEvents(events,method,phase,ctx,result){let frozen=freezeMiddlewareContext(ctx);for(let entry of events)if(!(entry.phase!==phase||!matchesPattern(entry.pattern,method)))try{entry.handler(frozen,result)}catch(error2){console.error(`[mcp-use] MCP event listener for "${entry.pattern}" (${phase}) threw:`,error2)}}function parseMcpPattern(raw){let pattern=raw.startsWith("mcp:")?raw.slice(4):raw;return pattern.endsWith(":complete")?{pattern:pattern.slice(0,-9),phase:"complete"}:{pattern,phase:"before"}}function normalizeMcpMiddlewarePattern(raw){return raw.startsWith("mcp:")?raw.slice(4):raw}import{CLIENT_INFO_META_KEY as CLIENT_INFO_META_KEY2,isJSONRPCRequest}from"@modelcontextprotocol/server";function colorsEnabled(){return typeof process>"u"||process.env?.NO_COLOR!==void 0?!1:process.stdout?.isTTY===!0}function ansi(open,close){return text2=>colorsEnabled()?`\x1B[${open}m${text2}\x1B[${close}m`:text2}var bold=ansi(1,22),dim=ansi(2,22),red=ansi(31,39),green=ansi(32,39),yellow=ansi(33,39),blue=ansi(34,39),magenta=ansi(35,39),cyan=ansi(36,39),gray=ansi(90,39);function resolveLogLevel(configured){let raw=typeof process>"u"?void 0:process.env?.MCP_USE_LOG_LEVEL?.toLowerCase();return raw==="info"||raw==="debug"||raw==="trace"?raw:configured??"info"}function formatClientInfo(info){if(info!==void 0)return typeof info.version=="string"&&info.version!==""?`${info.name}/${info.version}`:info.name}var detailFormatters={initialize:p=>({subject:formatClientInfo(p.clientInfo)}),ping:()=>({}),"server/discover":()=>({}),"completion/complete":p=>({subject:p.ref.type==="ref/prompt"?p.ref.name:p.ref.uri,input:p.argument}),"logging/setLevel":p=>({subject:p.level}),"prompts/get":p=>({subject:p.name,input:p.arguments}),"prompts/list":()=>({}),"resources/list":()=>({}),"resources/templates/list":()=>({}),"resources/read":p=>({subject:p.uri}),"resources/subscribe":p=>({subject:p.uri}),"resources/unsubscribe":p=>({subject:p.uri}),"subscriptions/listen":()=>({}),"tools/call":p=>({subject:p.name,input:p.arguments}),"tools/list":()=>({}),"sampling/createMessage":()=>({}),"elicitation/create":()=>({}),"roots/list":()=>({})};function isKnownMethod(method){return Object.prototype.hasOwnProperty.call(detailFormatters,method)}function formatDetail(message){if(!isKnownMethod(message.method))return{};try{let formatter=detailFormatters[message.method],detail=formatter(message.params);return typeof detail.subject=="string"||detail.subject===void 0?detail:{}}catch{return{}}}var INLINE_JSON_MAX_LENGTH=80;function inlineJson(value){let text2;try{text2=JSON.stringify(value)??String(value)}catch{text2=String(value)}return text2.length>INLINE_JSON_MAX_LENGTH?`${text2.slice(0,INLINE_JSON_MAX_LENGTH)}...`:text2}function formatClientIdentity(message){let meta=message.params?._meta;if(meta===void 0)return;let info=meta[CLIENT_INFO_META_KEY2];if(!(typeof info!="object"||info===null||typeof info.name!="string"))return formatClientInfo(info)}function sanitize(text2){return text2.replace(/[\u0000-\u001F\u007F-\u009F]+/g," ")}function methodStyle(method){return method.startsWith("tools/")?cyan:method.startsWith("resources/")?green:method.startsWith("prompts/")?magenta:method==="initialize"||method==="ping"?gray:blue}var REDACTED_HEADERS=new Set(["authorization","proxy-authorization","cookie","set-cookie","x-api-key"]);function redactHeaders(headers){return Object.fromEntries(Object.entries(headers).map(([name,value])=>[name,REDACTED_HEADERS.has(name.toLowerCase())?"[REDACTED]":value]))}async function extractResponseOutcome(res){if(!res.body)return{errorMessage:null};let text2;try{text2=await res.clone().text()}catch{return{errorMessage:null}}if(!text2)return{errorMessage:null};let isSse=(res.headers.get("content-type")??"").includes("text/event-stream"),payloads=[],tryParse=raw=>{try{payloads.push(JSON.parse(raw))}catch{}};if(isSse){for(let line of text2.split(/\r?\n/))if(line.startsWith("data:")){let data=line.slice(5).trim();data&&tryParse(data)}}else tryParse(text2);let result;for(let payload of payloads){if(payload===null||typeof payload!="object")continue;let message=payload;if(typeof message.error?.message=="string")return{errorMessage:message.error.message};if(message.result?.isError===!0){let textBlock=(Array.isArray(message.result.content)?message.result.content:[]).find(b=>b?.type==="text"&&typeof b.text=="string");return{errorMessage:textBlock?String(textBlock.text):"tool error"}}"result"in message&&(result=message.result)}return{errorMessage:null,result}}function compactToolResult(result){if(result===null||typeof result!="object")return result;let{structuredContent,content}=result;if(structuredContent!==void 0)return structuredContent;if(Array.isArray(content)){let[block]=content;if(content.length===1&&block?.type==="text")return block.text}return content}function formatForDump(value){function truncate(val){return typeof val=="string"&&val.length>100?`${val.slice(0,100)}...`:Array.isArray(val)?val.map(truncate):val!==null&&typeof val=="object"?Object.fromEntries(Object.entries(val).map(([k,v])=>[k,truncate(v)])):val}try{return JSON.stringify(truncate(value),null,2)}catch{return String(value)}}var DUMP_BODY_MAX_LENGTH=1e4;async function printTraceDump(response,requestHeaders,requestBody,readResponseBody){console.log(`
2
+ ${cyan("=".repeat(80))}`),console.log(bold(cyan("[TRACE] Request Details"))),console.log(cyan("-".repeat(80))),Object.keys(requestHeaders).length>0&&(console.log(yellow("Request Headers:")),console.log(formatForDump(redactHeaders(requestHeaders)))),requestBody!==void 0&&(console.log(yellow("Request Body:")),console.log(typeof requestBody=="string"?requestBody:formatForDump(requestBody)));let responseHeaders={};if(response.headers.forEach((value,key)=>{responseHeaders[key]=value}),Object.keys(responseHeaders).length>0&&(console.log(yellow("Response Headers:")),console.log(formatForDump(redactHeaders(responseHeaders)))),!readResponseBody)console.log(`${yellow("Response Body:")} (streaming \u2014 not dumped)`);else if(response.body===null)console.log(`${yellow("Response Body:")} (no body)`);else try{let text2=await response.clone().text();if(text2.length===0)console.log(`${yellow("Response Body:")} (empty)`);else{console.log(yellow("Response Body:"));try{console.log(formatForDump(JSON.parse(text2)))}catch{console.log(text2.length>DUMP_BODY_MAX_LENGTH?`${text2.slice(0,DUMP_BODY_MAX_LENGTH)}
3
+ ... (truncated, ${text2.length-DUMP_BODY_MAX_LENGTH} more characters)`:text2)}}}catch{console.log(`${yellow("Response Body:")} (unable to read)`)}console.log(`${cyan("=".repeat(80))}
4
+ `)}function styleStatus(status){let text2=String(status);return status>=500?magenta(text2):status>=400?red(text2):status>=300?yellow(text2):green(text2)}function isNoisyRequest(httpMethod,pathname){return httpMethod!=="GET"&&httpMethod!=="HEAD"?!1:pathname.endsWith("/favicon.ico")}function requestLogger(options={}){return options.enabled===!1?(_request,next)=>next():async(request,next)=>{let level=resolveLogLevel(options.level),startedAt=Date.now(),httpMethod=request.method,pathname=new URL(request.url).pathname;if(isNoisyRequest(httpMethod,pathname))return next();let requestHeaders={};level==="trace"&&request.headers.forEach((value,key)=>{requestHeaders[key]=value});let requestBody;if(httpMethod!=="GET"&&httpMethod!=="HEAD"){let parsedBody=getRequestBag(request).parsedBody;if(parsedBody!==void 0)requestBody=parsedBody;else try{requestBody=await request.clone().json()}catch{}}let response=await next(),durationMs=Date.now()-startedAt,timestamp=new Date().toISOString().substring(11,19),mcpRequest=isJSONRPCRequest(requestBody)?requestBody:void 0,isStreamingMethod=mcpRequest?.method==="subscriptions/listen",lines=[[dim(timestamp),bold(httpMethod),pathname,styleStatus(response.status),dim(`in ${durationMs}ms`)].join(" ")];if(mcpRequest!==void 0){let method=sanitize(mcpRequest.method),parts=[` ${methodStyle(method)(method)}`],detail=formatDetail(mcpRequest);detail.subject!==void 0&&parts.push(bold(sanitize(detail.subject)));let echoPayloads=level!=="info";echoPayloads&&detail.input!==void 0&&parts.push(inlineJson(detail.input));let outcome=isStreamingMethod?{errorMessage:null}:await extractResponseOutcome(response);if(echoPayloads&&mcpRequest.method==="tools/call"&&outcome.errorMessage===null&&outcome.result!==void 0&&parts.push(dim("->"),inlineJson(compactToolResult(outcome.result))),mcpRequest.method!=="initialize"){let client=formatClientIdentity(mcpRequest);client!==void 0&&parts.push(dim(sanitize(client)))}outcome.errorMessage!==null?parts.push(red(`ERROR ${sanitize(outcome.errorMessage)}`)):response.status>=400&&parts.push(red(`ERROR (HTTP ${response.status})`)),lines.push(parts.join(" "))}return console.log(lines.join(`
5
+ `)),level==="trace"&&await printTraceDump(response,requestHeaders,requestBody,!isStreamingMethod),response}}import{createMcpHandler}from"@modelcontextprotocol/server";function createMcpMount(factory,options={}){let{path="/mcp",handler:handlerOptions,authInfo:getAuthInfo}=options,legacyMode=handlerOptions?.legacy??"stateless",handler=createMcpHandler(factory,{legacy:"stateless",...handlerOptions});return{handler,fetch:async request=>{if(!matchesPath(request,path))return new Response("Not Found",{status:404});if(legacyMode==="stateless"){let method=request.method.toUpperCase();if(method==="GET"||method==="DELETE"||method==="HEAD")return new Response(null,{status:204})}let bag=getRequestBag(request),parsedBody=bag.parsedBody;if(parsedBody===void 0)try{parsedBody=await request.clone().json()}catch{}let capabilities=extractClientCapabilitiesFromBody(parsedBody);capabilities!==void 0&&stashClientCapabilities(request,capabilities);let authInfo=getAuthInfo?.(request)??bag.authInfo;return handler.fetch(request,{...parsedBody!==void 0&&{parsedBody},...authInfo!==void 0&&{authInfo}})}}}function resolveToolInputSchema(definition){return definition.inputSchema??definition.schema}var registerViews=Symbol("mcp-use/registerViews");function resolveAssetUrl(assetPath,origin){if(!assetPath.startsWith("/"))throw new Error(`View manifest asset path must be origin-absolute (start with "/"); got ${JSON.stringify(assetPath)}`);return`${origin}${assetPath}`}function viewAssetsBasePath(basePath,viewName){return`${pathUnderBase(basePath,`_mcp-use/views/${viewName}`)}/`}function resolveExternalAssetUrl(assetPath,assetsBase,basePath,viewName){return assetPath.startsWith("http://")||assetPath.startsWith("https://")||assetPath.startsWith("data:")?assetPath:assetPath.startsWith("/")?resolveAssetUrl(assetPath,assetsBase):`${assetsBase}${viewAssetsBasePath(basePath,viewName)}${assetPath.replace(/^\/+/,"")}`}function resolvePublicBase(assetsBase,basePath){return`${assetsBase}${pathUnderBase(basePath,"_mcp-use/public")}/`}function escapeInlineScript(code){return code.replaceAll(/<\/script/gi,"<\\/script").replaceAll("<!--","\\x3C!--")}function escapeInlineStyle(css2){return css2.replaceAll(/<\/style/gi,"<\\/style")}function escapeHtml(value){return value.replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;").replaceAll(">","&gt;")}var TRANSPARENT_IFRAME_STYLE="<style>html,body,#root{background:transparent}</style>";function synthesizeViewDocument(entry,assetsBase,basePath,viewName){let viewConfig={publicBase:resolvePublicBase(assetsBase,basePath)},configScript=`<script>globalThis.__mcpUseViewConfig=${JSON.stringify(viewConfig)};</script>`;if(entry.kind==="inline"){let styleTag=entry.css.length>0?`<style>${escapeInlineStyle(entry.css)}</style>`:"",moduleScript=`<script type="module">${escapeInlineScript(entry.js)}</script>`;return`<!doctype html>
6
+ <html>
7
+ <head>
8
+ <meta charset="utf-8">
9
+ ${configScript}
10
+ ${TRANSPARENT_IFRAME_STYLE}
11
+ ${styleTag}
12
+ </head>
13
+ <body>
14
+ <div id="root"></div>
15
+ ${moduleScript}
16
+ </body>
17
+ </html>`}if(viewName===void 0)throw new Error("viewName is required when synthesizing an external view document.");let cssLinks=entry.css.map(path=>`<link rel="stylesheet" href="${escapeHtml(resolveExternalAssetUrl(path,assetsBase,basePath,viewName))}">`).join(`
18
+ `),scriptTags=(entry.scripts??[]).map(path=>`<script type="module" src="${escapeHtml(resolveExternalAssetUrl(path,assetsBase,basePath,viewName))}"></script>`).join(`
19
+ `),entryUrl=resolveExternalAssetUrl(entry.entry,assetsBase,basePath,viewName);return`<!doctype html>
20
+ <html>
21
+ <head>
22
+ <meta charset="utf-8">
23
+ ${configScript}
24
+ ${TRANSPARENT_IFRAME_STYLE}
25
+ ${cssLinks}
26
+ </head>
27
+ <body>
28
+ <div id="root"></div>
29
+ ${scriptTags}
30
+ <script type="module" src="${escapeHtml(entryUrl)}"></script>
31
+ </body>
32
+ </html>`}var CATEGORY_ENV={connectDomains:"CSP_CONNECT_DOMAINS",resourceDomains:"CSP_RESOURCE_DOMAINS",frameDomains:"CSP_FRAME_DOMAINS",baseUriDomains:"CSP_BASE_URI_DOMAINS"};function parseDomainList(raw){return raw===void 0||raw.trim()===""?[]:raw.split(",").map(s=>s.trim()).filter(s=>s.length>0)}function readEnvDomains(name){if(typeof process>"u")return;let raw=process.env[name];if(!(raw===void 0||raw.trim()===""))return parseDomainList(raw)}function readCspUrlsShortcut(){return readEnvDomains("CSP_URLS")??[]}function readEnvDomainsForCategory(category){let perCategory=readEnvDomains(CATEGORY_ENV[category]);return perCategory!==void 0?perCategory:readCspUrlsShortcut()}function mergeDomainLists(...segments){let seen=new Set,out=[];for(let segment of segments)for(let domain of segment)seen.has(domain)||(seen.add(domain),out.push(domain));return out}function toWebSocketOrigin(serverOrigin){return serverOrigin.startsWith("https://")?`wss://${serverOrigin.slice(8)}`:serverOrigin.startsWith("http://")?`ws://${serverOrigin.slice(7)}`:serverOrigin}function buildMergedResourceCsp(authorFacts,options){let author=authorFacts?.csp,mcpConnectAuto=[];options.serverOrigin!==""&&(mcpConnectAuto.push(options.serverOrigin),options.hmrWs===!0&&mcpConnectAuto.push(toWebSocketOrigin(options.serverOrigin)));let mcpResourceAuto=[],resourceOrigin=options.explicitAssetsBase?options.assetsOrigin:options.serverOrigin;resourceOrigin!==""&&mcpResourceAuto.push(resourceOrigin);let connectDomains=mergeDomainLists(author?.connectDomains??[],readEnvDomainsForCategory("connectDomains"),mcpConnectAuto),resourceDomains=mergeDomainLists(author?.resourceDomains??[],readEnvDomainsForCategory("resourceDomains"),mcpResourceAuto),frameDomains=mergeDomainLists(author?.frameDomains??[],readEnvDomainsForCategory("frameDomains")),baseUriDomains=mergeDomainLists(author?.baseUriDomains??[],readEnvDomainsForCategory("baseUriDomains"));return{...author,connectDomains,resourceDomains,frameDomains,baseUriDomains}}var PUBLIC_BUILD_DIR=".mcp-use/build/views/public",PUBLIC_DEV_DIR="public",VIEW_ASSETS_BUILD_ROOT=".mcp-use/build/views";function createViewAssetsHandler(basePath,views,options){if(views.size===0)return;let assetsPrefix=pathUnderBase(basePath,"_mcp-use/views"),projectRoot=options?.projectRoot??process.cwd();return async request=>{if(request.method!=="GET"&&request.method!=="HEAD")return new Response("Method Not Allowed",{status:405});if(!matchesPathPrefix(request,assetsPrefix))return new Response("Not Found",{status:404});let remainder=pathnameOf(request).slice(assetsPrefix.length+1),slash=remainder.indexOf("/");if(slash<=0||slash===remainder.length-1)return new Response("Not Found",{status:404});let viewName=remainder.slice(0,slash),subpath=remainder.slice(slash+1),entry=views.get(viewName);if(entry===void 0||entry.kind!=="external")return new Response("Not Found",{status:404});let[{join},{resolvePublicFilePath:resolvePublicFilePath2,servePublicFile:servePublicFile2}]=await Promise.all([import("path"),import("./public-route-DAQJGS6K.js")]),viewRoot=join(projectRoot,VIEW_ASSETS_BUILD_ROOT,viewName),diskPath=await resolvePublicFilePath2(viewRoot,subpath);return diskPath===null?new Response("Not Found",{status:404}):await servePublicFile2(diskPath,{...options?.deferCors===!0&&{deferCors:!0},...request.method==="HEAD"&&{head:!0}})}}function createViewPublicHandler(basePath,views,options){if(views.size===0&&options?.enabled!==!0)return;let publicPrefix=pathUnderBase(basePath,"_mcp-use/public"),subdir=options?.dev===!0?PUBLIC_DEV_DIR:PUBLIC_BUILD_DIR,projectRoot=options?.projectRoot??process.cwd();return async request=>{if(request.method!=="GET"&&request.method!=="HEAD")return new Response("Method Not Allowed",{status:405});if(!matchesPathPrefix(request,publicPrefix))return new Response("Not Found",{status:404});let encodedSubpath=pathnameOf(request).slice(publicPrefix.length+1),subpath;try{subpath=decodeURIComponent(encodedSubpath)}catch{return new Response("Not Found",{status:404})}if(subpath.length===0)return new Response("Not Found",{status:404});let[{join},{resolvePublicFilePath:resolvePublicFilePath2,servePublicFile:servePublicFile2}]=await Promise.all([import("path"),import("./public-route-DAQJGS6K.js")]),publicRoot=join(projectRoot,subdir),diskPath=await resolvePublicFilePath2(publicRoot,subpath);return diskPath===null?new Response("Not Found",{status:404}):await servePublicFile2(diskPath,{...options?.deferCors===!0&&{deferCors:!0},...request.method==="HEAD"&&{head:!0}})}}function buildToolUiMeta(viewName,visibility,existingMetadata){if(viewName===void 0&&visibility===void 0&&existingMetadata===void 0)return;let meta={...existingMetadata},existingUi=existingMetadata?.["ui"],existingUiIsObject=typeof existingUi=="object"&&existingUi!==null&&!Array.isArray(existingUi),ui=existingUiIsObject?{...existingUi}:{};if(viewName!==void 0){let resourceUri=viewResourceUri(viewName);ui.resourceUri=resourceUri,meta[UI_RESOURCE_URI_META_KEY]=resourceUri}else delete ui.resourceUri,delete meta[UI_RESOURCE_URI_META_KEY];return visibility!==void 0?ui.visibility=[visibility]:delete ui.visibility,(viewName!==void 0||visibility!==void 0||existingUiIsObject)&&(meta["ui"]=ui),meta}function buildToolResultUiMeta(viewName){let resourceUri=viewResourceUri(viewName);return{ui:{resourceUri},[UI_RESOURCE_URI_META_KEY]:resourceUri}}function resolveCspOptions(options){let request=options?.request,serverOrigin=options?.serverOrigin??(request!==void 0?resolveServerOrigin(request):""),assetsBase=options?.assetsBase??(request!==void 0?resolveAssetsBase(request):serverOrigin);return{serverOrigin,assetsOrigin:originFromAssetsBase(assetsBase),explicitAssetsBase:hasExplicitAssetsBase(),...options?.hmrWs===!0?{hmrWs:!0}:{}}}function buildResourceUiMeta(authorFacts,options){let ui={csp:buildMergedResourceCsp(authorFacts,resolveCspOptions(options))};return authorFacts?.permissions!==void 0&&(ui.permissions=authorFacts.permissions),authorFacts?.domain!==void 0&&(ui.domain=authorFacts.domain),authorFacts?.prefersBorder!==void 0&&(ui.prefersBorder=authorFacts.prefersBorder),{ui}}function viewResourceConfig(_viewName,_entry,authorFacts,options){return{mimeType:UI_MIME_TYPE,...authorFacts?.description!==void 0&&{description:authorFacts.description},_meta:buildResourceUiMeta(authorFacts,options)}}function record(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)?value:void 0}function productId(value,fallback){if(typeof value!="string")return fallback;let normalized=value.trim();return normalized.length>0&&normalized.length<=64&&![...normalized].some(character=>{let code=character.charCodeAt(0);return code<32||code===127})?normalized:fallback}function clientUsageFromBody(body){if(!isJSONRPCRequest2(body))return;let params=record(body.params);if(body.method==="initialize"){let info2=record(params?.clientInfo),capabilities2=record(params?.capabilities)??{};return clientUsage(info2,capabilities2,params?.protocolVersion,"legacy")}let meta=record(params?._meta),info=record(meta?.[CLIENT_INFO_META_KEY3]),capabilities=record(meta?.[CLIENT_CAPABILITIES_META_KEY3]);if(!(info===void 0||capabilities===void 0))return clientUsage(info,capabilities,meta?.[PROTOCOL_VERSION_META_KEY],"modern")}function clientUsage(info,capabilities,protocolVersion,era){let typedCapabilities=capabilities;return{client_name:productId(info?.name,"other"),client_version:productId(info?.version,"unknown"),protocol_era:era,protocol_version:productId(protocolVersion,"unknown"),connection_mode:era==="modern"?"stateless_request":"legacy_session",sampling_capability:Object.hasOwn(capabilities,"sampling"),elicitation_capability:Object.hasOwn(capabilities,"elicitation"),roots_capability:Object.hasOwn(capabilities,"roots"),extensions_capability:Object.hasOwn(capabilities,"extensions"),views_capability:supportsViews(typedCapabilities),capability_count:Object.keys(capabilities).length}}function omitRootSchemaDialect(schema){if(typeof schema!="object"||schema===null||Array.isArray(schema)||!("$schema"in schema))return schema;let emittedSchema={...schema};return delete emittedSchema.$schema,emittedSchema}function omitToolSchemaDialects(tools){return tools.map(tool=>({...tool,inputSchema:omitRootSchemaDialect(tool.inputSchema),...tool.outputSchema===void 0?{}:{outputSchema:omitRootSchemaDialect(tool.outputSchema)}}))}function registerFetchMiddleware(app,middleware){app.use("*",async(context,next)=>{let response=await middleware(context.req.raw,async()=>(await next(),context.res));return context.res=response,response})}var MCPServer=class _MCPServer{#config;#branding;#tools=new Map;#resources=new Map;#resourceTemplates=new Map;#prompts=new Map;#views=new Map;#viewBindings=new Map;#viewsPrimed=!1;#viewsDevMode=!1;#viewsProjectRoot=process.cwd();#fetchHandler;#httpApp;#handler;#eventBus;#httpServer;#oauthResource;#oauthResourceResolved=!1;#oauthResourceConfigurationAbsent=!1;#hostValidated=!1;#mcpMiddlewares=[];#mcpEventListeners=[];#usageScope=crypto.randomUUID();#openApiTools=new Set;#proxiedTools=new Set;#proxiedResources=new Set;#proxiedPrompts=new Set;#httpMiddlewareCount=0;#proxyServersConfigured=0;#proxyServersConnected=0;#proxyToolsDiscovered=0;#proxyResourcesDiscovered=0;#proxyPromptsDiscovered=0;#proxyOwners=[];#proxyOperations=new Set;#closed=!1;app;get;post;put;patch;delete;all;fetch;static fromOpenAPI(options){let server=new _MCPServer({name:options.name??options.spec.info.title,version:options.version??options.spec.info.version??"1.0.0"});registerOpenAPITools(server,options);for(let name of server.#tools.keys())server.#openApiTools.add(name);return server}constructor(config){if(assertServerConfig(config),this.#config=config,this.#branding=normalizeServerBranding(config),this.app=new Hono,this.app.use("*",async(context,next)=>{getRequestBag(context.req.raw).honoContext=context,await next()}),this.get=this.app.get.bind(this.app),this.post=this.app.post.bind(this.app),this.put=this.app.put.bind(this.app),this.patch=this.app.patch.bind(this.app),this.delete=this.app.delete.bind(this.app),this.all=this.app.all.bind(this.app),this.fetch=async(request,env,executionCtx)=>(this.#ensureMounted("handler"),this.#httpApp.fetch(request,env,executionCtx)),config.oauth!==void 0){let mcpUrl=typeof process>"u"?void 0:process.env.MCP_URL,resource2=resolveConfiguredOAuthResource({provider:config.oauth,basePath:this.#basePath(),...mcpUrl!==void 0&&{mcpUrl}});this.#oauthResource=resource2,this.#oauthResourceResolved=resource2!==void 0,this.#oauthResourceConfigurationAbsent=resource2===void 0}}get basePath(){return this.#basePath()}get host(){return this.#config.host}get port(){return this.#config.port}get branding(){return this.#branding}getHandler(){return this.fetch}tool(definition,callback){return this.#assertNotStarted("tool",definition.name),this.#validateToolViewBinding(definition),this.#openApiTools.delete(definition.name),this.#proxiedTools.delete(definition.name),this.#tools.set(definition.name,{definition,callback}),Object.freeze({name:definition.name})}[registerViews](views,options){if(this.#viewsPrimed)throw new Error("Cannot prime views: the views registry is already primed on this server instance.");this.#assertNotStarted("views","manifest"),this.#viewsDevMode=options?.dev===!0,options?.projectRoot!==void 0&&(this.#viewsProjectRoot=options.projectRoot);for(let[name,entry]of Object.entries(views))this.#views.set(name,entry);this.#viewsPrimed=!0}__primeViews(views,options){this[registerViews](views,options)}resource(definition,callback){this.#assertNotStarted("resource",definition.name);let previous=this.#resources.get(definition.name);return previous!==void 0&&this.#proxiedResources.delete(previous.definition.uri),this.#resources.set(definition.name,{definition,callback}),this}resourceTemplate(definition,callback){this.#assertNotStarted("resourceTemplate",definition.name);let complete=definition.complete===void 0?void 0:normalizeCompletions(definition.complete);return this.#resourceTemplates.set(definition.name,{definition,...complete!==void 0&&{complete},callback}),this}prompt(definition,callback){return this.#assertNotStarted("prompt",definition.name),this.#proxiedPrompts.delete(definition.name),this.#prompts.set(definition.name,{definition,callback}),this}async proxy(input){this.#assertOpen("proxy()");let operation=(async()=>{let{isProxyConnection,mountProxyConnection,mountProxyServers}=await import("./mcp-proxy-NETCUGUD.js");if(isProxyConnection(input)){this.#proxyServersConfigured+=1,await mountProxyConnection(this.#proxyHost(),input);return}this.#proxyServersConfigured+=Object.keys(input).length,await mountProxyServers(this.#proxyHost(),input)})();this.#proxyOperations.add(operation);try{await operation}finally{this.#proxyOperations.delete(operation)}}use(patternOrHandler,...handlers){if(typeof patternOrHandler=="string"&&patternOrHandler.startsWith("mcp:")){this.#assertNotStarted("middleware",patternOrHandler);let handler=handlers[0];return this.#mcpMiddlewares.push(createMcpMiddlewareEntry(patternOrHandler,handler)),this}return this.app.use.call(this.app,patternOrHandler,...handlers),this.#httpMiddlewareCount+=typeof patternOrHandler=="function"?1:handlers.length,this}on(pattern,handler){return this.#assertNotStarted("event listener",pattern),this.#mcpEventListeners.push(createMcpEventListenerEntry(pattern,handler)),this}__setEventBus(bus){this.#assertNotStarted("event bus","shared"),this.#eventBus=bus}__mount(){this.#ensureMounted("handler")}async notifyToolsChanged(){await this.#ensureMounted("handler").handler.notify.toolsChanged()}async notifyPromptsChanged(){await this.#ensureMounted("handler").handler.notify.promptsChanged()}async notifyResourcesChanged(){await this.#ensureMounted("handler").handler.notify.resourcesChanged()}async notifyResourceUpdated(uri){await this.#ensureMounted("handler").handler.notify.resourceUpdated(uri)}async listen(port=void 0,options={}){this.#assertOpen("listen()");let{createServer}=await import("http"),{toNodeHandler}=await import("./node-bridge.js"),host=resolveListenHost(options.host,this.#config.host),requestedPort=resolveListenPort(port,this.#config.port);return this.#assertListenOAuthConfiguration(host),new Promise((resolve,reject)=>{let resolveFetch,rejectFetch,fetchReady=new Promise((resolveFetchPromise,rejectFetchPromise)=>{resolveFetch=resolveFetchPromise,rejectFetch=rejectFetchPromise});fetchReady.catch(()=>{});let settled=!1,rejectAndClose=error2=>{settled||(settled=!0,reject(error2)),rejectFetch?.(error2),new Promise(closeResolve=>server.close(()=>closeResolve())).catch(()=>{}).finally(()=>{this.#httpServer===server&&(this.#httpServer=void 0)})},nodeHandler=toNodeHandler({fetch:async request=>(await fetchReady)(request)}),server=createServer((req,res)=>{nodeHandler(req,res)});server.once("error",rejectAndClose),server.listen(requestedPort,host,()=>{try{let address=server.address(),boundPort=typeof address=="object"&&address!==null?address.port:requestedPort,{fetch}=this.#ensureMounted("listen",boundPort,host);resolveFetch?.(fetch),settled||(settled=!0,resolve({port:boundPort,url:`http://localhost:${boundPort}${this.#basePath()}`}))}catch(error2){rejectAndClose(error2)}}),this.#httpServer=server})}async close(){this.#closed=!0,await Promise.allSettled([...this.#proxyOperations]);let errors=[],proxyOwners=this.#proxyOwners.splice(0),ownerResults=await Promise.allSettled(proxyOwners.map(owner=>owner.close()));for(let result of ownerResults)result.status==="rejected"&&errors.push(result.reason);try{await this.#handler?.close()}catch(error2){errors.push(error2)}let httpServer=this.#httpServer;if(httpServer!==void 0)try{await new Promise((resolve,reject)=>{httpServer.close(err=>err?reject(err):resolve())}),this.#httpServer=void 0}catch(error2){errors.push(error2)}if(errors.length>0)throw new AggregateError(errors,"Failed to close MCP server cleanly")}#assertOpen(operation){if(this.#closed)throw operation!==void 0?new Error(`Cannot call ${operation} after the server has closed.`):new Error("Cannot use the server after it has closed.")}#basePath(){return this.#config.basePath??"/mcp"}#resolveOAuthResource(mode,listenPort,listenHost){if(this.#config.oauth===void 0)return;if(this.#oauthResourceResolved)return this.#oauthResource;let host=listenHost??this.#config.host??"127.0.0.1",localListen=mode==="listen"&&listenPort!==void 0&&["127.0.0.1","localhost","::1"].includes(host);if(this.#oauthResourceConfigurationAbsent&&localListen)return this.#oauthResource=resolveLocalOAuthResource(`http://localhost:${listenPort}`,this.#basePath()),this.#oauthResourceResolved=!0,this.#oauthResource;throw new Error("OAuth requires an explicit resource or MCP_URL when using server.fetch or listening on a non-local host")}#assertListenOAuthConfiguration(host){if(this.#config.oauth!==void 0&&!["127.0.0.1","localhost","::1"].includes(host)&&!this.#oauthResourceResolved)throw new Error("OAuth listen() on a public or wildcard host requires an explicit provider resource or valid MCP_URL.")}#assertNotStarted(kind,name){if(this.#handler!==void 0)throw new Error(`Cannot register ${kind} "${name}" after the server has started: registrations are replayed per request from the registry, so register everything before listen()/server.fetch.`)}#trackConfigured(){recordUsage("server","configured",{tools_total:this.#tools.size,tools_local:this.#tools.size-this.#openApiTools.size-this.#proxiedTools.size,tools_openapi:this.#openApiTools.size,tools_proxied:this.#proxiedTools.size,resources:this.#resources.size,resource_templates:this.#resourceTemplates.size,prompts:this.#prompts.size,views:this.#views.size,proxy_servers_configured:this.#proxyServersConfigured,proxy_servers_connected:this.#proxyServersConnected,proxy_tools_discovered:this.#proxyToolsDiscovered,proxy_resources_discovered:this.#proxyResourcesDiscovered,proxy_prompts_discovered:this.#proxyPromptsDiscovered,proxy_tools_mounted:this.#proxiedTools.size,proxy_resources_mounted:this.#proxiedResources.size,proxy_prompts_mounted:this.#proxiedPrompts.size,http_middleware:this.#httpMiddlewareCount,mcp_middleware:this.#mcpMiddlewares.length,observers_before:this.#mcpEventListeners.filter(({phase})=>phase==="before").length,observers_complete:this.#mcpEventListeners.filter(({phase})=>phase==="complete").length,oauth_configured:this.#config.oauth!==void 0,cors_configured:this.#config.cors!==void 0,request_state_configured:this.#config.requestState!==void 0,legacy_policy:this.#config.legacy??"stateless"},{onceKey:`${this.#usageScope}:server`,serverRoot:this.#viewsProjectRoot})}#trackClient(body){let client=clientUsageFromBody(body);client!==void 0&&recordUsage("client","observed",{...client},{onceKey:`${this.#usageScope}:client:${JSON.stringify(client)}`,serverRoot:this.#viewsProjectRoot})}#proxyHost(){return{isStarted:()=>this.#handler!==void 0,hasTool:name=>this.#tools.has(name),hasResource:name=>this.#resources.has(name),hasPrompt:name=>this.#prompts.has(name),registerTool:(definition,callback)=>{this.#assertNotStarted("tool",definition.name),this.#proxiedTools.add(definition.name),this.#tools.set(definition.name,{definition,callback})},registerResource:(definition,callback)=>{this.#assertNotStarted("resource",definition.name),this.#proxiedResources.add(definition.uri),this.#resources.set(definition.name,{definition,callback})},registerPrompt:(definition,callback)=>{this.#assertNotStarted("prompt",definition.name),this.#proxiedPrompts.add(definition.name),this.#prompts.set(definition.name,{definition,callback})},trackOwner:owner=>{this.#proxyOwners.push(owner)},trackNamespace:({tools,resources,prompts})=>{this.#proxyServersConnected+=1,this.#proxyToolsDiscovered+=tools,this.#proxyResourcesDiscovered+=resources,this.#proxyPromptsDiscovered+=prompts}}}#validationPolicy(mode,listenHost){let{allowedHosts,allowedOrigins}=this.#config,host=listenHost??this.#config.host??"127.0.0.1",localhostBind=["127.0.0.1","localhost","::1"].includes(host),hosts=allowedHosts!==void 0?[...new Set([...localhostAllowedHostnames(),...allowedHosts])]:mode==="listen"&&localhostBind?localhostAllowedHostnames():void 0,origins=allowedOrigins!==void 0?[...new Set([...localhostAllowedOrigins(),...allowedOrigins])]:void 0;return{hosts,origins}}#ensureMounted(mode,listenPort,listenHost){if(this.#assertOpen(),this.#fetchHandler===void 0||this.#handler===void 0){let{hosts,origins}=this.#validationPolicy(mode,listenHost),basePath=this.#basePath(),nestedBasePath=basePath==="/"?"":basePath,httpApp=new Hono,middlewares=[jsonBodyMiddleware(),requestLogger(this.#config.logging)],corsConfig=this.#config.cors;corsConfig!==void 0&&middlewares.unshift(corsFetchMiddleware(corsConfig));let deferViewCors=isGlobalCorsEnabled(corsConfig);hosts!==void 0&&middlewares.unshift(hostValidationMiddleware(hosts)),origins!==void 0&&middlewares.push(originValidationMiddleware(origins)),hosts===void 0&&mode==="listen"&&console.warn(`[mcp-use] listen() is serving on ${listenHost} without Host validation. Behind a platform edge that only routes your own domains this is expected; if this process is reachable directly, set allowedHosts to restrict it.`),this.#validateViewBindingsAtMount();let resource2=this.#resolveOAuthResource(mode,listenPort,listenHost);if(resource2!==void 0){let provider=this.#config.oauth;middlewares.push(oauthMetadata(provider,resource2))}for(let middleware of middlewares)registerFetchMiddleware(httpApp,middleware);let{handler,fetch:mcpFetch}=createMcpMount(ctx=>this.#buildSdkServer(ctx),{path:basePath,...(this.#config.legacy!==void 0||this.#eventBus!==void 0)&&{handler:{...this.#config.legacy!==void 0&&{legacy:this.#config.legacy},...this.#eventBus!==void 0&&{bus:this.#eventBus}}},...resource2!==void 0&&{authInfo:request=>authInfoFromRequest(request)}}),protectWithBearer=async(_request,next)=>next();if(resource2!==void 0){let provider=this.#config.oauth,providerOptions=getOAuthProviderOptions(provider),gate=requireBearerAuth({verifier:wrapOAuthTokenVerifier(provider,resource2),resourceMetadataUrl:getOAuthProtectedResourceMetadataUrl(resource2),...providerOptions.requiredScopes!==void 0&&{requiredScopes:providerOptions.requiredScopes}});protectWithBearer=async(request,next)=>{let result=await gate(request);if(result instanceof Response)return result;let bag=getRequestBag(request);return bag.authInfo=result,next()}}let mcpRouteHandler=request=>protectWithBearer(request,()=>{let body=getRequestBag(request).parsedBody;return isJSONRPCRequest2(body)&&(this.#trackConfigured(),this.#trackClient(body)),mcpFetch(request)}),endpointHandler=async request=>{if(!isHtmlNavigationRequest(request))return mcpRouteHandler(request);let respond=async()=>{let{createLandingPageResponse}=await import("./landing-handler-TG6LVQBI.js");return createLandingPageResponse(request,basePath,this.#config,this.#branding,this.#tools.values(),this.#prompts.values(),this.#resources.values())};return resource2!==void 0&&this.#config.publicLandingPage!==!0?protectWithBearer(request,respond):respond()},brandingDevMode=this.#viewsPrimed?this.#viewsDevMode:process.env.NODE_ENV!=="production",faviconHandler=createFaviconHandler(this.#branding,{dev:brandingDevMode,projectRoot:this.#viewsProjectRoot,deferCors:deferViewCors});faviconHandler!==void 0&&this.app.all("/favicon.ico",context=>faviconHandler(context.req.raw));let viewHandler=createViewPublicHandler(basePath,this.#views,{dev:this.#viewsPrimed?this.#viewsDevMode:brandingDevMode,projectRoot:this.#viewsProjectRoot,enabled:hasLocalBrandingAsset(this.#branding),deferCors:deferViewCors});if(viewHandler!==void 0&&this.app.on(["GET","HEAD"],`${nestedBasePath}/_mcp-use/public/*`,context=>viewHandler(context.req.raw)),!this.#viewsDevMode){let viewAssetsHandler=createViewAssetsHandler(basePath,this.#views,{projectRoot:this.#viewsProjectRoot,deferCors:deferViewCors});viewAssetsHandler!==void 0&&this.app.on(["GET","HEAD"],`${nestedBasePath}/_mcp-use/views/*`,context=>viewAssetsHandler(context.req.raw))}this.app.all(basePath,context=>endpointHandler(context.req.raw)),httpApp.route("/",this.app),this.#httpApp=httpApp,this.#fetchHandler=async request=>httpApp.fetch(request),this.#handler=handler,this.#hostValidated=hosts!==void 0}else if(mode==="listen"&&!this.#hostValidated&&this.#validationPolicy("listen",listenHost).hosts!==void 0)throw new Error("Cannot listen() on a localhost bind after server.fetch mounted the app without Host validation (server.fetch expects a platform edge in front). Call listen() first, or set allowedHosts.");return{fetch:this.#fetchHandler,handler:this.#handler}}#validateToolViewBinding(definition){let view=definition.view;if(view===void 0)return;if(definition.outputSchema===void 0)throw new Error(`Tool "${definition.name}" declares view "${view.name}" but has no outputSchema. View-bound tools require an outputSchema \u2014 the view reads structuredContent typed from it. Use outputSchema: z.object({}) for a view that takes no structured output.`);let existing=this.#viewBindings.get(view.name);if(existing!==void 0)throw new Error(`View "${view.name}" is already bound to tool "${existing.toolName}"; tool "${definition.name}" cannot bind the same view. Each view may be bound to one tool.`);this.#viewBindings.set(view.name,{toolName:definition.name,config:view})}#validateViewBindingsAtMount(){if(this.#viewBindings.size>0&&!this.#viewsPrimed){let first=[...this.#tools.values()].find(entry=>entry.definition.view!==void 0),viewName=first?.definition.view?.name??"unknown";throw new Error(`Tool "${first?.definition.name??"unknown"}" is bound to view "${viewName}" but no views were primed. Run \`mcp-use build\` and deploy the built entry, or in dev let the CLI prime views automatically.`)}for(let entry of this.#tools.values()){let viewName=entry.definition.view?.name;if(viewName!==void 0&&!this.#views.has(viewName))throw new Error(`Tool "${entry.definition.name}" is bound to view "${viewName}" which is not in the primed views registry. Run \`mcp-use build\` and deploy the built entry, or in dev let the CLI prime views automatically.`)}for(let viewName of this.#views.keys())this.#viewBindings.has(viewName)||console.warn(`[mcp-use] View "${viewName}" is registered but no tool binds it.`)}#buildSdkServer(ctx){let{name,version,title,description,instructions}=this.#config,authInfo=ctx.authInfo,server=new SdkMcpServer({name,version,...title!==void 0&&{title},...description!==void 0&&{description},...this.#branding.websiteUrl!==void 0&&{websiteUrl:this.#branding.websiteUrl},...this.#branding.icons!==void 0&&{icons:resolveImplementationIcons(this.#branding.icons,ctx.requestInfo,this.#basePath())}},{capabilities:{logging:{},tools:{listChanged:!0},prompts:{listChanged:!0},resources:{listChanged:!0,subscribe:!0}},...instructions!==void 0&&{instructions},...authInfo!==void 0&&{authInfo},...this.#config.requestState!==void 0&&{requestState:this.#config.requestState}}),request=ctx.requestInfo,viewMetaOptions=request!==void 0?{request,hmrWs:this.#viewsDevMode}:{hmrWs:this.#viewsDevMode},basePath=this.#basePath();for(let entry of this.#tools.values())this.#registerTool(server,entry);for(let entry of this.#resources.values())this.#registerResource(server,entry);for(let entry of this.#resourceTemplates.values())this.#registerResourceTemplate(server,entry);for(let entry of this.#prompts.values())this.#registerPrompt(server,entry);for(let[viewName,viewEntry]of this.#views.entries())this.#registerViewResource(server,viewName,viewEntry,viewMetaOptions,basePath);return this.#wrapListHandlers(server),server}#createMiddlewareContext(method,params,ctx){let requestContext=toRequestContext(ctx);return Object.assign(requestContext,{method,params,...ctx.sessionId!==void 0&&{session:{sessionId:ctx.sessionId}},...ctx.http?.authInfo!==void 0&&{auth:ctx.http.authInfo},state:new Map})}#runMcpHook(method,ctx,innerFn){let startedAt=performance.now(),matchedMiddleware=this.#mcpMiddlewares.filter(entry=>matchesPattern(entry.pattern,method)).length,matchedObservers=phase=>this.#mcpEventListeners.filter(entry=>entry.phase===phase&&matchesPattern(entry.pattern,method)).length,request=ctx.request?.raw,client=request===void 0?void 0:clientUsageFromBody(getRequestBag(request).parsedBody),capture=(outcome,completedPhase)=>{recordUsage("operation","completed",{method,outcome,duration_ms:Math.max(0,Math.round(performance.now()-startedAt)),primitive_origin:this.#primitiveOrigin(method,ctx.params),matched_middleware:matchedMiddleware,observers_before:matchedObservers("before"),observers_complete:completedPhase?matchedObservers("complete"):0,...client?.protocol_era==="modern"?client:{client_name:"unknown",protocol_era:"legacy"}},{sampleRate:outcome==="success"?.1:1,serverRoot:this.#viewsProjectRoot})};return runMcpOperation(this.#mcpMiddlewares,this.#mcpEventListeners,method,ctx,innerFn).then(result=>{let outcome=isInputRequiredResult2(result)?"input_required":method==="tools/call"&&typeof result=="object"&&result!==null&&"isError"in result&&result.isError===!0?"error":"success";return capture(outcome,!0),result},error2=>{throw capture("error",!1),error2})}#primitiveOrigin(method,params){if(method==="tools/call"){let name=String(params.name);return this.#proxiedTools.has(name)?"proxied":this.#openApiTools.has(name)?"openapi":"local"}return method==="resources/read"?this.#proxiedResources.has(String(params.uri))?"proxied":"local":method==="prompts/get"?this.#proxiedPrompts.has(String(params.name))?"proxied":"local":"mixed"}#wrapListHandlers(server){let handlers=server.server._requestHandlers;if(handlers===void 0)return;let wrapListMethod=(method,resultKey,transform)=>{let original=handlers.get(method);if(original===void 0||original.__mcpListWrapped)return;let wrapped=async(request,extra)=>{let serverContext=extra,params=request.params??{},mwCtx=this.#createMiddlewareContext(method,params,serverContext),originalEnvelope,innerFn=async()=>{let downstreamRequest=withMcpMiddlewareParams(request,mwCtx.params),result=await original(downstreamRequest,extra);if(typeof result!="object"||result===null)throw new TypeError(`[mcp-use] ${method} handler returned a non-object result`);originalEnvelope=result;let items=originalEnvelope[resultKey];if(!Array.isArray(items))throw new TypeError(`[mcp-use] ${method} handler result is missing a ${resultKey} array`);return items},filtered=await this.#runMcpHook(method,mwCtx,innerFn);if(!Array.isArray(filtered))throw new TypeError(`[mcp-use] ${method} middleware must return a ${resultKey} array`);let emitted=transform?.(filtered)??filtered;return{...originalEnvelope,[resultKey]:emitted}};wrapped.__mcpListWrapped=!0,handlers.set(method,wrapped)};wrapListMethod("tools/list","tools",omitToolSchemaDialects),wrapListMethod("resources/list","resources"),wrapListMethod("prompts/list","prompts")}#registerTool(server,{definition,callback}){let view=definition.view,toolMeta=buildToolUiMeta(view?.name,definition.visibility,definition._meta),config={...definition.title!==void 0&&{title:definition.title},...definition.description!==void 0&&{description:definition.description},...definition.annotations!==void 0&&{annotations:definition.annotations},...definition.outputSchema!==void 0&&{outputSchema:definition.outputSchema},...toolMeta!==void 0&&{_meta:toolMeta}},wireResultMeta=view!==void 0?buildToolResultUiMeta(view.name):void 0,inputSchema=resolveToolInputSchema(definition),invokeTool=async(args,ctx)=>{let mwCtx=this.#createMiddlewareContext("tools/call",{name:definition.name,arguments:args,...ctx.mcpReq._meta!==void 0&&{_meta:ctx.mcpReq._meta}},ctx),innerFn=async()=>{let effectiveArgs=mwCtx.params.arguments??{},result=await callback(effectiveArgs,this.#toRequestContext(ctx));return isInputRequiredResult2(result)||wireResultMeta===void 0||result.isError===!0?result:{...result,_meta:{...result._meta,...wireResultMeta}}};return await this.#runMcpHook("tools/call",mwCtx,innerFn)};inputSchema!==void 0?server.registerTool(definition.name,{...config,inputSchema},async(args,ctx)=>invokeTool(args,ctx)):server.registerTool(definition.name,config,async ctx=>invokeTool({},ctx))}#registerViewResource(server,viewName,entry,metaOptions,basePath){let uri=viewResourceUri(viewName),authorFacts=this.#viewResourceFacts(this.#viewBindings.get(viewName)?.config),resourceConfig=viewResourceConfig(viewName,entry,authorFacts,metaOptions);server.registerResource(viewName,uri,resourceConfig,async(readUri,ctx)=>{let req=ctx.http?.req,readOptions=req!==void 0?{request:req,...metaOptions.hmrWs===!0?{hmrWs:!0}:{}}:metaOptions.hmrWs===!0?{hmrWs:!0}:{},assetsBase=req!==void 0?resolveAssetsBase(req):metaOptions.request!==void 0?resolveAssetsBase(metaOptions.request):"",html2=synthesizeViewDocument(entry,assetsBase,basePath,viewName);return{contents:[{uri:readUri.href,mimeType:resourceConfig.mimeType,text:html2,_meta:buildResourceUiMeta(authorFacts,readOptions)}]}})}#registerResource(server,{definition,callback}){server.registerResource(definition.name,definition.uri,{...definition.title!==void 0&&{title:definition.title},...definition.description!==void 0&&{description:definition.description},...definition.mimeType!==void 0&&{mimeType:definition.mimeType},...definition.annotations!==void 0&&{annotations:definition.annotations},...definition._meta!==void 0&&{_meta:{...definition._meta}}},async(uri,ctx)=>{let mwCtx=this.#createMiddlewareContext("resources/read",{uri:uri.href,...ctx.mcpReq._meta!==void 0&&{_meta:ctx.mcpReq._meta}},ctx),innerFn=async()=>toResourceResult(await callback(uri,this.#toRequestContext(ctx)),uri.href);return await this.#runMcpHook("resources/read",mwCtx,innerFn)})}#registerResourceTemplate(server,{definition,callback,complete}){let template=new ResourceTemplate(definition.uriTemplate,{list:void 0,...complete!==void 0&&{complete}});server.registerResource(definition.name,template,{...definition.title!==void 0&&{title:definition.title},...definition.description!==void 0&&{description:definition.description},...definition.mimeType!==void 0&&{mimeType:definition.mimeType},...definition.annotations!==void 0&&{annotations:definition.annotations},...definition._meta!==void 0&&{_meta:{...definition._meta}}},async(uri,variables,ctx)=>{let mwCtx=this.#createMiddlewareContext("resources/read",{uri:uri.href,...ctx.mcpReq._meta!==void 0&&{_meta:ctx.mcpReq._meta}},ctx),innerFn=async()=>toResourceResult(await callback(uri,variables,this.#toRequestContext(ctx)),uri.href);return await this.#runMcpHook("resources/read",mwCtx,innerFn)})}#viewResourceFacts(viewConfig){if(viewConfig!==void 0)return{...viewConfig.description!==void 0&&{description:viewConfig.description},...viewConfig.csp!==void 0&&{csp:viewConfig.csp},...viewConfig.permissions!==void 0&&{permissions:viewConfig.permissions},...viewConfig.domain!==void 0&&{domain:viewConfig.domain},...viewConfig.prefersBorder!==void 0&&{prefersBorder:viewConfig.prefersBorder}}}#registerPrompt(server,{definition,callback}){let config={...definition.title!==void 0&&{title:definition.title},...definition.description!==void 0&&{description:definition.description}},invokePrompt=async(args,ctx)=>{let mwCtx=this.#createMiddlewareContext("prompts/get",{name:definition.name,arguments:args,...ctx.mcpReq._meta!==void 0&&{_meta:ctx.mcpReq._meta}},ctx),innerFn=async()=>{let effectiveArgs=mwCtx.params.arguments??{};return toPromptResult(await callback(effectiveArgs,this.#toRequestContext(ctx)))};return await this.#runMcpHook("prompts/get",mwCtx,innerFn)};if(definition.schema!==void 0)server.registerPrompt(definition.name,{...config,argsSchema:definition.schema},async(args,ctx)=>invokePrompt(args,ctx));else{let handler=async ctx=>invokePrompt({},ctx);server.registerPrompt(definition.name,config,handler)}}#toRequestContext(ctx){return this.#config.oauth===void 0?toRequestContext(ctx):toAuthenticatedRequestContext(ctx)}};import{acceptedContent,createRequestStateCodec,inputRequired as inputRequired2,inputResponse as inputResponse2,isInputRequiredResult as isInputRequiredResult3}from"@modelcontextprotocol/server";function text(content){return{content:[{type:"text",text:content}],_meta:{mimeType:"text/plain"}}}function markdown(content){return{content:[{type:"text",text:content}],_meta:{mimeType:"text/markdown"}}}function html(content){return{content:[{type:"text",text:content}],_meta:{mimeType:"text/html"}}}function xml(content){return{content:[{type:"text",text:content}],_meta:{mimeType:"text/xml"}}}function css(content){return{content:[{type:"text",text:content}],_meta:{mimeType:"text/css"}}}function javascript(content){return{content:[{type:"text",text:content}],_meta:{mimeType:"text/javascript"}}}function image(data,mimeType="image/png"){return{content:[{type:"image",data,mimeType}],_meta:{mimeType,isImage:!0}}}function audio(data,mimeType="audio/wav"){return{content:[{type:"audio",data,mimeType}],_meta:{mimeType,isAudio:!0}}}function binary(base64Data,mimeType){return{content:[{type:"text",text:base64Data}],_meta:{mimeType,isBinary:!0}}}function resource(uri,mimeTypeOrContent,text2){if(typeof mimeTypeOrContent=="object"&&mimeTypeOrContent!==null&&"content"in mimeTypeOrContent){let contentResult=mimeTypeOrContent,extractedText,extractedMimeType;if(contentResult._meta&&typeof contentResult._meta=="object"){let meta=contentResult._meta;typeof meta.mimeType=="string"&&(extractedMimeType=meta.mimeType)}let first=contentResult.content?.[0];return first?.type==="text"&&"text"in first&&(extractedText=first.text),{content:[{type:"resource",resource:{uri,...extractedMimeType!==void 0&&{mimeType:extractedMimeType},text:extractedText??""}}]}}let mimeType=mimeTypeOrContent;return{content:[{type:"resource",resource:{uri,...mimeType!==void 0&&mimeType!==""&&{mimeType},text:text2??""}}]}}function error(message){return{isError:!0,content:[{type:"text",text:message}]}}function object(data){return Array.isArray(data)?array(data):{content:[{type:"text",text:JSON.stringify(data,null,2)}],structuredContent:data,_meta:{mimeType:"application/json"}}}function array(data){return{content:[{type:"text",text:JSON.stringify(data,null,2)}],structuredContent:data}}function widget(config){let props=config.props??config.data??{},{output,message,metadata}=config,result={content:message?[{type:"text",text:message}]:Array.isArray(output?.content)&&output.content.length>0?output.content:[{type:"text",text:""}]};return metadata!==void 0&&Object.keys(metadata).length>0&&(result._meta=metadata),output?.structuredContent!==void 0?result.structuredContent=output.structuredContent:Object.keys(props).length>0&&(result.structuredContent=props),result}function mix(...results){let withStructured=results.filter(result=>result.structuredContent!==void 0),structuredContent=withStructured.length>0?withStructured.map(result=>result.structuredContent).reduce((acc,value)=>({...acc,...typeof value=="object"&&value!==null?value:{}}),{}):void 0,withMeta=results.filter(result=>result._meta!==void 0),_meta=withMeta.length>0?withMeta.map(result=>result._meta).reduce((acc,value)=>({...acc,...value!==void 0?value:{}}),{}):void 0;return{content:results.flatMap(result=>result.content),...structuredContent!==void 0&&Object.keys(structuredContent).length>0&&{structuredContent},..._meta!==void 0&&Object.keys(_meta).length>0&&{_meta}}}export{MCPServer,acceptedContent,array,audio,binary,completable,composeFetch,composeMiddleware,createMcpEventListenerEntry,createMcpMiddlewareEntry,createMcpMount,createRequestStateCodec,css,error,getRequestBag,hostValidationMiddleware,html,image,inputRequired2 as inputRequired,inputResponse2 as inputResponse,isInputRequiredResult3 as isInputRequiredResult,javascript,jsonBodyMiddleware,markdown,matchesPath,matchesPathPrefix,matchesPattern,mix,object,originValidationMiddleware,pathnameOf,registerViews,requestLogger,resource,text,widget,xml};