imcp 0.1.4 → 0.1.5

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 (228) hide show
  1. package/README.md +21 -4
  2. package/dist/cli/commands/install.js.map +1 -0
  3. package/dist/cli/commands/list.js.map +1 -0
  4. package/dist/cli/commands/pull.js.map +1 -0
  5. package/dist/cli/commands/serve.js.map +1 -0
  6. package/dist/cli/commands/start.d.ts +2 -0
  7. package/dist/cli/commands/start.js +32 -0
  8. package/dist/cli/commands/start.js.map +1 -0
  9. package/dist/cli/commands/sync.d.ts +2 -0
  10. package/dist/cli/commands/sync.js +17 -0
  11. package/dist/cli/commands/sync.js.map +1 -0
  12. package/dist/cli/commands/uninstall.js.map +1 -0
  13. package/dist/cli/index.js +0 -0
  14. package/dist/cli/index.js.map +1 -0
  15. package/dist/core/ConfigurationLoader.d.ts +32 -0
  16. package/{src/core/loaders/ConfigurationLoader.ts → dist/core/ConfigurationLoader.js} +236 -298
  17. package/dist/core/ConfigurationLoader.js.map +1 -0
  18. package/dist/core/ConfigurationProvider.d.ts +35 -0
  19. package/{src/core/loaders/ConfigurationProvider.ts → dist/core/ConfigurationProvider.js} +375 -462
  20. package/dist/core/ConfigurationProvider.js.map +1 -0
  21. package/dist/core/InstallationService.d.ts +50 -0
  22. package/dist/core/InstallationService.js +350 -0
  23. package/dist/core/InstallationService.js.map +1 -0
  24. package/dist/core/MCPManager.d.ts +28 -0
  25. package/dist/core/MCPManager.js +188 -0
  26. package/dist/core/MCPManager.js.map +1 -0
  27. package/dist/core/RequirementService.d.ts +40 -0
  28. package/dist/core/RequirementService.js +110 -0
  29. package/dist/core/RequirementService.js.map +1 -0
  30. package/dist/core/ServerSchemaLoader.d.ts +11 -0
  31. package/dist/core/ServerSchemaLoader.js +43 -0
  32. package/dist/core/ServerSchemaLoader.js.map +1 -0
  33. package/dist/core/ServerSchemaProvider.d.ts +17 -0
  34. package/dist/core/ServerSchemaProvider.js +120 -0
  35. package/dist/core/ServerSchemaProvider.js.map +1 -0
  36. package/dist/core/constants.d.ts +47 -0
  37. package/dist/core/constants.js +94 -0
  38. package/dist/core/constants.js.map +1 -0
  39. package/dist/core/installers/BaseInstaller.d.ts +74 -0
  40. package/dist/core/installers/BaseInstaller.js +253 -0
  41. package/dist/core/installers/BaseInstaller.js.map +1 -0
  42. package/dist/core/installers/ClientInstaller.d.ts +23 -0
  43. package/dist/core/installers/ClientInstaller.js +564 -0
  44. package/dist/core/installers/ClientInstaller.js.map +1 -0
  45. package/dist/core/installers/CommandInstaller.d.ts +37 -0
  46. package/{src/core/installers/requirements/CommandInstaller.ts → dist/core/installers/CommandInstaller.js} +173 -231
  47. package/dist/core/installers/CommandInstaller.js.map +1 -0
  48. package/dist/core/installers/GeneralInstaller.d.ts +33 -0
  49. package/dist/core/installers/GeneralInstaller.js +85 -0
  50. package/dist/core/installers/GeneralInstaller.js.map +1 -0
  51. package/dist/core/installers/InstallerFactory.d.ts +54 -0
  52. package/{src/core/installers/requirements/InstallerFactory.ts → dist/core/installers/InstallerFactory.js} +97 -114
  53. package/dist/core/installers/InstallerFactory.js.map +1 -0
  54. package/dist/core/installers/NpmInstaller.d.ts +26 -0
  55. package/dist/core/installers/NpmInstaller.js +127 -0
  56. package/dist/core/installers/NpmInstaller.js.map +1 -0
  57. package/dist/core/installers/PipInstaller.d.ts +28 -0
  58. package/dist/core/installers/PipInstaller.js +127 -0
  59. package/dist/core/installers/PipInstaller.js.map +1 -0
  60. package/{src/core/installers/requirements/RequirementInstaller.ts → dist/core/installers/RequirementInstaller.d.ts} +33 -42
  61. package/dist/core/installers/RequirementInstaller.js +3 -0
  62. package/dist/core/installers/RequirementInstaller.js.map +1 -0
  63. package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
  64. package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
  65. package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
  66. package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
  67. package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
  68. package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
  69. package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
  70. package/dist/core/installers/index.js.map +1 -0
  71. package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
  72. package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
  73. package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
  74. package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
  75. package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
  76. package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
  77. package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
  78. package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
  79. package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
  80. package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
  81. package/dist/core/loaders/InstallOperationManager.js.map +1 -0
  82. package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
  83. package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
  84. package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
  85. package/dist/core/metadatas/constants.js.map +1 -0
  86. package/dist/core/metadatas/recordingConstants.js.map +1 -0
  87. package/dist/core/metadatas/types.js.map +1 -0
  88. package/dist/core/onboard/FeedOnboardService.js.map +1 -0
  89. package/dist/core/onboard/OnboardProcessor.js.map +1 -0
  90. package/dist/core/onboard/OnboardStatus.js.map +1 -0
  91. package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
  92. package/dist/core/types.d.ts +166 -0
  93. package/dist/core/types.js +16 -0
  94. package/dist/core/types.js.map +1 -0
  95. package/dist/core/validators/FeedValidator.js.map +1 -0
  96. package/dist/core/validators/IServerValidator.js.map +1 -0
  97. package/dist/core/validators/SSEServerValidator.js.map +1 -0
  98. package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
  99. package/dist/core/validators/StdioServerValidator.js.map +1 -0
  100. package/dist/index.js.map +1 -0
  101. package/dist/services/InstallRequestValidator.d.ts +21 -0
  102. package/dist/services/InstallRequestValidator.js +99 -0
  103. package/dist/services/InstallRequestValidator.js.map +1 -0
  104. package/dist/services/InstallationService.js.map +1 -0
  105. package/dist/services/MCPManager.js.map +1 -0
  106. package/dist/services/RequirementService.js.map +1 -0
  107. package/dist/services/ServerService.js.map +1 -0
  108. package/dist/services/TelemetryService.js.map +1 -0
  109. package/dist/utils/UpdateCheckTracker.js.map +1 -0
  110. package/dist/utils/adoUtils.js.map +1 -0
  111. package/dist/utils/clientUtils.js.map +1 -0
  112. package/dist/utils/feedUtils.js.map +1 -0
  113. package/dist/utils/githubAuth.js.map +1 -0
  114. package/dist/utils/githubUtils.js.map +1 -0
  115. package/dist/utils/logger.js.map +1 -0
  116. package/dist/utils/macroExpressionUtils.js.map +1 -0
  117. package/dist/utils/osUtils.js.map +1 -0
  118. package/dist/utils/versionUtils.js.map +1 -0
  119. package/dist/web/contract/serverContract.js.map +1 -0
  120. package/dist/web/public/index.html +1 -1
  121. package/dist/web/public/js/modal/installHandler.js +227 -0
  122. package/dist/web/public/js/modal/loadingUI.js +74 -0
  123. package/dist/web/public/js/modal/messageQueue.js +101 -45
  124. package/dist/web/public/js/modal/modalUI.js +214 -0
  125. package/{src/web/public/js/modal/versionUtils.js → dist/web/public/js/modal/version.js} +1 -1
  126. package/dist/web/public/onboard.html +4 -4
  127. package/dist/web/server.js.map +1 -0
  128. package/package.json +5 -1
  129. package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
  130. package/.github/acl/access.yml +0 -20
  131. package/.github/compliance/inventory.yml +0 -5
  132. package/.github/policies/jit.yml +0 -19
  133. package/.roo/rules-code/rules.md +0 -88
  134. package/dist/core/onboard/InstallOperationManager.d.ts +0 -23
  135. package/dist/core/onboard/InstallOperationManager.js +0 -144
  136. package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
  137. package/docs/Telemetry.md +0 -136
  138. package/memory-bank/activeContext.md +0 -26
  139. package/memory-bank/decisionLog.md +0 -91
  140. package/memory-bank/productContext.md +0 -41
  141. package/memory-bank/progress.md +0 -35
  142. package/memory-bank/systemPatterns.md +0 -10
  143. package/src/cli/commands/install.ts +0 -139
  144. package/src/cli/commands/list.ts +0 -113
  145. package/src/cli/commands/pull.ts +0 -16
  146. package/src/cli/commands/serve.ts +0 -39
  147. package/src/cli/commands/uninstall.ts +0 -64
  148. package/src/cli/index.ts +0 -82
  149. package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
  150. package/src/core/installers/clients/ClientInstaller.ts +0 -222
  151. package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
  152. package/src/core/installers/clients/ClineInstaller.ts +0 -35
  153. package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
  154. package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
  155. package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
  156. package/src/core/installers/index.ts +0 -11
  157. package/src/core/installers/requirements/BaseInstaller.ts +0 -85
  158. package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
  159. package/src/core/installers/requirements/NpmInstaller.ts +0 -271
  160. package/src/core/installers/requirements/NugetInstaller.ts +0 -203
  161. package/src/core/installers/requirements/PipInstaller.ts +0 -207
  162. package/src/core/loaders/InstallOperationManager.ts +0 -367
  163. package/src/core/loaders/ServerSchemaLoader.ts +0 -117
  164. package/src/core/loaders/ServerSchemaProvider.ts +0 -99
  165. package/src/core/loaders/SystemSettingsManager.ts +0 -278
  166. package/src/core/metadatas/constants.ts +0 -122
  167. package/src/core/metadatas/recordingConstants.ts +0 -65
  168. package/src/core/metadatas/types.ts +0 -202
  169. package/src/core/onboard/FeedOnboardService.ts +0 -501
  170. package/src/core/onboard/OnboardProcessor.ts +0 -356
  171. package/src/core/onboard/OnboardStatus.ts +0 -60
  172. package/src/core/onboard/OnboardStatusManager.ts +0 -416
  173. package/src/core/validators/FeedValidator.ts +0 -135
  174. package/src/core/validators/IServerValidator.ts +0 -21
  175. package/src/core/validators/SSEServerValidator.ts +0 -43
  176. package/src/core/validators/ServerValidatorFactory.ts +0 -51
  177. package/src/core/validators/StdioServerValidator.ts +0 -313
  178. package/src/index.ts +0 -44
  179. package/src/services/InstallationService.ts +0 -102
  180. package/src/services/MCPManager.ts +0 -249
  181. package/src/services/RequirementService.ts +0 -627
  182. package/src/services/ServerService.ts +0 -161
  183. package/src/services/TelemetryService.ts +0 -59
  184. package/src/utils/UpdateCheckTracker.ts +0 -86
  185. package/src/utils/adoUtils.ts +0 -293
  186. package/src/utils/clientUtils.ts +0 -72
  187. package/src/utils/feedUtils.ts +0 -31
  188. package/src/utils/githubAuth.ts +0 -212
  189. package/src/utils/githubUtils.ts +0 -164
  190. package/src/utils/logger.ts +0 -195
  191. package/src/utils/macroExpressionUtils.ts +0 -104
  192. package/src/utils/osUtils.ts +0 -700
  193. package/src/utils/versionUtils.ts +0 -114
  194. package/src/web/contract/serverContract.ts +0 -74
  195. package/src/web/public/css/detailsWidget.css +0 -235
  196. package/src/web/public/css/modal.css +0 -757
  197. package/src/web/public/css/notifications.css +0 -101
  198. package/src/web/public/css/onboard.css +0 -107
  199. package/src/web/public/css/serverCategoryList.css +0 -120
  200. package/src/web/public/css/serverDetails.css +0 -139
  201. package/src/web/public/index.html +0 -359
  202. package/src/web/public/js/api.js +0 -132
  203. package/src/web/public/js/detailsWidget.js +0 -264
  204. package/src/web/public/js/flights/flights.js +0 -127
  205. package/src/web/public/js/modal/index.js +0 -52
  206. package/src/web/public/js/modal/installModal.js +0 -162
  207. package/src/web/public/js/modal/installation.js +0 -266
  208. package/src/web/public/js/modal/loadingModal.js +0 -182
  209. package/src/web/public/js/modal/modalSetup.js +0 -595
  210. package/src/web/public/js/modal/modalUtils.js +0 -37
  211. package/src/web/public/js/modal.js +0 -42
  212. package/src/web/public/js/notifications.js +0 -137
  213. package/src/web/public/js/onboard/formProcessor.js +0 -1037
  214. package/src/web/public/js/onboard/index.js +0 -374
  215. package/src/web/public/js/onboard/publishHandler.js +0 -172
  216. package/src/web/public/js/onboard/state.js +0 -76
  217. package/src/web/public/js/onboard/templates.js +0 -342
  218. package/src/web/public/js/onboard/uiHandlers.js +0 -1076
  219. package/src/web/public/js/onboard/validationHandlers.js +0 -493
  220. package/src/web/public/js/serverCategoryDetails.js +0 -364
  221. package/src/web/public/js/serverCategoryList.js +0 -241
  222. package/src/web/public/js/settings.js +0 -314
  223. package/src/web/public/modal.html +0 -84
  224. package/src/web/public/onboard.html +0 -296
  225. package/src/web/public/settings.html +0 -135
  226. package/src/web/public/styles.css +0 -277
  227. package/src/web/server.ts +0 -478
  228. package/tsconfig.json +0 -18
@@ -1,595 +0,0 @@
1
- import { showToast, showConfirm } from '../notifications.js';
2
- import { showInstallLoadingModal, updateOverallInstallStatus } from './loadingModal.js';
3
- // import { delayedAppendInstallLoadingMessage } from './messageQueue.js'; // No longer used
4
- import { uninstallTools } from './installation.js';
5
- import { handleBulkClientInstall } from './installation.js';
6
- import { compareVersions } from './versionUtils.js';
7
-
8
- /**
9
- * Set up client items in the modal
10
- */
11
- export function setupClientItems(targets, serverStatus, categoryName, serverName, targetDiv) {
12
- targets.forEach(target => {
13
- const operationStatus = serverStatus.installedStatus[target] || { status: 'not-installed', type: 'check', target: 'server' };
14
-
15
- // Determine client status
16
- let statusText = '';
17
- let statusClass = '';
18
-
19
- if (operationStatus.status === 'completed' && operationStatus.type === 'install') {
20
- statusText = 'Installed';
21
- statusClass = 'installed';
22
- } else if (operationStatus.status === 'pending') {
23
- statusText = 'Pending Requirements';
24
- statusClass = 'pending';
25
- } else if (operationStatus.status === 'in-progress') {
26
- statusText = 'In Progress';
27
- statusClass = 'pending';
28
- } else if (operationStatus.status === 'failed') {
29
- statusText = 'Failed';
30
- statusClass = 'not-installed';
31
- }
32
-
33
- const isConfigured = operationStatus.status === 'completed' && operationStatus.type === 'install';
34
- const isInProgress = operationStatus.status === 'in-progress';
35
- const isSelectable = !isConfigured && !isInProgress;
36
-
37
- const clientItem = createClientItem(target, statusText, statusClass, isSelectable, isConfigured, isInProgress);
38
- setupClientItemListeners(clientItem, target, isSelectable);
39
- setupUninstallButton(clientItem, statusText, operationStatus, target, categoryName, serverName, statusClass);
40
- targetDiv.appendChild(clientItem);
41
- });
42
-
43
- addSectionTitle(targetDiv);
44
- }
45
-
46
- /**
47
- * Set up environment variables section in the modal
48
- */
49
- export function setupEnvironmentVariables(mcpServer, envInputsDiv, targetData) {
50
- // For SSE mode, don't show env section at all
51
- if (mcpServer.mode === 'sse') {
52
- envInputsDiv.style.display = 'none';
53
- return;
54
- }
55
-
56
- const envRequirements = mcpServer.installation?.['env'] || mcpServer.installation?.env || {};
57
- addEnvironmentTitle(envInputsDiv);
58
-
59
- // Fetch system settings to get userConfigurations for env defaults
60
- fetch('/api/settings')
61
- .then(response => response.json())
62
- .then(data => {
63
- const userConfigurations = (data && data.data && data.data.userConfigurations) ? data.data.userConfigurations : {};
64
- if (Object.keys(envRequirements).length === 0) {
65
- addNoEnvMessage(envInputsDiv);
66
- } else {
67
- createEnvironmentInputs(envRequirements, envInputsDiv, targetData.clientMcpSettings, mcpServer.name, userConfigurations);
68
- }
69
- })
70
- .catch(() => {
71
- // fallback to old logic if fetch fails
72
- if (Object.keys(envRequirements).length === 0) {
73
- addNoEnvMessage(envInputsDiv);
74
- } else {
75
- createEnvironmentInputs(envRequirements, envInputsDiv, targetData.clientMcpSettings, mcpServer.name, {});
76
- }
77
- });
78
- }
79
-
80
- /**
81
- * Set up installation arguments section in the modal
82
- */
83
- export function setupInstallationArguments(installation, modalArguments, categoryName, mcpServer) {
84
- // For SSE mode, don't show arguments section at all
85
- if (mcpServer?.mode === 'sse') {
86
- modalArguments.style.display = 'none';
87
- return;
88
- }
89
-
90
- if (!installation) return;
91
-
92
- addArgumentsTitle(modalArguments);
93
- const container = createArgumentsContainer();
94
- modalArguments.appendChild(container);
95
-
96
- if (installation.args && Array.isArray(installation.args)) {
97
- installation.args.forEach(arg => {
98
- container.appendChild(createArgumentInput(arg));
99
- });
100
- } else {
101
- container.appendChild(createArgumentInput());
102
- }
103
-
104
- if (installation.command === 'python' || installation.command.includes('python')) {
105
- addPythonEnvironmentInput(categoryName, mcpServer.name, modalArguments);
106
- }
107
- }
108
-
109
- /**
110
- * Set up server requirements section in the modal
111
- */
112
- export function setupServerRequirements(mcpServer, serverData, categoryName, serverName, modalRequirements) {
113
- // For SSE mode, don't show requirements section at all
114
- if (mcpServer.mode === 'sse') {
115
- modalRequirements.style.display = 'none';
116
- return;
117
- }
118
-
119
- const serverRequirements = mcpServer.dependencies?.requirements || [];
120
- const requirements = serverData.data.installationStatus?.requirementsStatus || {};
121
-
122
- if (serverRequirements.length > 0) {
123
- const reqHtml = renderRequirements(serverRequirements, requirements, categoryName, serverName);
124
- modalRequirements.innerHTML = `
125
- <h3 class="text-lg font-semibold text-gray-700 mb-3">Dependencies</h3>
126
- <p class="text-sm text-gray-600 mb-4">These dependencies will be automatically installed when installing the server</p>
127
- ${reqHtml}
128
- `;
129
-
130
- setupUpdateToggles(modalRequirements);
131
- } else {
132
- modalRequirements.innerHTML = '<p class="text-gray-600">No additional dependencies required.</p>';
133
- }
134
- }
135
-
136
- /**
137
- * Set up the form submit handler
138
- */
139
- export function setupFormSubmitHandler(form, envInputsDiv, modalArguments, modalRequirements, categoryName, serverName, serverStatuses, serverData, mcpServer) {
140
- form.onsubmit = (e) => {
141
- e.preventDefault();
142
-
143
- const envVars = {};
144
- const args = [];
145
- const requirementsToUpdate = [];
146
- let pythonEnv = undefined;
147
-
148
- // Only collect env, args and requirements if not in SSE mode
149
- if (mcpServer?.mode !== 'sse') {
150
- const inputs = envInputsDiv.querySelectorAll('input');
151
- inputs.forEach(input => {
152
- if (input.name && input.value) {
153
- envVars[input.name] = input.value;
154
- }
155
- });
156
-
157
- const argInputs = modalArguments.querySelectorAll('.arg-input');
158
- args.push(...Array.from(argInputs)
159
- .map(input => input.value.trim())
160
- .filter(val => val !== ''));
161
-
162
- const pythonEnvInput = document.getElementById('python_env');
163
- pythonEnv = pythonEnvInput?.value?.trim();
164
-
165
- const updateToggles = modalRequirements.querySelectorAll('.toggle-update:checked');
166
- updateToggles.forEach(toggle => {
167
- requirementsToUpdate.push({
168
- name: toggle.dataset.name,
169
- version: toggle.dataset.version
170
- });
171
- });
172
- }
173
-
174
- // Only POST userConfigurations and/or pythonEnvs if there is a difference, then proceed with install
175
- fetch('/api/settings')
176
- .then(response => response.json())
177
- .then(data => {
178
- const userConfigurations = (data && data.data && data.data.userConfigurations) ? data.data.userConfigurations : {};
179
- const pythonEnvs = (data && data.data && data.data.pythonEnvs) ? data.data.pythonEnvs : {};
180
- const updatedUserConfigurations = { ...userConfigurations };
181
- const updatedPythonEnvs = { ...pythonEnvs };
182
-
183
- Object.keys(envVars).forEach(key => {
184
- updatedUserConfigurations[key] = envVars[key];
185
- });
186
-
187
- // Check for userConfigurations difference
188
- let needsUserConfigUpdate = false;
189
- const allUserConfigKeys = new Set([...Object.keys(userConfigurations), ...Object.keys(envVars)]);
190
- for (const key of allUserConfigKeys) {
191
- if (userConfigurations[key] !== updatedUserConfigurations[key]) {
192
- needsUserConfigUpdate = true;
193
- break;
194
- }
195
- }
196
-
197
- // Check for pythonEnvs difference
198
- let needsPythonEnvUpdate = false;
199
- if (pythonEnv !== undefined && pythonEnv !== pythonEnvs[`${categoryName}:${serverName}`]) {
200
- updatedPythonEnvs[`${categoryName}:${serverName}`] = pythonEnv;
201
- needsPythonEnvUpdate = true;
202
- }
203
-
204
- // If either needs update, POST the merged object
205
- if (needsUserConfigUpdate || needsPythonEnvUpdate) {
206
- const postBody = {};
207
- if (needsUserConfigUpdate) postBody.userConfigurations = updatedUserConfigurations;
208
- if (needsPythonEnvUpdate) postBody.pythonEnvs = updatedPythonEnvs;
209
- fetch('/api/settings', {
210
- method: 'POST',
211
- headers: { 'Content-Type': 'application/json' },
212
- body: JSON.stringify(postBody)
213
- }).then(() => {
214
- proceedInstall();
215
- }).catch(() => {
216
- proceedInstall();
217
- });
218
- } else {
219
- proceedInstall();
220
- }
221
- })
222
- .catch(() => {
223
- proceedInstall();
224
- });
225
-
226
- function proceedInstall() {
227
- const hasRequirementsToUpdate = requirementsToUpdate.length > 0;
228
-
229
- const uninstallBtn = document.querySelector('.uninstall-btn');
230
- if (!uninstallBtn || !uninstallBtn.matches(':active')) {
231
- const selectedTargets = window.selectedClients;
232
- if (selectedTargets.length === 0 && !hasRequirementsToUpdate) {
233
- showToast('Please select at least one client to configure.', 'error');
234
- return;
235
- }
236
-
237
- let installingMessage = "Starting installation...";
238
- const serverStatus = serverStatuses[serverName] || { installedStatus: {} };
239
- if (selectedTargets.length > 0) {
240
- const target = selectedTargets[0];
241
- const msg = serverStatus.installedStatus?.[target]?.message;
242
- if (msg) installingMessage = msg;
243
- }
244
-
245
- const serverInstallOptions = {
246
- targetClients: selectedTargets,
247
- env: envVars,
248
- args: args,
249
- settings: pythonEnv ? { pythonEnv: pythonEnv } : {}
250
- };
251
-
252
- if (requirementsToUpdate.length > 0) {
253
- serverInstallOptions.requirements = requirementsToUpdate;
254
- }
255
-
256
- handleBulkClientInstall(categoryName, serverName, selectedTargets, envVars, installingMessage, serverData, serverInstallOptions);
257
- }
258
- }
259
- };
260
- }
261
-
262
- // Helper functions
263
- function createClientItem(target, statusText, statusClass, isSelectable, isConfigured, isInProgress) {
264
- const clientItem = document.createElement('div');
265
- clientItem.className = 'client-item';
266
- clientItem.dataset.target = target;
267
- clientItem.dataset.selected = 'false';
268
-
269
- // Create client info (name)
270
- const clientInfo = document.createElement('div');
271
- clientInfo.className = 'client-info';
272
-
273
- // Client name label
274
- const clientName = document.createElement('span');
275
- clientName.className = 'text-sm font-medium text-gray-900';
276
- clientName.textContent = target;
277
-
278
- // Add elements to client info
279
- clientInfo.appendChild(clientName);
280
-
281
- // Add client info to client item
282
- clientItem.appendChild(clientInfo);
283
-
284
- if (!isSelectable) {
285
- clientItem.classList.add('non-selectable');
286
- if (isConfigured) {
287
- clientItem.classList.add('installed-item');
288
- clientItem.title = 'Already installed';
289
- } else if (isInProgress) {
290
- clientItem.classList.add('in-progress-item');
291
- clientItem.title = 'Installation in progress';
292
- }
293
- }
294
-
295
- return clientItem;
296
- }
297
-
298
- function setupClientItemListeners(clientItem, target, isSelectable) {
299
- if (isSelectable) {
300
- clientItem.addEventListener('click', () => {
301
- const isSelected = clientItem.dataset.selected === 'true';
302
- clientItem.dataset.selected = isSelected ? 'false' : 'true';
303
-
304
- if (isSelected) {
305
- clientItem.classList.remove('selected');
306
- window.selectedClients = window.selectedClients.filter(c => c !== target);
307
- } else {
308
- clientItem.classList.add('selected');
309
- if (!window.selectedClients.includes(target)) {
310
- window.selectedClients.push(target);
311
- }
312
- }
313
- });
314
- }
315
- }
316
-
317
- function setupUninstallButton(clientItem, statusText, operationStatus, target, categoryName, serverName, statusClass) {
318
- if (statusText) {
319
- const statusContainer = document.createElement('div');
320
- statusContainer.className = 'status-container';
321
-
322
- const statusBadge = document.createElement('span');
323
- statusBadge.className = `status-badge ${statusClass}`;
324
- statusBadge.textContent = statusText;
325
- statusContainer.appendChild(statusBadge);
326
-
327
- if (operationStatus.status === 'completed' && operationStatus.type === 'install') {
328
- const uninstallBtn = createUninstallButton(target, categoryName, serverName);
329
- statusContainer.appendChild(uninstallBtn);
330
- }
331
-
332
- clientItem.appendChild(statusContainer);
333
- }
334
- }
335
-
336
- function createUninstallButton(target, categoryName, serverName) {
337
- const uninstallBtn = document.createElement('button');
338
- uninstallBtn.className = 'uninstall-btn text-red-600 hover:text-red-800 ml-2';
339
- uninstallBtn.innerHTML = '<i class="bx bx-trash"></i>';
340
- uninstallBtn.title = 'Uninstall from this client';
341
-
342
- uninstallBtn.onclick = async (e) => {
343
- e.stopPropagation();
344
- e.preventDefault();
345
-
346
- const confirmed = await showConfirm('Uninstall Confirmation',
347
- `Are you sure you want to uninstall ${serverName} from ${target}?`);
348
-
349
- if (confirmed) {
350
- window.selectedClients = [target];
351
- showInstallLoadingModal('Uninstalling');
352
- const serverList = {
353
- [serverName]: {
354
- removeData: true
355
- }
356
- };
357
-
358
- try {
359
- updateOverallInstallStatus('in-progress', `Uninstalling ${serverName} from ${target}...`);
360
- await uninstallTools(categoryName, serverList, [target]);
361
- // uninstallTools will now handle its own final status update via updateOverallInstallStatus
362
- } catch (error) {
363
- updateOverallInstallStatus('failed', `Error during uninstall: ${error.message}`);
364
- // No need to throw here if uninstallTools handles its errors by updating status
365
- }
366
- }
367
- return false;
368
- };
369
-
370
- return uninstallBtn;
371
- }
372
-
373
- function addSectionTitle(targetDiv) {
374
- if (!targetDiv.querySelector('.section-title')) {
375
- const titleElement = document.createElement('h3');
376
- titleElement.className = 'section-title text-lg font-semibold text-gray-700 mb-3';
377
- titleElement.textContent = 'Client Status';
378
- targetDiv.insertBefore(titleElement, targetDiv.firstChild);
379
- }
380
- }
381
-
382
- function addEnvironmentTitle(envInputsDiv) {
383
- if (!envInputsDiv.querySelector('.section-title')) {
384
- const envTitle = document.createElement('h3');
385
- envTitle.className = 'section-title text-lg font-semibold text-gray-700 mb-3';
386
- envTitle.textContent = 'Environment Variables';
387
- envInputsDiv.insertBefore(envTitle, envInputsDiv.firstChild);
388
- }
389
- }
390
-
391
- function addNoEnvMessage(envInputsDiv) {
392
- const noEnvMessage = document.createElement('p');
393
- noEnvMessage.className = 'text-gray-600';
394
- noEnvMessage.textContent = 'No environment variables required for this MCP server.';
395
- envInputsDiv.appendChild(noEnvMessage);
396
- }
397
-
398
- function createEnvironmentInputs(envRequirements, envInputsDiv, clientSettings, serverName, userConfigurations = {}) {
399
- Object.keys(envRequirements).forEach(key => {
400
- const req = envRequirements[key];
401
- const inputId = `env_${key}`;
402
- const inputWrapper = document.createElement('div');
403
- inputWrapper.className = 'mb-3';
404
-
405
- const label = document.createElement('label');
406
- label.htmlFor = inputId;
407
- label.className = 'block text-sm font-medium text-gray-700 mb-1';
408
- label.innerHTML = `${key} ${req.Required ? '<span class="text-red-500">*</span>' : ''}`;
409
-
410
- const input = document.createElement('input');
411
- input.type = req.isSecret ? 'password' : 'text';
412
- input.id = inputId;
413
- input.name = key;
414
- input.placeholder = req.Description || key;
415
- input.required = req.Required;
416
- input.className = 'input-field';
417
-
418
- // For default value, first check userConfigurations, then client settings, then provided default
419
- let defaultValue = req.Default || '';
420
-
421
- // Use userConfigurations if present
422
- if (userConfigurations && userConfigurations[key]) {
423
- defaultValue = userConfigurations[key];
424
- } else if (clientSettings && clientSettings.MSRooCode &&
425
- clientSettings.MSRooCode.mcpServers &&
426
- clientSettings.MSRooCode.mcpServers[serverName] &&
427
- clientSettings.MSRooCode.mcpServers[serverName].env &&
428
- clientSettings.MSRooCode.mcpServers[serverName].env[key]) {
429
- defaultValue = clientSettings.MSRooCode.mcpServers[serverName].env[key];
430
- }
431
-
432
- input.value = defaultValue;
433
-
434
- inputWrapper.appendChild(label);
435
- inputWrapper.appendChild(input);
436
-
437
- if (req.Description) {
438
- const description = document.createElement('p');
439
- description.className = 'text-xs text-gray-500 mt-1';
440
- description.textContent = req.Description;
441
- inputWrapper.appendChild(description);
442
- }
443
-
444
- envInputsDiv.appendChild(inputWrapper);
445
- });
446
- }
447
-
448
- function addArgumentsTitle(modalArguments) {
449
- const argsTitle = document.createElement('h3');
450
- argsTitle.className = 'section-title text-lg font-semibold text-gray-700 mb-3';
451
- argsTitle.textContent = 'Arguments';
452
- modalArguments.appendChild(argsTitle);
453
- }
454
-
455
- function createArgumentsContainer() {
456
- const container = document.createElement('div');
457
- container.className = 'args-container mb-3';
458
-
459
- const addButton = document.createElement('button');
460
- addButton.type = 'button';
461
- addButton.className = 'add-arg-button px-3 py-1 text-sm text-blue-600 hover:text-blue-800 border border-blue-600 hover:border-blue-800 rounded-md mb-2';
462
- addButton.innerHTML = '<i class="bx bx-plus"></i> Add Argument';
463
- addButton.onclick = () => container.appendChild(createArgumentInput());
464
-
465
- container.appendChild(addButton);
466
- return container;
467
- }
468
-
469
- function createArgumentInput(value = '') {
470
- const argWrapper = document.createElement('div');
471
- argWrapper.className = 'arg-wrapper flex items-center gap-2 mb-2';
472
-
473
- const input = document.createElement('input');
474
- input.type = 'text';
475
- input.className = 'arg-input flex-grow';
476
- input.value = value;
477
- input.placeholder = 'Enter argument value';
478
-
479
- const removeButton = document.createElement('button');
480
- removeButton.type = 'button';
481
- removeButton.className = 'remove-arg-button text-red-600 hover:text-red-800';
482
- removeButton.innerHTML = '<i class="bx bx-trash"></i>';
483
- removeButton.onclick = () => argWrapper.remove();
484
-
485
- argWrapper.appendChild(input);
486
- argWrapper.appendChild(removeButton);
487
- return argWrapper;
488
- }
489
-
490
- function addPythonEnvironmentInput(categoryName, serverName, modalArguments) {
491
- const pythonEnvWrapper = document.createElement('div');
492
- pythonEnvWrapper.className = 'mt-4';
493
-
494
- const pythonEnvLabel = document.createElement('label');
495
- pythonEnvLabel.htmlFor = 'python_env';
496
- pythonEnvLabel.className = 'block text-sm font-medium text-gray-700 mb-1';
497
- pythonEnvLabel.textContent = 'Python Environment';
498
-
499
- const pythonEnvInput = document.createElement('input');
500
- pythonEnvInput.type = 'text';
501
- pythonEnvInput.id = 'python_env';
502
- pythonEnvInput.className = 'input-field';
503
- pythonEnvInput.placeholder = 'Enter Python environment path (optional)';
504
-
505
- const envDescription = document.createElement('p');
506
- envDescription.className = 'text-xs text-gray-500 mt-1';
507
- envDescription.textContent = 'Specify the Python exectable file(e.g. C:/python312/python) to use for installation. Leave empty to use system default. You can specify value in Settings page';
508
-
509
- pythonEnvWrapper.appendChild(pythonEnvLabel);
510
- pythonEnvWrapper.appendChild(pythonEnvInput);
511
- pythonEnvWrapper.appendChild(envDescription);
512
- modalArguments.appendChild(pythonEnvWrapper);
513
- // Fetch system settings and set default value for python_env
514
- fetch('/api/settings')
515
- .then(response => response.json())
516
- .then(data => {
517
- if (data && data.data && data.data.pythonEnvs) {
518
- pythonEnvInput.value = data.data.pythonEnvs[`${categoryName}:${serverName}`] || data.data.pythonEnvs['system'] || '';
519
- }
520
- })
521
- .catch(() => {
522
- // Ignore errors, leave input empty
523
- });
524
- }
525
-
526
- function renderRequirements(serverRequirements, requirements, categoryName, serverName) {
527
- return serverRequirements.map(req => {
528
- const status = requirements[req.name] || {};
529
- let statusClass = status.installed
530
- ? 'text-green-600 bg-green-50'
531
- : 'text-yellow-600 bg-yellow-50';
532
- let statusText = status.installed ? 'Installed' : 'Required';
533
- let versionDisplay = status.version ? ` • <span class="font-medium">${status.version}</span>` : '';
534
- let updateToggle = '';
535
-
536
- // Check if there's an available update
537
- if (status.installed && status.availableUpdate && status.availableUpdate.version) {
538
- if (status.version && compareVersions(status.availableUpdate.version, status.version) > 0) {
539
- // Show version update information with yellow color and icon
540
- statusClass = 'text-yellow-600 bg-yellow-50';
541
- statusText = `<span style="color: #f59e0b; font-weight: bold; margin-right: 5px;">↑</span>${status.availableUpdate.version}`;
542
-
543
- // Create a toggle switch for update
544
- updateToggle = `
545
- <label class="inline-flex items-center cursor-pointer ml-2">
546
- <input type="checkbox" class="toggle-update sr-only"
547
- data-name="${req.name}"
548
- data-version="${status.availableUpdate.version}"
549
- data-category="${categoryName}"
550
- data-server="${serverName}">
551
- <div class="relative w-10 h-5 bg-gray-200 rounded-full toggle-bg">
552
- <div class="absolute inset-y-0 left-0 w-5 h-5 bg-white rounded-full transition-transform duration-300 transform"></div>
553
- </div>
554
- <span class="ml-2 text-sm text-gray-700">Update</span>
555
- </label>
556
- `;
557
- }
558
- }
559
-
560
- return `
561
- <div class="border border-gray-200 p-3 rounded-lg mb-2 hover:bg-gray-50">
562
- <div class="flex justify-between items-center">
563
- <div>
564
- <div class="font-semibold text-gray-800">${req.name}</div>
565
- <div class="text-sm text-gray-600 shadow-sm p-1 rounded bg-gray-50">
566
- <span class="font-medium">${status.type || 'package'}</span>${versionDisplay}
567
- </div>
568
- </div>
569
- <div class="flex items-center">
570
- <span class="${statusClass} inline-flex items-center px-3 py-1 rounded-full text-sm">
571
- ${statusText}
572
- </span>
573
- ${updateToggle}
574
- </div>
575
- </div>
576
- </div>
577
- `;
578
- }).join('');
579
- }
580
-
581
- function setupUpdateToggles(modalRequirements) {
582
- const updateToggles = modalRequirements.querySelectorAll('.toggle-update');
583
- updateToggles.forEach(toggle => {
584
- toggle.addEventListener('change', function () {
585
- const toggleBg = this.parentElement.querySelector('.toggle-bg');
586
- if (this.checked) {
587
- toggleBg.classList.add('bg-blue-500');
588
- toggleBg.querySelector('div').classList.add('translate-x-5');
589
- } else {
590
- toggleBg.classList.remove('bg-blue-500');
591
- toggleBg.querySelector('div').classList.remove('translate-x-5');
592
- }
593
- });
594
- });
595
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * Close modal and ensure selected category persists
3
- */
4
- export function closeModal() {
5
- document.getElementById('installModal').style.display = "none";
6
-
7
- // Get the last selected category from localStorage
8
- const lastSelected = localStorage.getItem('lastSelectedCategory');
9
-
10
- // Refresh page and restore selection
11
- if (lastSelected) {
12
- setTimeout(() => {
13
- window.location.href = window.location.pathname + '?category=' + encodeURIComponent(lastSelected);
14
- }, 100);
15
- } else {
16
- location.reload();
17
- }
18
- }
19
-
20
- /**
21
- * Setup toggle switch styles
22
- */
23
- export function setupToggleStyles() {
24
- const styleElement = document.createElement('style');
25
- styleElement.textContent = `
26
- .toggle-bg.bg-blue-500 {
27
- background-color: #3b82f6;
28
- }
29
- .toggle-bg {
30
- transition: background-color 0.3s;
31
- }
32
- .toggle-bg div {
33
- transition: transform 0.3s;
34
- }
35
- `;
36
- document.head.appendChild(styleElement);
37
- }
@@ -1,42 +0,0 @@
1
- // Import all functionality from the modal folder
2
- import {
3
- showInstallModal,
4
- closeModal,
5
- uninstallTools,
6
- showInstallLoadingModal,
7
- // appendInstallLoadingMessage, // Removed
8
- hideInstallLoadingModal,
9
- // Potentially add updateOverallInstallStatus, addInstallationStep if needed from ./modal/index.js
10
- } from './modal/index.js';
11
-
12
- // Re-export all modal functionality
13
- export {
14
- showInstallModal,
15
- closeModal,
16
- uninstallTools,
17
- showInstallLoadingModal, // Added to exports
18
- hideInstallLoadingModal // Added to exports
19
- // Potentially add updateOverallInstallStatus, addInstallationStep to exports
20
- };
21
-
22
- // Make certain functions available globally
23
- window.showInstallModal = showInstallModal;
24
- window.showInstallLoadingModal = showInstallLoadingModal;
25
- // window.appendInstallLoadingMessage = appendInstallLoadingMessage; // Removed
26
- window.hideInstallLoadingModal = hideInstallLoadingModal;
27
-
28
- // Listen for the custom event to refresh the main modal content
29
- document.addEventListener('refreshMainModalContent', () => {
30
- console.log('[ModalJS] Received refreshMainModalContent event. Refreshing main modal.');
31
- const lastSelectedCategory = localStorage.getItem('lastSelectedCategory');
32
- const lastSelectedServerName = localStorage.getItem('lastSelectedServerName');
33
-
34
- const isCategoryValid = lastSelectedCategory && lastSelectedCategory.trim() !== '' && lastSelectedCategory !== 'undefined' && lastSelectedCategory !== 'null';
35
- const isServerNameValid = lastSelectedServerName && lastSelectedServerName.trim() !== '' && lastSelectedServerName !== 'undefined' && lastSelectedServerName !== 'null';
36
-
37
- if (isCategoryValid && isServerNameValid) {
38
- window.showInstallModal(lastSelectedCategory, lastSelectedServerName);
39
- } else {
40
- console.warn(`[ModalJS] Not refreshing modal. Category valid: ${isCategoryValid} (value: "${lastSelectedCategory}"), ServerName valid: ${isServerNameValid} (value: "${lastSelectedServerName}")`);
41
- }
42
- });