@1mcp/agent 0.28.1 → 0.29.0-beta2

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 (399) hide show
  1. package/build/auth/sessionTypes.d.ts +19 -0
  2. package/build/auth/sessionTypes.d.ts.map +1 -1
  3. package/build/commands/app/backups.d.ts.map +1 -1
  4. package/build/commands/app/backups.js +52 -42
  5. package/build/commands/app/backups.js.map +1 -1
  6. package/build/commands/app/consolidate.d.ts.map +1 -1
  7. package/build/commands/app/consolidate.js +66 -55
  8. package/build/commands/app/consolidate.js.map +1 -1
  9. package/build/commands/app/discover.d.ts.map +1 -1
  10. package/build/commands/app/discover.js +32 -25
  11. package/build/commands/app/discover.js.map +1 -1
  12. package/build/commands/app/index.d.ts.map +1 -1
  13. package/build/commands/app/index.js +2 -1
  14. package/build/commands/app/index.js.map +1 -1
  15. package/build/commands/app/list.d.ts.map +1 -1
  16. package/build/commands/app/list.js +35 -28
  17. package/build/commands/app/list.js.map +1 -1
  18. package/build/commands/app/restore.d.ts.map +1 -1
  19. package/build/commands/app/restore.js +74 -63
  20. package/build/commands/app/restore.js.map +1 -1
  21. package/build/commands/app/status.d.ts.map +1 -1
  22. package/build/commands/app/status.js +51 -43
  23. package/build/commands/app/status.js.map +1 -1
  24. package/build/commands/mcp/add.d.ts.map +1 -1
  25. package/build/commands/mcp/add.js +29 -23
  26. package/build/commands/mcp/add.js.map +1 -1
  27. package/build/commands/mcp/enable.d.ts.map +1 -1
  28. package/build/commands/mcp/enable.js +16 -15
  29. package/build/commands/mcp/enable.js.map +1 -1
  30. package/build/commands/mcp/index.d.ts.map +1 -1
  31. package/build/commands/mcp/index.js +2 -1
  32. package/build/commands/mcp/index.js.map +1 -1
  33. package/build/commands/mcp/install.d.ts.map +1 -1
  34. package/build/commands/mcp/install.js +44 -46
  35. package/build/commands/mcp/install.js.map +1 -1
  36. package/build/commands/mcp/list.d.ts.map +1 -1
  37. package/build/commands/mcp/list.js +51 -37
  38. package/build/commands/mcp/list.js.map +1 -1
  39. package/build/commands/mcp/remove.d.ts.map +1 -1
  40. package/build/commands/mcp/remove.js +23 -16
  41. package/build/commands/mcp/remove.js.map +1 -1
  42. package/build/commands/mcp/status.d.ts.map +1 -1
  43. package/build/commands/mcp/status.js +81 -73
  44. package/build/commands/mcp/status.js.map +1 -1
  45. package/build/commands/mcp/tokens.d.ts.map +1 -1
  46. package/build/commands/mcp/tokens.js +46 -47
  47. package/build/commands/mcp/tokens.js.map +1 -1
  48. package/build/commands/mcp/uninstall.d.ts.map +1 -1
  49. package/build/commands/mcp/uninstall.js +8 -6
  50. package/build/commands/mcp/uninstall.js.map +1 -1
  51. package/build/commands/mcp/update.d.ts.map +1 -1
  52. package/build/commands/mcp/update.js +11 -8
  53. package/build/commands/mcp/update.js.map +1 -1
  54. package/build/commands/mcp/utils/installWizard.d.ts.map +1 -1
  55. package/build/commands/mcp/utils/installWizard.js +3 -2
  56. package/build/commands/mcp/utils/installWizard.js.map +1 -1
  57. package/build/commands/mcp/utils/serverUtils.d.ts +8 -4
  58. package/build/commands/mcp/utils/serverUtils.d.ts.map +1 -1
  59. package/build/commands/mcp/utils/serverUtils.js +0 -3
  60. package/build/commands/mcp/utils/serverUtils.js.map +1 -1
  61. package/build/commands/mcp/wizard/components/serverDetailsDisplay.d.ts.map +1 -1
  62. package/build/commands/mcp/wizard/components/serverDetailsDisplay.js +4 -3
  63. package/build/commands/mcp/wizard/components/serverDetailsDisplay.js.map +1 -1
  64. package/build/commands/mcp/wizard/components/stepIndicator.d.ts.map +1 -1
  65. package/build/commands/mcp/wizard/components/stepIndicator.js +3 -2
  66. package/build/commands/mcp/wizard/components/stepIndicator.js.map +1 -1
  67. package/build/commands/mcp/wizard/components/welcomeScreen.d.ts.map +1 -1
  68. package/build/commands/mcp/wizard/components/welcomeScreen.js +2 -1
  69. package/build/commands/mcp/wizard/components/welcomeScreen.js.map +1 -1
  70. package/build/commands/mcp/wizard/configuration.d.ts.map +1 -1
  71. package/build/commands/mcp/wizard/configuration.js +10 -9
  72. package/build/commands/mcp/wizard/configuration.js.map +1 -1
  73. package/build/commands/mcp/wizard/display.d.ts.map +1 -1
  74. package/build/commands/mcp/wizard/display.js +9 -8
  75. package/build/commands/mcp/wizard/display.js.map +1 -1
  76. package/build/commands/mcp/wizard/search.d.ts.map +1 -1
  77. package/build/commands/mcp/wizard/search.js +4 -3
  78. package/build/commands/mcp/wizard/search.js.map +1 -1
  79. package/build/commands/preset/create.d.ts.map +1 -1
  80. package/build/commands/preset/create.js +7 -6
  81. package/build/commands/preset/create.js.map +1 -1
  82. package/build/commands/preset/delete.d.ts.map +1 -1
  83. package/build/commands/preset/delete.js +4 -2
  84. package/build/commands/preset/delete.js.map +1 -1
  85. package/build/commands/preset/edit.d.ts.map +1 -1
  86. package/build/commands/preset/edit.js +8 -5
  87. package/build/commands/preset/edit.js.map +1 -1
  88. package/build/commands/preset/interactive.d.ts.map +1 -1
  89. package/build/commands/preset/interactive.js +24 -15
  90. package/build/commands/preset/interactive.js.map +1 -1
  91. package/build/commands/preset/list.d.ts.map +1 -1
  92. package/build/commands/preset/list.js +12 -10
  93. package/build/commands/preset/list.js.map +1 -1
  94. package/build/commands/preset/show.d.ts.map +1 -1
  95. package/build/commands/preset/show.js +3 -2
  96. package/build/commands/preset/show.js.map +1 -1
  97. package/build/commands/preset/test.d.ts.map +1 -1
  98. package/build/commands/preset/test.js +2 -1
  99. package/build/commands/preset/test.js.map +1 -1
  100. package/build/commands/preset/url.d.ts.map +1 -1
  101. package/build/commands/preset/url.js +2 -1
  102. package/build/commands/preset/url.js.map +1 -1
  103. package/build/commands/proxy/index.d.ts.map +1 -1
  104. package/build/commands/proxy/index.js +5 -0
  105. package/build/commands/proxy/index.js.map +1 -1
  106. package/build/commands/proxy/proxy.d.ts.map +1 -1
  107. package/build/commands/proxy/proxy.js +1 -0
  108. package/build/commands/proxy/proxy.js.map +1 -1
  109. package/build/commands/registry/index.d.ts.map +1 -1
  110. package/build/commands/registry/index.js +2 -1
  111. package/build/commands/registry/index.js.map +1 -1
  112. package/build/commands/registry/search.d.ts.map +1 -1
  113. package/build/commands/registry/search.js +42 -37
  114. package/build/commands/registry/search.js.map +1 -1
  115. package/build/commands/registry/show.d.ts.map +1 -1
  116. package/build/commands/registry/show.js +8 -7
  117. package/build/commands/registry/show.js.map +1 -1
  118. package/build/commands/registry/status.d.ts.map +1 -1
  119. package/build/commands/registry/status.js +26 -16
  120. package/build/commands/registry/status.js.map +1 -1
  121. package/build/commands/registry/versions.d.ts.map +1 -1
  122. package/build/commands/registry/versions.js +8 -7
  123. package/build/commands/registry/versions.js.map +1 -1
  124. package/build/config/configChangeDetector.d.ts +8 -0
  125. package/build/config/configChangeDetector.d.ts.map +1 -0
  126. package/build/config/configChangeDetector.js +49 -0
  127. package/build/config/configChangeDetector.js.map +1 -0
  128. package/build/config/configLoader.d.ts +16 -0
  129. package/build/config/configLoader.d.ts.map +1 -0
  130. package/build/config/configLoader.js +155 -0
  131. package/build/config/configLoader.js.map +1 -0
  132. package/build/config/configManager.d.ts +49 -86
  133. package/build/config/configManager.d.ts.map +1 -1
  134. package/build/config/configManager.js +188 -301
  135. package/build/config/configManager.js.map +1 -1
  136. package/build/config/configWatcher.d.ts +18 -0
  137. package/build/config/configWatcher.d.ts.map +1 -0
  138. package/build/config/configWatcher.js +78 -0
  139. package/build/config/configWatcher.js.map +1 -0
  140. package/build/config/projectConfigTypes.d.ts +40 -0
  141. package/build/config/projectConfigTypes.d.ts.map +1 -1
  142. package/build/config/projectConfigTypes.js +21 -0
  143. package/build/config/projectConfigTypes.js.map +1 -1
  144. package/build/config/templateProcessor.d.ts +14 -0
  145. package/build/config/templateProcessor.d.ts.map +1 -0
  146. package/build/config/templateProcessor.js +102 -0
  147. package/build/config/templateProcessor.js.map +1 -0
  148. package/build/config/types.d.ts +36 -0
  149. package/build/config/types.d.ts.map +1 -0
  150. package/build/config/types.js +14 -0
  151. package/build/config/types.js.map +1 -0
  152. package/build/constants/mcp.d.ts +1 -1
  153. package/build/constants/mcp.d.ts.map +1 -1
  154. package/build/constants/mcp.js +1 -1
  155. package/build/constants/mcp.js.map +1 -1
  156. package/build/core/client/clientFactory.d.ts +7 -0
  157. package/build/core/client/clientFactory.d.ts.map +1 -0
  158. package/build/core/client/clientFactory.js +36 -0
  159. package/build/core/client/clientFactory.js.map +1 -0
  160. package/build/core/client/clientManager.d.ts +13 -101
  161. package/build/core/client/clientManager.d.ts.map +1 -1
  162. package/build/core/client/clientManager.js +115 -418
  163. package/build/core/client/clientManager.js.map +1 -1
  164. package/build/core/client/connectionHandler.d.ts +8 -0
  165. package/build/core/client/connectionHandler.d.ts.map +1 -0
  166. package/build/core/client/connectionHandler.js +80 -0
  167. package/build/core/client/connectionHandler.js.map +1 -0
  168. package/build/core/client/oauthFlowHandler.d.ts +10 -0
  169. package/build/core/client/oauthFlowHandler.d.ts.map +1 -0
  170. package/build/core/client/oauthFlowHandler.js +81 -0
  171. package/build/core/client/oauthFlowHandler.js.map +1 -0
  172. package/build/core/client/transportRecreator.d.ts +5 -0
  173. package/build/core/client/transportRecreator.d.ts.map +1 -0
  174. package/build/core/client/transportRecreator.js +23 -0
  175. package/build/core/client/transportRecreator.js.map +1 -0
  176. package/build/core/client/types.d.ts +7 -0
  177. package/build/core/client/types.d.ts.map +1 -0
  178. package/build/core/client/types.js +11 -0
  179. package/build/core/client/types.js.map +1 -0
  180. package/build/core/configChangeHandler.d.ts.map +1 -1
  181. package/build/core/configChangeHandler.js +11 -5
  182. package/build/core/configChangeHandler.js.map +1 -1
  183. package/build/core/context/globalContextManager.d.ts +58 -0
  184. package/build/core/context/globalContextManager.d.ts.map +1 -0
  185. package/build/core/context/globalContextManager.js +190 -0
  186. package/build/core/context/globalContextManager.js.map +1 -0
  187. package/build/core/filtering/clientFiltering.d.ts +1 -2
  188. package/build/core/filtering/clientFiltering.d.ts.map +1 -1
  189. package/build/core/filtering/clientTemplateTracker.d.ts +116 -0
  190. package/build/core/filtering/clientTemplateTracker.d.ts.map +1 -0
  191. package/build/core/filtering/clientTemplateTracker.js +286 -0
  192. package/build/core/filtering/clientTemplateTracker.js.map +1 -0
  193. package/build/core/filtering/filterCache.d.ts +121 -0
  194. package/build/core/filtering/filterCache.d.ts.map +1 -0
  195. package/build/core/filtering/filterCache.js +359 -0
  196. package/build/core/filtering/filterCache.js.map +1 -0
  197. package/build/core/filtering/index.d.ts +16 -0
  198. package/build/core/filtering/index.d.ts.map +1 -0
  199. package/build/core/filtering/index.js +16 -0
  200. package/build/core/filtering/index.js.map +1 -0
  201. package/build/core/filtering/templateFilteringService.d.ts +72 -0
  202. package/build/core/filtering/templateFilteringService.d.ts.map +1 -0
  203. package/build/core/filtering/templateFilteringService.js +293 -0
  204. package/build/core/filtering/templateFilteringService.js.map +1 -0
  205. package/build/core/filtering/templateIndex.d.ts +132 -0
  206. package/build/core/filtering/templateIndex.d.ts.map +1 -0
  207. package/build/core/filtering/templateIndex.js +368 -0
  208. package/build/core/filtering/templateIndex.js.map +1 -0
  209. package/build/core/flags/flagManager.d.ts +8 -4
  210. package/build/core/flags/flagManager.d.ts.map +1 -1
  211. package/build/core/flags/flagManager.js.map +1 -1
  212. package/build/core/protocol/requestHandlers.d.ts.map +1 -1
  213. package/build/core/protocol/requestHandlers.js +208 -46
  214. package/build/core/protocol/requestHandlers.js.map +1 -1
  215. package/build/core/server/clientInstancePool.d.ts +146 -0
  216. package/build/core/server/clientInstancePool.d.ts.map +1 -0
  217. package/build/core/server/clientInstancePool.js +407 -0
  218. package/build/core/server/clientInstancePool.js.map +1 -0
  219. package/build/core/server/connectionManager.d.ts +70 -0
  220. package/build/core/server/connectionManager.d.ts.map +1 -0
  221. package/build/core/server/connectionManager.js +240 -0
  222. package/build/core/server/connectionManager.js.map +1 -0
  223. package/build/core/server/mcpServerLifecycleManager.d.ts +55 -0
  224. package/build/core/server/mcpServerLifecycleManager.d.ts.map +1 -0
  225. package/build/core/server/mcpServerLifecycleManager.js +272 -0
  226. package/build/core/server/mcpServerLifecycleManager.js.map +1 -0
  227. package/build/core/server/serverManager.d.ts +56 -56
  228. package/build/core/server/serverManager.d.ts.map +1 -1
  229. package/build/core/server/serverManager.js +160 -431
  230. package/build/core/server/serverManager.js.map +1 -1
  231. package/build/core/server/templateConfigurationManager.d.ts +51 -0
  232. package/build/core/server/templateConfigurationManager.d.ts.map +1 -0
  233. package/build/core/server/templateConfigurationManager.js +160 -0
  234. package/build/core/server/templateConfigurationManager.js.map +1 -0
  235. package/build/core/server/templateServerManager.d.ts +92 -0
  236. package/build/core/server/templateServerManager.d.ts.map +1 -0
  237. package/build/core/server/templateServerManager.js +367 -0
  238. package/build/core/server/templateServerManager.js.map +1 -0
  239. package/build/core/tools/handlers/serverManagementHandler.d.ts +51 -1
  240. package/build/core/tools/handlers/serverManagementHandler.d.ts.map +1 -1
  241. package/build/core/tools/handlers/serverManagementHandler.js +42 -0
  242. package/build/core/tools/handlers/serverManagementHandler.js.map +1 -1
  243. package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts +11 -1
  244. package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts.map +1 -1
  245. package/build/core/tools/internal/adapters/installation/types.d.ts +2 -4
  246. package/build/core/tools/internal/adapters/installation/types.d.ts.map +1 -1
  247. package/build/core/tools/internal/adapters/installationAdapter.d.ts +2 -4
  248. package/build/core/tools/internal/adapters/installationAdapter.d.ts.map +1 -1
  249. package/build/core/tools/internal/adapters/installationAdapter.js.map +1 -1
  250. package/build/core/tools/internal/adapters/management/managementAdapter.d.ts +2 -5
  251. package/build/core/tools/internal/adapters/management/managementAdapter.d.ts.map +1 -1
  252. package/build/core/tools/internal/adapters/management/managementAdapter.js.map +1 -1
  253. package/build/core/tools/internal/adapters/management/types.d.ts +8 -4
  254. package/build/core/tools/internal/adapters/management/types.d.ts.map +1 -1
  255. package/build/core/tools/internal/index.d.ts +0 -31
  256. package/build/core/tools/internal/index.d.ts.map +1 -1
  257. package/build/core/tools/internal/index.js +4 -3
  258. package/build/core/tools/internal/index.js.map +1 -1
  259. package/build/core/tools/internal/schemas/index.d.ts +3 -3
  260. package/build/core/tools/internal/schemas/management.d.ts +3 -3
  261. package/build/core/types/server.d.ts +19 -0
  262. package/build/core/types/server.d.ts.map +1 -1
  263. package/build/core/types/server.js.map +1 -1
  264. package/build/core/types/transport.d.ts +178 -0
  265. package/build/core/types/transport.d.ts.map +1 -1
  266. package/build/core/types/transport.js +34 -0
  267. package/build/core/types/transport.js.map +1 -1
  268. package/build/core/validation/CustomJsonSchemaValidator.d.ts.map +1 -1
  269. package/build/core/validation/CustomJsonSchemaValidator.js +4 -3
  270. package/build/core/validation/CustomJsonSchemaValidator.js.map +1 -1
  271. package/build/domains/discovery/appPresets.d.ts.map +1 -1
  272. package/build/domains/discovery/appPresets.js +9 -7
  273. package/build/domains/discovery/appPresets.js.map +1 -1
  274. package/build/domains/installation/configurators/cliArgsConfigurator.d.ts.map +1 -1
  275. package/build/domains/installation/configurators/cliArgsConfigurator.js +8 -4
  276. package/build/domains/installation/configurators/cliArgsConfigurator.js.map +1 -1
  277. package/build/domains/installation/configurators/envVarConfigurator.d.ts.map +1 -1
  278. package/build/domains/installation/configurators/envVarConfigurator.js +8 -4
  279. package/build/domains/installation/configurators/envVarConfigurator.js.map +1 -1
  280. package/build/domains/installation/configurators/tagsConfigurator.d.ts +2 -4
  281. package/build/domains/installation/configurators/tagsConfigurator.d.ts.map +1 -1
  282. package/build/domains/installation/configurators/tagsConfigurator.js +4 -7
  283. package/build/domains/installation/configurators/tagsConfigurator.js.map +1 -1
  284. package/build/domains/installation/validators/conflictDetector.d.ts +6 -4
  285. package/build/domains/installation/validators/conflictDetector.d.ts.map +1 -1
  286. package/build/domains/installation/validators/conflictDetector.js +0 -3
  287. package/build/domains/installation/validators/conflictDetector.js.map +1 -1
  288. package/build/domains/preset/manager/presetManager.js +1 -1
  289. package/build/domains/preset/manager/presetManager.js.map +1 -1
  290. package/build/domains/preset/parsers/tagQueryEvaluator.d.ts +8 -4
  291. package/build/domains/preset/parsers/tagQueryEvaluator.d.ts.map +1 -1
  292. package/build/domains/preset/parsers/tagQueryEvaluator.js.map +1 -1
  293. package/build/domains/preset/services/presetErrorHandler.d.ts +0 -7
  294. package/build/domains/preset/services/presetErrorHandler.d.ts.map +1 -1
  295. package/build/domains/preset/services/presetErrorHandler.js +10 -37
  296. package/build/domains/preset/services/presetErrorHandler.js.map +1 -1
  297. package/build/domains/registry/cacheManager.d.ts +11 -1
  298. package/build/domains/registry/cacheManager.d.ts.map +1 -1
  299. package/build/domains/registry/cacheManager.js +21 -3
  300. package/build/domains/registry/cacheManager.js.map +1 -1
  301. package/build/domains/registry/formatters/serverDetailFormatter.d.ts.map +1 -1
  302. package/build/domains/registry/formatters/serverDetailFormatter.js +57 -8
  303. package/build/domains/registry/formatters/serverDetailFormatter.js.map +1 -1
  304. package/build/domains/registry/formatters/versionsFormatter.d.ts.map +1 -1
  305. package/build/domains/registry/formatters/versionsFormatter.js +8 -3
  306. package/build/domains/registry/formatters/versionsFormatter.js.map +1 -1
  307. package/build/logger/logger.d.ts +8 -4
  308. package/build/logger/logger.d.ts.map +1 -1
  309. package/build/logger/logger.js.map +1 -1
  310. package/build/server.d.ts +2 -1
  311. package/build/server.d.ts.map +1 -1
  312. package/build/server.js +16 -7
  313. package/build/server.js.map +1 -1
  314. package/build/template/handlebarsTemplateRenderer.d.ts +34 -0
  315. package/build/template/handlebarsTemplateRenderer.d.ts.map +1 -0
  316. package/build/template/handlebarsTemplateRenderer.js +92 -0
  317. package/build/template/handlebarsTemplateRenderer.js.map +1 -0
  318. package/build/template/index.d.ts +2 -0
  319. package/build/template/index.d.ts.map +1 -0
  320. package/build/template/index.js +3 -0
  321. package/build/template/index.js.map +1 -0
  322. package/build/transport/http/middlewares/securityMiddleware.js +1 -1
  323. package/build/transport/http/middlewares/securityMiddleware.js.map +1 -1
  324. package/build/transport/http/restorableStreamableTransport.d.ts +8 -4
  325. package/build/transport/http/restorableStreamableTransport.d.ts.map +1 -1
  326. package/build/transport/http/restorableStreamableTransport.js.map +1 -1
  327. package/build/transport/http/routes/sseRoutes.d.ts.map +1 -1
  328. package/build/transport/http/routes/sseRoutes.js +15 -0
  329. package/build/transport/http/routes/sseRoutes.js.map +1 -1
  330. package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
  331. package/build/transport/http/routes/streamableHttpRoutes.js +88 -12
  332. package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
  333. package/build/transport/http/server.d.ts +1 -0
  334. package/build/transport/http/server.d.ts.map +1 -1
  335. package/build/transport/http/server.js +1 -0
  336. package/build/transport/http/server.js.map +1 -1
  337. package/build/transport/http/storage/streamableSessionRepository.d.ts.map +1 -1
  338. package/build/transport/http/storage/streamableSessionRepository.js +2 -0
  339. package/build/transport/http/storage/streamableSessionRepository.js.map +1 -1
  340. package/build/transport/http/utils/contextExtractor.d.ts +23 -0
  341. package/build/transport/http/utils/contextExtractor.d.ts.map +1 -0
  342. package/build/transport/http/utils/contextExtractor.js +58 -0
  343. package/build/transport/http/utils/contextExtractor.js.map +1 -0
  344. package/build/transport/restartableStdioTransport.d.ts +8 -4
  345. package/build/transport/restartableStdioTransport.d.ts.map +1 -1
  346. package/build/transport/restartableStdioTransport.js.map +1 -1
  347. package/build/transport/stdioProxyTransport.d.ts +29 -0
  348. package/build/transport/stdioProxyTransport.d.ts.map +1 -1
  349. package/build/transport/stdioProxyTransport.js +236 -53
  350. package/build/transport/stdioProxyTransport.js.map +1 -1
  351. package/build/transport/transportFactory.d.ts +8 -0
  352. package/build/transport/transportFactory.d.ts.map +1 -1
  353. package/build/transport/transportFactory.js +47 -0
  354. package/build/transport/transportFactory.js.map +1 -1
  355. package/build/types/context.d.ts +120 -0
  356. package/build/types/context.d.ts.map +1 -0
  357. package/build/types/context.js +4 -0
  358. package/build/types/context.js.map +1 -0
  359. package/build/types/validation.d.ts +30 -0
  360. package/build/types/validation.d.ts.map +1 -0
  361. package/build/types/validation.js +5 -0
  362. package/build/types/validation.js.map +1 -0
  363. package/build/utils/client/clientInfoExtractor.d.ts +26 -0
  364. package/build/utils/client/clientInfoExtractor.d.ts.map +1 -0
  365. package/build/utils/client/clientInfoExtractor.js +65 -0
  366. package/build/utils/client/clientInfoExtractor.js.map +1 -0
  367. package/build/utils/core/errorHandling.d.ts +9 -5
  368. package/build/utils/core/errorHandling.d.ts.map +1 -1
  369. package/build/utils/core/errorHandling.js.map +1 -1
  370. package/build/utils/core/parsing.d.ts +8 -4
  371. package/build/utils/core/parsing.d.ts.map +1 -1
  372. package/build/utils/core/parsing.js.map +1 -1
  373. package/build/utils/crypto.d.ts +10 -0
  374. package/build/utils/crypto.d.ts.map +1 -0
  375. package/build/utils/crypto.js +20 -0
  376. package/build/utils/crypto.js.map +1 -0
  377. package/build/utils/ui/interactiveSelector.d.ts +16 -6
  378. package/build/utils/ui/interactiveSelector.d.ts.map +1 -1
  379. package/build/utils/ui/interactiveSelector.js +7 -31
  380. package/build/utils/ui/interactiveSelector.js.map +1 -1
  381. package/build/utils/ui/pagination.d.ts +6 -2
  382. package/build/utils/ui/pagination.d.ts.map +1 -1
  383. package/build/utils/ui/pagination.js.map +1 -1
  384. package/build/utils/ui/printer.d.ts +76 -0
  385. package/build/utils/ui/printer.d.ts.map +1 -0
  386. package/build/utils/ui/printer.js +172 -0
  387. package/build/utils/ui/printer.js.map +1 -0
  388. package/build/utils/ui/spinner.d.ts +19 -0
  389. package/build/utils/ui/spinner.d.ts.map +1 -0
  390. package/build/utils/ui/spinner.js +51 -0
  391. package/build/utils/ui/spinner.js.map +1 -0
  392. package/build/utils/ui/table.d.ts +16 -0
  393. package/build/utils/ui/table.d.ts.map +1 -0
  394. package/build/utils/ui/table.js +70 -0
  395. package/build/utils/ui/table.js.map +1 -0
  396. package/build/utils/validation/validationHelpers.d.ts +7 -3
  397. package/build/utils/validation/validationHelpers.d.ts.map +1 -1
  398. package/build/utils/validation/validationHelpers.js.map +1 -1
  399. package/package.json +2 -1
@@ -0,0 +1,18 @@
1
+ import { EventEmitter } from 'events';
2
+ interface ConfigLoader {
3
+ getConfigFilePath: () => string;
4
+ checkFileModified: () => boolean;
5
+ isReloadEnabled: () => boolean;
6
+ }
7
+ export declare class ConfigWatcher extends EventEmitter {
8
+ private configWatcher;
9
+ private debounceTimer;
10
+ private configFilePath;
11
+ private loader;
12
+ constructor(configFilePath: string, loader: ConfigLoader);
13
+ startWatching(): void;
14
+ stopWatching(): void;
15
+ private debouncedReloadConfig;
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=configWatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configWatcher.d.ts","sourceRoot":"","sources":["../../src/config/configWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAOtC,UAAU,YAAY;IACpB,iBAAiB,EAAE,MAAM,MAAM,CAAC;IAChC,iBAAiB,EAAE,MAAM,OAAO,CAAC;IACjC,eAAe,EAAE,MAAM,OAAO,CAAC;CAChC;AAED,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,aAAa,CAA8C;IACnE,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,MAAM,CAAe;gBAEjB,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY;IAMjD,aAAa,IAAI,IAAI;IA+CrB,YAAY,IAAI,IAAI;IAW3B,OAAO,CAAC,qBAAqB;CAc9B"}
@@ -0,0 +1,78 @@
1
+ import { EventEmitter } from 'events';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { AgentConfigManager } from '../core/server/agentConfig.js';
5
+ import logger, { debugIf } from '../logger/logger.js';
6
+ export class ConfigWatcher extends EventEmitter {
7
+ configWatcher = null;
8
+ debounceTimer = null;
9
+ configFilePath;
10
+ loader;
11
+ constructor(configFilePath, loader) {
12
+ super();
13
+ this.configFilePath = configFilePath;
14
+ this.loader = loader;
15
+ }
16
+ startWatching() {
17
+ if (!this.loader.isReloadEnabled()) {
18
+ logger.info('Configuration hot-reload is disabled, skipping file watcher setup');
19
+ return;
20
+ }
21
+ if (this.configWatcher) {
22
+ logger.warn('File watcher already started, ignoring duplicate call');
23
+ return;
24
+ }
25
+ try {
26
+ const configDir = path.dirname(this.configFilePath);
27
+ const configFileName = path.basename(this.configFilePath);
28
+ // Verify directory exists before watching
29
+ if (!fs.existsSync(configDir)) {
30
+ throw new Error(`Configuration directory does not exist: ${configDir}`);
31
+ }
32
+ this.configWatcher = fs.watch(configDir, (eventType, filename) => {
33
+ debugIf(() => ({
34
+ message: 'Directory change detected',
35
+ meta: { eventType, filename, configDir, configFileName },
36
+ }));
37
+ const isConfigFileEvent = filename === configFileName ||
38
+ (filename && filename.startsWith(configFileName)) ||
39
+ (eventType === 'rename' && filename && filename.includes(path.parse(configFileName).name));
40
+ if (isConfigFileEvent || this.loader.checkFileModified()) {
41
+ debugIf(() => ({
42
+ message: 'Configuration file change detected, debouncing reload',
43
+ meta: { eventType, filename },
44
+ }));
45
+ this.debouncedReloadConfig();
46
+ }
47
+ });
48
+ logger.info(`Started watching configuration directory: ${configDir} for file: ${configFileName}`);
49
+ }
50
+ catch (error) {
51
+ const errorMsg = `Failed to start watching configuration file: ${error instanceof Error ? error.message : String(error)}`;
52
+ logger.error(errorMsg);
53
+ throw new Error(errorMsg);
54
+ }
55
+ }
56
+ stopWatching() {
57
+ this.configWatcher?.close();
58
+ this.configWatcher = null;
59
+ logger.info('Stopped watching configuration file');
60
+ if (this.debounceTimer) {
61
+ clearTimeout(this.debounceTimer);
62
+ this.debounceTimer = null;
63
+ }
64
+ }
65
+ debouncedReloadConfig() {
66
+ if (this.debounceTimer) {
67
+ clearTimeout(this.debounceTimer);
68
+ }
69
+ const agentConfig = AgentConfigManager.getInstance();
70
+ const debounceDelayMs = agentConfig.get('configReload').debounceMs;
71
+ this.debounceTimer = setTimeout(() => {
72
+ logger.info('Debounce period completed, reloading configuration...');
73
+ this.emit('reload');
74
+ this.debounceTimer = null;
75
+ }, debounceDelayMs);
76
+ }
77
+ }
78
+ //# sourceMappingURL=configWatcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configWatcher.js","sourceRoot":"","sources":["../../src/config/configWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQxD,MAAM,OAAO,aAAc,SAAQ,YAAY;IACrC,aAAa,GAAwB,IAAI,CAAC;IAC1C,aAAa,GAAyC,IAAI,CAAC;IAC3D,cAAc,CAAS;IACvB,MAAM,CAAe;IAE7B,YAAY,cAAsB,EAAE,MAAoB;QACtD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEM,aAAa;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;YACjF,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;YACrE,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACpD,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAE1D,0CAA0C;YAC1C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE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YACvB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAEM,YAAY;QACjB,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,CAAC;QAC5B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QAEnD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACjC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;IAEO,qBAAqB;QAC3B,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACnC,CAAC;QAED,MAAM,WAAW,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QACrD,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC;QAEnE,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;YACrE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACpB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC,EAAE,eAAe,CAAC,CAAC;IACtB,CAAC;CACF"}
@@ -4,7 +4,21 @@ import { z } from 'zod';
4
4
  *
5
5
  * This file allows projects to specify default connection settings
6
6
  * that will be automatically detected by the proxy command.
7
+ *
8
+ * Extended to support context collection and template parameters.
7
9
  */
10
+ /**
11
+ * Context configuration schema
12
+ */
13
+ export declare const ContextConfigSchema: z.ZodObject<{
14
+ projectId: z.ZodOptional<z.ZodString>;
15
+ environment: z.ZodOptional<z.ZodString>;
16
+ team: z.ZodOptional<z.ZodString>;
17
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
18
+ envPrefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ includeGit: z.ZodDefault<z.ZodBoolean>;
20
+ sanitizePaths: z.ZodDefault<z.ZodBoolean>;
21
+ }, z.core.$strip>;
8
22
  /**
9
23
  * Zod schema for .1mcprc validation
10
24
  */
@@ -12,7 +26,28 @@ export declare const ProjectConfigSchema: z.ZodObject<{
12
26
  preset: z.ZodOptional<z.ZodString>;
13
27
  tags: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
14
28
  filter: z.ZodOptional<z.ZodString>;
29
+ context: z.ZodOptional<z.ZodObject<{
30
+ projectId: z.ZodOptional<z.ZodString>;
31
+ environment: z.ZodOptional<z.ZodString>;
32
+ team: z.ZodOptional<z.ZodString>;
33
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
34
+ envPrefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
+ includeGit: z.ZodDefault<z.ZodBoolean>;
36
+ sanitizePaths: z.ZodDefault<z.ZodBoolean>;
37
+ }, z.core.$strip>>;
15
38
  }, z.core.$strip>;
39
+ /**
40
+ * TypeScript interface for context configuration
41
+ */
42
+ export interface ContextConfig {
43
+ projectId?: string;
44
+ environment?: string;
45
+ team?: string;
46
+ custom?: Record<string, unknown>;
47
+ envPrefixes?: string[];
48
+ includeGit?: boolean;
49
+ sanitizePaths?: boolean;
50
+ }
16
51
  /**
17
52
  * TypeScript interface for project configuration
18
53
  */
@@ -20,9 +55,14 @@ export interface ProjectConfig {
20
55
  preset?: string;
21
56
  tags?: string | string[];
22
57
  filter?: string;
58
+ context?: ContextConfig;
23
59
  }
24
60
  /**
25
61
  * Validate project configuration
26
62
  */
27
63
  export declare function validateProjectConfig(data: unknown): ProjectConfig;
64
+ /**
65
+ * Validate context configuration
66
+ */
67
+ export declare function validateContextConfig(data: unknown): ContextConfig;
28
68
  //# sourceMappingURL=projectConfigTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"projectConfigTypes.d.ts","sourceRoot":"","sources":["../../src/config/projectConfigTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,CAElE"}
1
+ {"version":3,"file":"projectConfigTypes.d.ts","sourceRoot":"","sources":["../../src/config/projectConfigTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;iBAQ9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;iBAK9B,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,CAElE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,CAElE"}
@@ -4,7 +4,21 @@ import { z } from 'zod';
4
4
  *
5
5
  * This file allows projects to specify default connection settings
6
6
  * that will be automatically detected by the proxy command.
7
+ *
8
+ * Extended to support context collection and template parameters.
9
+ */
10
+ /**
11
+ * Context configuration schema
7
12
  */
13
+ export const ContextConfigSchema = z.object({
14
+ projectId: z.string().optional(),
15
+ environment: z.string().optional(),
16
+ team: z.string().optional(),
17
+ custom: z.record(z.string(), z.unknown()).optional(),
18
+ envPrefixes: z.array(z.string()).optional(),
19
+ includeGit: z.boolean().default(true),
20
+ sanitizePaths: z.boolean().default(true),
21
+ });
8
22
  /**
9
23
  * Zod schema for .1mcprc validation
10
24
  */
@@ -12,6 +26,7 @@ export const ProjectConfigSchema = z.object({
12
26
  preset: z.string().optional(),
13
27
  tags: z.union([z.string(), z.array(z.string())]).optional(),
14
28
  filter: z.string().optional(),
29
+ context: ContextConfigSchema.optional(),
15
30
  });
16
31
  /**
17
32
  * Validate project configuration
@@ -19,4 +34,10 @@ export const ProjectConfigSchema = z.object({
19
34
  export function validateProjectConfig(data) {
20
35
  return ProjectConfigSchema.parse(data);
21
36
  }
37
+ /**
38
+ * Validate context configuration
39
+ */
40
+ export function validateContextConfig(data) {
41
+ return ContextConfigSchema.parse(data);
42
+ }
22
43
  //# sourceMappingURL=projectConfigTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"projectConfigTypes.js","sourceRoot":"","sources":["../../src/config/projectConfigTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAA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;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,OAAO,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAyBH;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAa;IACjD,OAAO,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAa;IACjD,OAAO,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { ContextData } from '../types/context.js';
2
+ import { TemplateLoadResult } from './types.js';
3
+ export declare class TemplateProcessor {
4
+ private templateProcessingErrors;
5
+ private processedTemplates;
6
+ private lastContextHash?;
7
+ loadConfigWithTemplates(rawConfig: unknown, context?: ContextData): Promise<TemplateLoadResult>;
8
+ private processTemplates;
9
+ private hashContext;
10
+ getTemplateProcessingErrors(): string[];
11
+ hasTemplateProcessingErrors(): boolean;
12
+ clearTemplateCache(): void;
13
+ }
14
+ //# sourceMappingURL=templateProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateProcessor.d.ts","sourceRoot":"","sources":["../../src/config/templateProcessor.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,wBAAwB,CAAgB;IAChD,OAAO,CAAC,kBAAkB,CAAuC;IACjE,OAAO,CAAC,eAAe,CAAC,CAAS;IAEpB,uBAAuB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAmE9F,gBAAgB;IAgC9B,OAAO,CAAC,WAAW;IAIZ,2BAA2B,IAAI,MAAM,EAAE;IAIvC,2BAA2B,IAAI,OAAO;IAItC,kBAAkB,IAAI,IAAI;CAKlC"}
@@ -0,0 +1,102 @@
1
+ import { createHash } from 'crypto';
2
+ import { mcpServerConfigSchema, } from '../core/types/transport.js';
3
+ import logger, { debugIf } from '../logger/logger.js';
4
+ import { HandlebarsTemplateRenderer } from '../template/handlebarsTemplateRenderer.js';
5
+ export class TemplateProcessor {
6
+ templateProcessingErrors = [];
7
+ processedTemplates = {};
8
+ lastContextHash;
9
+ async loadConfigWithTemplates(rawConfig, context) {
10
+ let config;
11
+ try {
12
+ config = mcpServerConfigSchema.parse(rawConfig);
13
+ }
14
+ catch (error) {
15
+ const errorMessage = error instanceof Error ? error.message : String(error);
16
+ logger.error(`Failed to parse configuration: ${errorMessage}`);
17
+ return {
18
+ staticServers: {},
19
+ templateServers: {},
20
+ errors: [`Configuration parsing failed: ${errorMessage}`],
21
+ };
22
+ }
23
+ const settings = config.templateSettings;
24
+ const staticServers = {};
25
+ for (const [serverName, serverConfig] of Object.entries(config.mcpServers)) {
26
+ staticServers[serverName] = serverConfig;
27
+ }
28
+ let templateServers = {};
29
+ let errors = [];
30
+ if (config.mcpTemplates) {
31
+ if (context) {
32
+ const contextHash = this.hashContext(context);
33
+ if (settings?.cacheContext &&
34
+ this.lastContextHash === contextHash &&
35
+ Object.keys(this.processedTemplates).length > 0) {
36
+ templateServers = this.processedTemplates;
37
+ errors = this.templateProcessingErrors;
38
+ }
39
+ else {
40
+ const result = await this.processTemplates(config.mcpTemplates, context, settings);
41
+ templateServers = result.servers;
42
+ errors = result.errors;
43
+ if (settings?.cacheContext) {
44
+ this.processedTemplates = templateServers;
45
+ this.templateProcessingErrors = errors;
46
+ this.lastContextHash = contextHash;
47
+ }
48
+ }
49
+ }
50
+ }
51
+ const conflictingServers = [];
52
+ for (const staticServerName of Object.keys(staticServers)) {
53
+ if (staticServerName in templateServers) {
54
+ conflictingServers.push(staticServerName);
55
+ delete staticServers[staticServerName];
56
+ }
57
+ }
58
+ if (conflictingServers.length > 0) {
59
+ logger.warn(`Ignoring ${conflictingServers.length} static server(s) that conflict with template servers: ${conflictingServers.join(', ')}`);
60
+ }
61
+ return { staticServers, templateServers, errors };
62
+ }
63
+ async processTemplates(templates, context, settings) {
64
+ const errors = [];
65
+ const templateRenderer = new HandlebarsTemplateRenderer();
66
+ const processedServers = {};
67
+ for (const [serverName, templateConfig] of Object.entries(templates)) {
68
+ try {
69
+ const processedConfig = templateRenderer.renderTemplate(templateConfig, context);
70
+ processedServers[serverName] = processedConfig;
71
+ debugIf(() => ({
72
+ message: 'Template processed successfully',
73
+ meta: { serverName },
74
+ }));
75
+ }
76
+ catch (error) {
77
+ const errorMsg = `Template processing failed for ${serverName}: ${error instanceof Error ? error.message : String(error)}`;
78
+ errors.push(errorMsg);
79
+ logger.error(errorMsg);
80
+ if (settings?.failureMode === 'graceful') {
81
+ processedServers[serverName] = templateConfig;
82
+ }
83
+ }
84
+ }
85
+ return { servers: processedServers, errors };
86
+ }
87
+ hashContext(context) {
88
+ return createHash('sha256').update(JSON.stringify(context)).digest('hex');
89
+ }
90
+ getTemplateProcessingErrors() {
91
+ return [...this.templateProcessingErrors];
92
+ }
93
+ hasTemplateProcessingErrors() {
94
+ return this.templateProcessingErrors.length > 0;
95
+ }
96
+ clearTemplateCache() {
97
+ this.processedTemplates = {};
98
+ this.lastContextHash = undefined;
99
+ this.templateProcessingErrors = [];
100
+ }
101
+ }
102
+ //# sourceMappingURL=templateProcessor.js.map
@@ -0,0 +1 @@
1
+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ACH,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC/C,CAAC;IAEO,WAAW,CAAC,OAAoB;QACtC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,CAAC;IAEM,2BAA2B;QAChC,OAAO,CAAC,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IAEM,2BAA2B;QAChC,OAAO,IAAI,CAAC,wBAAwB,CAAC,MAAM,GAAG,CAAC,CAAC;IAClD,CAAC;IAEM,kBAAkB;QACvB,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,CAAC,wBAAwB,GAAG,EAAE,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import type { MCPServerParams } from '../core/types/transport.js';
2
+ export declare enum ConfigChangeType {
3
+ ADDED = "added",
4
+ REMOVED = "removed",
5
+ MODIFIED = "modified"
6
+ }
7
+ export declare const CONFIG_EVENTS: {
8
+ readonly CONFIG_CHANGED: "configChanged";
9
+ readonly SERVER_ADDED: "serverAdded";
10
+ readonly SERVER_REMOVED: "serverRemoved";
11
+ readonly METADATA_UPDATED: "metadataUpdated";
12
+ readonly VALIDATION_ERROR: "validationError";
13
+ };
14
+ /**
15
+ * Configuration change event with discriminated union to prevent invalid states.
16
+ * - Added servers don't have fieldsChanged
17
+ * - Removed servers don't have fieldsChanged
18
+ * - Modified servers must have fieldsChanged
19
+ */
20
+ export type ConfigChange = {
21
+ serverName: string;
22
+ type: ConfigChangeType.ADDED;
23
+ } | {
24
+ serverName: string;
25
+ type: ConfigChangeType.REMOVED;
26
+ } | {
27
+ serverName: string;
28
+ type: ConfigChangeType.MODIFIED;
29
+ fieldsChanged: readonly string[];
30
+ };
31
+ export interface TemplateLoadResult {
32
+ staticServers: Record<string, MCPServerParams>;
33
+ templateServers: Record<string, MCPServerParams>;
34
+ errors: string[];
35
+ }
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAC,KAAK,CAAA;CAAE,GACpD;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAA;CAAE,GACtD;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAC,QAAQ,CAAC;IAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAE9F,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC/C,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACjD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
@@ -0,0 +1,14 @@
1
+ export var ConfigChangeType;
2
+ (function (ConfigChangeType) {
3
+ ConfigChangeType["ADDED"] = "added";
4
+ ConfigChangeType["REMOVED"] = "removed";
5
+ ConfigChangeType["MODIFIED"] = "modified";
6
+ })(ConfigChangeType || (ConfigChangeType = {}));
7
+ export const CONFIG_EVENTS = {
8
+ CONFIG_CHANGED: 'configChanged',
9
+ SERVER_ADDED: 'serverAdded',
10
+ SERVER_REMOVED: 'serverRemoved',
11
+ METADATA_UPDATED: 'metadataUpdated',
12
+ VALIDATION_ERROR: 'validationError',
13
+ };
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,uCAAmB,CAAA;IACnB,yCAAqB,CAAA;AACvB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,cAAc,EAAE,eAAe;IAC/B,YAAY,EAAE,aAAa;IAC3B,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,iBAAiB;IACnC,gBAAgB,EAAE,iBAAiB;CAC3B,CAAC"}
@@ -5,7 +5,7 @@ import { ClientCapabilities, ServerCapabilities } from '@modelcontextprotocol/sd
5
5
  export declare const MCP_CONFIG_FILE = "mcp.json";
6
6
  export declare const MCP_INSTRUCTIONS_TEMPLATE_FILE = "instructions-template.md";
7
7
  export declare const MCP_SERVER_NAME = "1mcp";
8
- export declare const MCP_SERVER_VERSION = "0.28.1";
8
+ export declare const MCP_SERVER_VERSION = "0.29.0-beta2";
9
9
  export declare const MCP_URI_SEPARATOR = "_1mcp_";
10
10
  export declare const MCP_SERVER_CAPABILITIES: ServerCapabilities;
11
11
  export declare const MCP_CLIENT_CAPABILITIES: ClientCapabilities;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/constants/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAG5F,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,eAAO,MAAM,8BAA8B,6BAA6B,CAAC;AACzE,eAAO,MAAM,eAAe,SAAS,CAAC;AACtC,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAE3C,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,eAAO,MAAM,uBAAuB,EAAE,kBAYrC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,kBAMrC,CAAC"}
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/constants/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAG5F,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,eAAO,MAAM,8BAA8B,6BAA6B,CAAC;AACzE,eAAO,MAAM,eAAe,SAAS,CAAC;AACtC,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,eAAO,MAAM,uBAAuB,EAAE,kBAYrC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,kBAMrC,CAAC"}
@@ -2,7 +2,7 @@
2
2
  export const MCP_CONFIG_FILE = 'mcp.json';
3
3
  export const MCP_INSTRUCTIONS_TEMPLATE_FILE = 'instructions-template.md';
4
4
  export const MCP_SERVER_NAME = '1mcp';
5
- export const MCP_SERVER_VERSION = '0.28.1';
5
+ export const MCP_SERVER_VERSION = '0.29.0-beta2';
6
6
  export const MCP_URI_SEPARATOR = '_1mcp_';
7
7
  export const MCP_SERVER_CAPABILITIES = {
8
8
  completions: {},
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/constants/mcp.ts"],"names":[],"mappings":"AAKA,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;AAC1C,MAAM,CAAC,MAAM,8BAA8B,GAAG,0BAA0B,CAAC;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAE1C,MAAM,CAAC,MAAM,uBAAuB,GAAuB;IACzD,WAAW,EAAE,EAAE;IACf,SAAS,EAAE;QACT,WAAW,EAAE,IAAI;KAClB;IACD,KAAK,EAAE;QACL,WAAW,EAAE,IAAI;KAClB;IACD,OAAO,EAAE;QACP,WAAW,EAAE,IAAI;KAClB;IACD,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAuB;IACzD,KAAK,EAAE;QACL,WAAW,EAAE,KAAK;KACnB;IACD,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,EAAE;CAChB,CAAC"}
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/constants/mcp.ts"],"names":[],"mappings":"AAKA,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;AAC1C,MAAM,CAAC,MAAM,8BAA8B,GAAG,0BAA0B,CAAC;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAE1C,MAAM,CAAC,MAAM,uBAAuB,GAAuB;IACzD,WAAW,EAAE,EAAE;IACf,SAAS,EAAE;QACT,WAAW,EAAE,IAAI;KAClB;IACD,KAAK,EAAE;QACL,WAAW,EAAE,IAAI;KAClB;IACD,OAAO,EAAE;QACP,WAAW,EAAE,IAAI;KAClB;IACD,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAuB;IACzD,KAAK,EAAE;QACL,WAAW,EAAE,KAAK;KACnB;IACD,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,EAAE;CAChB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
+ export declare class ClientFactory {
3
+ createClient(): Client;
4
+ createClientInstance(): Client;
5
+ createPooledClientInstance(): Client;
6
+ }
7
+ //# sourceMappingURL=clientFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientFactory.d.ts","sourceRoot":"","sources":["../../../src/core/client/clientFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAWnE,qBAAa,aAAa;IACjB,YAAY,IAAI,MAAM;IAgBtB,oBAAoB,IAAI,MAAM;IAU9B,0BAA0B,IAAI,MAAM;CAW5C"}
@@ -0,0 +1,36 @@
1
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
+ import { MCP_CLIENT_CAPABILITIES, MCP_SERVER_NAME, MCP_SERVER_VERSION } from '../../constants.js';
3
+ import { CustomJsonSchemaValidator } from '../../core/validation/CustomJsonSchemaValidator.js';
4
+ const DEBOUNCED_NOTIFICATION_METHODS = [
5
+ 'notifications/tools/list_changed',
6
+ 'notifications/resources/list_changed',
7
+ 'notifications/prompts/list_changed',
8
+ ];
9
+ export class ClientFactory {
10
+ createClient() {
11
+ const customValidator = new CustomJsonSchemaValidator();
12
+ return new Client({
13
+ name: MCP_SERVER_NAME,
14
+ version: MCP_SERVER_VERSION,
15
+ }, {
16
+ capabilities: MCP_CLIENT_CAPABILITIES,
17
+ jsonSchemaValidator: customValidator,
18
+ debouncedNotificationMethods: [...DEBOUNCED_NOTIFICATION_METHODS],
19
+ });
20
+ }
21
+ createClientInstance() {
22
+ return new Client({
23
+ name: MCP_SERVER_NAME,
24
+ version: MCP_SERVER_VERSION,
25
+ }, undefined);
26
+ }
27
+ createPooledClientInstance() {
28
+ return new Client({
29
+ name: '1mcp-client',
30
+ version: '1.0.0',
31
+ }, {
32
+ capabilities: {},
33
+ });
34
+ }
35
+ }
36
+ //# sourceMappingURL=clientFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientFactory.js","sourceRoot":"","sources":["../../../src/core/client/clientFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,yBAAyB,EAAE,MAAM,mDAAmD,CAAC;AAE9F,MAAM,8BAA8B,GAAG;IACrC,kCAAkC;IAClC,sCAAsC;IACtC,oCAAoC;CAC5B,CAAC;AAEX,MAAM,OAAO,aAAa;IACjB,YAAY;QACjB,MAAM,eAAe,GAAG,IAAI,yBAAyB,EAAE,CAAC;QAExD,OAAO,IAAI,MAAM,CACf;YACE,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,kBAAkB;SAC5B,EACD;YACE,YAAY,EAAE,uBAAuB;YACrC,mBAAmB,EAAE,eAAe;YACpC,4BAA4B,EAAE,CAAC,GAAG,8BAA8B,CAAC;SAClE,CACF,CAAC;IACJ,CAAC;IAEM,oBAAoB;QACzB,OAAO,IAAI,MAAM,CACf;YACE,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,kBAAkB;SAC5B,EACD,SAAS,CACV,CAAC;IACJ,CAAC;IAEM,0BAA0B;QAC/B,OAAO,IAAI,MAAM,CACf;YACE,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,OAAO;SACjB,EACD;YACE,YAAY,EAAE,EAAE;SACjB,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -1,129 +1,41 @@
1
1
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
2
  import { InstructionAggregator } from '../../core/instructions/instructionAggregator.js';
3
3
  import { AuthProviderTransport, OperationOptions, OutboundConnection, OutboundConnections, ServerCapability } from '../../core/types/index.js';
4
+ import { OAuthRequiredError } from './types.js';
5
+ export { OAuthRequiredError };
4
6
  export declare class ClientManager {
5
7
  private static instance;
6
8
  private outboundConns;
7
9
  private transports;
8
10
  private connectionSemaphore;
9
11
  private instructionAggregator?;
12
+ private clientFactory;
13
+ private connectionHandler;
14
+ private oauthFlowHandler;
15
+ private transportRecreator;
10
16
  private constructor();
11
17
  static getOrCreateInstance(): ClientManager;
12
18
  static get current(): ClientManager;
13
19
  static resetInstance(): void;
14
- /**
15
- * Set the instruction aggregator instance
16
- * @param aggregator The instruction aggregator to use
17
- */
18
20
  setInstructionAggregator(aggregator: InstructionAggregator): void;
19
- /**
20
- * Extract and cache instructions from a connected client
21
- * @param name The client name
22
- * @param client The connected client instance
23
- */
24
21
  private extractAndCacheInstructions;
25
- /**
26
- * Creates a new MCP client instance
27
- * @returns A new Client instance
28
- */
29
- private createClient;
30
- /**
31
- * Creates a new MCP client instance for external use (e.g., OAuth testing)
32
- * @returns A new Client instance
33
- */
34
- createClientInstance(): Client;
35
- /**
36
- * Creates client instances for all transports with retry logic
37
- * @param transports Record of transport instances
38
- * @returns Record of client instances
39
- */
22
+ private setupConnectionHandlers;
40
23
  createClients(transports: Record<string, AuthProviderTransport>): Promise<OutboundConnections>;
41
- /**
42
- * Connects a client to its transport with retry logic and OAuth support
43
- * @param client The client to connect
44
- * @param transport The transport to connect to
45
- * @param name The name of the client for logging
46
- * @param abortSignal Optional abort signal to cancel the operation
47
- * @returns The connected client (may be a new instance after retries)
48
- */
49
- private connectWithRetry;
50
- /**
51
- * Gets a client by name with error handling
52
- * @param clientName The name of the client to get
53
- * @returns The client instance
54
- * @throws ClientNotFoundError if the client is not found
55
- */
24
+ private createClient;
25
+ private handleClientCreationError;
56
26
  getClient(clientName: string): OutboundConnection;
57
- /**
58
- * Gets all outbound connections
59
- * @returns Map of all outbound connections
60
- */
61
27
  getClients(): OutboundConnections;
62
- /**
63
- * Creates a single client for async loading (used by McpLoadingManager)
64
- * @param name The name of the client
65
- * @param transport The transport to connect to
66
- * @param abortSignal Optional AbortSignal to cancel the operation
67
- * @returns Promise that resolves when client is connected
68
- */
69
28
  createSingleClient(name: string, transport: AuthProviderTransport, abortSignal?: AbortSignal): Promise<void>;
70
- /**
71
- * Internal method to create and connect a single client
72
- */
73
29
  private createSingleClientInternal;
74
- /**
75
- * Initialize clients storage without connecting (for async loading)
76
- * @param transports Record of transport instances
77
- * @returns Empty connections map (to be populated by async loading)
78
- */
30
+ private handleSingleClientError;
79
31
  initializeClientsAsync(transports: Record<string, AuthProviderTransport>): OutboundConnections;
80
- /**
81
- * Get transport by name (used by loading manager for retries)
82
- * @param name The transport name
83
- * @returns The transport instance or undefined
84
- */
85
32
  getTransport(name: string): AuthProviderTransport | undefined;
86
- /**
87
- * Get all transport names
88
- * @returns Array of transport names
89
- */
90
33
  getTransportNames(): string[];
91
- /**
92
- * Recreates an HTTP or SSE transport with the same configuration
93
- * This is necessary because HTTP transports cannot be restarted once started
94
- * @param transport The original transport to recreate
95
- * @returns A new transport instance with the same configuration
96
- */
97
- private recreateHttpTransport;
98
- /**
99
- * Complete OAuth flow and reconnect client with fresh transport
100
- * This recreates both transport and client since HTTP transports cannot be restarted
101
- * @param serverName The name of the server to reconnect
102
- * @param authorizationCode The OAuth authorization code from the callback
103
- * @throws ClientNotFoundError if the client is not found
104
- * @throws Error if transport does not support OAuth or reconnection fails
105
- */
106
34
  completeOAuthAndReconnect(serverName: string, authorizationCode: string): Promise<void>;
107
- /**
108
- * Executes a client operation with error handling and retry logic
109
- * @param clientName The name of the client to use
110
- * @param operation The operation to execute
111
- * @param options Operation options including timeout and retry settings
112
- * @param requiredCapability The capability required for this operation
113
- */
114
35
  executeClientOperation<T>(clientName: string, operation: (clientInfo: OutboundConnection) => Promise<T>, options?: OperationOptions, requiredCapability?: ServerCapability): Promise<T>;
115
- /**
116
- * Remove a client and close its transport
117
- * @param name The name of the client to remove
118
- */
36
+ createClientInstance(): Client;
37
+ createPooledClientInstance(): Client;
119
38
  removeClient(name: string): Promise<void>;
120
39
  }
121
- /**
122
- * Custom error class for OAuth authorization required
123
- */
124
- export declare class OAuthRequiredError extends Error {
125
- serverName: string;
126
- client: Client;
127
- constructor(serverName: string, client: Client);
128
- }
40
+ export default ClientManager;
129
41
  //# sourceMappingURL=clientManager.d.ts.map