@mcp-use/inspector 1.0.0-canary.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/dist/cdn/inspector.css +1 -1
  2. package/dist/cdn/inspector.js +81264 -80633
  3. package/dist/client/hooks/useMCPPrompts.d.ts +3 -3
  4. package/dist/client/index.js +13657 -775
  5. package/dist/web/assets/browser-BwHKNEau.js +380 -0
  6. package/dist/web/assets/chunk-BBSBHVGK-D4wCPq_w.js +1 -0
  7. package/dist/web/assets/{chunk-KJ5RBDDO-DJkMH4KI.js → chunk-ECXMLUNG-CSRGaMIB.js} +1 -1
  8. package/dist/web/assets/chunk-JU7W27UC-CMTI_w7A.js +1 -0
  9. package/dist/web/assets/{chunk-QWQYAQCK-CyFuZlX8.js → chunk-QWQYAQCK-BR4V0xsV.js} +1 -1
  10. package/dist/web/assets/{chunk-RPN2XO5I-Boiv0wCv.js → chunk-RPN2XO5I-Cr13Miz-.js} +1 -1
  11. package/dist/web/assets/{chunk-UJPHRNQP-C81GjauI.js → chunk-UJPHRNQP-B14ZPq5a.js} +1 -1
  12. package/dist/web/assets/chunk_array-Bw1lTtex.js +1 -0
  13. package/dist/web/assets/{client-MLH2Q2DK-UzuK4Kji.js → client-2BTCLEUX-BhvJZmo-.js} +3 -3
  14. package/dist/web/assets/client-z1GrRUEs.js +68 -0
  15. package/dist/web/assets/{core-DktjxGrT.js → core-CsUyNVs5.js} +1 -1
  16. package/dist/web/assets/{core-B6Kp8rMh.js → core-GZZnkE26.js} +1 -1
  17. package/dist/web/assets/{display-A5IEINAP-BFwsYEHq.js → display-A5IEINAP-B8BJrcag.js} +2 -2
  18. package/dist/web/assets/{dist-CY62NsuD.js → dist-BZmXa__p.js} +2 -2
  19. package/dist/web/assets/{dist-B_dkmahO.js → dist-DlypDwtn.js} +1 -1
  20. package/dist/web/assets/dist-JsQmV3pO.js +21 -0
  21. package/dist/web/assets/dist-t5Yo0YiG.js +41 -0
  22. package/dist/web/assets/function_calling-kK7um7Ye.js +61 -0
  23. package/dist/web/assets/index-CM9P_1sf.css +2 -0
  24. package/dist/web/assets/index-zlrXpRSB.js +720 -0
  25. package/dist/web/assets/{json-schema-processors-DSIsU0go.js → json-schema-processors-DNSjFPrk.js} +1 -1
  26. package/dist/web/assets/langfuse-U2OEF7K7-BF5JV8uu.js +1 -0
  27. package/dist/web/assets/{llms-ByHaqvCr.js → llms-ByyTYk2T.js} +2 -2
  28. package/dist/web/assets/messages-D4_mH1tk.js +36 -0
  29. package/dist/web/assets/{module-DCsrdi7m.js → module-DbiflUeG.js} +2 -2
  30. package/dist/web/assets/react-C6BFTceN.js +1 -0
  31. package/dist/web/assets/rpc-logger-TPNV75J4-CMVlzCN7.js +1 -0
  32. package/dist/web/assets/{schemas-79owEkeD.js → schemas-BrqAD_Qo.js} +1 -1
  33. package/dist/web/assets/{source-1h9sRCfR.js → source-DeHaVNLZ.js} +1 -1
  34. package/dist/web/assets/stan-r2rUHRuO.js +1 -0
  35. package/dist/web/assets/{stdio-DH6BP75M-C4--HtGN.js → stdio-RWLH66ZO-C753VwJ7.js} +1 -1
  36. package/dist/web/assets/tools-kLe9X8V8.js +2 -0
  37. package/dist/web/index.html +13 -10
  38. package/package.json +8 -17
  39. package/dist/web/assets/browser-DeFVa-Up.js +0 -380
  40. package/dist/web/assets/chunk_array-CT_rI3GZ.js +0 -1
  41. package/dist/web/assets/client-DaI4JaTs.js +0 -68
  42. package/dist/web/assets/dist-Cjn62jmL.js +0 -21
  43. package/dist/web/assets/dist-DWk4vNzA.js +0 -41
  44. package/dist/web/assets/function_calling-BHFkMa4W.js +0 -61
  45. package/dist/web/assets/index-Bd0WP6Xj.js +0 -465
  46. package/dist/web/assets/index-DAB6h2wg.css +0 -2
  47. package/dist/web/assets/langfuse-U2OEF7K7-UPVEn4-O.js +0 -1
  48. package/dist/web/assets/messages-DQuC8BOl.js +0 -1
  49. package/dist/web/assets/react-C-wC1s-h.js +0 -1
  50. package/dist/web/assets/rpc-logger-TPNV75J4-DBofHjaa.js +0 -1
  51. package/dist/web/assets/stan-btJKTWsQ.js +0 -1
  52. package/dist/web/assets/tools-CFpbqXW1.js +0 -2
  53. /package/dist/web/assets/{1c-xAwF9KHw.js → 1c-AGlpZ3Bo.js} +0 -0
  54. /package/dist/web/assets/{abnf-57JF8nOy.js → abnf-CY04oKOo.js} +0 -0
  55. /package/dist/web/assets/{accesslog-C2D2ESC1.js → accesslog-BW-XYbZ-.js} +0 -0
  56. /package/dist/web/assets/{actionscript-BA90Z6ek.js → actionscript-CyrdwIe8.js} +0 -0
  57. /package/dist/web/assets/{ada-BOZemNeY.js → ada-C-TrrrBy.js} +0 -0
  58. /package/dist/web/assets/{angelscript-BPuRd7Au.js → angelscript-CRTYantF.js} +0 -0
  59. /package/dist/web/assets/{apache-CRejwSR0.js → apache-BtWb7jui.js} +0 -0
  60. /package/dist/web/assets/{applescript-DRWfnP7q.js → applescript-B5uiivcX.js} +0 -0
  61. /package/dist/web/assets/{arcade-c4fxT6cy.js → arcade-CKXflcFV.js} +0 -0
  62. /package/dist/web/assets/{arduino-D-GQgoAg.js → arduino-9WdEHP7F.js} +0 -0
  63. /package/dist/web/assets/{armasm-DW6aLB45.js → armasm-B1n3-9gm.js} +0 -0
  64. /package/dist/web/assets/{asciidoc-l4rRUjBn.js → asciidoc-DnpyabXI.js} +0 -0
  65. /package/dist/web/assets/{aspectj-CBoSaF_P.js → aspectj-DHfRYIO6.js} +0 -0
  66. /package/dist/web/assets/{autohotkey-oklQZH_e.js → autohotkey-D4kyAzbx.js} +0 -0
  67. /package/dist/web/assets/{autoit-CCOhikpq.js → autoit-Dkm5j0Id.js} +0 -0
  68. /package/dist/web/assets/{avrasm-DQyyIbM0.js → avrasm-DDWyveTc.js} +0 -0
  69. /package/dist/web/assets/{awk-Bpx3OGwB.js → awk-0C9tJhw5.js} +0 -0
  70. /package/dist/web/assets/{axapta-ConOtNUD.js → axapta-7WyvVgTr.js} +0 -0
  71. /package/dist/web/assets/{bash-CG9dvFVQ.js → bash-BU3h1nvY.js} +0 -0
  72. /package/dist/web/assets/{basic-D55fg9VU.js → basic-cvnVWdBh.js} +0 -0
  73. /package/dist/web/assets/{bnf-BRHfvdnF.js → bnf-DqQP6RvA.js} +0 -0
  74. /package/dist/web/assets/{brainfuck-CvIc7KgZ.js → brainfuck-9Gnm7MFh.js} +0 -0
  75. /package/dist/web/assets/{c-BYqCyjPu.js → c-CR0xII_C.js} +0 -0
  76. /package/dist/web/assets/{c-like-BiZIVjlk.js → c-like-DQRMjEeJ.js} +0 -0
  77. /package/dist/web/assets/{cal-BI45EWE9.js → cal-BupHjSW7.js} +0 -0
  78. /package/dist/web/assets/{capnproto-CT4_QH7U.js → capnproto-BJz3QcqE.js} +0 -0
  79. /package/dist/web/assets/{ceylon-DEhPqbQs.js → ceylon-Cm5BiqjN.js} +0 -0
  80. /package/dist/web/assets/{chunk-3GQAWCBQ-C-9Cm0Np.js → chunk-3GQAWCBQ-ntjTDD_C.js} +0 -0
  81. /package/dist/web/assets/{clean-Dj90Ldo4.js → clean-yd5cdwwQ.js} +0 -0
  82. /package/dist/web/assets/{clojure-nGPdvoWZ.js → clojure-BEy8uY0S.js} +0 -0
  83. /package/dist/web/assets/{clojure-repl-CoLrBnNB.js → clojure-repl-4mYnspW8.js} +0 -0
  84. /package/dist/web/assets/{cmake-Cau5qcoL.js → cmake-D6UxhUeW.js} +0 -0
  85. /package/dist/web/assets/{coffeescript-CRI19SN5.js → coffeescript-BKMS6sen.js} +0 -0
  86. /package/dist/web/assets/{coq-cKQTGfiT.js → coq-ByIcAboL.js} +0 -0
  87. /package/dist/web/assets/{cos-BvDn-C7W.js → cos-WtGXvK46.js} +0 -0
  88. /package/dist/web/assets/{cpp-Cm8w5GBK.js → cpp-7GTPyvMa.js} +0 -0
  89. /package/dist/web/assets/{crmsh-BphFuWfQ.js → crmsh-C5mOafXq.js} +0 -0
  90. /package/dist/web/assets/{crystal-CjeRzStm.js → crystal-CDkEXhx-.js} +0 -0
  91. /package/dist/web/assets/{csharp-BjNNmcwi.js → csharp-BB5evbyJ.js} +0 -0
  92. /package/dist/web/assets/{csp-BDakTyDq.js → csp-C5gCtA0-.js} +0 -0
  93. /package/dist/web/assets/{css-BS5Bw9la.js → css-BxJzVbPg.js} +0 -0
  94. /package/dist/web/assets/{d-iafwvjhA.js → d-pa4_Cp7t.js} +0 -0
  95. /package/dist/web/assets/{dart-CJj6VfDK.js → dart-BX2VLXw3.js} +0 -0
  96. /package/dist/web/assets/{delphi-CiYfdpeB.js → delphi-DdHGjuIZ.js} +0 -0
  97. /package/dist/web/assets/{diff-C0_uVc7j.js → diff-CBEZzUzk.js} +0 -0
  98. /package/dist/web/assets/{django-D2hgH-Q1.js → django-D4YuT7a9.js} +0 -0
  99. /package/dist/web/assets/{dns-Cl4dGnK7.js → dns-r4HMRPCv.js} +0 -0
  100. /package/dist/web/assets/{dockerfile-meWkyaPv.js → dockerfile-ZfcC6nOD.js} +0 -0
  101. /package/dist/web/assets/{dos-AwMP_0oM.js → dos-CIXc_2yf.js} +0 -0
  102. /package/dist/web/assets/{dsconfig-CnDR2ZdU.js → dsconfig-DlugHtUP.js} +0 -0
  103. /package/dist/web/assets/{dts-BzC-HwM_.js → dts-DaEIYGjQ.js} +0 -0
  104. /package/dist/web/assets/{dust-C7Vcl3-X.js → dust-D5BPeLmO.js} +0 -0
  105. /package/dist/web/assets/{ebnf-CL9qQEga.js → ebnf-FDSeI3Uq.js} +0 -0
  106. /package/dist/web/assets/{elixir-CfaDenjY.js → elixir-BW6MO0JC.js} +0 -0
  107. /package/dist/web/assets/{elm-Cy8gaJOl.js → elm-DlEB7oVS.js} +0 -0
  108. /package/dist/web/assets/{erb-C-4IIk8K.js → erb-Cfqar-lN.js} +0 -0
  109. /package/dist/web/assets/{erlang-B1M6fLuV.js → erlang-CAmVwVgE.js} +0 -0
  110. /package/dist/web/assets/{erlang-repl-BejU3MB_.js → erlang-repl-ynjzGTyJ.js} +0 -0
  111. /package/dist/web/assets/{excel-BkfhIrhj.js → excel-B4xDzPh0.js} +0 -0
  112. /package/dist/web/assets/{fix-BVmdZVAA.js → fix-DrIaqPya.js} +0 -0
  113. /package/dist/web/assets/{flix-D0avEvQY.js → flix-C1QBAYX7.js} +0 -0
  114. /package/dist/web/assets/{fortran-DakqiesO.js → fortran-13hn1qLz.js} +0 -0
  115. /package/dist/web/assets/{fsharp-DA54xfXW.js → fsharp-DsthWJmP.js} +0 -0
  116. /package/dist/web/assets/{gams-CXTQKphs.js → gams-CCIHfrc2.js} +0 -0
  117. /package/dist/web/assets/{gauss-CG12HF6_.js → gauss-DPE0fKXo.js} +0 -0
  118. /package/dist/web/assets/{gcode-BCEABt45.js → gcode-Cnu_Eke-.js} +0 -0
  119. /package/dist/web/assets/{gherkin-ZM-mRt_J.js → gherkin-6DphholZ.js} +0 -0
  120. /package/dist/web/assets/{glsl-CsBoWmwk.js → glsl-bxnyXALN.js} +0 -0
  121. /package/dist/web/assets/{gml-BpvmFz5F.js → gml-CNHkNLih.js} +0 -0
  122. /package/dist/web/assets/{go-oa77k3Q1.js → go-CNn2XrbH.js} +0 -0
  123. /package/dist/web/assets/{golo-DnSZZkzZ.js → golo-DiSoln2k.js} +0 -0
  124. /package/dist/web/assets/{gradle-xhSl5jRG.js → gradle-DwRwgn-A.js} +0 -0
  125. /package/dist/web/assets/{groovy-BUGEyqOY.js → groovy-B5vHRPUi.js} +0 -0
  126. /package/dist/web/assets/{haml-Q5moYl6B.js → haml-DyyQV85z.js} +0 -0
  127. /package/dist/web/assets/{handlebars-B8gHazwq.js → handlebars-BAEJweq7.js} +0 -0
  128. /package/dist/web/assets/{haskell-C_nTNVTF.js → haskell-ChxeibtB.js} +0 -0
  129. /package/dist/web/assets/{haxe-DEa-mhEM.js → haxe-Bnvb8PoO.js} +0 -0
  130. /package/dist/web/assets/{hsp-DAtUNrWr.js → hsp-BdBjqG0g.js} +0 -0
  131. /package/dist/web/assets/{htmlbars-IZ5H55KS.js → htmlbars-Dco0ls0x.js} +0 -0
  132. /package/dist/web/assets/{http-BlfIsTrN.js → http-BQrDnbm9.js} +0 -0
  133. /package/dist/web/assets/{hy-BKHwYI3U.js → hy-j_gy-_-v.js} +0 -0
  134. /package/dist/web/assets/{inform7-DBoQipSc.js → inform7-4lpsdkpY.js} +0 -0
  135. /package/dist/web/assets/{ini-rm_5Fj36.js → ini-CyoU_M9N.js} +0 -0
  136. /package/dist/web/assets/{irpf90-R1rxRBNO.js → irpf90-CA5ICZkt.js} +0 -0
  137. /package/dist/web/assets/{isbl-WbUbjWRI.js → isbl-D5MCB9gL.js} +0 -0
  138. /package/dist/web/assets/{java-flBTnDBg.js → java-C_cNvtw0.js} +0 -0
  139. /package/dist/web/assets/{javascript-Bi9wT7IL.js → javascript-Cx9Fh-yC.js} +0 -0
  140. /package/dist/web/assets/{jboss-cli-BVqHepEU.js → jboss-cli-n0a6upZq.js} +0 -0
  141. /package/dist/web/assets/{json-BvAVz8jQ.js → json-pS218i2Y.js} +0 -0
  142. /package/dist/web/assets/{julia-B3zW89kP.js → julia-ByIGgcyj.js} +0 -0
  143. /package/dist/web/assets/{julia-repl-Cpt_AFpB.js → julia-repl-DoKEpX79.js} +0 -0
  144. /package/dist/web/assets/{kotlin-CMZ_9XJI.js → kotlin-D7EVUsdH.js} +0 -0
  145. /package/dist/web/assets/{lasso-DVqtNSau.js → lasso-CfHzza_u.js} +0 -0
  146. /package/dist/web/assets/{latex-CFJv-UA6.js → latex-DEpVEzU4.js} +0 -0
  147. /package/dist/web/assets/{ldif-BS-KKOy0.js → ldif-CztKIlXq.js} +0 -0
  148. /package/dist/web/assets/{leaf--Z87tMVa.js → leaf-BeXHCQvG.js} +0 -0
  149. /package/dist/web/assets/{less-CXBPSZIU.js → less-BYuoMNFC.js} +0 -0
  150. /package/dist/web/assets/{lisp-cVmS95gk.js → lisp-DENj9Gb0.js} +0 -0
  151. /package/dist/web/assets/{livecodeserver-BOOiQrUz.js → livecodeserver-DzZuZBA6.js} +0 -0
  152. /package/dist/web/assets/{livescript-CVxJe7N1.js → livescript-Dcoaf4MP.js} +0 -0
  153. /package/dist/web/assets/{llvm-DQeHJJ2W.js → llvm-B_NkXFs1.js} +0 -0
  154. /package/dist/web/assets/{lsl-Bfxi34aD.js → lsl-sr9xRjsv.js} +0 -0
  155. /package/dist/web/assets/{lua-DXxL7Qnq.js → lua-DOwApfze.js} +0 -0
  156. /package/dist/web/assets/{makefile-B5Fr6EdB.js → makefile-Dnbo7dYF.js} +0 -0
  157. /package/dist/web/assets/{markdown-DTODmQHl.js → markdown-DGgwjJWS.js} +0 -0
  158. /package/dist/web/assets/{mathematica-XsKNpYVI.js → mathematica-DvU9l120.js} +0 -0
  159. /package/dist/web/assets/{matlab-BQHIwHUE.js → matlab-flr6798G.js} +0 -0
  160. /package/dist/web/assets/{maxima-4gc2wOHL.js → maxima-DCd2nSGc.js} +0 -0
  161. /package/dist/web/assets/{mel-tWDc8R_0.js → mel-NmXTNXHL.js} +0 -0
  162. /package/dist/web/assets/{mercury-CMAR8Kmo.js → mercury-PVmYLiQ2.js} +0 -0
  163. /package/dist/web/assets/{mipsasm-CuThUvs6.js → mipsasm-LHYPiOXU.js} +0 -0
  164. /package/dist/web/assets/{mizar-DJiOXbyw.js → mizar-BbJKfTOL.js} +0 -0
  165. /package/dist/web/assets/{mojolicious-BHZ1FyrY.js → mojolicious-Dw8SBiyk.js} +0 -0
  166. /package/dist/web/assets/{monkey-Ckr0R6Af.js → monkey-CYCsHKco.js} +0 -0
  167. /package/dist/web/assets/{moonscript-rPHoYTbB.js → moonscript-BndWJdyg.js} +0 -0
  168. /package/dist/web/assets/{n1ql-CVbFFpfR.js → n1ql-p64i6r1f.js} +0 -0
  169. /package/dist/web/assets/{nginx-piKHOi7C.js → nginx-Clg11n23.js} +0 -0
  170. /package/dist/web/assets/{nim-D2ljN6dK.js → nim-BF6erjkH.js} +0 -0
  171. /package/dist/web/assets/{nix-BE-MXto5.js → nix-aqHU_7Cj.js} +0 -0
  172. /package/dist/web/assets/{node-repl-DywEPp9w.js → node-repl-DuuOln4U.js} +0 -0
  173. /package/dist/web/assets/{nsis-DQnnPyE6.js → nsis-BZNwabo3.js} +0 -0
  174. /package/dist/web/assets/{objectivec-DVFSpwpL.js → objectivec-BD-A2eRS.js} +0 -0
  175. /package/dist/web/assets/{ocaml-B9_ypEp1.js → ocaml-Dtfm3HD8.js} +0 -0
  176. /package/dist/web/assets/{openscad-Cquxty4i.js → openscad-3uP221Jx.js} +0 -0
  177. /package/dist/web/assets/{oxygene-BtOMSMR6.js → oxygene-DBIMAfJO.js} +0 -0
  178. /package/dist/web/assets/{parser3-CWVyPD7l.js → parser3-C9bjRYvd.js} +0 -0
  179. /package/dist/web/assets/{path-BzTN_bR6.js → path-CG3438uq.js} +0 -0
  180. /package/dist/web/assets/{perl-DQMBOVA5.js → perl-Be1CLDbh.js} +0 -0
  181. /package/dist/web/assets/{pf-DhGORkJd.js → pf-BEYn9RX1.js} +0 -0
  182. /package/dist/web/assets/{pgsql-awwi5nDK.js → pgsql-Bp-7Jjz8.js} +0 -0
  183. /package/dist/web/assets/{php-_c_VoeVa.js → php-D8HtobZG.js} +0 -0
  184. /package/dist/web/assets/{php-template-Dsp4D0jE.js → php-template-5wDTa_KR.js} +0 -0
  185. /package/dist/web/assets/{plaintext-7v3vLFp3.js → plaintext-DF3cBN5Y.js} +0 -0
  186. /package/dist/web/assets/{pony-BVahP-cB.js → pony-CA_LuLTd.js} +0 -0
  187. /package/dist/web/assets/{powershell-DDAkbMgT.js → powershell-CfylS3qM.js} +0 -0
  188. /package/dist/web/assets/{preload-helper-XLr9-hSf.js → preload-helper-ckxxtgMM.js} +0 -0
  189. /package/dist/web/assets/{processing-CCja83Ot.js → processing-BOdw1uey.js} +0 -0
  190. /package/dist/web/assets/{profile-BjuA8z3S.js → profile-BMNLdTbz.js} +0 -0
  191. /package/dist/web/assets/{prolog-jJiPeztA.js → prolog-wnuVaQNI.js} +0 -0
  192. /package/dist/web/assets/{properties-DK40DOVd.js → properties-BY2UjzIx.js} +0 -0
  193. /package/dist/web/assets/{protobuf-DJs85Lp7.js → protobuf-W4tuiDUG.js} +0 -0
  194. /package/dist/web/assets/{puppet-BPdGz-Jp.js → puppet-CcAPsi7F.js} +0 -0
  195. /package/dist/web/assets/{purebasic-C8c2xseX.js → purebasic-Cx_iSilj.js} +0 -0
  196. /package/dist/web/assets/{python-B-gHuzXK.js → python-DtGc5unX.js} +0 -0
  197. /package/dist/web/assets/{python-repl-CLJQcHH8.js → python-repl-B1V7zIpU.js} +0 -0
  198. /package/dist/web/assets/{q-VmMkCWpr.js → q-DwgFecwj.js} +0 -0
  199. /package/dist/web/assets/{qml-BkIM5RCI.js → qml-CxtqwNEV.js} +0 -0
  200. /package/dist/web/assets/{r-CHi-Wrw8.js → r-Vyl1b83h.js} +0 -0
  201. /package/dist/web/assets/{reasonml-B05iQ6f2.js → reasonml-D1BWml10.js} +0 -0
  202. /package/dist/web/assets/{rib-DzxrqgFS.js → rib-WKK4Jb_l.js} +0 -0
  203. /package/dist/web/assets/{roboconf-DVxtd4X5.js → roboconf-DD9St8Le.js} +0 -0
  204. /package/dist/web/assets/{routeros-C7PRtmmR.js → routeros-DIyDrw3W.js} +0 -0
  205. /package/dist/web/assets/{rsl-CcIHTLD_.js → rsl-CfigMFVZ.js} +0 -0
  206. /package/dist/web/assets/{ruby-BGhMoiTk.js → ruby-YHScF8rv.js} +0 -0
  207. /package/dist/web/assets/{ruleslanguage-2nOGmUbL.js → ruleslanguage-BYwdQsZF.js} +0 -0
  208. /package/dist/web/assets/{rust-Bn5K3sZf.js → rust-B5YXnMyV.js} +0 -0
  209. /package/dist/web/assets/{sas-BOCzodK2.js → sas-CCTr8w16.js} +0 -0
  210. /package/dist/web/assets/{scala-BRv9Y1Gl.js → scala-Cbxd3VFS.js} +0 -0
  211. /package/dist/web/assets/{scheme-DgxU7T27.js → scheme-BsN3DINT.js} +0 -0
  212. /package/dist/web/assets/{scilab-CDpHNnol.js → scilab-DPKVNXPG.js} +0 -0
  213. /package/dist/web/assets/{scss-_DXiA8XH.js → scss-DbQAKOek.js} +0 -0
  214. /package/dist/web/assets/{shell-JZbpHYqw.js → shell-DWzkAqOf.js} +0 -0
  215. /package/dist/web/assets/{smali-D-pxIQI6.js → smali-BftjeLb5.js} +0 -0
  216. /package/dist/web/assets/{smalltalk-BgHXrgWH.js → smalltalk-CRiQmXNN.js} +0 -0
  217. /package/dist/web/assets/{sml-XMsOdlaX.js → sml-StzcQc9I.js} +0 -0
  218. /package/dist/web/assets/{sqf-BAJmpDEs.js → sqf-DD5HJChz.js} +0 -0
  219. /package/dist/web/assets/{sql-qDDDtU5U.js → sql-DPgh6LFW.js} +0 -0
  220. /package/dist/web/assets/{sql_more-OsRq2zw0.js → sql_more-CtzXbTQc.js} +0 -0
  221. /package/dist/web/assets/{stata-Bk4QaRj1.js → stata-BVbnRiot.js} +0 -0
  222. /package/dist/web/assets/{step21-JBksYMyW.js → step21-Dq-6Zq9y.js} +0 -0
  223. /package/dist/web/assets/{stylus-B2-KoW99.js → stylus-BBnpEkBq.js} +0 -0
  224. /package/dist/web/assets/{subunit-Dms0B4fv.js → subunit-ELCErEkQ.js} +0 -0
  225. /package/dist/web/assets/{swift-BDkC6DWd.js → swift-DaAs7qTh.js} +0 -0
  226. /package/dist/web/assets/{taggerscript-BQuVNykw.js → taggerscript-1FPav-0a.js} +0 -0
  227. /package/dist/web/assets/{tap-Bwup7RHy.js → tap-EToQ4lhN.js} +0 -0
  228. /package/dist/web/assets/{tcl-CbpGYImD.js → tcl-D3o49C6L.js} +0 -0
  229. /package/dist/web/assets/{thrift-B_z8wKcZ.js → thrift-CWhyiqPB.js} +0 -0
  230. /package/dist/web/assets/{tp-BJLBEN3J.js → tp-B6O9yM_7.js} +0 -0
  231. /package/dist/web/assets/{twig-nUEnJWT1.js → twig-CtXlonbL.js} +0 -0
  232. /package/dist/web/assets/{typescript-CrQbuH5h.js → typescript-CCrKHjvE.js} +0 -0
  233. /package/dist/web/assets/{util-BS7JSiXp.js → util-_DavpSWv.js} +0 -0
  234. /package/dist/web/assets/{vala-2XexN6SZ.js → vala-DqTbJvZE.js} +0 -0
  235. /package/dist/web/assets/{vbnet-BAt8krwo.js → vbnet-BIMC8kyn.js} +0 -0
  236. /package/dist/web/assets/{vbscript--ebsjfOw.js → vbscript-CwHfrTEX.js} +0 -0
  237. /package/dist/web/assets/{vbscript-html-yaZI43iV.js → vbscript-html-6BIOjkqb.js} +0 -0
  238. /package/dist/web/assets/{verilog-emU2h0-4.js → verilog-Br3eYmwZ.js} +0 -0
  239. /package/dist/web/assets/{vhdl-CPuOZFR2.js → vhdl-CDlnDphM.js} +0 -0
  240. /package/dist/web/assets/{vim-ZfleAGCY.js → vim-BOZojkV6.js} +0 -0
  241. /package/dist/web/assets/{x86asm-BHTiWqya.js → x86asm-Br9iqCtX.js} +0 -0
  242. /package/dist/web/assets/{xl-MlLWG0U8.js → xl-eSTclZWH.js} +0 -0
  243. /package/dist/web/assets/{xml-CJKMw8W2.js → xml-C775tW_n.js} +0 -0
  244. /package/dist/web/assets/{xquery-B4Yi49S8.js → xquery-DimlVJ6h.js} +0 -0
  245. /package/dist/web/assets/{yaml-5C-oV2Cp.js → yaml-Dnhus5cp.js} +0 -0
  246. /package/dist/web/assets/{zephir-Dig9AotJ.js → zephir-j3mL6he_.js} +0 -0
@@ -0,0 +1 @@
1
+ import{t as e}from"./chunk-3GQAWCBQ-ntjTDD_C.js";import{n as t}from"./chunk-QWQYAQCK-BR4V0xsV.js";import{c as n,i as r}from"./client-z1GrRUEs.js";import{a as i,c as a,d as o,l as s,n as c,o as l,s as u,t as d}from"./chunk-ECXMLUNG-CSRGaMIB.js";function f(e){let n=Object.keys(e.mcpServers??{});r.getInstance().trackMCPClientInit({codeMode:!1,sandbox:!1,allCallbacks:!1,verify:!1,servers:n,numServers:n.length,isBrowser:!0}).catch(e=>t.debug(`Failed to track BrowserMCPClient init: ${e}`))}e(f,`trackBrowserClientInit`);var p=class r extends d{static{e(this,`BrowserMCPClient`)}static getPackageVersion(){return n()}constructor(e){super(e),f(this.config)}static fromDict(e){return new r(e)}createConnectorFromConfig(e){let{url:n,headers:r,fetch:a,authToken:o,authProvider:s,wrapTransport:u,clientOptions:d,disableSseFallback:f,preferSse:p,timeout:m,sseReadTimeout:h,gatewayUrl:g,serverId:_,reconnectionOptions:v}=e;if(!n)throw Error(`Server URL is required`);let y=this.config,b=l(e,y),x=i(e.clientInfo??this.config.clientInfo),S={headers:r,fetch:a,authToken:o,authProvider:s,wrapTransport:u,clientOptions:d,onSampling:b.onSampling,onElicitation:b.onElicitation,onNotification:b.onNotification,disableSseFallback:f,preferSse:p,timeout:m,sseReadTimeout:h,clientInfo:x,gatewayUrl:g,serverId:_,reconnectionOptions:v};return t.debug(`[BrowserMCPClient] Connector options prepared (clientOptions: ${d?`provided`:`none`})`),new c(n,S)}};function m(t){let n=e(()=>{throw Error(`Invalid url to pass to open(): ${t}`)},`abort`),r;try{r=new URL(t)}catch{n()}return r.protocol!==`https:`&&r.protocol!==`http:`&&n(),r.hostname!==encodeURIComponent(r.hostname)&&n(),r.username&&=encodeURIComponent(r.username),r.password&&=encodeURIComponent(r.password),r.pathname=r.pathname.slice(0,1)+encodeURIComponent(r.pathname.slice(1)).replace(/%2f/gi,`/`),r.search=r.search.slice(0,1)+Array.from(r.searchParams.entries()).map(h).join(`&`),r.hash=r.hash.slice(0,1)+encodeURIComponent(r.hash.slice(1)),r.href}e(m,`sanitizeUrl`);function h([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:``}`}e(h,`sanitizeParam`);async function g(e){return typeof e==`string`?e:e instanceof URLSearchParams||e instanceof FormData?Object.fromEntries(e.entries()):e instanceof Blob?await e.text():e}e(g,`serializeBody`);var _=class{static{e(this,`BrowserOAuthClientProvider`)}serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;logoUri;callbackUrl;preventAutoAuth;useRedirectFlow;oauthProxyUrl;connectionUrl;originalFetch;pendingCodeVerifier=null;_lastOriginalResource=null;_cachedAuthServerUrl=null;_cachedMetadata=null;_refreshPromise=null;onPopupWindow;constructor(e,t={}){this.serverUrl=e,this.storageKeyPrefix=t.storageKeyPrefix||`mcp:auth`,this.serverUrlHash=this.hashString(e),this.clientName=t.clientName||`mcp-use`,this.clientUri=t.clientUri||(typeof window<`u`?window.location.origin:``),this.logoUri=t.logoUri||`https://mcp-use.com/logo.png`,this.callbackUrl=m(t.callbackUrl||(typeof window<`u`?new URL(`/oauth/callback`,window.location.origin).toString():`/oauth/callback`)),this.preventAutoAuth=t.preventAutoAuth,this.useRedirectFlow=t.useRedirectFlow,this.oauthProxyUrl=t.oauthProxyUrl,this.connectionUrl=t.connectionUrl,this.onPopupWindow=t.onPopupWindow}installFetchInterceptor(){if(!this.oauthProxyUrl){console.warn(`[BrowserOAuthProvider] No OAuth proxy URL configured, skipping fetch interceptor installation`);return}if(!this.originalFetch)this.originalFetch=window.fetch;else{console.warn(`[BrowserOAuthProvider] Fetch interceptor already installed`);return}let e=this.oauthProxyUrl,t=this.connectionUrl,n=this.serverUrl,r=this.originalFetch;console.log(`[BrowserOAuthProvider] Installing fetch interceptor with proxy: ${e}`),window.fetch=async(i,a)=>{let o=typeof i==`string`?i:i instanceof URL?i.toString():i.url;if(!(o.includes(`/.well-known/`)||o.match(/\/(register|token|authorize)$/)))return await r(i,a);try{let t=new URL(o),n=new URL(e);if(t.origin===n.origin&&(t.pathname.startsWith(n.pathname)||o.includes(`/inspector/api/oauth`)))return await r(i,a)}catch{}try{let i=o.includes(`/.well-known/`),s=i?`${e}/metadata?url=${encodeURIComponent(o)}`:`${e}/proxy`;if(console.log(`[OAuth Proxy] Routing ${i?`metadata`:`request`} through: ${s}`),i){let e={...a?.headers?Object.fromEntries(new Headers(a.headers)):{}};t&&(e[`X-Connection-URL`]=t);let i=new URL(s);n&&i.searchParams.set(`mcp_url`,n);let o=await r(i.toString(),{...a,method:`GET`,headers:e});try{if((o.headers.get(`content-type`)||``).includes(`application/json`)){let e=await o.clone().json(),t=e&&typeof e==`object`&&typeof e._original_resource==`string`?e._original_resource:null;t&&(this._lastOriginalResource=t)}}catch{}return o}let c=a?.body?await g(a.body):void 0,l=await(await r(s,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:o,method:a?.method||`POST`,headers:a?.headers?Object.fromEntries(new Headers(a.headers)):{},body:c})})).json();return new Response(JSON.stringify(l.body),{status:l.status,statusText:l.statusText,headers:new Headers(l.headers)})}catch(e){return console.error(`[OAuth Proxy] Request failed, falling back to direct fetch:`,e),await r(i,a)}}}restoreFetch(){this.originalFetch&&=(console.log(`[BrowserOAuthProvider] Restoring original fetch`),window.fetch=this.originalFetch,void 0)}get redirectUrl(){return m(this.callbackUrl)}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:`none`,grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],client_name:this.clientName,client_uri:this.clientUri,logo_uri:this.logoUri}}async clientInformation(){let e=this.getKey(`client_info`),t=localStorage.getItem(e);if(t)try{let n=JSON.parse(t),r=Array.isArray(n.redirect_uris)?n.redirect_uris:[];if(!(r.length===0||r.includes(this.redirectUrl))){console.info(`[${this.storageKeyPrefix}] Invalidating cached OAuth client info due to redirect URI mismatch.`),localStorage.removeItem(e),localStorage.removeItem(this.getKey(`tokens`)),localStorage.removeItem(this.getKey(`last_auth_url`));return}return n}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,t),localStorage.removeItem(e);return}}async saveClientInformation(e){let t=this.getKey(`client_info`);localStorage.setItem(t,JSON.stringify(e))}async tokens(){let e=this.getKey(`tokens`),t=localStorage.getItem(e);if(t)try{let e=JSON.parse(t);if(e.access_token&&e.refresh_token)try{let t=JSON.parse(atob(e.access_token.split(`.`)[1]));if(t.exp&&Date.now()>=(t.exp-30)*1e3){console.log(`[tokens] Access token expiring soon, refreshing...`);let t=await this._dedupedRefresh(e);if(t)return console.log(`[tokens] Refreshed successfully`),t}}catch{}return e}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,t),localStorage.removeItem(e);return}}async saveTokens(e){let t=this.getKey(`tokens`);localStorage.setItem(t,JSON.stringify(e)),localStorage.removeItem(this.getKey(`code_verifier`)),localStorage.removeItem(this.getKey(`last_auth_url`)),this.pendingCodeVerifier=null}async _refresh(e){try{if(!this._cachedAuthServerUrl||!this._cachedMetadata){let e=(await s(this.serverUrl)).authorization_servers?.[0];if(!e)return null;let t=await a(e);if(!t)return null;this._cachedAuthServerUrl=e,this._cachedMetadata=t}let t=await this.clientInformation();if(!t)return null;let n=await o(this._cachedAuthServerUrl,{metadata:this._cachedMetadata,clientInformation:t,refreshToken:e.refresh_token});return await this.saveTokens(n),n}catch{return null}}async _dedupedRefresh(e){if(this._refreshPromise)return this._refreshPromise;this._refreshPromise=this._refresh(e);try{return await this._refreshPromise}finally{this._refreshPromise=null}}async invalidateCredentials(e){switch(e){case`all`:localStorage.removeItem(this.getKey(`tokens`)),localStorage.removeItem(this.getKey(`client_info`)),localStorage.removeItem(this.getKey(`code_verifier`)),localStorage.removeItem(this.getKey(`last_auth_url`)),this.pendingCodeVerifier=null;break;case`client`:localStorage.removeItem(this.getKey(`client_info`));break;case`tokens`:localStorage.removeItem(this.getKey(`tokens`));break;case`verifier`:localStorage.removeItem(this.getKey(`code_verifier`)),this.pendingCodeVerifier=null;break;default:break}}async saveCodeVerifier(e){let t=this.getKey(`code_verifier`);localStorage.setItem(t,e),this.pendingCodeVerifier=e}async codeVerifier(){let e=this.getKey(`code_verifier`),t=localStorage.getItem(e);if(!t)throw Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return t}async prepareAuthorizationUrl(e){let t=e.searchParams.get(`resource`),n=!!(t&&(t.includes(`/inspector/api/proxy`)||t.includes(`/api/proxy`)||t.includes(`localhost:3000`))),r=!!(t&&this.connectionUrl&&t===this.connectionUrl),i=!!(t&&(this._lastOriginalResource||this.serverUrl)&&(r||n)),a=this._lastOriginalResource||this.serverUrl;i&&a&&e.searchParams.set(`resource`,a);let o=globalThis.crypto.randomUUID(),s=`${this.storageKeyPrefix}:state_${o}`,c=this.pendingCodeVerifier||localStorage.getItem(this.getKey(`code_verifier`)),l={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,codeVerifier:c||void 0,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl,oauthProxyUrl:this.oauthProxyUrl,connectionUrl:this.connectionUrl},flowType:this.useRedirectFlow?`redirect`:`popup`,returnUrl:typeof window<`u`?window.location.href:void 0};console.log(`[OAuth] Storing state key: ${s}`),localStorage.setItem(s,JSON.stringify(l));let u=localStorage.getItem(s);console.log(`[OAuth] State stored successfully: ${!!u}`),e.searchParams.set(`state`,o);let d=m(e.toString());return localStorage.setItem(this.getKey(`last_auth_url`),d),d}async redirectToAuthorization(e){let t=await this.prepareAuthorizationUrl(e);if(this.preventAutoAuth){console.info(`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`);return}if(this.useRedirectFlow){console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`),window.location.href=t;return}let n=`width=600,height=700,resizable=yes,scrollbars=yes,status=yes`;try{let e=window.open(t,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(t,n,e),!e||e.closed||e.closed===void 0?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(e.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(e){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,e)}}getLastAttemptedAuthUrl(){let e=localStorage.getItem(this.getKey(`last_auth_url`));return e?m(e):null}clearStorage(){let e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[],r=0;for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);if(i){if(i.startsWith(e))n.push(i);else if(i.startsWith(t))try{let e=localStorage.getItem(i);e&&JSON.parse(e).serverUrlHash===this.serverUrlHash&&n.push(i)}catch(e){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,e)}}}return[...new Set(n)].forEach(e=>{localStorage.removeItem(e),r++}),r}hashString(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}};async function v(){let e=new URLSearchParams(window.location.search),t=e.get(`code`),n=e.get(`state`),r=e.get(`error`),i=e.get(`error_description`),a=`[mcp-callback]`;console.log(`${a} Handling callback...`,{code:t,state:n,error:r,errorDescription:i});let o=null,s=null,c=null;try{if(r)throw Error(`OAuth error: ${r} - ${i||`No description provided.`}`);if(!t)throw Error(`Authorization code not found in callback query parameters.`);if(!n)throw Error(`State parameter not found or invalid in callback query parameters.`);console.log(`[mcp-callback] Looking for state: ${n}`),console.log(`[mcp-callback] All localStorage keys:`,Object.keys(localStorage));let e=`mcp:auth:state_${n}`;if(localStorage.getItem(e))c=e,console.log(`[mcp-callback] Found state with default key: ${e}`);else{let e=`:state_${n}`;for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n&&n.endsWith(e)){c=n,console.log(`[mcp-callback] Found state with dynamic key: ${n}`);break}}}if(!c){let e=Object.keys(localStorage).filter(e=>e.includes(`state`));throw console.log(`[mcp-callback] State keys in storage:`,e),Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`)}let l=localStorage.getItem(c);if(!l)throw Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`);try{s=JSON.parse(l)}catch{throw Error(`Failed to parse stored OAuth state.`)}if(!s.expiry||s.expiry<Date.now())throw localStorage.removeItem(c),Error(`OAuth state has expired. Please try initiating authentication again.`);if(!s.providerOptions)throw Error(`Stored state is missing required provider options.`);let{serverUrl:d,...f}=s.providerOptions,p=f.connectionUrl,m=!!(p&&/run\.mcp-use\.com|mcp-use\.run/.test(p)),h=m?p:void 0,g=f.oauthProxyUrl,v=h;if(!g&&v)try{let e=new URL(window.location.href);if(e.pathname.includes(`/oauth/callback`)){let t=e.pathname.replace(/\/oauth\/callback.*$/,``);(!t||t===``)&&(/run\.mcp-use\.com|mcp-use\.run/.test(v)?console.log(`${a} Gateway connection detected; skipping default /inspector OAuth proxy inference`):(t=`/inspector`,console.log(`${a} Callback at root /oauth/callback, using /inspector as base path for OAuth proxy`))),t&&(g=`${e.origin}${t}/api/oauth`),console.log(`${a} Inferred OAuth proxy URL from callback: ${g}`)}}catch(e){console.warn(`${a} Could not infer OAuth proxy URL:`,e)}console.log(`${a} Re-instantiating provider for server: ${d}`),o=new _(d,{...f,oauthProxyUrl:g,connectionUrl:v});let y=`${f.storageKeyPrefix}_${s.serverUrlHash}_code_verifier`,b=s.codeVerifier||localStorage.getItem(y);if(b)localStorage.setItem(y,b),localStorage.setItem(o.getKey(`code_verifier`),b);else throw Error(`[${f.storageKeyPrefix}] Code verifier missing for OAuth state ${n}. Please restart authentication.`);g&&(console.log(`${a} Installing fetch interceptor for token exchange (proxy: ${g})`),o.installFetchInterceptor()),console.log(`${a} Calling SDK auth() to exchange code...`);let x=m&&v?v:d;console.log(`${a} Using SDK serverUrl: ${x} (connectionUrl: ${v||`none`})`);let S=await u(o,{serverUrl:x,authorizationCode:t});if(S===`AUTHORIZED`)if(console.log(`${a} Authorization successful via SDK auth().`),s.flowType===`redirect`&&s.returnUrl)console.log(`${a} Redirect flow complete. Returning to: ${s.returnUrl}`),localStorage.removeItem(c),window.location.href=s.returnUrl;else if(window.opener&&!window.opener.closed)console.log(`${a} Popup flow complete. Notifying opener...`),window.opener.postMessage({type:`mcp_auth_callback`,success:!0},window.location.origin),localStorage.removeItem(c),window.close();else if(s.returnUrl)console.log(`${a} Popup flow without opener. Returning to: ${s.returnUrl}`),localStorage.removeItem(c),window.location.href=s.returnUrl;else{console.warn(`${a} No opener window or return URL detected. Redirecting to root.`),localStorage.removeItem(c);let e=window.location.pathname.split(`/`).filter(Boolean),t=e.length>0&&e[e.length-1]===`callback`?`/`+e.slice(0,-2).join(`/`):`/`;window.location.href=t||`/`}else throw console.warn(`${a} SDK auth() returned unexpected status: ${S}`),Error(`Unexpected result from authentication library: ${S}`)}catch(e){console.error(`${a} Error during OAuth callback handling:`,e);let t=e instanceof Error?e.message:String(e);window.opener&&!window.opener.closed&&window.opener.postMessage({type:`mcp_auth_callback`,success:!1,error:t},window.location.origin);try{document.body.innerHTML=``;let n=document.createElement(`div`);n.style.fontFamily=`sans-serif`,n.style.padding=`20px`;let r=document.createElement(`h1`);r.textContent=`Authentication Error`,n.appendChild(r);let i=document.createElement(`p`);i.style.color=`red`,i.style.backgroundColor=`#ffebeb`,i.style.border=`1px solid red`,i.style.padding=`10px`,i.style.borderRadius=`4px`,i.textContent=t,n.appendChild(i);let a=document.createElement(`p`);a.textContent=`You can close this window or `;let o=document.createElement(`a`);if(o.href=`#`,o.textContent=`click here to close`,o.onclick=e=>(e.preventDefault(),window.close(),!1),a.appendChild(o),a.appendChild(document.createTextNode(`.`)),n.appendChild(a),e instanceof Error&&e.stack){let t=document.createElement(`pre`);t.style.fontSize=`0.8em`,t.style.color=`#555`,t.style.marginTop=`20px`,t.style.whiteSpace=`pre-wrap`,t.textContent=e.stack,n.appendChild(t)}document.body.appendChild(n)}catch(e){console.error(`${a} Could not display error in callback window:`,e)}c&&localStorage.removeItem(c),o&&localStorage.removeItem(o.getKey(`last_auth_url`))}}e(v,`onMcpAuthorization`);export{m as i,_ as n,v as r,p as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./chunk-3GQAWCBQ-C-9Cm0Np.js";import{n as t}from"./chunk-QWQYAQCK-CyFuZlX8.js";import{I as n,_r as r}from"./json-schema-processors-DSIsU0go.js";import{F as i,N as a,P as o,_ as s,c,g as l,i as u,n as d,r as f,t as p}from"./client-DaI4JaTs.js";import{S as m,a as ee,d as te,f as h,m as g,o as _,p as ne,s as v,t as re,v as y}from"./schemas-79owEkeD.js";var ie={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},ae;(function(e){})(ae||={});function oe(e){return n(re,e)}function b(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function se(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...b(t.headers),...b(r.headers)}:t.headers}):e}var ce=globalThis.crypto;async function le(e){return(await ce).getRandomValues(new Uint8Array(e))}async function ue(e){let t=``;for(;t.length<e;){let n=await le(e-t.length);for(let e of n)e<198&&(t+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e%66])}return t}async function de(e){return await ue(e)}async function fe(e){let t=await(await ce).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function pe(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await de(e);return{code_verifier:t,code_challenge:await fe(t)}}var x=m().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:ie.custom,message:`URL must be parseable`,fatal:!0}),r}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),me=h({resource:y().url(),authorization_servers:_(x).optional(),jwks_uri:y().url().optional(),scopes_supported:_(y()).optional(),bearer_methods_supported:_(y()).optional(),resource_signing_alg_values_supported:_(y()).optional(),resource_name:y().optional(),resource_documentation:y().optional(),resource_policy_uri:y().url().optional(),resource_tos_uri:y().url().optional(),tls_client_certificate_bound_access_tokens:v().optional(),authorization_details_types_supported:_(y()).optional(),dpop_signing_alg_values_supported:_(y()).optional(),dpop_bound_access_tokens_required:v().optional()}),he=h({issuer:y(),authorization_endpoint:x,token_endpoint:x,registration_endpoint:x.optional(),scopes_supported:_(y()).optional(),response_types_supported:_(y()),response_modes_supported:_(y()).optional(),grant_types_supported:_(y()).optional(),token_endpoint_auth_methods_supported:_(y()).optional(),token_endpoint_auth_signing_alg_values_supported:_(y()).optional(),service_documentation:x.optional(),revocation_endpoint:x.optional(),revocation_endpoint_auth_methods_supported:_(y()).optional(),revocation_endpoint_auth_signing_alg_values_supported:_(y()).optional(),introspection_endpoint:y().optional(),introspection_endpoint_auth_methods_supported:_(y()).optional(),introspection_endpoint_auth_signing_alg_values_supported:_(y()).optional(),code_challenge_methods_supported:_(y()).optional(),client_id_metadata_document_supported:v().optional()}),ge=g({...h({issuer:y(),authorization_endpoint:x,token_endpoint:x,userinfo_endpoint:x.optional(),jwks_uri:x,registration_endpoint:x.optional(),scopes_supported:_(y()).optional(),response_types_supported:_(y()),response_modes_supported:_(y()).optional(),grant_types_supported:_(y()).optional(),acr_values_supported:_(y()).optional(),subject_types_supported:_(y()),id_token_signing_alg_values_supported:_(y()),id_token_encryption_alg_values_supported:_(y()).optional(),id_token_encryption_enc_values_supported:_(y()).optional(),userinfo_signing_alg_values_supported:_(y()).optional(),userinfo_encryption_alg_values_supported:_(y()).optional(),userinfo_encryption_enc_values_supported:_(y()).optional(),request_object_signing_alg_values_supported:_(y()).optional(),request_object_encryption_alg_values_supported:_(y()).optional(),request_object_encryption_enc_values_supported:_(y()).optional(),token_endpoint_auth_methods_supported:_(y()).optional(),token_endpoint_auth_signing_alg_values_supported:_(y()).optional(),display_values_supported:_(y()).optional(),claim_types_supported:_(y()).optional(),claims_supported:_(y()).optional(),service_documentation:y().optional(),claims_locales_supported:_(y()).optional(),ui_locales_supported:_(y()).optional(),claims_parameter_supported:v().optional(),request_parameter_supported:v().optional(),request_uri_parameter_supported:v().optional(),require_request_uri_registration:v().optional(),op_policy_uri:x.optional(),op_tos_uri:x.optional(),client_id_metadata_document_supported:v().optional()}).shape,...he.pick({code_challenge_methods_supported:!0}).shape}),_e=g({access_token:y(),id_token:y().optional(),token_type:y(),expires_in:oe().optional(),scope:y().optional(),refresh_token:y().optional()}).strip(),ve=g({error:y(),error_description:y().optional(),error_uri:y().optional()}),ye=x.optional().or(te(``).transform(()=>void 0)),be=g({redirect_uris:_(x),token_endpoint_auth_method:y().optional(),grant_types:_(y()).optional(),response_types:_(y()).optional(),client_name:y().optional(),client_uri:x.optional(),logo_uri:ye,scope:y().optional(),contacts:_(y()).optional(),tos_uri:ye,policy_uri:y().optional(),jwks_uri:x.optional(),jwks:ee().optional(),software_id:y().optional(),software_version:y().optional(),software_statement:y().optional()}).strip(),xe=g({client_id:y(),client_secret:y().optional(),client_id_issued_at:ne().optional(),client_secret_expires_at:ne().optional()}).strip(),Se=be.merge(xe);g({error:y(),error_description:y().optional()}).strip(),g({token:y(),token_type_hint:y().optional()}).strip();function Ce(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function we({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;let i=n.pathname.endsWith(`/`)?n.pathname:n.pathname+`/`,a=r.pathname.endsWith(`/`)?r.pathname:r.pathname+`/`;return i.startsWith(a)}var S=class extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Te=class extends S{};Te.errorCode=`invalid_request`;var C=class extends S{};C.errorCode=`invalid_client`;var w=class extends S{};w.errorCode=`invalid_grant`;var T=class extends S{};T.errorCode=`unauthorized_client`;var Ee=class extends S{};Ee.errorCode=`unsupported_grant_type`;var De=class extends S{};De.errorCode=`invalid_scope`;var E=class extends S{};E.errorCode=`access_denied`;var D=class extends S{};D.errorCode=`server_error`;var Oe=class extends S{};Oe.errorCode=`temporarily_unavailable`;var ke=class extends S{};ke.errorCode=`unsupported_response_type`;var Ae=class extends S{};Ae.errorCode=`unsupported_token_type`;var je=class extends S{};je.errorCode=`invalid_token`;var Me=class extends S{};Me.errorCode=`method_not_allowed`;var Ne=class extends S{};Ne.errorCode=`too_many_requests`;var O=class extends S{};O.errorCode=`invalid_client_metadata`;var Pe=class extends S{};Pe.errorCode=`insufficient_scope`;var Fe=class extends S{};Fe.errorCode=`invalid_target`;var Ie={[Te.errorCode]:Te,[C.errorCode]:C,[w.errorCode]:w,[T.errorCode]:T,[Ee.errorCode]:Ee,[De.errorCode]:De,[E.errorCode]:E,[D.errorCode]:D,[Oe.errorCode]:Oe,[ke.errorCode]:ke,[Ae.errorCode]:Ae,[je.errorCode]:je,[Me.errorCode]:Me,[Ne.errorCode]:Ne,[O.errorCode]:O,[Pe.errorCode]:Pe,[Fe.errorCode]:Fe},k=class extends Error{constructor(e){super(e??`Unauthorized`)}};function Le(e){return[`client_secret_basic`,`client_secret_post`,`none`].includes(e)}var Re=`code`,ze=`S256`;function Be(e,t){let n=e.client_secret!==void 0;return t.length===0?n?`client_secret_post`:`none`:`token_endpoint_auth_method`in e&&e.token_endpoint_auth_method&&Le(e.token_endpoint_auth_method)&&t.includes(e.token_endpoint_auth_method)?e.token_endpoint_auth_method:n&&t.includes(`client_secret_basic`)?`client_secret_basic`:n&&t.includes(`client_secret_post`)?`client_secret_post`:t.includes(`none`)?`none`:n?`client_secret_post`:`none`}function Ve(e,t,n,r){let{client_id:i,client_secret:a}=t;switch(e){case`client_secret_basic`:He(i,a,n);return;case`client_secret_post`:Ue(i,a,r);return;case`none`:We(i,r);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function He(e,t,n){if(!t)throw Error(`client_secret_basic authentication requires a client_secret`);let r=btoa(`${e}:${t}`);n.set(`Authorization`,`Basic ${r}`)}function Ue(e,t,n){n.set(`client_id`,e),t&&n.set(`client_secret`,t)}function We(e,t){t.set(`client_id`,e)}async function Ge(e){let t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{let{error:e,error_description:t,error_uri:r}=ve.parse(JSON.parse(n));return new(Ie[e]||D)(t||``,r)}catch(e){return new D(`${t?`HTTP ${t}: `:``}Invalid OAuth error response: ${e}. Raw body: ${n}`)}}async function A(e,t){try{return await Ke(e,t)}catch(n){if(n instanceof C||n instanceof T)return await e.invalidateCredentials?.(`all`),await Ke(e,t);if(n instanceof w)return await e.invalidateCredentials?.(`tokens`),await Ke(e,t);throw n}}async function Ke(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:i,fetchFn:a}){let o=await e.discoveryState?.(),s,c,l,u=i;if(!u&&o?.resourceMetadataUrl&&(u=new URL(o.resourceMetadataUrl)),o?.authorizationServerUrl){if(c=o.authorizationServerUrl,s=o.resourceMetadata,l=o.authorizationServerMetadata??await rt(c,{fetchFn:a}),!s)try{s=await Xe(t,{resourceMetadataUrl:u},a)}catch{}(l!==o.authorizationServerMetadata||s!==o.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}else{let n=await it(t,{resourceMetadataUrl:u,fetchFn:a});c=n.authorizationServerUrl,l=n.authorizationServerMetadata,s=n.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}let d=await Je(t,e,s),f=await Promise.resolve(e.clientInformation());if(!f){if(n!==void 0)throw Error(`Existing OAuth client information is required when exchanging an authorization code`);let t=l?.client_id_metadata_document_supported===!0,r=e.clientMetadataUrl;if(r&&!qe(r))throw new O(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${r}`);if(t&&r)f={client_id:r},await e.saveClientInformation?.(f);else{if(!e.saveClientInformation)throw Error(`OAuth client information must be saveable for dynamic registration`);let t=await ut(c,{metadata:l,clientMetadata:e.clientMetadata,fetchFn:a});await e.saveClientInformation(t),f=t}}let p=!e.redirectUrl;if(n!==void 0||p){let t=await lt(e,c,{metadata:l,resource:d,authorizationCode:n,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}let m=await e.tokens();if(m?.refresh_token)try{let t=await ct(c,{metadata:l,clientInformation:f,refreshToken:m.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}catch(e){if(!(!(e instanceof S)||e instanceof D))throw e}let ee=e.state?await e.state():void 0,{authorizationUrl:te,codeVerifier:h}=await at(c,{metadata:l,clientInformation:f,state:ee,redirectUrl:e.redirectUrl,scope:r||s?.scopes_supported?.join(` `)||e.clientMetadata.scope,resource:d});return await e.saveCodeVerifier(h),await e.redirectToAuthorization(te),`REDIRECT`}function qe(e){if(!e)return!1;try{let t=new URL(e);return t.protocol===`https:`&&t.pathname!==`/`}catch{return!1}}async function Je(e,t,n){let r=Ce(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!we({requestedResource:r,configuredResource:n.resource}))throw Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function j(e){let t=e.headers.get(`WWW-Authenticate`);if(!t)return{};let[n,r]=t.split(` `);if(n.toLowerCase()!==`bearer`||!r)return{};let i=Ye(e,`resource_metadata`)||void 0,a;if(i)try{a=new URL(i)}catch{}let o=Ye(e,`scope`)||void 0,s=Ye(e,`error`)||void 0;return{resourceMetadataUrl:a,scope:o,error:s}}function Ye(e,t){let n=e.headers.get(`WWW-Authenticate`);if(!n)return null;let r=RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),i=n.match(r);return i?i[1]||i[2]:null}async function Xe(e,t,n=fetch){let r=await tt(e,`oauth-protected-resource`,n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.body?.cancel(),Error(`Resource server does not implement OAuth 2.0 Protected Resource Metadata.`);if(!r.ok)throw await r.body?.cancel(),Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return me.parse(await r.json())}async function Ze(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?Ze(e,void 0,n):void 0;throw r}}function Qe(e,t=``,n={}){return t.endsWith(`/`)&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function $e(e,t,n=fetch){return await Ze(e,{"MCP-Protocol-Version":t},n)}function et(e,t){return!e||e.status>=400&&e.status<500&&t!==`/`}async function tt(e,t,n,r){let i=new URL(e),a=r?.protocolVersion??`2025-11-25`,o;if(r?.metadataUrl)o=new URL(r.metadataUrl);else{let e=Qe(t,i.pathname);o=new URL(e,r?.metadataServerUrl??i),o.search=i.search}let s=await $e(o,a,n);return!r?.metadataUrl&&et(s,i.pathname)&&(s=await $e(new URL(`/.well-known/${t}`,i),a,n)),s}function nt(e){let t=typeof e==`string`?new URL(e):e,n=t.pathname!==`/`,r=[];if(!n)return r.push({url:new URL(`/.well-known/oauth-authorization-server`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration`,t.origin),type:`oidc`}),r;let i=t.pathname;return i.endsWith(`/`)&&(i=i.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:`oidc`}),r.push({url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:`oidc`}),r}async function rt(e,{fetchFn:t=fetch,protocolVersion:n=s}={}){let r={"MCP-Protocol-Version":n,Accept:`application/json`},i=nt(e);for(let{url:e,type:n}of i){let i=await Ze(e,r,t);if(i){if(!i.ok){if(await i.body?.cancel(),i.status>=400&&i.status<500)continue;throw Error(`HTTP ${i.status} trying to load ${n===`oauth`?`OAuth`:`OpenID provider`} metadata from ${e}`)}return n===`oauth`?he.parse(await i.json()):ge.parse(await i.json())}}}async function it(e,t){let n,r;try{n=await Xe(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||=String(new URL(`/`,e));let i=await rt(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:i,resourceMetadata:n}}async function at(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:i,state:a,resource:o}){let s;if(t){if(s=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Re))throw Error(`Incompatible auth server: does not support response type ${Re}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(ze))throw Error(`Incompatible auth server: does not support code challenge method ${ze}`)}else s=new URL(`/authorize`,e);let c=await pe(),l=c.code_verifier,u=c.code_challenge;return s.searchParams.set(`response_type`,Re),s.searchParams.set(`client_id`,n.client_id),s.searchParams.set(`code_challenge`,u),s.searchParams.set(`code_challenge_method`,ze),s.searchParams.set(`redirect_uri`,String(r)),a&&s.searchParams.set(`state`,a),i&&s.searchParams.set(`scope`,i),i?.includes(`offline_access`)&&s.searchParams.append(`prompt`,`consent`),o&&s.searchParams.set(`resource`,o.href),{authorizationUrl:s,codeVerifier:l}}function ot(e,t,n){return new URLSearchParams({grant_type:`authorization_code`,code:e,code_verifier:t,redirect_uri:String(n)})}async function st(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:i,resource:a,fetchFn:o}){let s=t?.token_endpoint?new URL(t.token_endpoint):new URL(`/token`,e),c=new Headers({"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`});a&&n.set(`resource`,a.href),i?await i(c,n,s,t):r&&Ve(Be(r,t?.token_endpoint_auth_methods_supported??[]),r,c,n);let l=await(o??fetch)(s,{method:`POST`,headers:c,body:n});if(!l.ok)throw await Ge(l);return _e.parse(await l.json())}async function ct(e,{metadata:t,clientInformation:n,refreshToken:r,resource:i,addClientAuthentication:a,fetchFn:o}){return{refresh_token:r,...await st(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:`refresh_token`,refresh_token:r}),clientInformation:n,addClientAuthentication:a,resource:i,fetchFn:o})}}async function lt(e,t,{metadata:n,resource:r,authorizationCode:i,fetchFn:a}={}){let o=e.clientMetadata.scope,s;if(e.prepareTokenRequest&&(s=await e.prepareTokenRequest(o)),!s){if(!i)throw Error(`Either provider.prepareTokenRequest() or authorizationCode is required`);if(!e.redirectUrl)throw Error(`redirectUrl is required for authorization_code flow`);s=ot(i,await e.codeVerifier(),e.redirectUrl)}let c=await e.clientInformation();return st(t,{metadata:n,tokenRequestParams:s,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:a})}async function ut(e,{metadata:t,clientMetadata:n,fetchFn:r}){let i;if(t){if(!t.registration_endpoint)throw Error(`Incompatible auth server: does not support dynamic client registration`);i=new URL(t.registration_endpoint)}else i=new URL(`/register`,e);let a=await(r??fetch)(i,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!a.ok)throw await Ge(a);return Se.parse(await a.json())}var dt=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function ft(e){}function pt(e){if(typeof e==`function`)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=ft,onError:n=ft,onRetry:r=ft,onComment:i}=e,a=``,o=!0,s,c=``,l=``;function u(e){let t=o?e.replace(/^\xEF\xBB\xBF/,``):e,[n,r]=mt(`${a}${t}`);for(let e of n)d(e);a=r,o=!1}function d(e){if(e===``){p();return}if(e.startsWith(`:`)){i&&i(e.slice(e.startsWith(`: `)?2:1));return}let t=e.indexOf(`:`);if(t!==-1){let n=e.slice(0,t),r=e[t+1]===` `?2:1;f(n,e.slice(t+r),e);return}f(e,``,e)}function f(e,t,i){switch(e){case`event`:l=t;break;case`data`:c=`${c}${t}
1
+ import{t as e}from"./chunk-3GQAWCBQ-ntjTDD_C.js";import{n as t}from"./chunk-QWQYAQCK-BR4V0xsV.js";import{I as n,_r as r}from"./json-schema-processors-DNSjFPrk.js";import{F as i,N as a,P as o,_ as s,c,g as l,i as u,n as d,r as f,t as p}from"./client-z1GrRUEs.js";import{S as m,a as ee,d as te,f as h,m as g,o as _,p as ne,s as v,t as re,v as y}from"./schemas-BrqAD_Qo.js";var ie={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},ae;(function(e){})(ae||={});function oe(e){return n(re,e)}function b(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function se(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...b(t.headers),...b(r.headers)}:t.headers}):e}var ce=globalThis.crypto;async function le(e){return(await ce).getRandomValues(new Uint8Array(e))}async function ue(e){let t=``;for(;t.length<e;){let n=await le(e-t.length);for(let e of n)e<198&&(t+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e%66])}return t}async function de(e){return await ue(e)}async function fe(e){let t=await(await ce).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function pe(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await de(e);return{code_verifier:t,code_challenge:await fe(t)}}var x=m().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:ie.custom,message:`URL must be parseable`,fatal:!0}),r}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),me=h({resource:y().url(),authorization_servers:_(x).optional(),jwks_uri:y().url().optional(),scopes_supported:_(y()).optional(),bearer_methods_supported:_(y()).optional(),resource_signing_alg_values_supported:_(y()).optional(),resource_name:y().optional(),resource_documentation:y().optional(),resource_policy_uri:y().url().optional(),resource_tos_uri:y().url().optional(),tls_client_certificate_bound_access_tokens:v().optional(),authorization_details_types_supported:_(y()).optional(),dpop_signing_alg_values_supported:_(y()).optional(),dpop_bound_access_tokens_required:v().optional()}),he=h({issuer:y(),authorization_endpoint:x,token_endpoint:x,registration_endpoint:x.optional(),scopes_supported:_(y()).optional(),response_types_supported:_(y()),response_modes_supported:_(y()).optional(),grant_types_supported:_(y()).optional(),token_endpoint_auth_methods_supported:_(y()).optional(),token_endpoint_auth_signing_alg_values_supported:_(y()).optional(),service_documentation:x.optional(),revocation_endpoint:x.optional(),revocation_endpoint_auth_methods_supported:_(y()).optional(),revocation_endpoint_auth_signing_alg_values_supported:_(y()).optional(),introspection_endpoint:y().optional(),introspection_endpoint_auth_methods_supported:_(y()).optional(),introspection_endpoint_auth_signing_alg_values_supported:_(y()).optional(),code_challenge_methods_supported:_(y()).optional(),client_id_metadata_document_supported:v().optional()}),ge=g({...h({issuer:y(),authorization_endpoint:x,token_endpoint:x,userinfo_endpoint:x.optional(),jwks_uri:x,registration_endpoint:x.optional(),scopes_supported:_(y()).optional(),response_types_supported:_(y()),response_modes_supported:_(y()).optional(),grant_types_supported:_(y()).optional(),acr_values_supported:_(y()).optional(),subject_types_supported:_(y()),id_token_signing_alg_values_supported:_(y()),id_token_encryption_alg_values_supported:_(y()).optional(),id_token_encryption_enc_values_supported:_(y()).optional(),userinfo_signing_alg_values_supported:_(y()).optional(),userinfo_encryption_alg_values_supported:_(y()).optional(),userinfo_encryption_enc_values_supported:_(y()).optional(),request_object_signing_alg_values_supported:_(y()).optional(),request_object_encryption_alg_values_supported:_(y()).optional(),request_object_encryption_enc_values_supported:_(y()).optional(),token_endpoint_auth_methods_supported:_(y()).optional(),token_endpoint_auth_signing_alg_values_supported:_(y()).optional(),display_values_supported:_(y()).optional(),claim_types_supported:_(y()).optional(),claims_supported:_(y()).optional(),service_documentation:y().optional(),claims_locales_supported:_(y()).optional(),ui_locales_supported:_(y()).optional(),claims_parameter_supported:v().optional(),request_parameter_supported:v().optional(),request_uri_parameter_supported:v().optional(),require_request_uri_registration:v().optional(),op_policy_uri:x.optional(),op_tos_uri:x.optional(),client_id_metadata_document_supported:v().optional()}).shape,...he.pick({code_challenge_methods_supported:!0}).shape}),_e=g({access_token:y(),id_token:y().optional(),token_type:y(),expires_in:oe().optional(),scope:y().optional(),refresh_token:y().optional()}).strip(),ve=g({error:y(),error_description:y().optional(),error_uri:y().optional()}),ye=x.optional().or(te(``).transform(()=>void 0)),be=g({redirect_uris:_(x),token_endpoint_auth_method:y().optional(),grant_types:_(y()).optional(),response_types:_(y()).optional(),client_name:y().optional(),client_uri:x.optional(),logo_uri:ye,scope:y().optional(),contacts:_(y()).optional(),tos_uri:ye,policy_uri:y().optional(),jwks_uri:x.optional(),jwks:ee().optional(),software_id:y().optional(),software_version:y().optional(),software_statement:y().optional()}).strip(),xe=g({client_id:y(),client_secret:y().optional(),client_id_issued_at:ne().optional(),client_secret_expires_at:ne().optional()}).strip(),Se=be.merge(xe);g({error:y(),error_description:y().optional()}).strip(),g({token:y(),token_type_hint:y().optional()}).strip();function Ce(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function we({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;let i=n.pathname.endsWith(`/`)?n.pathname:n.pathname+`/`,a=r.pathname.endsWith(`/`)?r.pathname:r.pathname+`/`;return i.startsWith(a)}var S=class extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Te=class extends S{};Te.errorCode=`invalid_request`;var C=class extends S{};C.errorCode=`invalid_client`;var w=class extends S{};w.errorCode=`invalid_grant`;var T=class extends S{};T.errorCode=`unauthorized_client`;var Ee=class extends S{};Ee.errorCode=`unsupported_grant_type`;var De=class extends S{};De.errorCode=`invalid_scope`;var E=class extends S{};E.errorCode=`access_denied`;var D=class extends S{};D.errorCode=`server_error`;var Oe=class extends S{};Oe.errorCode=`temporarily_unavailable`;var ke=class extends S{};ke.errorCode=`unsupported_response_type`;var Ae=class extends S{};Ae.errorCode=`unsupported_token_type`;var je=class extends S{};je.errorCode=`invalid_token`;var Me=class extends S{};Me.errorCode=`method_not_allowed`;var Ne=class extends S{};Ne.errorCode=`too_many_requests`;var O=class extends S{};O.errorCode=`invalid_client_metadata`;var Pe=class extends S{};Pe.errorCode=`insufficient_scope`;var Fe=class extends S{};Fe.errorCode=`invalid_target`;var Ie={[Te.errorCode]:Te,[C.errorCode]:C,[w.errorCode]:w,[T.errorCode]:T,[Ee.errorCode]:Ee,[De.errorCode]:De,[E.errorCode]:E,[D.errorCode]:D,[Oe.errorCode]:Oe,[ke.errorCode]:ke,[Ae.errorCode]:Ae,[je.errorCode]:je,[Me.errorCode]:Me,[Ne.errorCode]:Ne,[O.errorCode]:O,[Pe.errorCode]:Pe,[Fe.errorCode]:Fe},k=class extends Error{constructor(e){super(e??`Unauthorized`)}};function Le(e){return[`client_secret_basic`,`client_secret_post`,`none`].includes(e)}var Re=`code`,ze=`S256`;function Be(e,t){let n=e.client_secret!==void 0;return t.length===0?n?`client_secret_post`:`none`:`token_endpoint_auth_method`in e&&e.token_endpoint_auth_method&&Le(e.token_endpoint_auth_method)&&t.includes(e.token_endpoint_auth_method)?e.token_endpoint_auth_method:n&&t.includes(`client_secret_basic`)?`client_secret_basic`:n&&t.includes(`client_secret_post`)?`client_secret_post`:t.includes(`none`)?`none`:n?`client_secret_post`:`none`}function Ve(e,t,n,r){let{client_id:i,client_secret:a}=t;switch(e){case`client_secret_basic`:He(i,a,n);return;case`client_secret_post`:Ue(i,a,r);return;case`none`:We(i,r);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function He(e,t,n){if(!t)throw Error(`client_secret_basic authentication requires a client_secret`);let r=btoa(`${e}:${t}`);n.set(`Authorization`,`Basic ${r}`)}function Ue(e,t,n){n.set(`client_id`,e),t&&n.set(`client_secret`,t)}function We(e,t){t.set(`client_id`,e)}async function Ge(e){let t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{let{error:e,error_description:t,error_uri:r}=ve.parse(JSON.parse(n));return new(Ie[e]||D)(t||``,r)}catch(e){return new D(`${t?`HTTP ${t}: `:``}Invalid OAuth error response: ${e}. Raw body: ${n}`)}}async function A(e,t){try{return await Ke(e,t)}catch(n){if(n instanceof C||n instanceof T)return await e.invalidateCredentials?.(`all`),await Ke(e,t);if(n instanceof w)return await e.invalidateCredentials?.(`tokens`),await Ke(e,t);throw n}}async function Ke(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:i,fetchFn:a}){let o=await e.discoveryState?.(),s,c,l,u=i;if(!u&&o?.resourceMetadataUrl&&(u=new URL(o.resourceMetadataUrl)),o?.authorizationServerUrl){if(c=o.authorizationServerUrl,s=o.resourceMetadata,l=o.authorizationServerMetadata??await rt(c,{fetchFn:a}),!s)try{s=await Xe(t,{resourceMetadataUrl:u},a)}catch{}(l!==o.authorizationServerMetadata||s!==o.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}else{let n=await it(t,{resourceMetadataUrl:u,fetchFn:a});c=n.authorizationServerUrl,l=n.authorizationServerMetadata,s=n.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}let d=await Je(t,e,s),f=await Promise.resolve(e.clientInformation());if(!f){if(n!==void 0)throw Error(`Existing OAuth client information is required when exchanging an authorization code`);let t=l?.client_id_metadata_document_supported===!0,r=e.clientMetadataUrl;if(r&&!qe(r))throw new O(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${r}`);if(t&&r)f={client_id:r},await e.saveClientInformation?.(f);else{if(!e.saveClientInformation)throw Error(`OAuth client information must be saveable for dynamic registration`);let t=await ut(c,{metadata:l,clientMetadata:e.clientMetadata,fetchFn:a});await e.saveClientInformation(t),f=t}}let p=!e.redirectUrl;if(n!==void 0||p){let t=await lt(e,c,{metadata:l,resource:d,authorizationCode:n,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}let m=await e.tokens();if(m?.refresh_token)try{let t=await ct(c,{metadata:l,clientInformation:f,refreshToken:m.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}catch(e){if(!(!(e instanceof S)||e instanceof D))throw e}let ee=e.state?await e.state():void 0,{authorizationUrl:te,codeVerifier:h}=await at(c,{metadata:l,clientInformation:f,state:ee,redirectUrl:e.redirectUrl,scope:r||s?.scopes_supported?.join(` `)||e.clientMetadata.scope,resource:d});return await e.saveCodeVerifier(h),await e.redirectToAuthorization(te),`REDIRECT`}function qe(e){if(!e)return!1;try{let t=new URL(e);return t.protocol===`https:`&&t.pathname!==`/`}catch{return!1}}async function Je(e,t,n){let r=Ce(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!we({requestedResource:r,configuredResource:n.resource}))throw Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function j(e){let t=e.headers.get(`WWW-Authenticate`);if(!t)return{};let[n,r]=t.split(` `);if(n.toLowerCase()!==`bearer`||!r)return{};let i=Ye(e,`resource_metadata`)||void 0,a;if(i)try{a=new URL(i)}catch{}let o=Ye(e,`scope`)||void 0,s=Ye(e,`error`)||void 0;return{resourceMetadataUrl:a,scope:o,error:s}}function Ye(e,t){let n=e.headers.get(`WWW-Authenticate`);if(!n)return null;let r=RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),i=n.match(r);return i?i[1]||i[2]:null}async function Xe(e,t,n=fetch){let r=await tt(e,`oauth-protected-resource`,n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.body?.cancel(),Error(`Resource server does not implement OAuth 2.0 Protected Resource Metadata.`);if(!r.ok)throw await r.body?.cancel(),Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return me.parse(await r.json())}async function Ze(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?Ze(e,void 0,n):void 0;throw r}}function Qe(e,t=``,n={}){return t.endsWith(`/`)&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function $e(e,t,n=fetch){return await Ze(e,{"MCP-Protocol-Version":t},n)}function et(e,t){return!e||e.status>=400&&e.status<500&&t!==`/`}async function tt(e,t,n,r){let i=new URL(e),a=r?.protocolVersion??`2025-11-25`,o;if(r?.metadataUrl)o=new URL(r.metadataUrl);else{let e=Qe(t,i.pathname);o=new URL(e,r?.metadataServerUrl??i),o.search=i.search}let s=await $e(o,a,n);return!r?.metadataUrl&&et(s,i.pathname)&&(s=await $e(new URL(`/.well-known/${t}`,i),a,n)),s}function nt(e){let t=typeof e==`string`?new URL(e):e,n=t.pathname!==`/`,r=[];if(!n)return r.push({url:new URL(`/.well-known/oauth-authorization-server`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration`,t.origin),type:`oidc`}),r;let i=t.pathname;return i.endsWith(`/`)&&(i=i.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:`oidc`}),r.push({url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:`oidc`}),r}async function rt(e,{fetchFn:t=fetch,protocolVersion:n=s}={}){let r={"MCP-Protocol-Version":n,Accept:`application/json`},i=nt(e);for(let{url:e,type:n}of i){let i=await Ze(e,r,t);if(i){if(!i.ok){if(await i.body?.cancel(),i.status>=400&&i.status<500)continue;throw Error(`HTTP ${i.status} trying to load ${n===`oauth`?`OAuth`:`OpenID provider`} metadata from ${e}`)}return n===`oauth`?he.parse(await i.json()):ge.parse(await i.json())}}}async function it(e,t){let n,r;try{n=await Xe(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||=String(new URL(`/`,e));let i=await rt(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:i,resourceMetadata:n}}async function at(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:i,state:a,resource:o}){let s;if(t){if(s=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Re))throw Error(`Incompatible auth server: does not support response type ${Re}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(ze))throw Error(`Incompatible auth server: does not support code challenge method ${ze}`)}else s=new URL(`/authorize`,e);let c=await pe(),l=c.code_verifier,u=c.code_challenge;return s.searchParams.set(`response_type`,Re),s.searchParams.set(`client_id`,n.client_id),s.searchParams.set(`code_challenge`,u),s.searchParams.set(`code_challenge_method`,ze),s.searchParams.set(`redirect_uri`,String(r)),a&&s.searchParams.set(`state`,a),i&&s.searchParams.set(`scope`,i),i?.includes(`offline_access`)&&s.searchParams.append(`prompt`,`consent`),o&&s.searchParams.set(`resource`,o.href),{authorizationUrl:s,codeVerifier:l}}function ot(e,t,n){return new URLSearchParams({grant_type:`authorization_code`,code:e,code_verifier:t,redirect_uri:String(n)})}async function st(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:i,resource:a,fetchFn:o}){let s=t?.token_endpoint?new URL(t.token_endpoint):new URL(`/token`,e),c=new Headers({"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`});a&&n.set(`resource`,a.href),i?await i(c,n,s,t):r&&Ve(Be(r,t?.token_endpoint_auth_methods_supported??[]),r,c,n);let l=await(o??fetch)(s,{method:`POST`,headers:c,body:n});if(!l.ok)throw await Ge(l);return _e.parse(await l.json())}async function ct(e,{metadata:t,clientInformation:n,refreshToken:r,resource:i,addClientAuthentication:a,fetchFn:o}){return{refresh_token:r,...await st(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:`refresh_token`,refresh_token:r}),clientInformation:n,addClientAuthentication:a,resource:i,fetchFn:o})}}async function lt(e,t,{metadata:n,resource:r,authorizationCode:i,fetchFn:a}={}){let o=e.clientMetadata.scope,s;if(e.prepareTokenRequest&&(s=await e.prepareTokenRequest(o)),!s){if(!i)throw Error(`Either provider.prepareTokenRequest() or authorizationCode is required`);if(!e.redirectUrl)throw Error(`redirectUrl is required for authorization_code flow`);s=ot(i,await e.codeVerifier(),e.redirectUrl)}let c=await e.clientInformation();return st(t,{metadata:n,tokenRequestParams:s,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:a})}async function ut(e,{metadata:t,clientMetadata:n,fetchFn:r}){let i;if(t){if(!t.registration_endpoint)throw Error(`Incompatible auth server: does not support dynamic client registration`);i=new URL(t.registration_endpoint)}else i=new URL(`/register`,e);let a=await(r??fetch)(i,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!a.ok)throw await Ge(a);return Se.parse(await a.json())}var dt=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function ft(e){}function pt(e){if(typeof e==`function`)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=ft,onError:n=ft,onRetry:r=ft,onComment:i}=e,a=``,o=!0,s,c=``,l=``;function u(e){let t=o?e.replace(/^\xEF\xBB\xBF/,``):e,[n,r]=mt(`${a}${t}`);for(let e of n)d(e);a=r,o=!1}function d(e){if(e===``){p();return}if(e.startsWith(`:`)){i&&i(e.slice(e.startsWith(`: `)?2:1));return}let t=e.indexOf(`:`);if(t!==-1){let n=e.slice(0,t),r=e[t+1]===` `?2:1;f(n,e.slice(t+r),e);return}f(e,``,e)}function f(e,t,i){switch(e){case`event`:l=t;break;case`data`:c=`${c}${t}
2
2
  `;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new dt(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new dt(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function p(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(`
3
3
  `)?c.slice(0,-1):c}),s=void 0,c=``,l=``}function m(e={}){a&&e.consume&&d(a),o=!0,s=void 0,c=``,l=``,a=``}return{feed:u,reset:m}}function mt(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e.indexOf(`\r`,r),a=e.indexOf(`
4
4
  `,r),o=-1;if(i!==-1&&a!==-1?o=Math.min(i,a):i===-1?a!==-1&&(o=a):o=i===e.length-1?-1:i,o===-1){n=e.slice(r);break}else{let n=e.slice(r,o);t.push(n),r=o+1,e[r-1]===`\r`&&e[r]===`
@@ -0,0 +1 @@
1
+ import{t as e}from"./chunk-3GQAWCBQ-ntjTDD_C.js";import{t}from"./chunk-QWQYAQCK-BR4V0xsV.js";var n=t.get(`RpcLogger`),r=new class{static{e(this,`RpcLogStore`)}logs=[];listeners=new Set;maxLogs=1e3;publish(e){n.debug(`[RPC Logger] Publishing log:`,e.direction,e.serverId,e.message?.method),this.logs.push(e),this.logs.length>this.maxLogs&&(this.logs=this.logs.slice(-this.maxLogs)),n.debug(`[RPC Logger] Total logs:`,this.logs.length,`Listeners:`,this.listeners.size),this.listeners.forEach(t=>{try{t(e)}catch(e){n.error(`[RPC Logger] Listener error:`,e)}})}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getLogsForServer(e){return this.logs.filter(t=>t.serverId===e)}getAllLogs(){return[...this.logs]}clear(e){e?this.logs=this.logs.filter(t=>t.serverId!==e):this.logs=[]}};function i(e){return r.getLogsForServer(e)}e(i,`getRpcLogs`);function a(){return r.getAllLogs()}e(a,`getAllRpcLogs`);function o(e){return r.subscribe(e)}e(o,`subscribeToRpcLogs`);function s(e){r.clear(e)}e(s,`clearRpcLogs`);function c(t,n){class i{constructor(e){this.inner=e,this.inner.onmessage=(e,t)=>{r.publish({serverId:n,direction:`receive`,timestamp:new Date().toISOString(),message:e}),this.onmessage?.(e,t)},this.inner.onclose=()=>{this.onclose?.()},this.inner.onerror=e=>{this.onerror?.(e)}}static{e(this,`LoggingTransport`)}onclose;onerror;onmessage;async start(){typeof this.inner.start==`function`&&await this.inner.start()}async send(e,t){r.publish({serverId:n,direction:`send`,timestamp:new Date().toISOString(),message:e}),await this.inner.send(e,t)}async close(){await this.inner.close()}get sessionId(){return this.inner.sessionId}setProtocolVersion(e){typeof this.inner.setProtocolVersion==`function`&&this.inner.setProtocolVersion(e)}}return new i(t)}e(c,`wrapTransportForLogging`);export{c as a,o as i,a as n,i as r,s as t};
@@ -1 +1 @@
1
- import{t as e}from"./chunk-3GQAWCBQ-C-9Cm0Np.js";var t=`mcp-use`;function n(e){switch((typeof process<`u`?e:void 0)?.trim()){case`2`:return`debug`;case`1`:return`info`;default:return`info`}}e(n,`resolveLevel`);function r(e){return e.length===0?``:e.map(e=>{if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}).join(` `)}e(r,`formatArgs`);var i=class{static{e(this,`SimpleConsoleLogger`)}_level;name;format;constructor(e=t,n=`info`,r=`minimal`){this.name=e,this._level=n,this.format=r}shouldLog(e){if(this._level===`silent`)return!1;let t=[`silent`,`error`,`warn`,`info`,`http`,`verbose`,`debug`,`silly`],n=t.indexOf(this._level);return t.indexOf(e)<=n}formatMessage(e,t,n){let i=new Date().toLocaleTimeString(`en-US`,{hour12:!1}),a=r(n),o=a?`${t} ${a}`:t;switch(this.format){case`detailed`:return`${i} [${this.name}] ${e.toUpperCase()}: ${o}`;case`emoji`:return`${i} [${this.name}] ${{silent:``,error:`❌`,warn:`⚠️`,info:`ℹ️`,http:`🌐`,verbose:`📝`,debug:`🔍`,silly:`🤪`}[e]||``} ${e.toUpperCase()}: ${o}`;default:return`${i} [${this.name}] ${e}: ${o}`}}error(e,...t){this.shouldLog(`error`)&&console.error(this.formatMessage(`error`,e,t))}warn(e,...t){this.shouldLog(`warn`)&&console.warn(this.formatMessage(`warn`,e,t))}info(e,...t){this.shouldLog(`info`)&&console.info(this.formatMessage(`info`,e,t))}debug(e,...t){this.shouldLog(`debug`)&&console.debug(this.formatMessage(`debug`,e,t))}http(e,...t){this.shouldLog(`http`)&&console.log(this.formatMessage(`http`,e,t))}verbose(e,...t){this.shouldLog(`verbose`)&&console.log(this.formatMessage(`verbose`,e,t))}silly(e,...t){this.shouldLog(`silly`)&&console.log(this.formatMessage(`silly`,e,t))}get level(){return this._level}set level(e){this._level=e}setFormat(e){this.format=e}},a=class{static{e(this,`Logger`)}static instances={};static currentFormat=`minimal`;static get(e=t){if(!this.instances[e]){let t=typeof process<`u`&&{}?.DEBUG||void 0;this.instances[e]=new i(e,n(t),this.currentFormat)}return this.instances[e]}static configure(e={}){let{level:t,format:r=`minimal`}=e,i=typeof process<`u`&&{}?.DEBUG||void 0,a=t??n(i);this.currentFormat=r,Object.values(this.instances).forEach(e=>{e.level=a,e.setFormat(r)})}static setDebug(e){let t;t=e===2||e===!0?`debug`:`info`,Object.values(this.instances).forEach(e=>{e.level=t}),typeof process<`u`&&({}.DEBUG=e?e===!0?`2`:String(e):`0`)}static setFormat(e){this.currentFormat=e,this.configure({format:e})}},o=a.get();export{o as n,a as t};
1
+ import{t as e}from"./chunk-3GQAWCBQ-ntjTDD_C.js";var t=`mcp-use`;function n(e){switch((typeof process<`u`?e:void 0)?.trim()){case`2`:return`debug`;case`1`:return`info`;default:return`info`}}e(n,`resolveLevel`);function r(e){return e.length===0?``:e.map(e=>{if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}).join(` `)}e(r,`formatArgs`);var i=class{static{e(this,`SimpleConsoleLogger`)}_level;name;format;constructor(e=t,n=`info`,r=`minimal`){this.name=e,this._level=n,this.format=r}shouldLog(e){if(this._level===`silent`)return!1;let t=[`silent`,`error`,`warn`,`info`,`http`,`verbose`,`debug`,`silly`],n=t.indexOf(this._level);return t.indexOf(e)<=n}formatMessage(e,t,n){let i=new Date().toLocaleTimeString(`en-US`,{hour12:!1}),a=r(n),o=a?`${t} ${a}`:t;switch(this.format){case`detailed`:return`${i} [${this.name}] ${e.toUpperCase()}: ${o}`;case`emoji`:return`${i} [${this.name}] ${{silent:``,error:`❌`,warn:`⚠️`,info:`ℹ️`,http:`🌐`,verbose:`📝`,debug:`🔍`,silly:`🤪`}[e]||``} ${e.toUpperCase()}: ${o}`;default:return`${i} [${this.name}] ${e}: ${o}`}}error(e,...t){this.shouldLog(`error`)&&console.error(this.formatMessage(`error`,e,t))}warn(e,...t){this.shouldLog(`warn`)&&console.warn(this.formatMessage(`warn`,e,t))}info(e,...t){this.shouldLog(`info`)&&console.info(this.formatMessage(`info`,e,t))}debug(e,...t){this.shouldLog(`debug`)&&console.debug(this.formatMessage(`debug`,e,t))}http(e,...t){this.shouldLog(`http`)&&console.log(this.formatMessage(`http`,e,t))}verbose(e,...t){this.shouldLog(`verbose`)&&console.log(this.formatMessage(`verbose`,e,t))}silly(e,...t){this.shouldLog(`silly`)&&console.log(this.formatMessage(`silly`,e,t))}get level(){return this._level}set level(e){this._level=e}setFormat(e){this.format=e}},a=class{static{e(this,`Logger`)}static instances={};static currentFormat=`minimal`;static get(e=t){if(!this.instances[e]){let t=typeof process<`u`&&{}?.DEBUG||void 0;this.instances[e]=new i(e,n(t),this.currentFormat)}return this.instances[e]}static configure(e={}){let{level:t,format:r=`minimal`}=e,i=typeof process<`u`&&{}?.DEBUG||void 0,a=t??n(i);this.currentFormat=r,Object.values(this.instances).forEach(e=>{e.level=a,e.setFormat(r)})}static setDebug(e){let t;t=e===2||e===!0?`debug`:`info`,Object.values(this.instances).forEach(e=>{e.level=t}),typeof process<`u`&&({}.DEBUG=e?e===!0?`2`:String(e):`0`)}static setFormat(e){this.currentFormat=e,this.configure({format:e})}},o=a.get();export{o as n,a as t};
@@ -1 +1 @@
1
- import{t as e}from"./chunk-3GQAWCBQ-C-9Cm0Np.js";import{_ as t,a as n,b as r,i,m as a,o,p as s,s as c,v as l}from"./schemas-79owEkeD.js";import{f as u}from"./chunk-KJ5RBDDO-DJkMH4KI.js";var d=class{static{e(this,`JSONSchemaToZod`)}static convert(e){return this.parseSchema(e)}static matchesCondition(e,t){if(!t.properties)return!0;if(typeof e!=`object`||!e||Array.isArray(e))return!1;let n=e;for(let[e,r]of Object.entries(t.properties)){if(!(e in n)){if(`const`in r)return!1;continue}let t=n[e];if(`const`in r&&t!==r.const||`minimum`in r&&typeof t==`number`&&t<r.minimum||`maximum`in r&&typeof t==`number`&&t>r.maximum)return!1}return!0}static validateConditionalSchema(e,t,n){this.validateRequiredProperties(e,t,n),this.validatePropertyPatterns(e,t,n),this.validateNestedConditions(e,t,n)}static validateRequiredProperties(e,t,n){if(t.required){if(typeof e!=`object`||!e){for(let e of t.required)n.addIssue({code:u.custom,message:`Required property '${e}' is missing`,path:[e]});return}for(let r of t.required)r in e||n.addIssue({code:u.custom,message:`Required property '${r}' is missing`,path:[r]})}}static validatePropertyPatterns(e,t,n){if(!t.properties||typeof e!=`object`||!e||Array.isArray(e))return;let r=e;for(let[e,i]of Object.entries(t.properties)){if(!(e in r))continue;let t=r[e];i.pattern&&typeof t==`string`&&(new RegExp(i.pattern).test(t)||n.addIssue({code:u.custom,message:`String '${t}' does not match pattern '${i.pattern}'`,path:[e]}))}}static validateNestedConditions(e,t,n){!t.if||!t.then||(this.matchesCondition(e,t.if)?this.validateConditionalSchema(e,t.then,n):t.else&&this.validateConditionalSchema(e,t.else,n))}static parseSchema(e){let t;return t=Array.isArray(e.type)?this.handleTypeArray(e):e.oneOf||e.anyOf||e.allOf?this.parseCombinator(e):e.if&&e.then||e.properties&&(!e.type||e.type===`object`)?this.parseObject(e):this.handleSingleType(e),e.description&&typeof t.describe==`function`&&(t=t.describe(e.description)),t}static handleTypeArray(e){if(!Array.isArray(e.type))throw Error(`Expected schema.type to be an array`);return e.type.includes(`null`)?this.handleNullableType(e):this.createUnionFromTypes(e.type,e)}static handleNullableType(e){if(!Array.isArray(e.type))throw Error(`Expected schema.type to be an array`);let t={...e};return t.type=e.type.filter(e=>e!==`null`),t.type.length===1?this.handleSingleType({...e,type:t.type[0]}).nullable():this.parseSchema(t).nullable()}static createUnionFromTypes(e,t){return r(e.map(e=>{let n={...t,type:e};return this.parseSchema(n)}))}static handleSingleType(e){if(e.type===void 0)return e.oneOf||e.anyOf||e.allOf?this.parseCombinator(e):e.properties?this.parseObject(e):n();switch(e.type){case`string`:return this.parseString(e);case`number`:case`integer`:return this.parseNumberSchema(e);case`boolean`:return c();case`array`:return this.parseArray(e);case`object`:return this.parseObject(e);default:throw Error(`Unsupported schema type`)}}static parseNumberSchema(e){let t=s(),n=t;return n=this.applyNumberBounds(t,e),n=this.applyNumberMultipleOf(t,e),n=this.applyNumberEnum(t,e),n=this.applyIntegerConstraint(t,e),n}static applyNumberBounds(e,t){let n=e;return t.minimum!==void 0&&(n=t.exclusiveMinimum?n.gt(t.minimum):n.gte(t.minimum)),t.maximum!==void 0&&(n=t.exclusiveMaximum?n.lt(t.maximum):n.lte(t.maximum)),n}static applyNumberMultipleOf(e,t){return t.multipleOf===void 0?e:e.refine(e=>e%t.multipleOf===0,{message:`Number must be a multiple of ${t.multipleOf}`})}static applyNumberEnum(e,t){if(!t.enum)return e;let n=t.enum.filter(e=>typeof e==`number`);return n.length===0?e:e.refine(e=>n.includes(e),{message:`Number must be one of: ${n.join(`, `)}`})}static applyIntegerConstraint(e,t){return t.type===`integer`?e.refine(e=>Number.isInteger(e),{message:`Number must be an integer`}):e}static parseString(e){let t=l(),n=t;return e.format?this.applyStringFormat(t,e):(n=this.applyStringPattern(t,e),n=this.applyStringLength(t,e),n=this.applyStringEnum(t,e),n)}static applyStringFormat(e,t){if(!t.format)return e;switch(t.format){case`email`:return e.email();case`date-time`:return e.datetime();case`uri`:return e.url();case`uuid`:return e.uuid();case`date`:return e.date();default:return e}}static applyStringPattern(e,t){if(!t.pattern)return e;let n=new RegExp(t.pattern);return e.regex(n,{message:`String must match pattern: ${t.pattern}`})}static applyStringLength(e,t){let n=e;return t.minLength!==void 0&&(e=e.min(t.minLength)),t.maxLength!==void 0&&(e=e.max(t.maxLength)),n}static applyStringEnum(e,t){return t.enum?e.refine(e=>t.enum?.includes(e),{message:`Value must be one of: ${t.enum?.join(`, `)}`}):e}static parseArray(e){if(Array.isArray(e.items))return r(e.items.map(e=>this.parseSchema(e)));let t=o(e.items?this.parseSchema(e.items):n()),i=t;return i=this.applyArrayConstraints(t,e),i}static applyArrayConstraints(e,t){return t.minItems!==void 0&&(e=e.min(t.minItems)),t.maxItems!==void 0&&(e=e.max(t.maxItems)),t.uniqueItems?e.refine(e=>new Set(e).size===e.length,{message:`Array items must be unique`}):e}static parseObject(e){if(e.if&&e.then)return this.parseConditional(e);if(!e.properties&&e.additionalProperties&&typeof e.additionalProperties==`object`){let n=this.parseSchema(e.additionalProperties);return t(l(),n)}let n={};return this.processObjectProperties(e,n),this.processAdditionalProperties(e,a(n))}static processObjectProperties(e,t){let n=new Set(e.required||[]);if(e.properties)for(let[r,i]of Object.entries(e.properties)){let e=this.parseSchema(i);t[r]=n.has(r)?e:e.optional()}}static processAdditionalProperties(e,t){if(e.additionalProperties===!0)return t.passthrough();if(e.additionalProperties&&typeof e.additionalProperties==`object`){let n=this.parseSchema(e.additionalProperties);return t.catchall(n)}else return t.strict()}static parseConditional(e){let t=this.createBaseObjectSchema(e),n=e.if,r=e.then,i=e.else;return t.superRefine((t,a)=>{let o=this.applyDefaultValues(t,e);this.matchesCondition(o,n)?this.validateConditionalSchema(o,r,a):i&&this.validateConditionalSchema(o,i,a)})}static createBaseObjectSchema(e){let t={},n=new Set(e.required||[]);for(let[r,i]of Object.entries(e.properties||{})){let e=this.parseSchema(i);t[r]=n.has(r)?e:e.optional()}let r=a(t);return this.processAdditionalProperties(e,r)}static applyDefaultValues(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return e;let n={...e};if(!t.properties)return n;for(let[e,r]of Object.entries(t.properties))!(e in n)&&`default`in r&&(n[e]=r.default);return n}static parseCombinator(e){if(e.oneOf)return this.parseOneOf(e.oneOf);if(e.anyOf)return this.parseAnyOf(e.anyOf);if(e.allOf)return this.parseAllOf(e.allOf);throw Error(`Unsupported schema type`)}static parseOneOf(e){return this.createUnionFromSchemas(e)}static parseAnyOf(e){return this.createUnionFromSchemas(e)}static createUnionFromSchemas(e){if(e.length===0)return n();if(e.length===1)return this.parseSchema(e[0]);let t=[];for(let n of e)n.type===`null`?t.push(i()):t.push(this.parseSchema(n));return t.length>=2?r(t):t.length===1?t[0]:n()}static parseAllOf(e){if(e.length===0)return n();if(e.length===1)return this.parseSchema(e[0]);let t=e.reduce((e,t)=>this.mergeSchemas(e,t));return this.parseSchema(t)}static mergeSchemas(e,t){let n={...e,...t};return e.properties&&t.properties&&(n.properties={...e.properties,...t.properties}),e.required&&t.required&&(n.required=[...new Set([...e.required,...t.required])]),n}};export{d as t};
1
+ import{t as e}from"./chunk-3GQAWCBQ-ntjTDD_C.js";import{_ as t,a as n,b as r,i,m as a,o,p as s,s as c,v as l}from"./schemas-BrqAD_Qo.js";import{f as u}from"./chunk-ECXMLUNG-CSRGaMIB.js";var d=class{static{e(this,`JSONSchemaToZod`)}static convert(e){return this.parseSchema(e)}static matchesCondition(e,t){if(!t.properties)return!0;if(typeof e!=`object`||!e||Array.isArray(e))return!1;let n=e;for(let[e,r]of Object.entries(t.properties)){if(!(e in n)){if(`const`in r)return!1;continue}let t=n[e];if(`const`in r&&t!==r.const||`minimum`in r&&typeof t==`number`&&t<r.minimum||`maximum`in r&&typeof t==`number`&&t>r.maximum)return!1}return!0}static validateConditionalSchema(e,t,n){this.validateRequiredProperties(e,t,n),this.validatePropertyPatterns(e,t,n),this.validateNestedConditions(e,t,n)}static validateRequiredProperties(e,t,n){if(t.required){if(typeof e!=`object`||!e){for(let e of t.required)n.addIssue({code:u.custom,message:`Required property '${e}' is missing`,path:[e]});return}for(let r of t.required)r in e||n.addIssue({code:u.custom,message:`Required property '${r}' is missing`,path:[r]})}}static validatePropertyPatterns(e,t,n){if(!t.properties||typeof e!=`object`||!e||Array.isArray(e))return;let r=e;for(let[e,i]of Object.entries(t.properties)){if(!(e in r))continue;let t=r[e];i.pattern&&typeof t==`string`&&(new RegExp(i.pattern).test(t)||n.addIssue({code:u.custom,message:`String '${t}' does not match pattern '${i.pattern}'`,path:[e]}))}}static validateNestedConditions(e,t,n){!t.if||!t.then||(this.matchesCondition(e,t.if)?this.validateConditionalSchema(e,t.then,n):t.else&&this.validateConditionalSchema(e,t.else,n))}static parseSchema(e){let t;return t=Array.isArray(e.type)?this.handleTypeArray(e):e.oneOf||e.anyOf||e.allOf?this.parseCombinator(e):e.if&&e.then||e.properties&&(!e.type||e.type===`object`)?this.parseObject(e):this.handleSingleType(e),e.description&&typeof t.describe==`function`&&(t=t.describe(e.description)),t}static handleTypeArray(e){if(!Array.isArray(e.type))throw Error(`Expected schema.type to be an array`);return e.type.includes(`null`)?this.handleNullableType(e):this.createUnionFromTypes(e.type,e)}static handleNullableType(e){if(!Array.isArray(e.type))throw Error(`Expected schema.type to be an array`);let t={...e};return t.type=e.type.filter(e=>e!==`null`),t.type.length===1?this.handleSingleType({...e,type:t.type[0]}).nullable():this.parseSchema(t).nullable()}static createUnionFromTypes(e,t){return r(e.map(e=>{let n={...t,type:e};return this.parseSchema(n)}))}static handleSingleType(e){if(e.type===void 0)return e.oneOf||e.anyOf||e.allOf?this.parseCombinator(e):e.properties?this.parseObject(e):n();switch(e.type){case`string`:return this.parseString(e);case`number`:case`integer`:return this.parseNumberSchema(e);case`boolean`:return c();case`array`:return this.parseArray(e);case`object`:return this.parseObject(e);default:throw Error(`Unsupported schema type`)}}static parseNumberSchema(e){let t=s(),n=t;return n=this.applyNumberBounds(t,e),n=this.applyNumberMultipleOf(t,e),n=this.applyNumberEnum(t,e),n=this.applyIntegerConstraint(t,e),n}static applyNumberBounds(e,t){let n=e;return t.minimum!==void 0&&(n=t.exclusiveMinimum?n.gt(t.minimum):n.gte(t.minimum)),t.maximum!==void 0&&(n=t.exclusiveMaximum?n.lt(t.maximum):n.lte(t.maximum)),n}static applyNumberMultipleOf(e,t){return t.multipleOf===void 0?e:e.refine(e=>e%t.multipleOf===0,{message:`Number must be a multiple of ${t.multipleOf}`})}static applyNumberEnum(e,t){if(!t.enum)return e;let n=t.enum.filter(e=>typeof e==`number`);return n.length===0?e:e.refine(e=>n.includes(e),{message:`Number must be one of: ${n.join(`, `)}`})}static applyIntegerConstraint(e,t){return t.type===`integer`?e.refine(e=>Number.isInteger(e),{message:`Number must be an integer`}):e}static parseString(e){let t=l(),n=t;return e.format?this.applyStringFormat(t,e):(n=this.applyStringPattern(t,e),n=this.applyStringLength(t,e),n=this.applyStringEnum(t,e),n)}static applyStringFormat(e,t){if(!t.format)return e;switch(t.format){case`email`:return e.email();case`date-time`:return e.datetime();case`uri`:return e.url();case`uuid`:return e.uuid();case`date`:return e.date();default:return e}}static applyStringPattern(e,t){if(!t.pattern)return e;let n=new RegExp(t.pattern);return e.regex(n,{message:`String must match pattern: ${t.pattern}`})}static applyStringLength(e,t){let n=e;return t.minLength!==void 0&&(e=e.min(t.minLength)),t.maxLength!==void 0&&(e=e.max(t.maxLength)),n}static applyStringEnum(e,t){return t.enum?e.refine(e=>t.enum?.includes(e),{message:`Value must be one of: ${t.enum?.join(`, `)}`}):e}static parseArray(e){if(Array.isArray(e.items))return r(e.items.map(e=>this.parseSchema(e)));let t=o(e.items?this.parseSchema(e.items):n()),i=t;return i=this.applyArrayConstraints(t,e),i}static applyArrayConstraints(e,t){return t.minItems!==void 0&&(e=e.min(t.minItems)),t.maxItems!==void 0&&(e=e.max(t.maxItems)),t.uniqueItems?e.refine(e=>new Set(e).size===e.length,{message:`Array items must be unique`}):e}static parseObject(e){if(e.if&&e.then)return this.parseConditional(e);if(!e.properties&&e.additionalProperties&&typeof e.additionalProperties==`object`){let n=this.parseSchema(e.additionalProperties);return t(l(),n)}let n={};return this.processObjectProperties(e,n),this.processAdditionalProperties(e,a(n))}static processObjectProperties(e,t){let n=new Set(e.required||[]);if(e.properties)for(let[r,i]of Object.entries(e.properties)){let e=this.parseSchema(i);t[r]=n.has(r)?e:e.optional()}}static processAdditionalProperties(e,t){if(e.additionalProperties===!0)return t.passthrough();if(e.additionalProperties&&typeof e.additionalProperties==`object`){let n=this.parseSchema(e.additionalProperties);return t.catchall(n)}else return t.strict()}static parseConditional(e){let t=this.createBaseObjectSchema(e),n=e.if,r=e.then,i=e.else;return t.superRefine((t,a)=>{let o=this.applyDefaultValues(t,e);this.matchesCondition(o,n)?this.validateConditionalSchema(o,r,a):i&&this.validateConditionalSchema(o,i,a)})}static createBaseObjectSchema(e){let t={},n=new Set(e.required||[]);for(let[r,i]of Object.entries(e.properties||{})){let e=this.parseSchema(i);t[r]=n.has(r)?e:e.optional()}let r=a(t);return this.processAdditionalProperties(e,r)}static applyDefaultValues(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return e;let n={...e};if(!t.properties)return n;for(let[e,r]of Object.entries(t.properties))!(e in n)&&`default`in r&&(n[e]=r.default);return n}static parseCombinator(e){if(e.oneOf)return this.parseOneOf(e.oneOf);if(e.anyOf)return this.parseAnyOf(e.anyOf);if(e.allOf)return this.parseAllOf(e.allOf);throw Error(`Unsupported schema type`)}static parseOneOf(e){return this.createUnionFromSchemas(e)}static parseAnyOf(e){return this.createUnionFromSchemas(e)}static createUnionFromSchemas(e){if(e.length===0)return n();if(e.length===1)return this.parseSchema(e[0]);let t=[];for(let n of e)n.type===`null`?t.push(i()):t.push(this.parseSchema(n));return t.length>=2?r(t):t.length===1?t[0]:n()}static parseAllOf(e){if(e.length===0)return n();if(e.length===1)return this.parseSchema(e[0]);let t=e.reduce((e,t)=>this.mergeSchemas(e,t));return this.parseSchema(t)}static mergeSchemas(e,t){let n={...e,...t};return e.properties&&t.properties&&(n.properties={...e.properties,...t.properties}),e.required&&t.required&&(n.required=[...new Set([...e.required,...t.required])]),n}};export{d as t};
@@ -1 +1 @@
1
- import{t as e}from"./chunk-3GQAWCBQ-C-9Cm0Np.js";import{n as t}from"./chunk-QWQYAQCK-CyFuZlX8.js";import{t as n}from"./preload-helper-XLr9-hSf.js";function r(e){if(typeof process<`u`)return{}[e]}e(r,`getEnvVar`);var i=r(`MCP_USE_LANGFUSE`)?.toLowerCase()===`false`,a={handler:null,client:null,initPromise:null};async function o(i,o,s,c){try{let l=await n(()=>import(`langfuse-langchain`),[]).catch(()=>null);if(!l){t.debug(`Langfuse package not installed - tracing disabled. Install with: npm install @langfuse/langchain`);return}let{CallbackHandler:u}=l;class d extends u{static{e(this,`LoggingCallbackHandler`)}agentId;metadata;metadataProvider;tagsProvider;verbose;constructor(e,t,n,r,i){super(e),this.agentId=t,this.metadata=n,this.metadataProvider=r,this.tagsProvider=i,this.verbose=e?.verbose??!1}async handleChainStart(e,n,r,i,a,o,s,c){t.debug(`Langfuse: Chain start intercepted`);let l=this.getCustomTags(),u=this.getMetadata(),d=[...a||[],...l],f={...o||{},...u};return this.verbose&&(t.debug(`Langfuse: Chain start with custom tags: ${JSON.stringify(d)}`),t.debug(`Langfuse: Chain start with metadata: ${JSON.stringify(f)}`)),super.handleChainStart(e,n,r,i,d,f,s,c)}getCustomTags(){let e=[],t=this.getEnvironmentTag();if(t&&e.push(`env:${t}`),this.agentId&&e.push(`agent_id:${this.agentId}`),this.tagsProvider){let t=this.tagsProvider();t&&t.length>0&&e.push(...t)}return e}getMetadata(){let e={},t=this.getEnvironmentTag();if(t&&(e.env=t),this.agentId&&(e.agent_id=this.agentId),this.metadata&&Object.assign(e,this.metadata),this.metadataProvider){let t=this.metadataProvider();t&&Object.assign(e,t)}return e}getEnvironmentTag(){let e=r(`MCP_USE_AGENT_ENV`);if(!e)return`unknown`;let t=e.toLowerCase();return t===`local`||t===`development`?`local`:t===`production`||t===`prod`?`production`:t===`staging`||t===`stage`?`staging`:t===`hosted`||t===`cloud`?`hosted`:t.replace(/[^a-z0-9_-]/g,`_`)}async handleLLMStart(...e){return t.debug(`Langfuse: LLM start intercepted`),this.verbose&&t.debug(`Langfuse: LLM start args: ${JSON.stringify(e)}`),super.handleLLMStart(...e)}async handleToolStart(...e){return t.debug(`Langfuse: Tool start intercepted`),this.verbose&&t.debug(`Langfuse: Tool start args: ${JSON.stringify(e)}`),super.handleToolStart(...e)}async handleRetrieverStart(...e){return t.debug(`Langfuse: Retriever start intercepted`),this.verbose&&t.debug(`Langfuse: Retriever start args: ${JSON.stringify(e)}`),super.handleRetrieverStart(...e)}async handleAgentAction(...e){return t.debug(`Langfuse: Agent action intercepted`),this.verbose&&t.debug(`Langfuse: Agent action args: ${JSON.stringify(e)}`),super.handleAgentAction(...e)}async handleAgentEnd(...e){return t.debug(`Langfuse: Agent end intercepted`),this.verbose&&t.debug(`Langfuse: Agent end args: ${JSON.stringify(e)}`),super.handleAgentEnd(...e)}}let f=o||(s?s():{}),p=c?c():[],m={publicKey:r(`LANGFUSE_PUBLIC_KEY`),secretKey:r(`LANGFUSE_SECRET_KEY`),baseUrl:r(`LANGFUSE_HOST`)||r(`LANGFUSE_BASEURL`)||`https://cloud.langfuse.com`,flushAt:Number.parseInt(r(`LANGFUSE_FLUSH_AT`)||`15`),flushInterval:Number.parseInt(r(`LANGFUSE_FLUSH_INTERVAL`)||`10000`),release:r(`LANGFUSE_RELEASE`),requestTimeout:Number.parseInt(r(`LANGFUSE_REQUEST_TIMEOUT`)||`10000`),enabled:r(`LANGFUSE_ENABLED`)!==`false`,traceName:f.trace_name||r(`LANGFUSE_TRACE_NAME`)||`mcp-use-agent`,sessionId:f.session_id||void 0,userId:f.user_id||void 0,tags:p.length>0?p:void 0,metadata:f||void 0};t.debug(`Langfuse handler config:`,JSON.stringify({traceName:m.traceName,sessionId:m.sessionId,userId:m.userId,tags:m.tags},null,2)),a.handler=new d(m,i,o,s,c),t.debug(`Langfuse observability initialized successfully with logging enabled`);try{let e=await n(()=>import(`langfuse`),[]).catch(()=>null);if(e){let{Langfuse:n}=e;a.client=new n({publicKey:r(`LANGFUSE_PUBLIC_KEY`),secretKey:r(`LANGFUSE_SECRET_KEY`),baseUrl:r(`LANGFUSE_HOST`)||`https://cloud.langfuse.com`}),t.debug(`Langfuse client initialized`)}}catch(e){t.debug(`Langfuse client initialization failed: ${e}`)}}catch(e){t.debug(`Langfuse initialization error: ${e}`)}}e(o,`initializeLangfuse`),i?t.debug(`Langfuse tracing disabled via MCP_USE_LANGFUSE environment variable`):!r(`LANGFUSE_PUBLIC_KEY`)||!r(`LANGFUSE_SECRET_KEY`)?t.debug(`Langfuse API keys not found - tracing disabled. Set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY to enable`):a.initPromise=o();var s=e(()=>a.handler,`langfuseHandler`),c=e(()=>a.initPromise,`langfuseInitPromise`);export{s as n,c as r,o as t};
1
+ import{t as e}from"./chunk-3GQAWCBQ-ntjTDD_C.js";import{n as t}from"./chunk-QWQYAQCK-BR4V0xsV.js";import{t as n}from"./preload-helper-ckxxtgMM.js";function r(e){if(typeof process<`u`)return{}[e]}e(r,`getEnvVar`);var i=r(`MCP_USE_LANGFUSE`)?.toLowerCase()===`false`,a={handler:null,client:null,initPromise:null};async function o(i,o,s,c){try{let l=await n(()=>import(`langfuse-langchain`),[]).catch(()=>null);if(!l){t.debug(`Langfuse package not installed - tracing disabled. Install with: npm install @langfuse/langchain`);return}let{CallbackHandler:u}=l;class d extends u{static{e(this,`LoggingCallbackHandler`)}agentId;metadata;metadataProvider;tagsProvider;verbose;constructor(e,t,n,r,i){super(e),this.agentId=t,this.metadata=n,this.metadataProvider=r,this.tagsProvider=i,this.verbose=e?.verbose??!1}async handleChainStart(e,n,r,i,a,o,s,c){t.debug(`Langfuse: Chain start intercepted`);let l=this.getCustomTags(),u=this.getMetadata(),d=[...a||[],...l],f={...o||{},...u};return this.verbose&&(t.debug(`Langfuse: Chain start with custom tags: ${JSON.stringify(d)}`),t.debug(`Langfuse: Chain start with metadata: ${JSON.stringify(f)}`)),super.handleChainStart(e,n,r,i,d,f,s,c)}getCustomTags(){let e=[],t=this.getEnvironmentTag();if(t&&e.push(`env:${t}`),this.agentId&&e.push(`agent_id:${this.agentId}`),this.tagsProvider){let t=this.tagsProvider();t&&t.length>0&&e.push(...t)}return e}getMetadata(){let e={},t=this.getEnvironmentTag();if(t&&(e.env=t),this.agentId&&(e.agent_id=this.agentId),this.metadata&&Object.assign(e,this.metadata),this.metadataProvider){let t=this.metadataProvider();t&&Object.assign(e,t)}return e}getEnvironmentTag(){let e=r(`MCP_USE_AGENT_ENV`);if(!e)return`unknown`;let t=e.toLowerCase();return t===`local`||t===`development`?`local`:t===`production`||t===`prod`?`production`:t===`staging`||t===`stage`?`staging`:t===`hosted`||t===`cloud`?`hosted`:t.replace(/[^a-z0-9_-]/g,`_`)}async handleLLMStart(...e){return t.debug(`Langfuse: LLM start intercepted`),this.verbose&&t.debug(`Langfuse: LLM start args: ${JSON.stringify(e)}`),super.handleLLMStart(...e)}async handleToolStart(...e){return t.debug(`Langfuse: Tool start intercepted`),this.verbose&&t.debug(`Langfuse: Tool start args: ${JSON.stringify(e)}`),super.handleToolStart(...e)}async handleRetrieverStart(...e){return t.debug(`Langfuse: Retriever start intercepted`),this.verbose&&t.debug(`Langfuse: Retriever start args: ${JSON.stringify(e)}`),super.handleRetrieverStart(...e)}async handleAgentAction(...e){return t.debug(`Langfuse: Agent action intercepted`),this.verbose&&t.debug(`Langfuse: Agent action args: ${JSON.stringify(e)}`),super.handleAgentAction(...e)}async handleAgentEnd(...e){return t.debug(`Langfuse: Agent end intercepted`),this.verbose&&t.debug(`Langfuse: Agent end args: ${JSON.stringify(e)}`),super.handleAgentEnd(...e)}}let f=o||(s?s():{}),p=c?c():[],m={publicKey:r(`LANGFUSE_PUBLIC_KEY`),secretKey:r(`LANGFUSE_SECRET_KEY`),baseUrl:r(`LANGFUSE_HOST`)||r(`LANGFUSE_BASEURL`)||`https://cloud.langfuse.com`,flushAt:Number.parseInt(r(`LANGFUSE_FLUSH_AT`)||`15`),flushInterval:Number.parseInt(r(`LANGFUSE_FLUSH_INTERVAL`)||`10000`),release:r(`LANGFUSE_RELEASE`),requestTimeout:Number.parseInt(r(`LANGFUSE_REQUEST_TIMEOUT`)||`10000`),enabled:r(`LANGFUSE_ENABLED`)!==`false`,traceName:f.trace_name||r(`LANGFUSE_TRACE_NAME`)||`mcp-use-agent`,sessionId:f.session_id||void 0,userId:f.user_id||void 0,tags:p.length>0?p:void 0,metadata:f||void 0};t.debug(`Langfuse handler config:`,JSON.stringify({traceName:m.traceName,sessionId:m.sessionId,userId:m.userId,tags:m.tags},null,2)),a.handler=new d(m,i,o,s,c),t.debug(`Langfuse observability initialized successfully with logging enabled`);try{let e=await n(()=>import(`langfuse`),[]).catch(()=>null);if(e){let{Langfuse:n}=e;a.client=new n({publicKey:r(`LANGFUSE_PUBLIC_KEY`),secretKey:r(`LANGFUSE_SECRET_KEY`),baseUrl:r(`LANGFUSE_HOST`)||`https://cloud.langfuse.com`}),t.debug(`Langfuse client initialized`)}}catch(e){t.debug(`Langfuse client initialization failed: ${e}`)}}catch(e){t.debug(`Langfuse initialization error: ${e}`)}}e(o,`initializeLangfuse`),i?t.debug(`Langfuse tracing disabled via MCP_USE_LANGFUSE environment variable`):!r(`LANGFUSE_PUBLIC_KEY`)||!r(`LANGFUSE_SECRET_KEY`)?t.debug(`Langfuse API keys not found - tracing disabled. Set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY to enable`):a.initPromise=o();var s=e(()=>a.handler,`langfuseHandler`),c=e(()=>a.initPromise,`langfuseInitPromise`);export{s as n,c as r,o as t};
@@ -0,0 +1 @@
1
+ import{nt as e,zn as t}from"./messages-D4_mH1tk.js";var n={};t(n,{Embeddings:()=>r});var r=class{caller;constructor(t){this.caller=new e(t??{})}},i={};t(i,{chunkArray:()=>a});var a=(e,t)=>e.reduce((e,n,r)=>{let i=Math.floor(r/t);return e[i]=(e[i]||[]).concat([n]),e},[]);export{r as n,n as r,i as t};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/stdio-DH6BP75M-C4--HtGN.js","assets/chunk-zsgVPwQN.js","assets/client-DaI4JaTs.js","assets/preload-helper-XLr9-hSf.js","assets/schemas-79owEkeD.js","assets/json-schema-processors-DSIsU0go.js","assets/chunk-3GQAWCBQ-C-9Cm0Np.js","assets/chunk-QWQYAQCK-CyFuZlX8.js","assets/path-BzTN_bR6.js"])))=>i.map(i=>d[i]);
2
- import{n as e,t}from"./chunk-3GQAWCBQ-C-9Cm0Np.js";import{n}from"./chunk-QWQYAQCK-CyFuZlX8.js";import{c as r,i,n as a}from"./client-DaI4JaTs.js";import{a as o,i as s,o as c,r as l,t as u}from"./chunk-KJ5RBDDO-DJkMH4KI.js";import{t as d}from"./preload-helper-XLr9-hSf.js";import{t as f}from"./chunk-RPN2XO5I-Boiv0wCv.js";import{i as p,n as m,o as h,t as g}from"./path-BzTN_bR6.js";h(),g();var _=class{static{t(this,`BaseCodeExecutor`)}client;_connecting=!1;constructor(e){this.client=e}async ensureServersConnected(){let e=this.client.getServerNames(),t=Object.keys(this.client.getAllActiveSessions()),r=e.filter(e=>!t.includes(e));if(r.length>0&&!this._connecting){this._connecting=!0;try{n.debug(`Connecting to configured servers for code execution: ${r.join(`, `)}`),await this.client.createAllSessions()}finally{this._connecting=!1}}else if(r.length>0&&this._connecting){n.debug(`Waiting for ongoing server connection...`);let e=Date.now();for(;this._connecting&&Date.now()-e<5e3;)await new Promise(e=>setTimeout(e,100))}}getToolNamespaces(){let e=[],t=this.client.getAllActiveSessions();for(let[r,i]of Object.entries(t))if(r!==`code_mode`)try{let t=i.connector,a;try{a=t.tools}catch(e){n.warn(`Tools not available for server ${r}: ${e}`);continue}if(!a||a.length===0)continue;e.push({serverName:r,tools:a,session:i})}catch(e){n.warn(`Failed to load tools for server ${r}: ${e}`)}return e}createSearchToolsFunction(){return async(e=``,t=`full`)=>{let r=[],i=new Set,a=e.toLowerCase(),o=this.client.getAllActiveSessions();for(let[e,a]of Object.entries(o))if(e!==`code_mode`)try{let n=a.connector.tools;n&&n.length>0&&i.add(e);for(let i of n)t===`names`?r.push({name:i.name,server:e}):t===`descriptions`?r.push({name:i.name,server:e,description:i.description}):r.push({name:i.name,server:e,description:i.description,input_schema:i.inputSchema})}catch(t){n.warn(`Failed to search tools in server ${e}: ${t}`)}let s=r;return e&&(s=r.filter(e=>{let t=e.name.toLowerCase().includes(a),n=e.description?.toLowerCase().includes(a),r=e.server.toLowerCase().includes(a);return t||n||r})),{meta:{total_tools:r.length,namespaces:Array.from(i).sort(),result_count:s.length},results:s}}}},v=class extends _{static{t(this,`E2BCodeExecutor`)}e2bApiKey;codeExecSandbox=null;SandboxClass=null;timeoutMs;constructor(e,t){super(e),this.e2bApiKey=t.apiKey,this.timeoutMs=t.timeoutMs??3e5}async ensureSandboxClass(){if(!this.SandboxClass)try{this.SandboxClass=(await d(()=>import(`@e2b/code-interpreter`),[])).Sandbox}catch{throw Error(`@e2b/code-interpreter is not installed. The E2B code executor requires this optional dependency. Install it with: yarn add @e2b/code-interpreter`)}}async getOrCreateCodeExecSandbox(){return this.codeExecSandbox?this.codeExecSandbox:(await this.ensureSandboxClass(),n.debug(`Starting E2B sandbox for code execution...`),this.codeExecSandbox=await this.SandboxClass.create(`base`,{apiKey:this.e2bApiKey,timeoutMs:this.timeoutMs}),this.codeExecSandbox)}generateShim(e){let t=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/stdio-RWLH66ZO-C753VwJ7.js","assets/chunk-zsgVPwQN.js","assets/client-z1GrRUEs.js","assets/preload-helper-ckxxtgMM.js","assets/schemas-BrqAD_Qo.js","assets/json-schema-processors-DNSjFPrk.js","assets/chunk-3GQAWCBQ-ntjTDD_C.js","assets/chunk-QWQYAQCK-BR4V0xsV.js","assets/path-CG3438uq.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,t}from"./chunk-3GQAWCBQ-ntjTDD_C.js";import{n}from"./chunk-QWQYAQCK-BR4V0xsV.js";import{c as r,i,n as a}from"./client-z1GrRUEs.js";import{a as o,i as s,o as c,r as l,t as u}from"./chunk-ECXMLUNG-CSRGaMIB.js";import{t as d}from"./preload-helper-ckxxtgMM.js";import{t as f}from"./chunk-RPN2XO5I-Cr13Miz-.js";import{i as p,n as m,o as h,t as g}from"./path-CG3438uq.js";h(),g();var _=class{static{t(this,`BaseCodeExecutor`)}client;_connecting=!1;constructor(e){this.client=e}async ensureServersConnected(){let e=this.client.getServerNames(),t=Object.keys(this.client.getAllActiveSessions()),r=e.filter(e=>!t.includes(e));if(r.length>0&&!this._connecting){this._connecting=!0;try{n.debug(`Connecting to configured servers for code execution: ${r.join(`, `)}`),await this.client.createAllSessions()}finally{this._connecting=!1}}else if(r.length>0&&this._connecting){n.debug(`Waiting for ongoing server connection...`);let e=Date.now();for(;this._connecting&&Date.now()-e<5e3;)await new Promise(e=>setTimeout(e,100))}}getToolNamespaces(){let e=[],t=this.client.getAllActiveSessions();for(let[r,i]of Object.entries(t))if(r!==`code_mode`)try{let t=i.connector,a;try{a=t.tools}catch(e){n.warn(`Tools not available for server ${r}: ${e}`);continue}if(!a||a.length===0)continue;e.push({serverName:r,tools:a,session:i})}catch(e){n.warn(`Failed to load tools for server ${r}: ${e}`)}return e}createSearchToolsFunction(){return async(e=``,t=`full`)=>{let r=[],i=new Set,a=e.toLowerCase(),o=this.client.getAllActiveSessions();for(let[e,a]of Object.entries(o))if(e!==`code_mode`)try{let n=a.connector.tools;n&&n.length>0&&i.add(e);for(let i of n)t===`names`?r.push({name:i.name,server:e}):t===`descriptions`?r.push({name:i.name,server:e,description:i.description}):r.push({name:i.name,server:e,description:i.description,input_schema:i.inputSchema})}catch(t){n.warn(`Failed to search tools in server ${e}: ${t}`)}let s=r;return e&&(s=r.filter(e=>{let t=e.name.toLowerCase().includes(a),n=e.description?.toLowerCase().includes(a),r=e.server.toLowerCase().includes(a);return t||n||r})),{meta:{total_tools:r.length,namespaces:Array.from(i).sort(),result_count:s.length},results:s}}}},v=class extends _{static{t(this,`E2BCodeExecutor`)}e2bApiKey;codeExecSandbox=null;SandboxClass=null;timeoutMs;constructor(e,t){super(e),this.e2bApiKey=t.apiKey,this.timeoutMs=t.timeoutMs??3e5}async ensureSandboxClass(){if(!this.SandboxClass)try{this.SandboxClass=(await d(()=>import(`@e2b/code-interpreter`),[])).Sandbox}catch{throw Error(`@e2b/code-interpreter is not installed. The E2B code executor requires this optional dependency. Install it with: yarn add @e2b/code-interpreter`)}}async getOrCreateCodeExecSandbox(){return this.codeExecSandbox?this.codeExecSandbox:(await this.ensureSandboxClass(),n.debug(`Starting E2B sandbox for code execution...`),this.codeExecSandbox=await this.SandboxClass.create(`base`,{apiKey:this.e2bApiKey,timeoutMs:this.timeoutMs}),this.codeExecSandbox)}generateShim(e){let t=`
3
3
  // MCP Bridge Shim
4
4
  global.__callMcpTool = async (server, tool, args) => {
5
5
  const id = Math.random().toString(36).substring(7);
@@ -88,4 +88,4 @@ ${this.generateShim(c)}
88
88
  throw e;
89
89
  }
90
90
  })()
91
- `;o=await new y.Script(n,{filename:`agent_code.js`}).runInNewContext(t,{timeout:r,displayErrors:!0})}catch(e){s=e.message||String(e),(e.code===`ERR_SCRIPT_EXECUTION_TIMEOUT`||e.message===`Script execution timed out.`||typeof s==`string`&&(s.includes(`timed out`)||s.includes(`timeout`)))&&(s=`Script execution timed out`),e.stack&&n.debug(`Code execution error stack: ${e.stack}`)}let c=(Date.now()-a)/1e3;return{result:o,logs:i,error:s,execution_time:c}}async _buildContext(e){let n=t((...t)=>{e.push(t.map(e=>typeof e==`object`?JSON.stringify(e,null,2):String(e)).join(` `))},`logHandler`),r={console:{log:n,error:t((...e)=>{n(`[ERROR]`,...e)},`error`),warn:t((...e)=>{n(`[WARN]`,...e)},`warn`),info:n,debug:n},Object,Array,String,Number,Boolean,Date,Math,JSON,RegExp,Map,Set,Promise,parseInt,parseFloat,isNaN,isFinite,encodeURI,decodeURI,encodeURIComponent,decodeURIComponent,setTimeout,clearTimeout,search_tools:this.createSearchToolsFunction(),__tool_namespaces:[]},i={},a=this.getToolNamespaces();for(let{serverName:e,tools:t,session:n}of a){let a={};for(let e of t){let t=e.name;a[t]=async e=>{let r=await n.connector.callTool(t,e||{});if(r.content&&r.content.length>0){let e=r.content[0];if(e.type===`text`)try{return JSON.parse(e.text)}catch{return e.text}return e}return r}}r[e]=a,i[e]=!0}return r.__tool_namespaces=Object.keys(i),y.createContext(r)}async cleanup(){}},E=class extends a{static{t(this,`CodeModeConnector`)}mcpClient;_tools;constructor(e){super(),this.mcpClient=e,this.connected=!0,this._tools=this._createToolsList()}async connect(){this.connected=!0}async disconnect(){this.connected=!1}get publicIdentifier(){return{name:`code_mode`,version:`1.0.0`}}_createToolsList(){return[{name:`execute_code`,description:`Execute JavaScript/TypeScript code with access to MCP tools. This is the PRIMARY way to interact with MCP servers in code mode. Write code that discovers tools using search_tools(), calls tools as async functions (e.g., await github.get_pull_request(...)), processes data efficiently, and returns results. Use 'await' for async operations and 'return' to return values. Available in code: search_tools(), __tool_namespaces, and server.tool_name() functions.`,inputSchema:{type:`object`,properties:{code:{type:`string`,description:`JavaScript/TypeScript code to execute. Use 'await' for async operations. Use 'return' to return a value. Available: search_tools(), server.tool_name(), __tool_namespaces`},timeout:{type:`number`,description:`Execution timeout in milliseconds`,default:3e4}},required:[`code`]}},{name:`search_tools`,description:`Search and discover available MCP tools across all servers. Use this to find out what tools are available before writing code. Returns tool information including names, descriptions, and schemas. Can filter by query and control detail level.`,inputSchema:{type:`object`,properties:{query:{type:`string`,description:`Search query to filter tools by name or description`,default:``},detail_level:{type:`string`,description:`Detail level: 'names', 'descriptions', or 'full'`,enum:[`names`,`descriptions`,`full`],default:`full`}}}}]}get tools(){return this._tools}async initialize(){return this.toolsCache=this._tools,{capabilities:{},version:`1.0.0`}}async callTool(e,t){if(e===`execute_code`){let e=t.code,n=t.timeout||3e4,r=await this.mcpClient.executeCode(e,n);return{content:[{type:`text`,text:JSON.stringify(r)}]}}else if(e===`search_tools`){let e=t.query||``,n=t.detail_level,r=await this.mcpClient.searchTools(e,n&&n in[`names`,`descriptions`,`full`]?n:`full`);return{content:[{type:`text`,text:JSON.stringify(r)}]}}throw Error(`Unknown tool: ${e}`)}};function D(t){let{readFileSync:n}=e(`fs`),r=n(t,`utf-8`);return JSON.parse(r)}t(D,`loadConfigFile`);function O(e){return`requestedSchema`in e&&e.requestedSchema!=null}t(O,`hasRequestedSchema`);function k(e){let t={};if(!O(e))return t;let n=e.requestedSchema.properties??{};for(let[e,r]of Object.entries(n)){let n=r;if(`default`in n){let r=n.default;(typeof r==`string`||typeof r==`number`||typeof r==`boolean`||Array.isArray(r)&&r.every(e=>typeof e==`string`))&&(t[e]=r)}}return t}t(k,`getDefaults`);function A(e,t){let n=k(e);return t==null?n:{...n,...t}}t(A,`applyDefaults`);function j(e){return{action:`accept`,content:k(e)}}t(j,`acceptWithDefaults`);function M(e){return{action:`accept`,content:e}}t(M,`accept`);function N(e){return{action:`decline`}}t(N,`decline`);function P(){return{action:`cancel`}}t(P,`cancel`);function F(e){return N(e)}t(F,`reject`);function I(e,t){if(!O(e))return{valid:!0};try{let n=f.convert(e.requestedSchema).safeParse(t);return n.success?{valid:!0}:{valid:!1,errors:n.error.issues.map(e=>e.path.length>0?`${e.path.join(`.`)}: ${e.message}`:e.message)}}catch{return{valid:!1,errors:[`Unsupported or invalid schema`]}}}t(I,`validate`);function L(e,t,r){let a=Object.keys(e.mcpServers??{}),o=!!(r.onSampling??r.samplingCallback),s=!!(r.onElicitation??r.elicitationCallback);i.getInstance().trackMCPClientInit({codeMode:t,sandbox:!1,allCallbacks:o&&s,verify:!1,servers:a,numServers:a.length,isBrowser:!1}).catch(e=>n.debug(`Failed to track MCPClient init: ${e}`))}t(L,`trackNodeClientInit`);var R=class e extends u{static{t(this,`MCPClient`)}static getPackageVersion(){return r()}codeMode=!1;_codeExecutor=null;_customCodeExecutor=null;_codeExecutorConfig=`vm`;_executorOptions;_globalCallbacks;constructor(e,t){e?super(typeof e==`string`?D(e):e):super();let n=!1,r=`vm`,i;t?.codeMode&&(typeof t.codeMode==`boolean`?n=t.codeMode:(n=t.codeMode.enabled,r=t.codeMode.executor??`vm`,i=t.codeMode.executorOptions)),this.codeMode=n,this._codeExecutorConfig=r,this._executorOptions=i;let a=this.config;this._globalCallbacks={onSampling:t?.onSampling??t?.samplingCallback??a?.onSampling??a?.samplingCallback,samplingCallback:t?.samplingCallback??a?.samplingCallback,onElicitation:t?.onElicitation??t?.elicitationCallback??a?.onElicitation??a?.elicitationCallback,elicitationCallback:t?.elicitationCallback??a?.elicitationCallback,onNotification:t?.onNotification??a?.onNotification},t?.samplingCallback&&!t?.onSampling&&console.warn(`[MCPClient] The "samplingCallback" option is deprecated. Use "onSampling" instead.`),t?.elicitationCallback&&!t?.onElicitation&&console.warn(`[MCPClient] The "elicitationCallback" option is deprecated. Use "onElicitation" instead.`),this.codeMode&&this._setupCodeModeConnector(),L(this.config,this.codeMode,this._globalCallbacks)}static fromDict(t,n){return new e(t,n)}static fromConfigFile(t,n){return new e(D(t),n)}saveConfig(e){let t=m.dirname(e);p.existsSync(t)||p.mkdirSync(t,{recursive:!0}),p.writeFileSync(e,JSON.stringify(this.config,null,2),`utf-8`)}async createConnectorFromConfig(e){let t=c(e,this._globalCallbacks),n={...e,clientInfo:e.clientInfo??this.config.clientInfo};if(`command`in n&&`args`in n){let{StdioConnector:e}=await d(async()=>{let{StdioConnector:e}=await import(`./stdio-DH6BP75M-C4--HtGN.js`);return{StdioConnector:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])),r=n;return new e({command:r.command,args:r.args,env:r.env,clientInfo:o(n.clientInfo),onSampling:t.onSampling,onElicitation:t.onElicitation,onNotification:t.onNotification})}return s(n,{onSampling:t.onSampling,onElicitation:t.onElicitation,onNotification:t.onNotification})}_setupCodeModeConnector(){n.debug(`Code mode connector initialized as internal meta server`);let e=new l(new E(this));this.sessions.code_mode=e,this.activeSessions.push(`code_mode`)}_ensureCodeExecutor(){if(!this._codeExecutor){let e=this._codeExecutorConfig;if(e instanceof _)this._codeExecutor=e;else if(typeof e==`function`)throw this._customCodeExecutor=e,Error(`Custom executor function should be handled in executeCode`);else if(e===`e2b`){let e=this._executorOptions;if(e?.apiKey)this._codeExecutor=new v(this,e);else{n.warn(`E2B executor requires apiKey. Falling back to VM.`);try{this._codeExecutor=new T(this,this._executorOptions)}catch{throw Error(`VM executor is not available in this environment and E2B API key is not provided. Please provide an E2B API key or run in a Node.js environment.`)}}}else try{this._codeExecutor=new T(this,this._executorOptions)}catch{let e=this._executorOptions,t=e?.apiKey||{}.E2B_API_KEY;if(t)n.info(`VM executor not available in this environment. Falling back to E2B.`),this._codeExecutor=new v(this,{...e,apiKey:t});else throw Error(`VM executor is not available in this environment. Please provide an E2B API key via executorOptions or E2B_API_KEY environment variable, or run in a Node.js environment.`)}}return this._codeExecutor}async executeCode(e,t){if(!this.codeMode)throw Error(`Code execution mode is not enabled`);return this._customCodeExecutor?this._customCodeExecutor(e,t):this._ensureCodeExecutor().execute(e,t)}async searchTools(e=``,t=`full`){if(!this.codeMode)throw Error(`Code execution mode is not enabled`);return this._ensureCodeExecutor().createSearchToolsFunction()(e,t)}getServerNames(){let e=this.codeMode;return super.getServerNames().filter(t=>!e||t!==`code_mode`)}async close(){this._codeExecutor&&=(await this._codeExecutor.cleanup(),null),await this.closeAllSessions()}};export{R as MCPClient};
91
+ `;o=await new y.Script(n,{filename:`agent_code.js`}).runInNewContext(t,{timeout:r,displayErrors:!0})}catch(e){s=e.message||String(e),(e.code===`ERR_SCRIPT_EXECUTION_TIMEOUT`||e.message===`Script execution timed out.`||typeof s==`string`&&(s.includes(`timed out`)||s.includes(`timeout`)))&&(s=`Script execution timed out`),e.stack&&n.debug(`Code execution error stack: ${e.stack}`)}let c=(Date.now()-a)/1e3;return{result:o,logs:i,error:s,execution_time:c}}async _buildContext(e){let n=t((...t)=>{e.push(t.map(e=>typeof e==`object`?JSON.stringify(e,null,2):String(e)).join(` `))},`logHandler`),r={console:{log:n,error:t((...e)=>{n(`[ERROR]`,...e)},`error`),warn:t((...e)=>{n(`[WARN]`,...e)},`warn`),info:n,debug:n},Object,Array,String,Number,Boolean,Date,Math,JSON,RegExp,Map,Set,Promise,parseInt,parseFloat,isNaN,isFinite,encodeURI,decodeURI,encodeURIComponent,decodeURIComponent,setTimeout,clearTimeout,search_tools:this.createSearchToolsFunction(),__tool_namespaces:[]},i={},a=this.getToolNamespaces();for(let{serverName:e,tools:t,session:n}of a){let a={};for(let e of t){let t=e.name;a[t]=async e=>{let r=await n.connector.callTool(t,e||{});if(r.content&&r.content.length>0){let e=r.content[0];if(e.type===`text`)try{return JSON.parse(e.text)}catch{return e.text}return e}return r}}r[e]=a,i[e]=!0}return r.__tool_namespaces=Object.keys(i),y.createContext(r)}async cleanup(){}},E=class extends a{static{t(this,`CodeModeConnector`)}mcpClient;_tools;constructor(e){super(),this.mcpClient=e,this.connected=!0,this._tools=this._createToolsList()}async connect(){this.connected=!0}async disconnect(){this.connected=!1}get publicIdentifier(){return{name:`code_mode`,version:`1.0.0`}}_createToolsList(){return[{name:`execute_code`,description:`Execute JavaScript/TypeScript code with access to MCP tools. This is the PRIMARY way to interact with MCP servers in code mode. Write code that discovers tools using search_tools(), calls tools as async functions (e.g., await github.get_pull_request(...)), processes data efficiently, and returns results. Use 'await' for async operations and 'return' to return values. Available in code: search_tools(), __tool_namespaces, and server.tool_name() functions.`,inputSchema:{type:`object`,properties:{code:{type:`string`,description:`JavaScript/TypeScript code to execute. Use 'await' for async operations. Use 'return' to return a value. Available: search_tools(), server.tool_name(), __tool_namespaces`},timeout:{type:`number`,description:`Execution timeout in milliseconds`,default:3e4}},required:[`code`]}},{name:`search_tools`,description:`Search and discover available MCP tools across all servers. Use this to find out what tools are available before writing code. Returns tool information including names, descriptions, and schemas. Can filter by query and control detail level.`,inputSchema:{type:`object`,properties:{query:{type:`string`,description:`Search query to filter tools by name or description`,default:``},detail_level:{type:`string`,description:`Detail level: 'names', 'descriptions', or 'full'`,enum:[`names`,`descriptions`,`full`],default:`full`}}}}]}get tools(){return this._tools}async initialize(){return this.toolsCache=this._tools,{capabilities:{},version:`1.0.0`}}async callTool(e,t){if(e===`execute_code`){let e=t.code,n=t.timeout||3e4,r=await this.mcpClient.executeCode(e,n);return{content:[{type:`text`,text:JSON.stringify(r)}]}}else if(e===`search_tools`){let e=t.query||``,n=t.detail_level,r=await this.mcpClient.searchTools(e,n&&n in[`names`,`descriptions`,`full`]?n:`full`);return{content:[{type:`text`,text:JSON.stringify(r)}]}}throw Error(`Unknown tool: ${e}`)}};function D(t){let{readFileSync:n}=e(`fs`),r=n(t,`utf-8`);return JSON.parse(r)}t(D,`loadConfigFile`);function O(e){return`requestedSchema`in e&&e.requestedSchema!=null}t(O,`hasRequestedSchema`);function k(e){let t={};if(!O(e))return t;let n=e.requestedSchema.properties??{};for(let[e,r]of Object.entries(n)){let n=r;if(`default`in n){let r=n.default;(typeof r==`string`||typeof r==`number`||typeof r==`boolean`||Array.isArray(r)&&r.every(e=>typeof e==`string`))&&(t[e]=r)}}return t}t(k,`getDefaults`);function A(e,t){let n=k(e);return t==null?n:{...n,...t}}t(A,`applyDefaults`);function j(e){return{action:`accept`,content:k(e)}}t(j,`acceptWithDefaults`);function M(e){return{action:`accept`,content:e}}t(M,`accept`);function N(e){return{action:`decline`}}t(N,`decline`);function P(){return{action:`cancel`}}t(P,`cancel`);function F(e){return N(e)}t(F,`reject`);function I(e,t){if(!O(e))return{valid:!0};try{let n=f.convert(e.requestedSchema).safeParse(t);return n.success?{valid:!0}:{valid:!1,errors:n.error.issues.map(e=>e.path.length>0?`${e.path.join(`.`)}: ${e.message}`:e.message)}}catch{return{valid:!1,errors:[`Unsupported or invalid schema`]}}}t(I,`validate`);function L(e,t,r){let a=Object.keys(e.mcpServers??{}),o=!!(r.onSampling??r.samplingCallback),s=!!(r.onElicitation??r.elicitationCallback);i.getInstance().trackMCPClientInit({codeMode:t,sandbox:!1,allCallbacks:o&&s,verify:!1,servers:a,numServers:a.length,isBrowser:!1}).catch(e=>n.debug(`Failed to track MCPClient init: ${e}`))}t(L,`trackNodeClientInit`);var R=class e extends u{static{t(this,`MCPClient`)}static getPackageVersion(){return r()}codeMode=!1;_codeExecutor=null;_customCodeExecutor=null;_codeExecutorConfig=`vm`;_executorOptions;_globalCallbacks;constructor(e,t){e?super(typeof e==`string`?D(e):e):super();let n=!1,r=`vm`,i;t?.codeMode&&(typeof t.codeMode==`boolean`?n=t.codeMode:(n=t.codeMode.enabled,r=t.codeMode.executor??`vm`,i=t.codeMode.executorOptions)),this.codeMode=n,this._codeExecutorConfig=r,this._executorOptions=i;let a=this.config;this._globalCallbacks={onSampling:t?.onSampling??t?.samplingCallback??a?.onSampling??a?.samplingCallback,samplingCallback:t?.samplingCallback??a?.samplingCallback,onElicitation:t?.onElicitation??t?.elicitationCallback??a?.onElicitation??a?.elicitationCallback,elicitationCallback:t?.elicitationCallback??a?.elicitationCallback,onNotification:t?.onNotification??a?.onNotification},t?.samplingCallback&&!t?.onSampling&&console.warn(`[MCPClient] The "samplingCallback" option is deprecated. Use "onSampling" instead.`),t?.elicitationCallback&&!t?.onElicitation&&console.warn(`[MCPClient] The "elicitationCallback" option is deprecated. Use "onElicitation" instead.`),this.codeMode&&this._setupCodeModeConnector(),L(this.config,this.codeMode,this._globalCallbacks)}static fromDict(t,n){return new e(t,n)}static fromConfigFile(t,n){return new e(D(t),n)}saveConfig(e){let t=m.dirname(e);p.existsSync(t)||p.mkdirSync(t,{recursive:!0}),p.writeFileSync(e,JSON.stringify(this.config,null,2),`utf-8`)}async createConnectorFromConfig(e){let t=c(e,this._globalCallbacks),n={...e,clientInfo:e.clientInfo??this.config.clientInfo};if(`command`in n&&`args`in n){let{StdioConnector:e}=await d(async()=>{let{StdioConnector:e}=await import(`./stdio-RWLH66ZO-C753VwJ7.js`);return{StdioConnector:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])),r=n;return new e({command:r.command,args:r.args,env:r.env,clientInfo:o(n.clientInfo),onSampling:t.onSampling,onElicitation:t.onElicitation,onNotification:t.onNotification})}return s(n,{onSampling:t.onSampling,onElicitation:t.onElicitation,onNotification:t.onNotification})}_setupCodeModeConnector(){n.debug(`Code mode connector initialized as internal meta server`);let e=new l(new E(this));this.sessions.code_mode=e,this.activeSessions.push(`code_mode`)}_ensureCodeExecutor(){if(!this._codeExecutor){let e=this._codeExecutorConfig;if(e instanceof _)this._codeExecutor=e;else if(typeof e==`function`)throw this._customCodeExecutor=e,Error(`Custom executor function should be handled in executeCode`);else if(e===`e2b`){let e=this._executorOptions;if(e?.apiKey)this._codeExecutor=new v(this,e);else{n.warn(`E2B executor requires apiKey. Falling back to VM.`);try{this._codeExecutor=new T(this,this._executorOptions)}catch{throw Error(`VM executor is not available in this environment and E2B API key is not provided. Please provide an E2B API key or run in a Node.js environment.`)}}}else try{this._codeExecutor=new T(this,this._executorOptions)}catch{let e=this._executorOptions,t=e?.apiKey||{}.E2B_API_KEY;if(t)n.info(`VM executor not available in this environment. Falling back to E2B.`),this._codeExecutor=new v(this,{...e,apiKey:t});else throw Error(`VM executor is not available in this environment. Please provide an E2B API key via executorOptions or E2B_API_KEY environment variable, or run in a Node.js environment.`)}}return this._codeExecutor}async executeCode(e,t){if(!this.codeMode)throw Error(`Code execution mode is not enabled`);return this._customCodeExecutor?this._customCodeExecutor(e,t):this._ensureCodeExecutor().execute(e,t)}async searchTools(e=``,t=`full`){if(!this.codeMode)throw Error(`Code execution mode is not enabled`);return this._ensureCodeExecutor().createSearchToolsFunction()(e,t)}getServerNames(){let e=this.codeMode;return super.getServerNames().filter(t=>!e||t!==`code_mode`)}async close(){this._codeExecutor&&=(await this._codeExecutor.cleanup(),null),await this.closeAllSessions()}};export{R as MCPClient};