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,139 +0,0 @@
1
- import { Command } from 'commander';
2
- import { serverService } from '../../services/ServerService.js';
3
- import { Logger } from '../../utils/logger.js';
4
- import { hasLocalFeeds } from '../../utils/feedUtils.js';
5
- import { ServerInstallOptions } from '../../core/metadatas/types.js';
6
- import { SUPPORTED_CLIENT_NAMES } from '../../core/metadatas/constants.js';
7
- import { mcpManager } from '../../services/MCPManager.js';
8
-
9
- export function createInstallCommand(): Command {
10
- return new Command('install')
11
- .description('Install specific MCP servers')
12
- .addHelpText('after', `
13
- Examples:
14
- # Install a server
15
- $ imcp install --category ai-coder-tools --name github-tools
16
-
17
- # Install with specific client targets (semicolon separated)
18
- $ imcp install --category ai-coder-tools --name github-tools --clients "MSRooCode;GithubCopilot"
19
-
20
- # Install with environment variables
21
- $ imcp install --category ai-coder-tools --name github-tools --envs "GITHUB_TOKEN=abc123;API_KEY=xyz789"
22
- `)
23
- .requiredOption(
24
- '--category <category>',
25
- 'Server category'
26
- )
27
- .requiredOption(
28
- '--name <name>',
29
- 'Server name to install'
30
- )
31
- .option(
32
- '--clients <clients>',
33
- 'Target clients (semicolon separated). Supported values: Cline, MSRooCode, GithubCopilot. If not specified, installs for all clients'
34
- )
35
- .option(
36
- '--envs <envs>',
37
- 'Environment variables (semicolon separated key=value pairs)'
38
- )
39
- .action(async (options: {
40
- category: string;
41
- name: string;
42
- clients?: string;
43
- envs?: string;
44
- verbose?: boolean;
45
- }) => {
46
- try {
47
- // Check for local feeds existence at the start
48
- const feedsExist = await hasLocalFeeds();
49
- if (!feedsExist) {
50
- Logger.log('Local feeds not found, syncing from remote...');
51
- await serverService.syncFeeds();
52
- }
53
- await mcpManager.initialize();
54
- const { category, name, verbose, clients, envs } = options;
55
-
56
- Logger.debug(`Install options: ${JSON.stringify({ category, name, verbose, clients, envs })}`);
57
-
58
- const serverName = name.trim();
59
- Logger.debug(`Server name: ${serverName}`);
60
-
61
- if (!await serverService.validateServerName(category, serverName)) {
62
- Logger.error(
63
- 'Invalid server name or category provided.\n' +
64
- 'This could be because:\n' +
65
- ' 1. The server name or category is misspelled\n' +
66
- ' 2. Your local feeds are outdated\n\n' +
67
- 'Try running "imcp pull" to update your local feeds from remote.',
68
- { category, serverName }
69
- );
70
- process.exit(1);
71
- }
72
-
73
- // Parse and validate clients
74
- const parsedClients = clients ? clients.split(';')
75
- .map((c: string) => c.trim())
76
- .filter(Boolean)
77
- .map((c: string) => {
78
- const clientName = c.toLowerCase();
79
- const validClient = SUPPORTED_CLIENT_NAMES.find((name: string) => name.toLowerCase() === clientName);
80
- if (!validClient) {
81
- Logger.error(`Invalid client name: ${c}`);
82
- return null;
83
- }
84
- return validClient;
85
- })
86
- .filter((c: string | null): c is string => c !== null) : undefined;
87
-
88
- if (parsedClients && parsedClients.length > 0) {
89
- Logger.debug(`Target clients: ${JSON.stringify(parsedClients)}`);
90
- }
91
-
92
- // Parse environment variables
93
- const parsedEnvs: Record<string, string> = {};
94
- if (envs) {
95
- const pairs = envs.split(';');
96
- for (const pair of pairs) {
97
- const [key, value] = pair.split('=').map((s: string) => s.trim());
98
- if (key && value) {
99
- parsedEnvs[key] = value;
100
- } else {
101
- Logger.error(`Invalid environment variable format: ${pair}`);
102
- }
103
- }
104
- }
105
-
106
- if (Object.keys(parsedEnvs).length > 0) {
107
- Logger.debug(`Environment variables: ${JSON.stringify(parsedEnvs)}`);
108
- }
109
-
110
- Logger.log(`Installing server: ${serverName}`);
111
-
112
- const installOptions: ServerInstallOptions = {
113
- force: false,
114
- ...(parsedClients?.length && { targetClients: parsedClients }),
115
- ...(Object.keys(parsedEnvs).length > 0 && { env: parsedEnvs })
116
- };
117
-
118
- const results = [await serverService.installMcpServer(category, serverName, installOptions)];
119
-
120
- const { success, messages } = serverService.formatOperationResults(results);
121
-
122
- messages.forEach((message: string) => {
123
- if (success) {
124
- Logger.log(`✓ ${message}`);
125
- } else {
126
- Logger.error(`✗ ${message}`);
127
- }
128
- });
129
-
130
- if (!success) {
131
- process.exit(1);
132
- }
133
- } catch (error: unknown) {
134
- const message = error instanceof Error ? error.message : 'Unknown error';
135
- Logger.error('Installation failed:', message);
136
- process.exit(1);
137
- }
138
- });
139
- }
@@ -1,113 +0,0 @@
1
- import { Command } from 'commander';
2
- import fs from 'fs/promises';
3
- import path from 'path';
4
- import { LOCAL_FEEDS_DIR } from '../../core/metadatas/constants.js';
5
- import { mcpManager } from '../../services/MCPManager.js';
6
- import { Logger } from '../../utils/logger.js';
7
-
8
- interface SimplifiedServer {
9
- name: string;
10
- description: string;
11
- }
12
-
13
- interface SimplifiedFeed {
14
- name: string;
15
- displayName: string;
16
- description: string;
17
- mcpServers: SimplifiedServer[];
18
- }
19
-
20
- export function createListCommand(): Command {
21
- return new Command('list')
22
- .description('List all available MCP servers from feeds')
23
- .option('--pull', 'Sync with remote feeds before listing')
24
- .action(async (options) => {
25
- try {
26
- Logger.debug({
27
- action: 'list_command_started',
28
- options
29
- });
30
-
31
- // If sync flag is provided, try to sync first
32
- if (options.pull) {
33
- try {
34
- await mcpManager.syncFeeds();
35
- } catch (syncError) {
36
- Logger.error('Failed to sync feeds, falling back to local feeds', syncError);
37
- }
38
- }
39
- await mcpManager.initialize();
40
-
41
- Logger.debug({
42
- action: 'ensuring_feeds_directory',
43
- path: LOCAL_FEEDS_DIR
44
- });
45
-
46
- // Ensure feeds directory exists
47
- await fs.mkdir(LOCAL_FEEDS_DIR, { recursive: true });
48
-
49
- // Read all json files from feeds directory
50
- Logger.debug('Reading feed files from directory...');
51
- const files = await fs.readdir(LOCAL_FEEDS_DIR);
52
- const jsonFiles = files.filter(file => file.endsWith('.json'));
53
-
54
- Logger.debug({
55
- action: 'found_feed_files',
56
- count: jsonFiles.length,
57
- files: jsonFiles
58
- });
59
-
60
- const feeds: SimplifiedFeed[] = [];
61
-
62
- // Process each json file
63
- for (const file of jsonFiles) {
64
- Logger.debug(`Processing feed file: ${file}`);
65
- try {
66
- const filePath = path.join(LOCAL_FEEDS_DIR, file);
67
- const content = await fs.readFile(filePath, 'utf8');
68
- const feedConfig = JSON.parse(content);
69
-
70
- Logger.debug({
71
- action: 'processing_feed',
72
- file,
73
- feedName: feedConfig.name,
74
- serverCount: feedConfig.mcpServers?.length ?? 0
75
- });
76
-
77
- // Extract only needed information
78
- const simplifiedFeed: SimplifiedFeed = {
79
- name: feedConfig.name,
80
- displayName: feedConfig.displayName,
81
- description: feedConfig.description,
82
- mcpServers: feedConfig.mcpServers.map((server: any) => ({
83
- name: server.name,
84
- description: server.description
85
- }))
86
- };
87
-
88
- feeds.push(simplifiedFeed);
89
- Logger.debug(`Successfully processed feed: ${feedConfig.name}`);
90
- } catch (error) {
91
- Logger.error(`Failed to process feed file: ${file}`, error);
92
- }
93
- }
94
-
95
- if (feeds.length === 0) {
96
- Logger.log('No feeds found.');
97
- return;
98
- }
99
-
100
- Logger.debug({
101
- action: 'completed_processing',
102
- totalFeeds: feeds.length,
103
- totalServers: feeds.reduce((acc, feed) => acc + feed.mcpServers.length, 0)
104
- });
105
-
106
- // Output as formatted JSON
107
- console.log(JSON.stringify(feeds, null, 2));
108
- } catch (error) {
109
- Logger.error('Failed to list servers', error);
110
- process.exit(1);
111
- }
112
- });
113
- }
@@ -1,16 +0,0 @@
1
- import { Command } from 'commander';
2
- import { serverService } from '../../services/ServerService.js';
3
-
4
- export function createPullCommand(): Command {
5
- return new Command('pull')
6
- .description('Pull MCP server configurations from remote feed source')
7
- .action(async () => {
8
- try {
9
- await serverService.syncFeeds();
10
- } catch (error) {
11
- const message = error instanceof Error ? error.message : 'Unknown error';
12
- console.error('Error syncing configurations:', message);
13
- process.exit(1);
14
- }
15
- });
16
- }
@@ -1,39 +0,0 @@
1
- import { Command } from 'commander';
2
- import { startWebServer } from '../../web/server.js';
3
- import { mcpManager } from '../../services/MCPManager.js';
4
- import { checkGithubAuth } from '../../utils/githubAuth.js';
5
- import { Logger } from '../../utils/logger.js';
6
-
7
- export function createServeCommand(): Command {
8
- return new Command('serve')
9
- .description('Serve local web interface')
10
- .option('-p, --port <port>', 'Port to run the server on', '3000')
11
- .option('-f, --feed-file <filepath>', 'Path to a custom feed configuration file')
12
- .option('-s, --schemas-directory <path>', 'Path to a directory containing adhoc schema files')
13
- .action(async (options) => {
14
- try {
15
- // Sync feeds before start the local UI
16
- await mcpManager.syncFeeds();
17
-
18
- // Ensure MCP manager is initialized before starting the web server
19
- await mcpManager.initialize(options.feedFile, options.schemasDirectory);
20
-
21
- const port = parseInt(options.port, 10);
22
- if (isNaN(port) || port < 1 || port > 65535) {
23
- throw new Error('Invalid port number');
24
- }
25
-
26
- await startWebServer(port);
27
-
28
- // The server is running, keep the process alive
29
- process.on('SIGINT', () => {
30
- console.log('\nShutting down server...');
31
- process.exit(0);
32
- });
33
- } catch (error) {
34
- const message = error instanceof Error ? error.message : 'Unknown error';
35
- console.error('Failed to start web server:', message);
36
- process.exit(1);
37
- }
38
- });
39
- }
@@ -1,64 +0,0 @@
1
- import { Command } from 'commander';
2
- import { serverService } from '../../services/ServerService.js';
3
-
4
- export function createUninstallCommand(): Command {
5
- return new Command('uninstall')
6
- .description('Uninstall specific MCP servers')
7
- .requiredOption(
8
- '--category <category>',
9
- 'Server category'
10
- )
11
- .requiredOption(
12
- '--names <names>',
13
- 'Server names (semicolon separated)'
14
- )
15
- .requiredOption(
16
- '--targets <targets>',
17
- 'Target clients to uninstall from (semicolon separated)'
18
- )
19
- .option(
20
- '--remove-data',
21
- 'Remove all associated data',
22
- true // Change default to true to ensure cleanup happens
23
- )
24
- .action(async (options) => {
25
- try {
26
- const serverNames = options.names.split(';').map((name: string) => name.trim());
27
-
28
- const validNames = await serverService.validateServerName(options.category, serverNames);
29
- if (!validNames) {
30
- console.error('Invalid server names provided');
31
- process.exit(1);
32
- }
33
-
34
- console.log(`Uninstalling servers: ${serverNames.join(', ')}`);
35
-
36
- const results = await Promise.all(
37
- serverNames.map((serverName: string) => {
38
- const targets = options.targets ? options.targets.split(';').map((t: string) => t.trim()) : [];
39
- return serverService.uninstallMcpServer(options.category, serverName, {
40
- removeData: options.removeData,
41
- targets: targets
42
- });
43
- })
44
- );
45
-
46
- const { success, messages } = serverService.formatOperationResults(results);
47
- messages.forEach(message => {
48
- if (success) {
49
- console.log(`✓ ${message}`);
50
- } else {
51
- console.error(`✗ ${message}`);
52
- }
53
- });
54
-
55
- if (!success) {
56
- process.exit(1);
57
- }
58
- } catch (error) {
59
- const message = error instanceof Error ? error.message : 'Unknown error';
60
- console.error('Uninstallation failed:', message);
61
- process.exit(1);
62
- }
63
- });
64
- }
package/src/cli/index.ts DELETED
@@ -1,82 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from 'commander';
4
- import { createServeCommand } from './commands/serve.js';
5
- import { createListCommand } from './commands/list.js';
6
- import { createInstallCommand } from './commands/install.js';
7
- import { createUninstallCommand } from './commands/uninstall.js';
8
- import { createPullCommand } from './commands/pull.js';
9
- import { mcpManager } from '../services/MCPManager.js';
10
- import { Logger } from '../utils/logger.js';
11
- import { checkForUpdates } from '../utils/versionUtils.js';
12
-
13
- // Custom error interface for Commander.js errors
14
- interface CommanderError extends Error {
15
- code?: string;
16
- }
17
-
18
- async function main(): Promise<void> {
19
- // Initialize the MCP manager
20
- // await mcpManager.initialize();
21
-
22
- const program = new Command();
23
- program
24
- .name('imcp')
25
- .description('IMCP (Install Model Context Protocol) CLI')
26
- .option('--verbose', 'Show detailed logs for all commands');
27
-
28
- // Parse global options first
29
- program.parseOptions(process.argv);
30
- const opts = program.opts();
31
- Logger.setVerbose(!!opts.verbose);
32
-
33
- // Add all commands
34
- program.addCommand(createServeCommand());
35
- // program.addCommand(createListCommand());
36
- // program.addCommand(createInstallCommand());
37
- // program.addCommand(createUninstallCommand());
38
- // program.addCommand(createPullCommand());
39
-
40
- // Error handling for the entire CLI
41
- program.exitOverride();
42
-
43
- // Check for updates
44
- await checkForUpdates();
45
-
46
- try {
47
- await program.parseAsync(process.argv);
48
- } catch (error) {
49
- const commanderError = error as CommanderError;
50
-
51
- if (commanderError.code === 'commander.help') {
52
- // Help was displayed, exit normally
53
- process.exit(0);
54
- } else if (commanderError.code === 'commander.version') {
55
- // Version was displayed, exit normally
56
- process.exit(0);
57
- } else {
58
- console.error('Error:', commanderError.message || 'An unknown error occurred');
59
- process.exit(1);
60
- }
61
- }
62
- }
63
-
64
- // Handle unhandled promise rejections
65
- process.on('unhandledRejection', (error: unknown) => {
66
- if (error instanceof Error) {
67
- console.error('Unhandled promise rejection:', error.message);
68
- } else {
69
- console.error('Unhandled promise rejection:', error);
70
- }
71
- process.exit(1);
72
- });
73
-
74
- // Start the CLI
75
- main().catch((error: unknown) => {
76
- if (error instanceof Error) {
77
- console.error('Fatal error:', error.message);
78
- } else {
79
- console.error('Fatal error:', error);
80
- }
81
- process.exit(1);
82
- });