imcp 0.1.7 → 0.1.8-dev

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 (314) hide show
  1. package/dist/cli/commands/install.js +1 -106
  2. package/dist/cli/commands/install.js.map +1 -0
  3. package/dist/cli/commands/list.js +1 -90
  4. package/dist/cli/commands/list.js.map +1 -0
  5. package/dist/cli/commands/pull.js +1 -16
  6. package/dist/cli/commands/pull.js.map +1 -0
  7. package/dist/cli/commands/serve.js +1 -33
  8. package/dist/cli/commands/serve.js.map +1 -0
  9. package/dist/cli/commands/uninstall.js +1 -46
  10. package/dist/cli/commands/uninstall.js.map +1 -0
  11. package/dist/cli/index.js +1 -65
  12. package/dist/cli/index.js.map +1 -0
  13. package/dist/core/installers/clients/BaseClientInstaller.js +1 -282
  14. package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
  15. package/dist/core/installers/clients/ClientInstaller.js +1 -163
  16. package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
  17. package/dist/core/installers/clients/ClientInstallerFactory.js +1 -36
  18. package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
  19. package/dist/core/installers/clients/ClineInstaller.js +1 -30
  20. package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
  21. package/dist/core/installers/clients/ExtensionInstaller.js +1 -151
  22. package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
  23. package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -68
  24. package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
  25. package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -28
  26. package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
  27. package/dist/core/installers/index.js +1 -8
  28. package/dist/core/installers/index.js.map +1 -0
  29. package/dist/core/installers/requirements/BaseInstaller.js +1 -56
  30. package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
  31. package/dist/core/installers/requirements/CommandInstaller.js +1 -213
  32. package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
  33. package/dist/core/installers/requirements/GeneralInstaller.js +1 -126
  34. package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
  35. package/dist/core/installers/requirements/InstallerFactory.js +1 -99
  36. package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
  37. package/dist/core/installers/requirements/NpmInstaller.js +1 -235
  38. package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
  39. package/dist/core/installers/requirements/NugetInstaller.js +1 -188
  40. package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
  41. package/dist/core/installers/requirements/PipInstaller.js +1 -192
  42. package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
  43. package/dist/core/installers/requirements/RequirementInstaller.js +1 -2
  44. package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
  45. package/dist/core/loaders/ConfigurationLoader.js +1 -256
  46. package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
  47. package/dist/core/loaders/ConfigurationProvider.js +1 -383
  48. package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
  49. package/dist/core/loaders/InstallOperationManager.js +1 -310
  50. package/dist/core/loaders/InstallOperationManager.js.map +1 -0
  51. package/dist/core/loaders/ServerSchemaLoader.js +1 -108
  52. package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
  53. package/dist/core/loaders/ServerSchemaProvider.js +1 -89
  54. package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
  55. package/dist/core/loaders/SystemSettingsManager.js +1 -256
  56. package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
  57. package/dist/core/metadatas/constants.js +1 -100
  58. package/dist/core/metadatas/constants.js.map +1 -0
  59. package/dist/core/metadatas/recordingConstants.js +1 -46
  60. package/dist/core/metadatas/recordingConstants.js.map +1 -0
  61. package/dist/core/metadatas/types.js +1 -15
  62. package/dist/core/metadatas/types.js.map +1 -0
  63. package/dist/core/onboard/FeedOnboardService.js +1 -422
  64. package/dist/core/onboard/FeedOnboardService.js.map +1 -0
  65. package/dist/core/onboard/OnboardProcessor.js +1 -333
  66. package/dist/core/onboard/OnboardProcessor.js.map +1 -0
  67. package/dist/core/onboard/OnboardStatus.js +1 -9
  68. package/dist/core/onboard/OnboardStatus.js.map +1 -0
  69. package/dist/core/onboard/OnboardStatusManager.js +1 -360
  70. package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
  71. package/dist/core/validators/FeedValidator.js +1 -133
  72. package/dist/core/validators/FeedValidator.js.map +1 -0
  73. package/dist/core/validators/IServerValidator.js +1 -1
  74. package/dist/core/validators/IServerValidator.js.map +1 -0
  75. package/dist/core/validators/SSEServerValidator.js +1 -38
  76. package/dist/core/validators/SSEServerValidator.js.map +1 -0
  77. package/dist/core/validators/ServerValidatorFactory.js +1 -44
  78. package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
  79. package/dist/core/validators/StdioServerValidator.js +1 -281
  80. package/dist/core/validators/StdioServerValidator.js.map +1 -0
  81. package/dist/index.js +1 -18
  82. package/dist/index.js.map +1 -0
  83. package/dist/services/InstallationService.js +1 -81
  84. package/dist/services/InstallationService.js.map +1 -0
  85. package/dist/services/MCPManager.js +1 -197
  86. package/dist/services/MCPManager.js.map +1 -0
  87. package/dist/services/RequirementService.js +1 -548
  88. package/dist/services/RequirementService.js.map +1 -0
  89. package/dist/services/ServerService.js +1 -127
  90. package/dist/services/ServerService.js.map +1 -0
  91. package/dist/services/TelemetryService.js +1 -53
  92. package/dist/services/TelemetryService.js.map +1 -0
  93. package/dist/utils/UpdateCheckTracker.js +1 -79
  94. package/dist/utils/UpdateCheckTracker.js.map +1 -0
  95. package/dist/utils/adoUtils.js +1 -254
  96. package/dist/utils/adoUtils.js.map +1 -0
  97. package/dist/utils/clientUtils.js +1 -65
  98. package/dist/utils/clientUtils.js.map +1 -0
  99. package/dist/utils/feedUtils.js +1 -28
  100. package/dist/utils/feedUtils.js.map +1 -0
  101. package/dist/utils/githubAuth.js +1 -177
  102. package/dist/utils/githubAuth.js.map +1 -0
  103. package/dist/utils/githubUtils.js +1 -125
  104. package/dist/utils/githubUtils.js.map +1 -0
  105. package/dist/utils/logger.js +1 -176
  106. package/dist/utils/logger.js.map +1 -0
  107. package/dist/utils/macroExpressionUtils.js +1 -93
  108. package/dist/utils/macroExpressionUtils.js.map +1 -0
  109. package/dist/utils/osUtils.js +1 -664
  110. package/dist/utils/osUtils.js.map +1 -0
  111. package/dist/utils/versionUtils.js +1 -101
  112. package/dist/utils/versionUtils.js.map +1 -0
  113. package/dist/web/contract/serverContract.js +1 -1
  114. package/dist/web/contract/serverContract.js.map +1 -0
  115. package/dist/web/public/js/api.js +2 -132
  116. package/dist/web/public/js/api.js.map +1 -0
  117. package/dist/web/public/js/detailsWidget.js +2 -264
  118. package/dist/web/public/js/detailsWidget.js.map +1 -0
  119. package/dist/web/public/js/flights/flights.js +2 -127
  120. package/dist/web/public/js/flights/flights.js.map +1 -0
  121. package/dist/web/public/js/modal/index.js +2 -52
  122. package/dist/web/public/js/modal/index.js.map +1 -0
  123. package/dist/web/public/js/modal/installModal.js +2 -162
  124. package/dist/web/public/js/modal/installModal.js.map +1 -0
  125. package/dist/web/public/js/modal/installation.js +2 -266
  126. package/dist/web/public/js/modal/installation.js.map +1 -0
  127. package/dist/web/public/js/modal/loadingModal.js +2 -182
  128. package/dist/web/public/js/modal/loadingModal.js.map +1 -0
  129. package/dist/web/public/js/modal/modalSetup.js +2 -595
  130. package/dist/web/public/js/modal/modalSetup.js.map +1 -0
  131. package/dist/web/public/js/modal/modalUtils.js +2 -37
  132. package/dist/web/public/js/modal/modalUtils.js.map +1 -0
  133. package/dist/web/public/js/modal/versionUtils.js +2 -20
  134. package/dist/web/public/js/modal/versionUtils.js.map +1 -0
  135. package/dist/web/public/js/modal.js +2 -42
  136. package/dist/web/public/js/modal.js.map +1 -0
  137. package/dist/web/public/js/notifications.js +2 -137
  138. package/dist/web/public/js/notifications.js.map +1 -0
  139. package/dist/web/public/js/onboard/formProcessor.js +2 -1037
  140. package/dist/web/public/js/onboard/formProcessor.js.map +1 -0
  141. package/dist/web/public/js/onboard/index.js +2 -374
  142. package/dist/web/public/js/onboard/index.js.map +1 -0
  143. package/dist/web/public/js/onboard/publishHandler.js +2 -172
  144. package/dist/web/public/js/onboard/publishHandler.js.map +1 -0
  145. package/dist/web/public/js/onboard/state.js +2 -76
  146. package/dist/web/public/js/onboard/state.js.map +1 -0
  147. package/dist/web/public/js/onboard/templates.js +2 -342
  148. package/dist/web/public/js/onboard/templates.js.map +1 -0
  149. package/dist/web/public/js/onboard/uiHandlers.js +2 -1076
  150. package/dist/web/public/js/onboard/uiHandlers.js.map +1 -0
  151. package/dist/web/public/js/onboard/validationHandlers.js +2 -493
  152. package/dist/web/public/js/onboard/validationHandlers.js.map +1 -0
  153. package/dist/web/public/js/serverCategoryDetails.js +2 -364
  154. package/dist/web/public/js/serverCategoryDetails.js.map +1 -0
  155. package/dist/web/public/js/serverCategoryList.js +2 -241
  156. package/dist/web/public/js/serverCategoryList.js.map +1 -0
  157. package/dist/web/public/js/settings.js +2 -314
  158. package/dist/web/public/js/settings.js.map +1 -0
  159. package/dist/web/server.js +1 -404
  160. package/dist/web/server.js.map +1 -0
  161. package/package.json +8 -2
  162. package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
  163. package/.github/acl/access.yml +0 -20
  164. package/.github/compliance/inventory.yml +0 -5
  165. package/.github/policies/jit.yml +0 -19
  166. package/.github/workflows/build.yml +0 -28
  167. package/.roo/rules-code/rules.md +0 -88
  168. package/dist/cli/commands/start.d.ts +0 -2
  169. package/dist/cli/commands/start.js +0 -32
  170. package/dist/cli/commands/sync.d.ts +0 -2
  171. package/dist/cli/commands/sync.js +0 -17
  172. package/dist/core/ConfigurationLoader.d.ts +0 -32
  173. package/dist/core/ConfigurationLoader.js +0 -236
  174. package/dist/core/ConfigurationProvider.d.ts +0 -35
  175. package/dist/core/ConfigurationProvider.js +0 -375
  176. package/dist/core/InstallationService.d.ts +0 -50
  177. package/dist/core/InstallationService.js +0 -350
  178. package/dist/core/MCPManager.d.ts +0 -28
  179. package/dist/core/MCPManager.js +0 -188
  180. package/dist/core/RequirementService.d.ts +0 -40
  181. package/dist/core/RequirementService.js +0 -110
  182. package/dist/core/ServerSchemaLoader.d.ts +0 -11
  183. package/dist/core/ServerSchemaLoader.js +0 -43
  184. package/dist/core/ServerSchemaProvider.d.ts +0 -17
  185. package/dist/core/ServerSchemaProvider.js +0 -120
  186. package/dist/core/constants.d.ts +0 -47
  187. package/dist/core/constants.js +0 -94
  188. package/dist/core/installers/BaseInstaller.d.ts +0 -74
  189. package/dist/core/installers/BaseInstaller.js +0 -253
  190. package/dist/core/installers/ClientInstaller.d.ts +0 -23
  191. package/dist/core/installers/ClientInstaller.js +0 -564
  192. package/dist/core/installers/CommandInstaller.d.ts +0 -37
  193. package/dist/core/installers/CommandInstaller.js +0 -173
  194. package/dist/core/installers/GeneralInstaller.d.ts +0 -33
  195. package/dist/core/installers/GeneralInstaller.js +0 -85
  196. package/dist/core/installers/InstallerFactory.d.ts +0 -54
  197. package/dist/core/installers/InstallerFactory.js +0 -97
  198. package/dist/core/installers/NpmInstaller.d.ts +0 -26
  199. package/dist/core/installers/NpmInstaller.js +0 -127
  200. package/dist/core/installers/PipInstaller.d.ts +0 -28
  201. package/dist/core/installers/PipInstaller.js +0 -127
  202. package/dist/core/installers/RequirementInstaller.d.ts +0 -33
  203. package/dist/core/installers/RequirementInstaller.js +0 -3
  204. package/dist/core/types.d.ts +0 -166
  205. package/dist/core/types.js +0 -16
  206. package/dist/services/InstallRequestValidator.d.ts +0 -21
  207. package/dist/services/InstallRequestValidator.js +0 -99
  208. package/dist/web/public/js/modal/installHandler.js +0 -227
  209. package/dist/web/public/js/modal/loadingUI.js +0 -74
  210. package/dist/web/public/js/modal/messageQueue.js +0 -112
  211. package/dist/web/public/js/modal/modalUI.js +0 -214
  212. package/dist/web/public/js/modal/version.js +0 -20
  213. package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +0 -370
  214. package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
  215. package/docs/Telemetry.md +0 -136
  216. package/memory-bank/activeContext.md +0 -26
  217. package/memory-bank/decisionLog.md +0 -91
  218. package/memory-bank/productContext.md +0 -41
  219. package/memory-bank/progress.md +0 -35
  220. package/memory-bank/systemPatterns.md +0 -10
  221. package/src/cli/commands/install.ts +0 -139
  222. package/src/cli/commands/list.ts +0 -113
  223. package/src/cli/commands/pull.ts +0 -16
  224. package/src/cli/commands/serve.ts +0 -39
  225. package/src/cli/commands/uninstall.ts +0 -64
  226. package/src/cli/index.ts +0 -82
  227. package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
  228. package/src/core/installers/clients/ClientInstaller.ts +0 -222
  229. package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
  230. package/src/core/installers/clients/ClineInstaller.ts +0 -35
  231. package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
  232. package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
  233. package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
  234. package/src/core/installers/index.ts +0 -11
  235. package/src/core/installers/requirements/BaseInstaller.ts +0 -85
  236. package/src/core/installers/requirements/CommandInstaller.ts +0 -231
  237. package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
  238. package/src/core/installers/requirements/InstallerFactory.ts +0 -114
  239. package/src/core/installers/requirements/NpmInstaller.ts +0 -271
  240. package/src/core/installers/requirements/NugetInstaller.ts +0 -203
  241. package/src/core/installers/requirements/PipInstaller.ts +0 -207
  242. package/src/core/installers/requirements/RequirementInstaller.ts +0 -42
  243. package/src/core/loaders/ConfigurationLoader.ts +0 -298
  244. package/src/core/loaders/ConfigurationProvider.ts +0 -462
  245. package/src/core/loaders/InstallOperationManager.ts +0 -367
  246. package/src/core/loaders/ServerSchemaLoader.ts +0 -117
  247. package/src/core/loaders/ServerSchemaProvider.ts +0 -99
  248. package/src/core/loaders/SystemSettingsManager.ts +0 -278
  249. package/src/core/metadatas/constants.ts +0 -122
  250. package/src/core/metadatas/recordingConstants.ts +0 -65
  251. package/src/core/metadatas/types.ts +0 -202
  252. package/src/core/onboard/FeedOnboardService.ts +0 -501
  253. package/src/core/onboard/OnboardProcessor.ts +0 -356
  254. package/src/core/onboard/OnboardStatus.ts +0 -60
  255. package/src/core/onboard/OnboardStatusManager.ts +0 -416
  256. package/src/core/validators/FeedValidator.ts +0 -135
  257. package/src/core/validators/IServerValidator.ts +0 -21
  258. package/src/core/validators/SSEServerValidator.ts +0 -43
  259. package/src/core/validators/ServerValidatorFactory.ts +0 -51
  260. package/src/core/validators/StdioServerValidator.ts +0 -313
  261. package/src/index.ts +0 -44
  262. package/src/services/InstallationService.ts +0 -102
  263. package/src/services/MCPManager.ts +0 -249
  264. package/src/services/RequirementService.ts +0 -627
  265. package/src/services/ServerService.ts +0 -161
  266. package/src/services/TelemetryService.ts +0 -59
  267. package/src/utils/UpdateCheckTracker.ts +0 -86
  268. package/src/utils/adoUtils.ts +0 -293
  269. package/src/utils/clientUtils.ts +0 -72
  270. package/src/utils/feedUtils.ts +0 -31
  271. package/src/utils/githubAuth.ts +0 -212
  272. package/src/utils/githubUtils.ts +0 -164
  273. package/src/utils/logger.ts +0 -195
  274. package/src/utils/macroExpressionUtils.ts +0 -104
  275. package/src/utils/osUtils.ts +0 -700
  276. package/src/utils/versionUtils.ts +0 -114
  277. package/src/web/contract/serverContract.ts +0 -74
  278. package/src/web/public/css/detailsWidget.css +0 -235
  279. package/src/web/public/css/modal.css +0 -757
  280. package/src/web/public/css/notifications.css +0 -101
  281. package/src/web/public/css/onboard.css +0 -107
  282. package/src/web/public/css/serverCategoryList.css +0 -120
  283. package/src/web/public/css/serverDetails.css +0 -139
  284. package/src/web/public/index.html +0 -359
  285. package/src/web/public/js/api.js +0 -132
  286. package/src/web/public/js/detailsWidget.js +0 -264
  287. package/src/web/public/js/flights/flights.js +0 -127
  288. package/src/web/public/js/modal/index.js +0 -52
  289. package/src/web/public/js/modal/installModal.js +0 -162
  290. package/src/web/public/js/modal/installation.js +0 -266
  291. package/src/web/public/js/modal/loadingModal.js +0 -182
  292. package/src/web/public/js/modal/modalSetup.js +0 -595
  293. package/src/web/public/js/modal/modalUtils.js +0 -37
  294. package/src/web/public/js/modal/versionUtils.js +0 -20
  295. package/src/web/public/js/modal.js +0 -42
  296. package/src/web/public/js/notifications.js +0 -137
  297. package/src/web/public/js/onboard/formProcessor.js +0 -1037
  298. package/src/web/public/js/onboard/index.js +0 -374
  299. package/src/web/public/js/onboard/publishHandler.js +0 -172
  300. package/src/web/public/js/onboard/state.js +0 -76
  301. package/src/web/public/js/onboard/templates.js +0 -342
  302. package/src/web/public/js/onboard/uiHandlers.js +0 -1076
  303. package/src/web/public/js/onboard/validationHandlers.js +0 -493
  304. package/src/web/public/js/serverCategoryDetails.js +0 -364
  305. package/src/web/public/js/serverCategoryList.js +0 -241
  306. package/src/web/public/js/settings.js +0 -314
  307. package/src/web/public/modal.html +0 -84
  308. package/src/web/public/onboard.html +0 -296
  309. package/src/web/public/settings.html +0 -135
  310. package/src/web/public/styles.css +0 -277
  311. package/src/web/server.ts +0 -478
  312. package/tsconfig.json +0 -18
  313. package/wiki/Installation.md +0 -3
  314. package/wiki/Publish.md +0 -3
@@ -1,350 +0,0 @@
1
- import path from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { exec } from 'child_process';
4
- import util from 'util';
5
- import { createInstallerFactory } from './installers/index.js';
6
- import { SUPPORTED_CLIENTS } from './constants.js';
7
- import { ClientInstaller } from './installers/clients/ClientInstaller.js';
8
- import { ConfigurationProvider } from './ConfigurationProvider.js';
9
- import { Logger } from '../utils/logger.js';
10
- const execPromise = util.promisify(exec);
11
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
- /**
13
- * Handles the actual installation process for an MCP server.
14
- */
15
- export class InstallationService {
16
- activeInstallations = new Map();
17
- installerFactory;
18
- constructor() {
19
- this.installerFactory = createInstallerFactory();
20
- }
21
- generateOperationId() {
22
- return `install-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
23
- }
24
- /**
25
- * Installs a server based on the provided options and feed configuration.
26
- * @param serverName The name of the server to install.
27
- * @param options The installation options.
28
- * @returns A result object indicating success or failure.
29
- */
30
- async install(categoryName, serverName, options) {
31
- const configProvider = ConfigurationProvider.getInstance();
32
- const clients = options.targetClients || Object.keys(SUPPORTED_CLIENTS);
33
- // Process updates for requirements if specified in options
34
- // Fire off requirement updates in the background without awaiting completion
35
- if (options.requirements && options.requirements.length > 0) {
36
- // Start the process but don't await it - it will run in the background
37
- this.processRequirementUpdates(categoryName, serverName, options)
38
- .catch(error => {
39
- console.error(`Error in background requirement updates: ${error instanceof Error ? error.message : String(error)}`);
40
- });
41
- }
42
- // Check if server is already ready
43
- const isReady = await configProvider.isServerReady(categoryName, serverName, clients);
44
- if (isReady) {
45
- return {
46
- success: true,
47
- message: 'Server and clients are already installed and ready',
48
- status: [{
49
- status: 'completed',
50
- type: 'install',
51
- target: 'server',
52
- message: 'Server and clients are already installed and ready'
53
- }]
54
- };
55
- }
56
- // Create new ClientInstaller instance for handling installation
57
- const clientInstaller = new ClientInstaller(categoryName, serverName, clients);
58
- const requirementsResult = await this.checkAndInstallRequirements(categoryName, serverName, options);
59
- if (requirementsResult) {
60
- return requirementsResult;
61
- }
62
- // Process client installation regardless of requirements state
63
- // Each client installer will check requirements before actual installation
64
- return await clientInstaller.install(options);
65
- }
66
- /**
67
- * Process requirement updates specified in serverInstallOptions
68
- * All updates are processed in parallel for maximum efficiency
69
- * @param categoryName The category name
70
- * @param serverName The server name
71
- * @param requirements The requirements to update
72
- */
73
- async processRequirementUpdates(categoryName, serverName, options) {
74
- // Use UpdateCheckTracker to prevent concurrent updates
75
- const updateCheckTracker = await import('../utils/UpdateCheckTracker.js').then(m => m.updateCheckTracker);
76
- const operationKey = `requirement-updates-${categoryName}-${serverName}`;
77
- // Check if there's already an update operation in progress for this server
78
- const canProceed = await updateCheckTracker.startOperation(operationKey);
79
- if (!canProceed) {
80
- console.log(`Requirement updates for ${categoryName}/${serverName} already in progress, skipping`);
81
- return;
82
- }
83
- try {
84
- const configProvider = ConfigurationProvider.getInstance();
85
- const feedConfig = await configProvider.getFeedConfiguration(categoryName);
86
- if (!feedConfig) {
87
- console.error(`Feed configuration not found for category: ${categoryName}`);
88
- return;
89
- }
90
- // Import the RequirementService
91
- const { requirementService } = await import('./RequirementService.js');
92
- // Create an array of promises to update all requirements in parallel
93
- const updatePromises = options.requirements?.map(async (reqToUpdate) => {
94
- try {
95
- // Find the full requirement config
96
- const reqConfig = feedConfig.requirements?.find((r) => r.name === reqToUpdate.name);
97
- if (!reqConfig) {
98
- console.error(`Requirement configuration not found for: ${reqToUpdate.name}`);
99
- return;
100
- }
101
- // Get current status
102
- const currentStatus = await configProvider.getRequirementStatus(categoryName, reqToUpdate.name);
103
- if (!currentStatus) {
104
- console.error(`No current status found for requirement: ${reqToUpdate.name}`);
105
- return;
106
- }
107
- // Update requirement status to indicate update in progress
108
- await configProvider.updateRequirementStatus(categoryName, reqToUpdate.name, {
109
- ...currentStatus,
110
- name: reqToUpdate.name,
111
- type: currentStatus.type || 'unknown',
112
- installed: currentStatus.installed || false,
113
- inProgress: true,
114
- operationStatus: {
115
- status: 'in-progress',
116
- type: 'update',
117
- target: 'requirement',
118
- message: `Updating ${reqToUpdate.name} from ${currentStatus.version || 'unknown'} to ${reqToUpdate.version}`
119
- }
120
- });
121
- // For pip requirements, check if we have a stored pythonEnv
122
- if (reqConfig.type === 'pip' && currentStatus.pythonEnv && !options?.settings?.pythonEnv) {
123
- options = {
124
- ...options,
125
- settings: { ...options?.settings, pythonEnv: currentStatus.pythonEnv }
126
- };
127
- }
128
- // Update the requirement with options for pip environment
129
- const updatedStatus = await requirementService.updateRequirement(reqConfig, reqToUpdate.version, options);
130
- // Update requirement status
131
- await configProvider.updateRequirementStatus(categoryName, reqToUpdate.name, {
132
- ...updatedStatus,
133
- name: reqToUpdate.name,
134
- type: updatedStatus.type || currentStatus.type || 'unknown',
135
- installed: updatedStatus.installed,
136
- inProgress: false,
137
- operationStatus: {
138
- status: updatedStatus.installed ? 'completed' : 'failed',
139
- type: 'update',
140
- target: 'requirement',
141
- message: updatedStatus.installed
142
- ? `Successfully updated ${reqToUpdate.name} to version ${reqToUpdate.version}`
143
- : `Failed to update ${reqToUpdate.name} to version ${reqToUpdate.version}`
144
- },
145
- availableUpdate: updatedStatus.installed ? undefined : currentStatus.availableUpdate
146
- });
147
- console.log(`Requirement ${reqToUpdate.name} updated to version ${reqToUpdate.version}`);
148
- }
149
- catch (error) {
150
- console.error(`Error updating requirement ${reqToUpdate.name}:`, error);
151
- // Update status to indicate failure
152
- await configProvider.updateRequirementStatus(categoryName, reqToUpdate.name, {
153
- name: reqToUpdate.name,
154
- type: 'unknown',
155
- installed: false,
156
- inProgress: false,
157
- error: error instanceof Error ? error.message : String(error),
158
- operationStatus: {
159
- status: 'failed',
160
- type: 'update',
161
- target: 'requirement',
162
- message: `Error updating requirement: ${error instanceof Error ? error.message : String(error)}`
163
- }
164
- });
165
- }
166
- });
167
- // Wait for all updates to complete in parallel if there are any
168
- if (updatePromises) {
169
- await Promise.all(updatePromises);
170
- }
171
- }
172
- finally {
173
- // Always release the lock when done, even if there was an error
174
- await updateCheckTracker.endOperation(operationKey);
175
- }
176
- }
177
- /**
178
- * Checks and installs requirements for a server if needed
179
- * @param categoryName The category name
180
- * @param serverName The server name
181
- * @param options The installation options
182
- * @returns A failure result if requirements check fails, null if requirements are satisfied
183
- */
184
- async checkAndInstallRequirements(categoryName, serverName, options) {
185
- const configProvider = ConfigurationProvider.getInstance();
186
- // Get feed configuration to get requirements
187
- const feedConfig = await configProvider.getFeedConfiguration(categoryName);
188
- if (!feedConfig) {
189
- return {
190
- success: false,
191
- message: 'Feed configuration not found',
192
- status: [{
193
- status: 'failed',
194
- type: 'install',
195
- target: 'server',
196
- message: 'Feed configuration not found'
197
- }]
198
- };
199
- }
200
- // Find server config and verify requirements
201
- const serverConfig = feedConfig.mcpServers.find((s) => s.name === serverName);
202
- if (!serverConfig?.dependencies?.requirements) {
203
- Logger.debug(`No requirements for ${serverName}`);
204
- return null;
205
- }
206
- // Check all requirements installation status
207
- const requirementStatuses = await Promise.all(serverConfig.dependencies.requirements.map(async (req) => {
208
- const reqConfig = feedConfig.requirements?.find((r) => r.name === req.name) || {
209
- name: req.name,
210
- version: req.version,
211
- type: 'npm'
212
- };
213
- return await this.installerFactory.checkInstallation(reqConfig, options);
214
- }));
215
- // If all requirements are installed and ready, no need to proceed with installation
216
- if (requirementStatuses.every(status => status.installed)) {
217
- // Check if requirements are ready via ConfigurationProvider
218
- const requirementsReady = await configProvider.isRequirementsReady(categoryName, serverName);
219
- // Update requirement status if not ready
220
- if (!requirementsReady) {
221
- for (const status of requirementStatuses) {
222
- await configProvider.updateRequirementStatus(categoryName, status.name, status);
223
- }
224
- }
225
- return null;
226
- }
227
- // Sort requirements by order for installation
228
- const sortedRequirements = [...serverConfig.dependencies.requirements].sort((a, b) => {
229
- const orderA = a.order ?? Infinity;
230
- const orderB = b.order ?? Infinity;
231
- return orderA - orderB;
232
- });
233
- // Start requirements installation in background
234
- this.installRequirementsInBackground(categoryName, sortedRequirements, options)
235
- .catch(error => {
236
- Logger.error(`Error in background requirement installations: ${error instanceof Error ? error.message : String(error)}`);
237
- });
238
- // Return immediately while installation continues in background
239
- return null;
240
- }
241
- /**
242
- * Installs requirements in background without blocking the main thread
243
- * Requirements with the same order are installed in parallel
244
- */
245
- async installRequirementsInBackground(categoryName, sortedRequirements, options) {
246
- const configProvider = ConfigurationProvider.getInstance();
247
- const requirementGroups = sortedRequirements.reduce((groups, req) => {
248
- const order = req.order ?? Infinity;
249
- if (!groups[order]) {
250
- groups[order] = [];
251
- }
252
- groups[order].push(req);
253
- return groups;
254
- }, {});
255
- // Process each group in sequence, but requirements within group in parallel
256
- const orderKeys = Object.keys(requirementGroups).map(Number).sort((a, b) => a - b);
257
- for (const order of orderKeys) {
258
- const group = requirementGroups[order];
259
- await Promise.all(group.map(async (requirement) => {
260
- try {
261
- const feeds = await configProvider.getFeedConfiguration(categoryName);
262
- const requirementConfig = feeds?.requirements?.find((r) => r.name === requirement.name) || {
263
- name: requirement.name,
264
- version: requirement.version,
265
- type: 'npm'
266
- };
267
- // For pip requirements, check if we need to use stored pythonEnv
268
- const currentStatus = await configProvider.getRequirementStatus(categoryName, requirement.name);
269
- if (requirementConfig.type === 'pip' && currentStatus?.pythonEnv && !options?.settings?.pythonEnv) {
270
- options = {
271
- ...options,
272
- settings: { ...options?.settings, pythonEnv: currentStatus.pythonEnv }
273
- };
274
- }
275
- const installer = this.installerFactory.getInstaller(requirementConfig);
276
- if (!installer) {
277
- await this.updateRequirementFailureStatus(categoryName, requirement.name, requirementConfig.type, `No installer found for requirement type: ${requirementConfig.type}`);
278
- return;
279
- }
280
- const operationId = this.generateOperationId();
281
- await this.updateRequirementProgressStatus(categoryName, requirement.name, requirementConfig.type, operationId);
282
- const installStatus = await installer.install(requirementConfig, options);
283
- await this.updateRequirementCompletionStatus(categoryName, requirement.name, installStatus, operationId);
284
- }
285
- catch (error) {
286
- await this.updateRequirementFailureStatus(categoryName, requirement.name, 'unknown', error instanceof Error ? error.message : String(error));
287
- }
288
- }));
289
- }
290
- }
291
- /**
292
- * Helper to update requirement status for failure case
293
- */
294
- async updateRequirementFailureStatus(categoryName, requirementName, requirementType, errorMessage) {
295
- const configProvider = ConfigurationProvider.getInstance();
296
- await configProvider.updateRequirementStatus(categoryName, requirementName, {
297
- name: requirementName,
298
- type: requirementType,
299
- installed: false,
300
- error: errorMessage,
301
- operationStatus: {
302
- status: 'failed',
303
- type: 'install',
304
- target: 'requirement',
305
- message: `Error installing requirement: ${errorMessage}`,
306
- operationId: this.generateOperationId()
307
- }
308
- });
309
- }
310
- /**
311
- * Helper to update requirement status for in-progress case
312
- */
313
- async updateRequirementProgressStatus(categoryName, requirementName, requirementType, operationId) {
314
- const configProvider = ConfigurationProvider.getInstance();
315
- await configProvider.updateRequirementStatus(categoryName, requirementName, {
316
- name: requirementName,
317
- type: requirementType,
318
- installed: false,
319
- inProgress: true,
320
- operationStatus: {
321
- status: 'in-progress',
322
- type: 'install',
323
- target: 'requirement',
324
- message: `Installing requirement: ${requirementName}`,
325
- operationId
326
- }
327
- });
328
- }
329
- /**
330
- * Helper to update requirement status for completion case
331
- */
332
- async updateRequirementCompletionStatus(categoryName, requirementName, installStatus, operationId) {
333
- const configProvider = ConfigurationProvider.getInstance();
334
- await configProvider.updateRequirementStatus(categoryName, requirementName, {
335
- ...installStatus,
336
- operationStatus: {
337
- status: installStatus.installed ? 'completed' : 'failed',
338
- type: 'install',
339
- target: 'requirement',
340
- message: installStatus.installed
341
- ? `Requirement ${requirementName} installed successfully`
342
- : `Failed to install ${requirementName}`,
343
- operationId
344
- }
345
- });
346
- }
347
- }
348
- // Export a singleton instance (optional)
349
- // export const installationService = new InstallationService();
350
- //# sourceMappingURL=InstallationService.js.map
@@ -1,28 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- import { MCPEvent, MCPEventData, MCPServerCategory, ServerInstallOptions, ServerCategoryListOptions, ServerOperationResult, ServerUninstallOptions, FeedConfiguration } from './types.js';
3
- import { OperationStatus } from './onboard/OnboardStatus.js';
4
- export declare class MCPManager extends EventEmitter {
5
- private installationService;
6
- private configProvider;
7
- private feedOnboardService;
8
- constructor();
9
- syncFeeds(): Promise<void>;
10
- initialize(feedFile?: string): Promise<void>;
11
- listServerCategories(options?: ServerCategoryListOptions): Promise<MCPServerCategory[]>;
12
- getFeedConfiguration(categoryName: string): Promise<FeedConfiguration | undefined>;
13
- getServerMcpConfig(categoryName: string, serverName: string): Promise<import("./types.js").McpConfig | undefined>;
14
- installServer(categoryName: string, serverName: string, requestOptions?: ServerInstallOptions): Promise<ServerOperationResult>;
15
- uninstallServer(categoryName: string, serverName: string, options?: ServerUninstallOptions): Promise<ServerOperationResult>;
16
- updateRequirement(categoryName: string, serverName: string, requirementName: string, updateVersion: string): Promise<ServerOperationResult>;
17
- /**
18
- * Onboards a new feed configuration
19
- * @param config The feed configuration to onboard
20
- */
21
- onboardFeed(config: FeedConfiguration): Promise<OperationStatus & {
22
- feedConfiguration?: FeedConfiguration;
23
- }>;
24
- emit<E extends MCPEvent>(event: E, data: MCPEventData[E]): boolean;
25
- on<E extends MCPEvent>(event: E, listener: (data: MCPEventData[E]) => void): this;
26
- off<E extends MCPEvent>(event: E, listener: (data: MCPEventData[E]) => void): this;
27
- }
28
- export declare const mcpManager: MCPManager;
@@ -1,188 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- import { ConfigurationProvider } from './ConfigurationProvider.js';
3
- import { InstallationService } from './InstallationService.js';
4
- import { MCPEvent, } from './types.js';
5
- import { Logger } from '../utils/logger.js';
6
- import { FeedOnboardService } from './onboard/FeedOnboardService.js';
7
- export class MCPManager extends EventEmitter {
8
- installationService;
9
- configProvider;
10
- feedOnboardService;
11
- constructor() {
12
- super();
13
- this.configProvider = ConfigurationProvider.getInstance();
14
- this.installationService = new InstallationService();
15
- this.feedOnboardService = new FeedOnboardService();
16
- }
17
- async syncFeeds() {
18
- await this.configProvider.syncFeeds();
19
- }
20
- async initialize(feedFile) {
21
- try {
22
- await this.configProvider.initialize(feedFile);
23
- }
24
- catch (error) {
25
- console.error("Error during MCPManager initialization:", error);
26
- throw error;
27
- }
28
- }
29
- async listServerCategories(options = {}) {
30
- const { local = true } = options;
31
- if (local) {
32
- return await this.configProvider.getServerCategories();
33
- }
34
- return [];
35
- }
36
- async getFeedConfiguration(categoryName) {
37
- return this.configProvider.getFeedConfiguration(categoryName);
38
- }
39
- async getServerMcpConfig(categoryName, serverName) {
40
- return this.configProvider.getServerMcpConfig(categoryName, serverName);
41
- }
42
- async installServer(categoryName, serverName, requestOptions = {}) {
43
- try {
44
- const server = await this.configProvider.getServerCategory(categoryName);
45
- if (!server) {
46
- return {
47
- success: false,
48
- message: `Server category ${categoryName} is not onboarded`,
49
- };
50
- }
51
- const installResult = await this.installationService.install(categoryName, serverName, requestOptions);
52
- if (!installResult.success) {
53
- return installResult;
54
- }
55
- this.emit(MCPEvent.SERVER_INSTALLED, { server });
56
- return installResult;
57
- }
58
- catch (error) {
59
- console.error(`Unexpected error during installServer for ${serverName}:`, error);
60
- return {
61
- success: false,
62
- message: `Failed to install ${serverName}: ${error instanceof Error ? error.message : String(error)}`,
63
- error: error instanceof Error ? error : new Error(String(error)),
64
- };
65
- }
66
- }
67
- async uninstallServer(categoryName, serverName, options = {}) {
68
- try {
69
- const serverCategory = await this.configProvider.getServerCategory(categoryName);
70
- if (!serverCategory) {
71
- return {
72
- success: false,
73
- message: `Server category ${categoryName} is not onboarded`,
74
- };
75
- }
76
- const { targets = [], removeData = false } = options;
77
- // Clear installation status for specified targets
78
- const currentStatus = serverCategory.installationStatus || {
79
- requirementsStatus: {},
80
- serversStatus: {},
81
- lastUpdated: new Date().toISOString()
82
- };
83
- const serversStatus = currentStatus.serversStatus || {};
84
- const serverStatus = serversStatus[serverName] || { installedStatus: {}, name: serverName };
85
- // Only reset installedStatus for specified targets
86
- for (const target of targets) {
87
- if (serverStatus.installedStatus) {
88
- delete serverStatus.installedStatus[target];
89
- }
90
- }
91
- if (removeData) {
92
- for (const target of targets) {
93
- await this.configProvider.removeServerFromClientMCPSettings(serverName, target);
94
- }
95
- }
96
- // Update server status
97
- serversStatus[serverName] = serverStatus;
98
- // Update status keeping requirements
99
- await this.configProvider.updateInstallationStatus(categoryName, currentStatus.requirementsStatus || {}, serversStatus);
100
- this.emit(MCPEvent.SERVER_UNINSTALLED, { serverName, targets });
101
- return {
102
- success: true,
103
- message: `Successfully uninstalled ${serverName} from ${targets.join(', ')}`,
104
- };
105
- }
106
- catch (error) {
107
- return {
108
- success: false,
109
- message: `Failed to uninstall ${serverName}`,
110
- error: error,
111
- };
112
- }
113
- }
114
- async updateRequirement(categoryName, serverName, requirementName, updateVersion) {
115
- try {
116
- const { requirementService } = await import('./RequirementService.js');
117
- const serverCategory = await this.configProvider.getServerCategory(categoryName);
118
- if (!serverCategory) {
119
- return {
120
- success: false,
121
- message: `Server category ${categoryName} is not onboarded`,
122
- };
123
- }
124
- if (!serverCategory.feedConfiguration) {
125
- return {
126
- success: false,
127
- message: `Server category ${categoryName} has no feed configuration`,
128
- };
129
- }
130
- // Find the requirement
131
- const requirement = serverCategory.feedConfiguration.requirements.find(r => r.name === requirementName);
132
- if (!requirement) {
133
- return {
134
- success: false,
135
- message: `Requirement ${requirementName} not found in category ${categoryName}`,
136
- };
137
- }
138
- // Update the requirement using requirementService
139
- const updatedStatus = await requirementService.updateRequirement(requirement, updateVersion);
140
- // Update the status in configuration
141
- await this.configProvider.updateRequirementStatus(categoryName, requirementName, updatedStatus);
142
- return {
143
- success: true,
144
- message: `Successfully updated ${requirementName} to version ${updateVersion}`,
145
- };
146
- }
147
- catch (error) {
148
- console.error(`Error updating requirement ${requirementName}:`, error);
149
- return {
150
- success: false,
151
- message: `Failed to update ${requirementName}: ${error instanceof Error ? error.message : String(error)}`,
152
- error: error instanceof Error ? error : new Error(String(error)),
153
- };
154
- }
155
- }
156
- /**
157
- * Onboards a new feed configuration
158
- * @param config The feed configuration to onboard
159
- */
160
- async onboardFeed(config) {
161
- try {
162
- const result = await this.feedOnboardService.onboardFeed(config);
163
- // After successful onboarding initiation, sync feeds to get the latest changes
164
- // Syncing should ideally happen after the PR is merged, but for now,
165
- // syncing here makes the new (pending) category available locally if needed.
166
- // Consider if syncFeeds should be conditional based on operation status or handled differently.
167
- await this.syncFeeds();
168
- return result;
169
- }
170
- catch (error) {
171
- Logger.error('Failed to onboard feed in MCPManager:', error);
172
- throw error; // Rethrow or handle by returning a failed OperationStatus
173
- }
174
- }
175
- // Type-safe event emitter methods
176
- emit(event, data) {
177
- return super.emit(event, data);
178
- }
179
- on(event, listener) {
180
- return super.on(event, listener);
181
- }
182
- off(event, listener) {
183
- return super.off(event, listener);
184
- }
185
- }
186
- // Export a singleton instance
187
- export const mcpManager = new MCPManager();
188
- //# sourceMappingURL=MCPManager.js.map
@@ -1,40 +0,0 @@
1
- import { RequirementConfig, RequirementStatus, ServerInstallOptions } from './types.js';
2
- /**
3
- * Service responsible for managing requirements installation and status
4
- */
5
- export declare class RequirementService {
6
- private static instance;
7
- private installerFactory;
8
- private constructor();
9
- /**
10
- * Get the singleton instance of RequirementService
11
- * @returns The RequirementService instance
12
- */
13
- static getInstance(): RequirementService;
14
- /**
15
- * Check the installation status of a requirement
16
- * @param requirement The requirement to check
17
- * @returns The installation status
18
- */
19
- checkRequirementStatus(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus>;
20
- /**
21
- * Check if updates are available for a requirement
22
- * @param requirement The requirement to check for updates
23
- * @returns Updated status with available updates information
24
- */
25
- checkRequirementForUpdates(requirement: RequirementConfig, currentStatus: RequirementStatus): Promise<RequirementStatus>;
26
- /**
27
- * Update a requirement to a new version
28
- * @param requirement The requirement configuration
29
- * @param updateVersion The version to update to
30
- * @returns The updated requirement status
31
- */
32
- updateRequirement(requirement: RequirementConfig, updateVersion: string, options?: ServerInstallOptions): Promise<RequirementStatus>;
33
- /**
34
- * Validate a requirement configuration
35
- * @param requirement The requirement to validate
36
- * @throws Error if the requirement is invalid
37
- */
38
- private validateRequirement;
39
- }
40
- export declare const requirementService: RequirementService;