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,370 +0,0 @@
1
- # Onboarding Page: JavaScript Design and Implementation
2
-
3
- This document outlines the JavaScript architecture and key implementation details for the dynamic onboarding page.
4
-
5
- ---
6
-
7
- ## 1. File Structure and Roles
8
-
9
- The JavaScript logic is modularized into several files within `src/web/public/js/onboard/`:
10
-
11
- - **`index.js`**: Main entry point. Handles page initialization, event listeners for primary actions (form submission, tab switching), loading existing data, and orchestrates calls to other modules for more complex UI interactions like view toggling and validation.
12
- - **`formProcessor.js`**: Handles conversion between the HTML form and the `FeedConfiguration` JSON object. Contains logic for `formDataToFeedConfiguration` (Form → JSON), `populateForm` (JSON → Form), and `resetOnboardFormDynamicContent`. Also includes the `submitForm` handler.
13
- - **`uiHandlers.js`**: Manages dynamic UI manipulations, such as adding/removing server sections, environment variables, and server-specific requirements. Includes re-indexing logic, handlers for collapsible sections, view mode toggling (`toggleViewMode`), JSON data saving (`saveJsonData`), and clipboard operations (`copyJsonToClipboard`).
14
- - **`validationHandlers.js`**: Manages the validation process, including initiating validation requests (`handleValidation`). It also provides shared utility functions for polling operation status (`pollOperationStatus`) and updating the UI with operation results (`updateOperationDisplay`), which are used by both validation and publishing flows.
15
- - **`publishHandler.js`**: Manages the publishing process. This includes initiating publish requests (`handlePublish`), and utilizing shared functions from `validationHandlers.js` for polling status and displaying results.
16
- - **`templates.js`**: Contains HTML string templates for dynamically generated form sections (e.g., server items, environment variables, requirements).
17
- - **`state.js`**: Manages client-side state, primarily counters for dynamically added elements (servers, env vars per server, requirements per server).
18
- - **`templates.js`**: Contains HTML string templates for dynamically generated form sections (e.g., server items, environment variables, requirements).
19
- - **`state.js`**: Manages client-side state, primarily counters for dynamically added elements (servers, env vars per server, requirements per server).
20
-
21
- ---
22
-
23
- ## 2. Core Data Model: `FeedConfiguration`
24
-
25
- The central data structure is `FeedConfiguration` (defined in `src/core/types.ts`). This object represents the entire configuration for a new server category.
26
-
27
- **Key aspects:**
28
-
29
- - `name`, `displayName`, `description`, `repository`: Basic category information.
30
- - `mcpServers: McpConfig[]`: Array of server configurations. Each `McpConfig` includes:
31
- - `name`, `mode`, `description`, `schemas`, `repository`
32
- - `installation`: Contains `command`, `args`, and `env` (an object mapping environment variable names to their configurations).
33
- - `dependencies`: Contains `requirements: Array<{ name: string; version: string; order?: number; }>` (references to full requirement definitions).
34
- - `requirements: RequirementConfig[]`: Top-level array of unique, fully defined requirements. Each includes:
35
- - `name`, `type` (npm, pip, command, etc.), `version`
36
- - Optional: `alias` (for command type)
37
- - Optional: `registry` (for private/custom registries like GitHub, Artifactory, local)
38
-
39
- ---
40
-
41
- ## 3. Form to JSON Conversion (`formDataToFeedConfiguration`)
42
-
43
- Located in `formProcessor.js`, this function converts data from the HTML form into a `FeedConfiguration` object.
44
-
45
- **Process:**
46
-
47
- - **Parsing Strategy:** Iterates through `FormData` entries. Uses regex to identify and group fields belonging to specific servers, environment variables, and requirements based on their name attributes (e.g., `servers[0].name`, `servers[0].repository`, `servers[0].installation.env[0].name`).
48
- - **Server Processing:**
49
- - Collects all fields for each server into a temporary map.
50
- - Converts collected data into `McpConfig` objects.
51
- - Environment variables are transformed from an array of objects into the `installation.env` object structure (key-value pairs).
52
- - **Requirement Processing:**
53
- - For each server, its requirements are processed.
54
- - **Server-Specific Dependencies:** An array of `{ name, version, order }` objects is created for `mcpServer.dependencies.requirements`.
55
- - **Global Requirements List:** Full `RequirementConfig` objects (including type, alias, registry details) are constructed for each requirement defined in the form. These are added to a temporary map (`globalRequirementsMap`) to ensure uniqueness.
56
- - **De-duplication Key:** The key `${type}|${name}|${version}` ensures requirements differing in type, name, or version are treated as distinct entries in the top-level `feedConfiguration.requirements` array.
57
- - **Output:** Returns a complete `FeedConfiguration` object.
58
-
59
- ---
60
-
61
- ## 4. JSON to Form Conversion (`populateForm`)
62
-
63
- Located in `formProcessor.js`, this function populates the HTML form using a `FeedConfiguration` object. This is crucial when loading an existing category for editing or when switching from the JSON view back to the form view.
64
-
65
- **Process:**
66
-
67
- - **Form Reset:** Before populating, `resetOnboardFormDynamicContent()` (now part of `formProcessor.js` and called by `populateForm` itself) is invoked to clear existing dynamic elements and reset relevant state counters.
68
- - **Basic Fields:** Populates top-level category fields (`name`, `displayName`, etc.).
69
- - **Server Population:**
70
- - Iterates through `feedConfig.mcpServers`.
71
- - For each server, `window.addServer()` (from `uiHandlers.js`) is called to create the basic server UI block.
72
- - Server-specific fields (`name`, `mode`, `description`, `repository`, `schema`, `installation` command/args) are populated.
73
- - **Environment Variables:** Iterates `server.installation.env`, calls `window.addEnvVariable()` for each, and populates its fields.
74
- - **Package Dependencies:**
75
- - Iterates through `server.dependencies.requirements` (which are `{name, version, order}` objects, referred to as `depReq`).
76
- - For each `depReq`, searches the top-level `feedConfig.requirements` array to find the corresponding full `RequirementConfig` object (`fullReq`) by matching `fullReq.name === depReq.name` AND `fullReq.version === depReq.version`.
77
- - If `fullReq` is found, `window.addServerRequirement()` is called to create the UI block for this requirement within the server.
78
- - All fields of the requirement (`type`, `version`, `alias`, `registry` details) are then populated using data from `fullReq` and `depReq.order`.
79
- - Conditional UI elements (alias field, specific registry config sections) are toggled based on the requirement's type and selected registry.
80
-
81
- ---
82
-
83
- ## 5. Dynamic UI Handling (`uiHandlers.js`, `templates.js`)
84
-
85
- - **`templates.js`**: Provides HTML string template functions (`serverTemplate`, `envVariableTemplate`, `serverRequirementTemplate`) that generate the necessary HTML for dynamic sections. This includes correct indices for name attributes, `onclick` handlers, and structures for collapsible sections with toggle icons.
86
- - The `serverTemplate` structures each server item with collapsible sub-sections for "Package Dependencies" (which includes an "Add Dependency" button), "Startup Configuration", and "Environment Variables", in that order. It also includes a `server-content-scrollable` class on the main server content `div` for vertical scrolling.
87
- - The `serverRequirementTemplate` (used within "Package Dependencies") includes a registry type dropdown that defaults to "Public Registry" and omits the "Local Registry" and placeholder options.
88
- - Icon-only buttons with tooltips are used (e.g., the "Remove Server" button).
89
- - **`uiHandlers.js`**:
90
- - **Adding Elements:**
91
- - `addServer()`: Determines the new server's index. Inserts HTML using `serverTemplate` (which includes a collapsible server structure with sub-sections). Initializes state counters. Attaches an `onchange` event listener to the new server's mode `<select>` element, which calls `renderInstallationConfig`. Calls `renderInstallationConfig` to display the initial UI for the "Startup Configuration" section (defaulting to `stdio` fields). The server header is clickable to toggle its content visibility.
92
- - `addEnvVariable(serverIndex)`, `addServerRequirement(serverIndex)`: Get current counter for the specific server, insert HTML using respective templates, and increment the counter.
93
- - **Rendering Startup Configuration:**
94
- - `renderInstallationConfig(serverIndex)`: This function is called when a server is added or its mode is changed. It populates the "Startup Configuration" section based on the server's current mode:
95
- - If `sse`: Clears the startup configuration container (e.g., `installation-config-${serverIndex}`) and inserts an input field for `installation.url`. Hides the "Environment Variables" block.
96
- - If `stdio` (or other): Clears the startup configuration container and inserts input fields for `installation.command` and `installation.args`. Shows the "Environment Variables" block.
97
- - **Removing Elements:**
98
- - `removeServer(serverIndexToRemove)`: Removes the server item from the DOM, then calls `reindexServers()`.
99
- - `removeEnvVariable(serverIndex, envIndex)`, `removeServerRequirement(serverIndex, reqIndex)`: Remove the specific item. (Re-indexing of these sub-items happens within `reindexServers` when a parent server is re-indexed.)
100
- - **Re-indexing:**
101
- - `reindexServers()`: Called after a server is removed.
102
- - Iterates through all remaining server items in the DOM.
103
- - For each server item and its new sequential index (`newServerIndex`):
104
- - Updates its `data-index` attribute.
105
- - Updates its displayed title (e.g., "MCP Server #1").
106
- - Updates name attributes of all form elements within it to reflect `newServerIndex`.
107
- - Updates `onclick` handlers for all relevant buttons (remove server, add env var, add requirement, etc.) to use `newServerIndex`.
108
- - Updates IDs of dynamically generated elements (e.g., `schema-path-`, `envVarsContainer_`, `server-requirements-list-`).
109
- - Recursively re-indexes nested environment variables and server-specific requirements:
110
- - Updates their `data-env-index`/`data-req-index`.
111
- - Updates their input name attributes (e.g., `servers[newServerIndex].installation.env[newEnvIndex]...`).
112
- - Updates their `onclick` and `onchange` handlers with new indices.
113
- - Updates their dynamic IDs.
114
- - After re-indexing all servers and their children, it rebuilds/updates `state.envCounters` and `state.serverRequirementCounters` and sets `state.serverCounter` to the new total.
115
- - **Toggling Fields:**
116
- - `toggleServerAliasField()`: Shows/hides the alias input based on requirement type (`command`).
117
- - `toggleServerRegistryConfig()`: Shows/hides specific registry configuration sections based on the selected registry type.
118
- - `browseLocalSchema()`: Uses File System Access API (with fallback) to allow users to select a local schema file, populating its name into the input field.
119
- - `toggleSectionContent(contentId, iconElement)`: Generic handler to toggle the visibility of a content element (identified by `contentId`) and update an associated icon's state (e.g., chevron up/down). Used for all collapsible sections.
120
- - `toggleViewMode(isJsonView)`: Handles switching between the form view and the JSON editor view. Manages data conversion and panel visibility.
121
- - `saveJsonData()`: Handles submitting the data from the JSON editor.
122
- - `copyJsonToClipboard()`: Copies the content of the JSON editor to the clipboard.
123
-
124
- ---
125
-
126
- ## 6. State Management (`state.js`)
127
-
128
- Provides a simple client-side state store.
129
-
130
- - `state.serverCounter`: Tracks the total number of server sections. Managed by `setServerCounter()`, which is updated by `addServer()` and `reindexServers()`.
131
- - `state.envCounters` (`Map`): `serverIndex` → count for environment variables within each server.
132
- - `state.serverRequirementCounters` (`Map`): `serverIndex` → count for requirements within each server.
133
-
134
- These maps are updated by their respective add... functions and fully rebuilt by `reindexServers()` to ensure consistency after deletions and re-indexing.
135
-
136
- ---
137
-
138
- ## 7. View Toggling (Form vs. JSON Editor — `uiHandlers.js` & `formProcessor.js`)
139
-
140
- A toggle switch allows users to switch between the standard form view and a raw JSON editor view.
141
-
142
- - **Switching to JSON View:**
143
- - `getFormData(currentForm)` (from `formProcessor.js`) is called, which internally uses `formDataToFeedConfiguration` to get the `FeedConfiguration` object.
144
- - This object is `JSON.stringify`-ed and displayed in a `<textarea>`.
145
- - The form panel is hidden, and the JSON editor panel is shown.
146
- - **Switching back to Form View (from JSON):**
147
- - The JSON content is read from `jsonEditorTextarea` and parsed.
148
- - `resetOnboardFormDynamicContent()` (from `formProcessor.js`) is called by `populateForm` (also from `formProcessor.js`):
149
- - Clears the `serversList` container in the DOM.
150
- - Resets the main form (`onboardForm.reset()`).
151
- - Resets state counters (`setServerCounter(0)`, `state.envCounters.clear()`, `state.serverRequirementCounters.clear()`) using imported functions/objects from `state.js`.
152
- - `populateForm(parsedJsonData)` (from `formProcessor.js`) is called to reconstruct the form from the (potentially edited) JSON.
153
- - If parsing or populating the form fails:
154
- - An error notification is shown using `showToast()`.
155
- - The view remains in JSON mode.
156
- - The view mode toggle switch is ensured to be in the "JSON View" state.
157
- - If successful, the JSON editor panel is hidden, and the form panel is shown.
158
-
159
- > The `toggleViewMode` function in `uiHandlers.js` orchestrates this. Application of JSON to the form (via `populateForm` in `formProcessor.js`) is automatic upon switching back to the form view. If it fails, the user stays in JSON view.
160
-
161
- ---
162
-
163
- ## 8. Other Key Features (`index.js`, `formProcessor.js`, `validationHandlers.js`, `publishHandler.js`, `uiHandlers.js`)
164
-
165
- - **Loading Existing Category (`loadExistingCategory` in `index.js`)**: If a `?category=categoryName` URL parameter is present, fetches the category data from `/api/categories/:categoryName`, and then uses `populateForm()` (from `formProcessor.js`) to fill the form for editing. Errors are reported using `showToast()`.
166
- - **Publishing (`handlePublish` in `publishHandler.js`)**:
167
- - Triggered by the "Publish" button.
168
- - Calls `getFormData()` (from `formProcessor.js`) to get the current form data as `FeedConfiguration`.
169
- - Sends an initial POST request to `/api/categories/onboard` with the `FeedConfiguration` object and an `isUpdate` flag.
170
- - The "Publish" button shows a spinning loader icon and its text changes to "Publishing...". Both "Validate" and "Publish" buttons are disabled.
171
- - **Polling for Status**: If the initial publish request is successful and the operation is not immediately completed or failed, `handlePublish` initiates polling. The shared `pollOperationStatus` function (from `validationHandlers.js`) is called, which periodically queries `GET /api/categories/:categoryName/onboard/status?operationType=FULL_ONBOARDING`. `pollOperationStatus` now returns a boolean to manage polling continuation.
172
- - **Displaying Results**: The shared `updateOperationDisplay` function (from `validationHandlers.js`) formats and displays detailed progress, including individual steps, from both the initial publish call and subsequent status polls.
173
- - **Completion/Failure**: Polling stops based on the status returned by `pollOperationStatus`. Upon completion or failure, buttons are reset, and `showToast()` displays messages. For detailed information on recent changes to polling and status display, see Section 9: "Enhanced Operation Status Polling and Display".
174
- - **Validation (`handleValidation` in `validationHandlers.js`)**:
175
- - **Validation (`handleValidation` in `validationHandlers.js`)**:
176
- - The `validationStatusPanel` (unique per tab) is located under the "MCP Servers" section (or equivalent) and above the main action buttons ("Validate", "Publish"). It is a foldable panel.
177
- - When the "Validate" button is clicked:
178
- - Calls `getFormData()` (from `formProcessor.js`) to get the current form data as `FeedConfiguration`.
179
- - Sends an initial POST request to `/api/categories/onboard/validate`.
180
- - The "Validate" button shows a spinning loader icon and its text changes to "Validating...". Both "Validate" and "Publish" buttons are disabled.
181
- - **Polling for Status**:
182
- - If the initial validation request is successful and the operation is not immediately completed or failed, `handleValidation` initiates polling.
183
- - The shared `pollOperationStatus` function (from `validationHandlers.js`) is called, which periodically queries `GET /api/categories/:categoryName/onboard/status?operationType=VALIDATION_ONLY` (using the category name from the form). `pollOperationStatus` now returns a boolean to manage polling continuation.
184
- - **Displaying Results**:
185
- - The shared `updateOperationDisplay` function (from `validationHandlers.js`) formats and displays detailed progress, including individual steps, from both the initial validation call and subsequent status polls.
186
- - It handles different structures of the `validationStatus` object and overall operation status.
187
- - **Completion/Failure**:
188
- - Polling stops based on the status returned by `pollOperationStatus`.
189
- - Upon completion or failure, buttons are reset. For detailed information on recent changes to polling and status display, see Section 9: "Enhanced Operation Status Polling and Display".
190
- - **Copy JSON (`copyJsonToClipboard` in `uiHandlers.js`)**: Copies the content of `jsonEditorTextarea` to the clipboard. Uses `showToast()` for feedback.
191
- - **Global Function Exposure**: Necessary UI handler functions (like `addServer`, `removeServer`, `toggleSectionContent`, etc.) are attached to the `window` object so they can be called from `onclick` attributes in the HTML templates.
192
- - **Custom Notifications**: Standard browser `alert()` calls have been replaced with a custom toast notification system (`showToast()` from `../notifications.js`). This system requires an `.alert-container` div in the host HTML (`onboard.html`) and uses CSS from `css/notifications.css` for styling. The `notifications.js` module handles the creation, display, and dismissal (manual and automatic) of these toasts without relying on Bootstrap's JavaScript.
193
-
194
- ---
195
-
196
- This summary covers the main design patterns and implementation choices made for the onboarding page's frontend logic.
197
-
198
- ---
199
-
200
- ## 9. Recent Fixes and Changes (May 2025)
201
-
202
- This section documents significant fixes and behavior changes implemented recently.
203
-
204
- - **Visibility of Existing Category Servers:**
205
-
206
- - **Issue:** When selecting an existing category in the "Create Server in Existing Category" tab, the container holding the list of existing MCP servers (`existingCategoryMcpServersContainer`) and the servers themselves were not becoming visible, even though the data was being fetched and `populateForm` was called.
207
- - **Root Cause Analysis:** Extensive logging revealed that `existingCategoryMcpServersContainer` was being correctly unhidden before `populateForm` was called. However, immediately after `populateForm` completed, the container was found to be hidden again. The exact mechanism causing this re-hiding was elusive but seemed to occur synchronously within or immediately after `populateForm`'s execution, despite `populateForm` itself not directly hiding the container. Standard form reset (`form.reset()`) was ruled out as the cause.
208
- - **Solution:**
209
- 1. In `templates.js`, the `serverTemplate` was modified to ensure that the main content `div` of a server item (`server-content-${serverIndex}`) includes the `hidden` class by default. This allows the `toggleSectionContent` function to correctly manage its visibility.
210
- 2. In `uiHandlers.js`, within the `addServer` function, if a server is being rendered as `isReadOnly` (i.e., an existing server), its content section (`#server-content-${newServerIndex}`) is explicitly made visible by removing the `hidden` class. This ensures that existing servers are expanded by default when displayed.
211
- 3. **Crucially**, in `index.js`, within the `handleExistingCategorySelection` function, after `populateForm` is called to display the existing servers, a line was added to explicitly call `mcpServersContainer.classList.remove('hidden');`. This ensures that the main container for these servers is visible, overriding whatever was causing it to become hidden.
212
- - **Outcome:** Existing servers for a selected category are now correctly displayed and visible.
213
-
214
- - **Requirement Lookup in `populateForm`:**
215
-
216
- - **Issue:** The logic in `formProcessor.js` (`populateForm`) for finding the full `RequirementConfig` for a server's dependency was matching on both `name` and `version`.
217
- - **Change Request:** The lookup should only be based on the requirement `name`, ignoring the `version` specified in the server's dependency list when matching against the global `feedConfig.requirements`.
218
- - **Solution:** In `formProcessor.js`, the line:
219
- `const fullReq = (feedConfig.requirements || []).find(r => r.name === depReq.name && r.version === depReq.version);`
220
- was changed to:
221
- `const fullReq = (feedConfig.requirements || []).find(r => r.name === depReq.name);`
222
- The associated warning message was also updated to reflect this change in lookup behavior.
223
-
224
- - **Code Cleanup:**
225
-
226
- - All diagnostic `console.log` statements added during the debugging of the visibility issue were removed from `index.js`, `formProcessor.js`, and `uiHandlers.js`.
227
- - The experimental `requestAnimationFrame` logic for forcing a reflow in `formProcessor.js` was removed as it was not the solution to the visibility problem.
228
-
229
- - **Tab Switching and View Mode Toggling Enhancements:**
230
-
231
- - **Context:** A series of changes were made to improve the user experience related to switching between the main onboarding tabs ("Create New Category", "Create Server in Existing Category") and toggling between the Form view and JSON editor view.
232
- - **Issues Addressed & Solutions:**
233
- 1. **JSON View Buttons Hidden (`uiHandlers.js`):**
234
- - **Problem:** Buttons like "Cancel" and "Publish JSON" were visible in the JSON editor view, which was not desired.
235
- - **Solution:** The `toggleViewMode` function in `uiHandlers.js` was updated to explicitly hide the `jsonEditorActionsContainer` when switching to JSON view.
236
- 2. **JSON View Content Preservation (`uiHandlers.js`):**
237
- - **Problem:** Clicking the JSON view toggle switch again while already in JSON view would cause the editor's content to be re-processed or cleared.
238
- - **Solution:** The `toggleViewMode` function in `uiHandlers.js` now checks if the target view (Form or JSON) is already active. If so, it returns early, preventing unnecessary re-rendering and preserving the current content.
239
- 3. \*\*Tab Switching Logic Improvements (`index.js`):
240
- - **Problem 1:** Clicking on a main navigation tab that was already active would still trigger tab switching logic, potentially causing unnecessary view updates.
241
- - **Solution 1:** The `switchTab` function in `index.js` now checks if the `targetTab` is the same as the `activeTab`. If so, it returns immediately.
242
- - **Problem 2:** When switching away from the "Create New Category" tab and then back to it (without being in an edit-category scenario), any entered form data was lost due to an automatic form reset.
243
- - **Solution 2:** The automatic call to `resetOnboardFormDynamicContent('onboardForm')` within `switchTab` for the "Create New Category" tab (in non-edit scenarios) was removed. This allows form data to be preserved when tabbing away and back.
244
- - **Problem 3:** If the JSON view was active and a user clicked on a different main navigation tab, the new tab's form content could render on top of or alongside the still-visible JSON editor.
245
- - **Solution 3:** The `switchTab` function in `index.js` was updated. If the JSON view is active when a tab switch is initiated, it now first calls `toggleViewMode(false, ...)` to programmatically switch back to the Form view (for the currently active tab) before proceeding to display the content of the newly selected tab. This ensures a clean transition from JSON view to the new tab's form view.
246
- - **Outcome:** These changes provide a more stable, predictable, and user-friendly experience when navigating between tabs and view modes. Data entered by the user is better preserved, and UI rendering artifacts during transitions are avoided.
247
-
248
- - **Dropdown Reset, Form Disappearance, and Misplaced Validation (May 2025 - Current Session):**
249
- - **Context:** A series of interconnected issues were addressed to improve the stability and correctness of the "Create New Server in Existing Category" tab and its interaction with view toggling and validation.
250
- - **Issues Addressed & Solutions:**
251
- 1. **Existing Category Dropdown Reset (`formProcessor.js`):**
252
- - **Problem:** After selecting a category from the `existingCategorySelect` dropdown on the "Create New Server in Existing Category" tab, the dropdown would immediately reset to its default "Select a category" or "Loading..." state.
253
- - **Root Cause:** The `populateForm` function, called upon category selection, invoked `resetOnboardFormDynamicContent`. Inside `resetOnboardFormDynamicContent`, the line `formToReset.reset()` was being called for the `onboardServerForm` (the form containing the dropdown). This `HTMLFormElement.reset()` method reverts all form controls to their initial HTML values.
254
- - **Solution:** The `resetOnboardFormDynamicContent` function in `formProcessor.js` was modified. The `formToReset.reset()` call is now conditional: it is skipped if `formId` is `'onboardServerForm'`, thus preserving the dropdown's selected value. Other dynamic content clearing (server list, counters) within the function remains active.
255
- 2. **Form Disappearance on JSON Toggle (Existing Category Tab - `formProcessor.js`):**
256
- - **Problem:** On the "Create New Server in Existing Category" tab, if a category was selected (displaying its basic info and servers), then the view was toggled to JSON and back to Form view, the displayed category information would vanish.
257
- - **Root Cause:** When `toggleViewMode` (in `uiHandlers.js`) switched from JSON back to Form view, it called `populateForm`. However, `populateForm` lacked specific logic to re-populate the basic category information fields (name, display name, description, repository) for the `onboardServerForm`. Additionally, the containers for this basic info (`existingCategoryBasicInfoContainer`) and the MCP servers (`existingCategoryMcpServersContainer`) were not being explicitly made visible again after `resetOnboardFormDynamicContent` (called by `populateForm`) might have hidden them or cleared their content.
258
- - **Solution:**
259
- - An `else if (formId === 'onboardServerForm' && feedConfig)` block was added to `populateForm` in `formProcessor.js`. This block now explicitly populates the read-only basic category information fields using the `feedConfig` data.
260
- - Within this new block, `existingCategoryBasicInfoContainer.classList.remove('hidden')` and `existingCategoryMcpServersContainer.classList.remove('hidden')` are called to ensure these sections are visible.
261
- 3. **Validation Results on Wrong Tab (Multiple Files):**
262
- - **Problem:** Clicking the "Validate" button on the "Create New Server in Existing Category" tab would display the validation results in the validation panel of the "Create New Category" tab.
263
- - **Root Cause:** Validation panels, content areas, and buttons on both tabs shared common HTML IDs (e.g., `validationStatusPanel`, `validateButton`). JavaScript's `getElementById` would typically find the first matching element in the DOM, leading to the incorrect panel being targeted.
264
- - **Solution (Multi-file update):**
265
- - **HTML (`onboard.html`):** All relevant validation-related element IDs were made unique for each tab (e.g., `validationStatusPanelNewCategory`, `validateButtonNewCategory`, `validationStatusPanelExistingCategory`, `validateButtonExistingCategory`).
266
- - **Event Listeners (`index.js`):** Event listeners for the "Validate" buttons were updated to target these new unique IDs.
267
- - **Validation Logic (`validationHandlers.js`):**
268
- - The `handleValidation` function was updated to accept `activeTab` and `currentSelectedCategoryData` as parameters. It now dynamically determines the correct, unique element IDs for the panel, content area, form, validate button, and publish button based on the `activeTab`.
269
- - The `pollValidationStatus` function was modified to accept these dynamic element IDs as parameters, ensuring it updates the UI on the correct tab during polling.
270
- - The call to `getFormData` within `handleValidation` was adjusted to pass the `forExistingCategoryTab` flag and `currentSelectedCategoryData` when validating for the "Create Server in Existing Category" tab.
271
- - **Form Reset Logic (`formProcessor.js`):**
272
- - The `resetOnboardFormDynamicContent` function was updated. When resetting validation panels, it now determines the correct unique panel ID and content ID based on the `formId` parameter, ensuring it hides and clears the appropriate panel for the active tab.
273
- - **Outcome:** These fixes ensure that the "Create New Server in Existing Category" tab functions correctly with respect to category selection, view toggling, and validation display, providing a more robust and intuitive user experience.
274
-
275
- - **API Data Integrity and UI State for "Create Server" Tab (May 2025 - Current Session):**
276
- - **Context:** Two issues were addressed related to the "Create Server in Existing Category" tab's interaction with backend APIs and UI feedback during operations.
277
- - **Issues Addressed & Solutions:**
278
- 1. **Incomplete Data Sent to API:**
279
- - **Problem:** When using the "Validate" or "Publish" buttons on the "Create Server in Existing Category" tab, only the data for the newly added server(s) was being sent to the backend, omitting the data of the existing category to which they were being added.
280
- - **Solution:**
281
- - The `handleValidation` function in `validationHandlers.js` was updated. It now retrieves the new server data using `getFormData` and then merges it with the `currentSelectedCategoryData` (the full data of the existing category) before sending the combined `FeedConfiguration` to the `/api/categories/onboard/validate` endpoint.
282
- - Similarly, the `handlePublish` function in `publishHandler.js` was updated to perform the same merge of new server data with `currentSelectedCategoryData` before sending the complete payload to the `/api/categories/onboard` endpoint.
283
- - **Outcome:** The backend now receives the full, correct `FeedConfiguration` when a new server is validated or published within an existing category.
284
- 2. **Persistent Spinner on Publish Failure:**
285
- - **Problem:** If a publish operation failed (e.g., backend returns a "FAILED" status), the "Publish" button would remain in its loading state (displaying a spinner icon) instead of reverting to its active state.
286
- - **Root Cause:** The status check within the `pollOperationStatus` function (in `validationHandlers.js`) was case-sensitive when comparing the received status string (e.g., "failed") against expected terminal states (e.g., "FAILED"). If the casing didn't match, the logic to reset button states wasn't triggered.
287
- - **Solution:**
288
- - The `pollOperationStatus` function in `validationHandlers.js` was modified to convert the received status string to uppercase before comparing it against 'COMPLETED', 'FAILED', or 'SUCCEEDED'. This makes the check case-insensitive.
289
- - Additionally, the direct error/failure handling paths within `handlePublish` (in `publishHandler.js`) were enhanced to ensure both "Publish" and "Validate" buttons are comprehensively reset (disabling, innerHTML, and opacity classes) if the initial publish call itself fails or returns a terminal status immediately.
290
- - **Outcome:** The "Publish" and "Validate" buttons now reliably revert to their default active states when an operation (validation or publish) concludes with a failure, regardless of the casing of the status string from the backend or whether the failure occurs immediately or during polling.
291
- - **Overall Outcome:** These changes improve the reliability of data submission and provide more accurate UI feedback for asynchronous operations on the "Create Server in Existing Category" tab.
292
-
293
- - **Enhanced Operation Status Polling and Display (May 2025 - Current Session):**
294
- - **Context:** Significant improvements were made to the handling of asynchronous operations (validation and publishing), including more detailed progress display, robust polling, and clearer API interactions.
295
- - **Issues Addressed & Solutions:**
296
- 1. **Server-Side API (`server.ts` - `/api/categories/:categoryName/onboard/status`):**
297
- - The endpoint now requires an `operationType` query parameter (e.g., `VALIDATION_ONLY`, `FULL_ONBOARDING`).
298
- - The response payload (`OperationStatus`) was enhanced to include:
299
- - `steps`: An array of objects detailing each step of the operation (name, serverName, timestamp, status, errorMessage).
300
- - `operationType`: Reflects the type of operation being tracked, taken from the status object.
301
- - `feedConfiguration`: Conditionally included for successful `VALIDATION_ONLY` operations if present in the result.
302
- - The `onboardingId` in the response is `categoryName_operationType`.
303
- - The `message` field in the response now prioritizes the last step's name or an overall error message.
304
- 2. **Client-Side Polling Logic (`validationHandlers.js` - `pollOperationStatus`):**
305
- - The function now accepts an `operationType` parameter, which is passed to the API.
306
- - It returns a boolean promise (`Promise<boolean>`) indicating whether polling should continue, allowing the caller (`handleValidation` or `handlePublish`) to manage `clearInterval`.
307
- - Calls `ensureProgressToggleListener` to ensure the UI for displaying progress steps is interactive.
308
- - Status comparisons (`COMPLETED`, `FAILED`, `SUCCEEDED`) are now case-insensitive.
309
- 3. **Operation Initiation (`publishHandler.js` - `handlePublish`, `validationHandlers.js` - `handleValidation`):**
310
- - When initiating polling, these functions now pass the correct `operationType` (`FULL_ONBOARDING` for publish, `VALIDATION_ONLY` for validate) and use the original `finalFeedConfiguration.name` as the `categoryName` for the polling request.
311
- - They now manage `clearInterval` based on the boolean returned by `pollOperationStatus`.
312
- - Both handlers call `ensureProgressToggleListener` at the beginning to prepare the UI for status updates.
313
- - `handlePublish` includes improved error handling for the initial publish request, ensuring UI elements are correctly updated even if the initial call fails or returns a terminal status.
314
- 4. **UI Display (`validationHandlers.js` - `updateOperationDisplay`):**
315
- - A new collapsible "Progress" section is displayed, showing detailed `steps` from the API response. Each step includes:
316
- - A status icon (error, in-progress spinner, success).
317
- - The step name, server name (if applicable), and timestamp.
318
- - An error message for the step, if any.
319
- - The visibility of the "Progress" section is managed by `ensureProgressToggleListener` (which attaches a click handler to the section header) and the `toggleSectionContent` utility.
320
- - The `operationType` is now displayed.
321
- - The logic for displaying the overall status spinner has been updated to cover more in-progress states (e.g., `PENDING`, `VALIDATING`, `PRCREATING`, `PUBLISHING`) and uses case-insensitive comparisons.
322
- 5. **Progress Section Toggling (`validationHandlers.js` - `ensureProgressToggleListener`):**
323
- - A new exported utility function, `ensureProgressToggleListener`, was added. It attaches a click event listener to the status content element. This listener delegates to `toggleSectionContent` (from `uiHandlers.js`) when the progress section header is clicked, allowing users to expand or collapse the detailed list of progress steps. The listener is attached only once per status content element.
324
- - **Outcome:** These changes provide users with more granular and interactive feedback on long-running operations, improve the robustness and accuracy of status polling, and align client-server communication for tracking asynchronous onboarding tasks.
325
- ---
326
-
327
- ## 10. Server Validation System
328
-
329
- The server validation system consists of multiple components that work together to validate MCP server configurations. This ensures that servers are properly configured before they can be deployed.
330
-
331
- ### Server Validator Architecture
332
-
333
- - **`IServerValidator` Interface**: Defines the common validation contract for all server validators:
334
- - `validateServer(server: McpConfig, config: FeedConfiguration): Promise<boolean>`
335
- - Implementations throw errors with descriptive messages when validation fails
336
-
337
- - **`ServerValidatorFactory`**: Factory class managing validator instances
338
- - Maintains a singleton map of validators by type ('stdio' | 'sse')
339
- - Provides methods to get appropriate validator for server mode
340
- - Initializes validators on construction
341
-
342
- ### Validator Implementations
343
-
344
- 1. **StdioServerValidator**:
345
- - Validates stdio-mode MCP server configurations
346
- - Key validation steps:
347
- - Verifies installation command exists and is executable
348
- - Validates required environment variables
349
- - Validates and installs dependencies using installer factory
350
- - Tests server startup with path resolution for:
351
- - Node commands: Resolves `${NPMPATH}` in arguments
352
- - Python commands: Resolves `${PYTHON_PACKAGE}` in arguments
353
- - Uses timeout-based server startup testing with output monitoring
354
- - Comprehensive error handling and logging
355
-
356
- 2. **SSEServerValidator**:
357
- - Validates SSE-mode MCP server configurations
358
- - Key validation steps:
359
- - Verifies installation URL is present and valid
360
- - Validates server mode is 'sse'
361
- - Extensible design for additional SSE-specific validation
362
-
363
- ### Error Handling
364
-
365
- - All validators provide detailed error messages through Error objects
366
- - Errors include specific validation failure reasons (e.g., missing command, invalid URL)
367
- - Logging is implemented throughout the validation process
368
- - Error messages propagate to the UI for user feedback
369
-
370
- This validation system ensures that server configurations are complete and functional before deployment, reducing runtime issues and improving reliability.