imcp 0.0.16 → 0.0.18

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 (151) hide show
  1. package/dist/cli/commands/install.js +2 -2
  2. package/dist/cli/commands/list.js +2 -2
  3. package/dist/cli/commands/serve.js +3 -2
  4. package/dist/core/RequirementService.d.ts +0 -12
  5. package/dist/core/RequirementService.js +0 -24
  6. package/dist/core/installers/clients/BaseClientInstaller.d.ts +26 -3
  7. package/dist/core/installers/clients/BaseClientInstaller.js +121 -0
  8. package/dist/core/installers/clients/ClientInstaller.d.ts +1 -1
  9. package/dist/core/installers/clients/ClientInstaller.js +1 -1
  10. package/dist/core/installers/clients/ClientInstallerFactory.js +1 -1
  11. package/dist/core/installers/clients/ClineInstaller.d.ts +1 -6
  12. package/dist/core/installers/clients/ClineInstaller.js +1 -94
  13. package/dist/core/installers/clients/ExtensionInstaller.js +1 -1
  14. package/dist/core/installers/clients/GithubCopilotInstaller.d.ts +1 -6
  15. package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -94
  16. package/dist/core/installers/clients/MSRooCodeInstaller.d.ts +1 -5
  17. package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -94
  18. package/dist/core/installers/requirements/BaseInstaller.d.ts +1 -1
  19. package/dist/core/installers/requirements/BaseInstaller.js +1 -1
  20. package/dist/core/installers/requirements/CommandInstaller.d.ts +1 -1
  21. package/dist/core/installers/requirements/CommandInstaller.js +1 -1
  22. package/dist/core/installers/requirements/GeneralInstaller.d.ts +1 -1
  23. package/dist/core/installers/requirements/InstallerFactory.d.ts +1 -1
  24. package/dist/core/installers/requirements/NpmInstaller.d.ts +1 -1
  25. package/dist/core/installers/requirements/NpmInstaller.js +1 -1
  26. package/dist/core/installers/requirements/PipInstaller.d.ts +1 -1
  27. package/dist/core/installers/requirements/RequirementInstaller.d.ts +1 -1
  28. package/dist/core/loaders/ConfigurationLoader.d.ts +35 -0
  29. package/dist/core/loaders/ConfigurationLoader.js +257 -0
  30. package/dist/core/loaders/ConfigurationProvider.d.ts +38 -0
  31. package/dist/core/loaders/ConfigurationProvider.js +384 -0
  32. package/dist/core/loaders/ServerSchemaLoader.d.ts +22 -0
  33. package/dist/core/loaders/ServerSchemaLoader.js +109 -0
  34. package/dist/core/loaders/ServerSchemaProvider.d.ts +14 -0
  35. package/dist/core/loaders/ServerSchemaProvider.js +90 -0
  36. package/dist/core/metadatas/constants.d.ts +47 -0
  37. package/dist/core/metadatas/constants.js +94 -0
  38. package/dist/core/metadatas/types.d.ts +167 -0
  39. package/dist/core/metadatas/types.js +16 -0
  40. package/dist/core/onboard/FeedOnboardService.d.ts +15 -8
  41. package/dist/core/onboard/FeedOnboardService.js +215 -130
  42. package/dist/core/onboard/OnboardProcessor.d.ts +8 -2
  43. package/dist/core/onboard/OnboardProcessor.js +53 -9
  44. package/dist/core/onboard/OnboardStatus.d.ts +7 -2
  45. package/dist/core/onboard/OnboardStatusManager.d.ts +71 -25
  46. package/dist/core/onboard/OnboardStatusManager.js +231 -47
  47. package/dist/core/validators/FeedValidator.d.ts +8 -3
  48. package/dist/core/validators/FeedValidator.js +61 -7
  49. package/dist/core/validators/IServerValidator.d.ts +1 -1
  50. package/dist/core/validators/SSEServerValidator.d.ts +1 -1
  51. package/dist/core/validators/ServerValidatorFactory.d.ts +1 -1
  52. package/dist/core/validators/StdioServerValidator.d.ts +1 -1
  53. package/dist/core/validators/StdioServerValidator.js +85 -33
  54. package/dist/index.d.ts +3 -3
  55. package/dist/index.js +3 -3
  56. package/dist/services/InstallationService.d.ts +50 -0
  57. package/dist/services/InstallationService.js +350 -0
  58. package/dist/services/MCPManager.d.ts +29 -0
  59. package/dist/services/MCPManager.js +192 -0
  60. package/dist/services/RequirementService.d.ts +40 -0
  61. package/dist/services/RequirementService.js +110 -0
  62. package/dist/services/ServerService.d.ts +2 -2
  63. package/dist/services/ServerService.js +6 -6
  64. package/dist/utils/adoUtils.d.ts +2 -2
  65. package/dist/utils/adoUtils.js +1 -1
  66. package/dist/utils/feedUtils.js +1 -1
  67. package/dist/utils/githubUtils.d.ts +1 -1
  68. package/dist/utils/githubUtils.js +1 -1
  69. package/dist/utils/logger.d.ts +2 -0
  70. package/dist/utils/logger.js +11 -1
  71. package/dist/utils/macroExpressionUtils.d.ts +1 -1
  72. package/dist/utils/osUtils.d.ts +1 -1
  73. package/dist/utils/osUtils.js +1 -1
  74. package/dist/web/contract/serverContract.d.ts +1 -1
  75. package/dist/web/public/index.html +1 -3
  76. package/dist/web/public/js/api.js +2 -80
  77. package/dist/web/public/js/modal/installation.js +1 -1
  78. package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +41 -9
  79. package/dist/web/public/js/onboard/formProcessor.js +200 -34
  80. package/dist/web/public/js/onboard/index.js +2 -2
  81. package/dist/web/public/js/onboard/publishHandler.js +30 -22
  82. package/dist/web/public/js/onboard/templates.js +34 -40
  83. package/dist/web/public/js/onboard/uiHandlers.js +175 -84
  84. package/dist/web/public/js/onboard/validationHandlers.js +147 -64
  85. package/dist/web/public/js/serverCategoryDetails.js +19 -4
  86. package/dist/web/public/js/serverCategoryList.js +13 -1
  87. package/dist/web/public/onboard.html +1 -1
  88. package/dist/web/server.js +21 -8
  89. package/package.json +1 -1
  90. package/src/cli/commands/install.ts +3 -3
  91. package/src/cli/commands/list.ts +2 -2
  92. package/src/cli/commands/serve.ts +3 -2
  93. package/src/cli/index.ts +1 -1
  94. package/src/core/installers/clients/BaseClientInstaller.ts +134 -3
  95. package/src/core/installers/clients/ClientInstaller.ts +3 -3
  96. package/src/core/installers/clients/ClientInstallerFactory.ts +1 -1
  97. package/src/core/installers/clients/ClineInstaller.ts +1 -101
  98. package/src/core/installers/clients/ExtensionInstaller.ts +1 -1
  99. package/src/core/installers/clients/GithubCopilotInstaller.ts +1 -101
  100. package/src/core/installers/clients/MSRooCodeInstaller.ts +1 -102
  101. package/src/core/installers/requirements/BaseInstaller.ts +2 -2
  102. package/src/core/installers/requirements/CommandInstaller.ts +1 -1
  103. package/src/core/installers/requirements/GeneralInstaller.ts +1 -1
  104. package/src/core/installers/requirements/InstallerFactory.ts +1 -1
  105. package/src/core/installers/requirements/NpmInstaller.ts +12 -12
  106. package/src/core/installers/requirements/PipInstaller.ts +1 -1
  107. package/src/core/installers/requirements/RequirementInstaller.ts +1 -1
  108. package/src/core/{ConfigurationLoader.ts → loaders/ConfigurationLoader.ts} +31 -7
  109. package/src/core/{ConfigurationProvider.ts → loaders/ConfigurationProvider.ts} +18 -10
  110. package/src/core/loaders/ServerSchemaLoader.ts +117 -0
  111. package/src/core/loaders/ServerSchemaProvider.ts +99 -0
  112. package/src/core/{types.ts → metadatas/types.ts} +3 -2
  113. package/src/core/onboard/FeedOnboardService.ts +270 -146
  114. package/src/core/onboard/OnboardProcessor.ts +60 -11
  115. package/src/core/onboard/OnboardStatus.ts +7 -2
  116. package/src/core/onboard/OnboardStatusManager.ts +270 -43
  117. package/src/core/validators/FeedValidator.ts +65 -9
  118. package/src/core/validators/IServerValidator.ts +1 -1
  119. package/src/core/validators/SSEServerValidator.ts +2 -2
  120. package/src/core/validators/ServerValidatorFactory.ts +1 -1
  121. package/src/core/validators/StdioServerValidator.ts +86 -34
  122. package/src/index.ts +3 -3
  123. package/src/{core → services}/InstallationService.ts +5 -5
  124. package/src/{core → services}/MCPManager.ts +10 -5
  125. package/src/{core → services}/RequirementService.ts +2 -31
  126. package/src/services/ServerService.ts +7 -7
  127. package/src/utils/adoUtils.ts +3 -3
  128. package/src/utils/feedUtils.ts +2 -2
  129. package/src/utils/githubUtils.ts +2 -2
  130. package/src/utils/logger.ts +13 -1
  131. package/src/utils/macroExpressionUtils.ts +1 -1
  132. package/src/utils/osUtils.ts +4 -4
  133. package/src/web/contract/serverContract.ts +2 -2
  134. package/src/web/public/index.html +1 -3
  135. package/src/web/public/js/api.js +2 -80
  136. package/src/web/public/js/modal/installation.js +1 -1
  137. package/src/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +41 -9
  138. package/src/web/public/js/onboard/formProcessor.js +200 -34
  139. package/src/web/public/js/onboard/index.js +2 -2
  140. package/src/web/public/js/onboard/publishHandler.js +30 -22
  141. package/src/web/public/js/onboard/templates.js +34 -40
  142. package/src/web/public/js/onboard/uiHandlers.js +175 -84
  143. package/src/web/public/js/onboard/validationHandlers.js +147 -64
  144. package/src/web/public/js/serverCategoryDetails.js +19 -4
  145. package/src/web/public/js/serverCategoryList.js +13 -1
  146. package/src/web/public/onboard.html +1 -1
  147. package/src/web/server.ts +30 -14
  148. package/src/core/ServerSchemaLoader.ts +0 -48
  149. package/src/core/ServerSchemaProvider.ts +0 -137
  150. package/src/services/InstallRequestValidator.ts +0 -112
  151. /package/src/core/{constants.ts → metadatas/constants.ts} +0 -0
@@ -2,8 +2,8 @@ import { Command } from 'commander';
2
2
  import { serverService } from '../../services/ServerService.js';
3
3
  import { Logger } from '../../utils/logger.js';
4
4
  import { hasLocalFeeds } from '../../utils/feedUtils.js';
5
- import { SUPPORTED_CLIENT_NAMES } from '../../core/constants.js';
6
- import { mcpManager } from '../../core/MCPManager.js';
5
+ import { SUPPORTED_CLIENT_NAMES } from '../../core/metadatas/constants.js';
6
+ import { mcpManager } from '../../services/MCPManager.js';
7
7
  export function createInstallCommand() {
8
8
  return new Command('install')
9
9
  .description('Install specific MCP servers')
@@ -1,8 +1,8 @@
1
1
  import { Command } from 'commander';
2
2
  import fs from 'fs/promises';
3
3
  import path from 'path';
4
- import { LOCAL_FEEDS_DIR } from '../../core/constants.js';
5
- import { mcpManager } from '../../core/MCPManager.js';
4
+ import { LOCAL_FEEDS_DIR } from '../../core/metadatas/constants.js';
5
+ import { mcpManager } from '../../services/MCPManager.js';
6
6
  import { Logger } from '../../utils/logger.js';
7
7
  export function createListCommand() {
8
8
  return new Command('list')
@@ -1,17 +1,18 @@
1
1
  import { Command } from 'commander';
2
2
  import { startWebServer } from '../../web/server.js';
3
- import { mcpManager } from '../../core/MCPManager.js';
3
+ import { mcpManager } from '../../services/MCPManager.js';
4
4
  export function createServeCommand() {
5
5
  return new Command('serve')
6
6
  .description('Serve local web interface')
7
7
  .option('-p, --port <port>', 'Port to run the server on', '3000')
8
8
  .option('-f, --feed-file <filepath>', 'Path to a custom feed configuration file')
9
+ .option('-s, --schemas-directory <path>', 'Path to a directory containing adhoc schema files')
9
10
  .action(async (options) => {
10
11
  try {
11
12
  // Sync feeds before start the local UI
12
13
  await mcpManager.syncFeeds();
13
14
  // Ensure MCP manager is initialized before starting the web server
14
- await mcpManager.initialize(options.feedFile);
15
+ await mcpManager.initialize(options.feedFile, options.schemasDirectory);
15
16
  const port = parseInt(options.port, 10);
16
17
  if (isNaN(port) || port < 1 || port > 65535) {
17
18
  throw new Error('Invalid port number');
@@ -11,12 +11,6 @@ export declare class RequirementService {
11
11
  * @returns The RequirementService instance
12
12
  */
13
13
  static getInstance(): RequirementService;
14
- /**
15
- * Install a requirement
16
- * @param requirement The requirement to install
17
- * @returns The installation status
18
- */
19
- installRequirement(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus>;
20
14
  /**
21
15
  * Check the installation status of a requirement
22
16
  * @param requirement The requirement to check
@@ -36,12 +30,6 @@ export declare class RequirementService {
36
30
  * @returns The updated requirement status
37
31
  */
38
32
  updateRequirement(requirement: RequirementConfig, updateVersion: string, options?: ServerInstallOptions): Promise<RequirementStatus>;
39
- /**
40
- * Install multiple requirements
41
- * @param requirements The requirements to install
42
- * @returns A map of requirement names to their installation status
43
- */
44
- installRequirements(requirements: RequirementConfig[]): Promise<Record<string, RequirementStatus>>;
45
33
  /**
46
34
  * Validate a requirement configuration
47
35
  * @param requirement The requirement to validate
@@ -18,17 +18,6 @@ export class RequirementService {
18
18
  }
19
19
  return RequirementService.instance;
20
20
  }
21
- /**
22
- * Install a requirement
23
- * @param requirement The requirement to install
24
- * @returns The installation status
25
- */
26
- async installRequirement(requirement, options) {
27
- // Validate requirement
28
- this.validateRequirement(requirement);
29
- // Install the requirement
30
- return await this.installerFactory.install(requirement, options);
31
- }
32
21
  /**
33
22
  * Check the installation status of a requirement
34
23
  * @param requirement The requirement to check
@@ -78,19 +67,6 @@ export class RequirementService {
78
67
  // Install the updated version
79
68
  return await this.installerFactory.install(updatedRequirement, options);
80
69
  }
81
- /**
82
- * Install multiple requirements
83
- * @param requirements The requirements to install
84
- * @returns A map of requirement names to their installation status
85
- */
86
- async installRequirements(requirements) {
87
- const results = {};
88
- // Process each requirement sequentially to avoid conflicts
89
- for (const requirement of requirements) {
90
- results[requirement.name] = await this.installRequirement(requirement);
91
- }
92
- return results;
93
- }
94
70
  /**
95
71
  * Validate a requirement configuration
96
72
  * @param requirement The requirement to validate
@@ -1,8 +1,9 @@
1
- import { OperationStatus, McpConfig, ServerInstallOptions } from '../../types.js';
1
+ import { OperationStatus, McpConfig, ServerInstallOptions } from '../../metadatas/types.js';
2
2
  /**
3
3
  * Base class for client installers with shared functionality
4
4
  */
5
5
  export declare abstract class BaseClientInstaller {
6
+ protected abstract readonly clientName: string;
6
7
  /**
7
8
  * Generate a unique operation ID for tracking installations
8
9
  */
@@ -44,8 +45,30 @@ export declare abstract class BaseClientInstaller {
44
45
  */
45
46
  private getNpmPath;
46
47
  /**
47
- * Abstract methods that must be implemented by client-specific installers
48
+ * Checks if VS Code or VS Code Insiders is installed and installs the client extension.
49
+ * @param operationId The operation ID for tracking.
50
+ * @returns An OperationStatus object if checks fail or installation fails, otherwise undefined.
51
+ */
52
+ protected checkVSCodeAndInstallExtension(operationId: string): Promise<OperationStatus | undefined>;
53
+ /**
54
+ * Update VS Code settings for both VS Code and VS Code Insiders if installed
55
+ * @param serverName The name of the server to configure
56
+ * @param installConfig The installation configuration
57
+ * @returns Array of results indicating success/failure for each VS Code variant
58
+ */
59
+ protected updateVSCodeSettings(serverName: string, installConfig: any): Promise<Array<{
60
+ success: boolean;
61
+ path: string;
62
+ error?: string;
63
+ }>>;
64
+ /**
65
+ * Install the client
66
+ * @param serverConfig Server configuration
67
+ * @param options Installation options including environment variables and arguments
68
+ */
69
+ install(serverConfig: McpConfig, options: ServerInstallOptions): Promise<OperationStatus>;
70
+ /**
71
+ * Abstract method that must be implemented by client-specific installers
48
72
  */
49
- abstract install(serverConfig: McpConfig, options: ServerInstallOptions): Promise<OperationStatus>;
50
73
  abstract setupClientSettings(settingPath: string, serverName: string, installConfig: any): Promise<void>;
51
74
  }
@@ -1,6 +1,9 @@
1
1
  import { Logger } from '../../../utils/logger.js';
2
2
  import { exec } from 'child_process';
3
3
  import { promisify } from 'util';
4
+ import { isCommandAvailable } from '../../../utils/osUtils.js';
5
+ import { ExtensionInstaller } from './ExtensionInstaller.js';
6
+ import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
4
7
  import { MACRO_EXPRESSIONS, MacroResolverFunctions } from '../../../utils/macroExpressionUtils.js';
5
8
  const execAsync = promisify(exec);
6
9
  /**
@@ -156,5 +159,123 @@ export class BaseClientInstaller {
156
159
  return 'C:\\Program Files\\nodejs';
157
160
  }
158
161
  }
162
+ /**
163
+ * Checks if VS Code or VS Code Insiders is installed and installs the client extension.
164
+ * @param operationId The operation ID for tracking.
165
+ * @returns An OperationStatus object if checks fail or installation fails, otherwise undefined.
166
+ */
167
+ async checkVSCodeAndInstallExtension(operationId) {
168
+ // Check if VS Code or VS Code Insiders is installed
169
+ const isVSCodeInstalled = await isCommandAvailable('code');
170
+ const isVSCodeInsidersInstalled = await isCommandAvailable('code-insiders');
171
+ if (!isVSCodeInstalled && !isVSCodeInsidersInstalled) {
172
+ return {
173
+ status: 'failed',
174
+ type: 'install',
175
+ target: 'server',
176
+ message: 'Failed to install as neither VS Code nor VS Code Insiders are installed on this system. Please run `code` or `code-insiders` to make sure they are installed. Relaunch imcp after installation.',
177
+ operationId
178
+ };
179
+ }
180
+ // Install extension
181
+ const extensionResult = await ExtensionInstaller.installExtension(this.clientName);
182
+ if (!extensionResult) {
183
+ Logger.debug(`Failed to install ${this.clientName} extension`);
184
+ return {
185
+ status: 'failed',
186
+ type: 'install',
187
+ target: 'server',
188
+ message: `Failed to install ${this.clientName} extension`,
189
+ operationId
190
+ };
191
+ }
192
+ return undefined;
193
+ }
194
+ /**
195
+ * Update VS Code settings for both VS Code and VS Code Insiders if installed
196
+ * @param serverName The name of the server to configure
197
+ * @param installConfig The installation configuration
198
+ * @returns Array of results indicating success/failure for each VS Code variant
199
+ */
200
+ async updateVSCodeSettings(serverName, installConfig) {
201
+ const results = [];
202
+ const isVSCodeInstalled = await isCommandAvailable('code');
203
+ const isVSCodeInsidersInstalled = await isCommandAvailable('code-insiders');
204
+ // Update settings for VS Code if installed
205
+ if (isVSCodeInstalled) {
206
+ try {
207
+ const settingPath = SUPPORTED_CLIENTS[this.clientName].codeSettingPath;
208
+ await this.setupClientSettings(settingPath, serverName, installConfig);
209
+ results.push({ success: true, path: settingPath });
210
+ }
211
+ catch (error) {
212
+ results.push({
213
+ success: false,
214
+ path: SUPPORTED_CLIENTS[this.clientName].codeSettingPath,
215
+ error: error instanceof Error ? error.message : String(error)
216
+ });
217
+ }
218
+ }
219
+ // Update settings for VS Code Insiders if installed
220
+ if (isVSCodeInsidersInstalled) {
221
+ try {
222
+ const settingPath = SUPPORTED_CLIENTS[this.clientName].codeInsiderSettingPath;
223
+ await this.setupClientSettings(settingPath, serverName, installConfig);
224
+ results.push({ success: true, path: settingPath });
225
+ }
226
+ catch (error) {
227
+ results.push({
228
+ success: false,
229
+ path: SUPPORTED_CLIENTS[this.clientName].codeInsiderSettingPath,
230
+ error: error instanceof Error ? error.message : String(error)
231
+ });
232
+ }
233
+ }
234
+ return results;
235
+ }
236
+ /**
237
+ * Install the client
238
+ * @param serverConfig Server configuration
239
+ * @param options Installation options including environment variables and arguments
240
+ */
241
+ async install(serverConfig, options) {
242
+ const operationId = this.generateOperationId();
243
+ try {
244
+ const vsCodeCheckResult = await this.checkVSCodeAndInstallExtension(operationId);
245
+ if (vsCodeCheckResult) {
246
+ return vsCodeCheckResult;
247
+ }
248
+ const installConfig = await this.setupInstallConfig(serverConfig, options);
249
+ if (serverConfig.mode) {
250
+ installConfig.mode = serverConfig.mode;
251
+ }
252
+ // Update VS Code settings
253
+ const results = await this.updateVSCodeSettings(serverConfig.name, installConfig);
254
+ // Determine overall success
255
+ const anySuccess = results.some(r => r.success);
256
+ const successPaths = results.filter(r => r.success).map(r => r.path);
257
+ const errors = results.filter(r => !r.success).map(r => r.error);
258
+ return {
259
+ status: anySuccess ? 'completed' : 'failed',
260
+ type: 'install',
261
+ target: 'server',
262
+ message: anySuccess
263
+ ? `Successfully installed ${this.clientName} client. Updated settings in: ${successPaths.join(', ')}`
264
+ : `Failed to install ${this.clientName} client. Errors: ${errors.join('; ')}`,
265
+ operationId,
266
+ error: anySuccess ? undefined : errors.join('; ')
267
+ };
268
+ }
269
+ catch (error) {
270
+ return {
271
+ status: 'failed',
272
+ type: 'install',
273
+ target: 'server',
274
+ message: `Unexpected error installing ${this.clientName} client: ${error instanceof Error ? error.message : String(error)}`,
275
+ operationId,
276
+ error: error instanceof Error ? error.message : String(error)
277
+ };
278
+ }
279
+ }
159
280
  }
160
281
  //# sourceMappingURL=BaseClientInstaller.js.map
@@ -1,4 +1,4 @@
1
- import { ServerOperationResult, ServerInstallOptions } from '../../types.js';
1
+ import { ServerOperationResult, ServerInstallOptions } from '../../metadatas/types.js';
2
2
  /**
3
3
  * Main client installer class that orchestrates client installation process
4
4
  * Handles requirements checking and delegates to specific client installers
@@ -1,4 +1,4 @@
1
- import { ConfigurationProvider } from '../../ConfigurationProvider.js';
1
+ import { ConfigurationProvider } from '../../loaders/ConfigurationProvider.js';
2
2
  import { ClientInstallerFactory } from './ClientInstallerFactory.js';
3
3
  /**
4
4
  * Main client installer class that orchestrates client installation process
@@ -1,7 +1,7 @@
1
1
  import { MSRooCodeInstaller } from './MSRooCodeInstaller.js';
2
2
  import { ClineInstaller } from './ClineInstaller.js';
3
3
  import { GithubCopilotInstaller } from './GithubCopilotInstaller.js';
4
- import { SUPPORTED_CLIENTS } from '../../constants.js';
4
+ import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
5
5
  /**
6
6
  * Factory for creating client-specific installers
7
7
  * Handles creation of appropriate installer based on client type
@@ -1,15 +1,10 @@
1
1
  import { BaseClientInstaller } from './BaseClientInstaller.js';
2
- import { ServerInstallOptions, OperationStatus, McpConfig } from '../../types.js';
3
2
  /**
4
3
  * Cline client installer implementation
5
4
  * Handles installation of Cline client including extension installation and settings configuration
6
5
  */
7
6
  export declare class ClineInstaller extends BaseClientInstaller {
8
- /**
9
- * Install Cline client
10
- * @param options Installation options including environment variables and arguments
11
- */
12
- install(serverConfig: McpConfig, options: ServerInstallOptions): Promise<OperationStatus>;
7
+ protected readonly clientName: string;
13
8
  /**
14
9
  * Set up Cline client settings
15
10
  * Updates VS Code settings with MCP server configuration
@@ -1,104 +1,11 @@
1
1
  import { BaseClientInstaller } from './BaseClientInstaller.js';
2
- import { Logger } from '../../../utils/logger.js';
3
2
  import { readJsonFile, writeJsonFile } from '../../../utils/clientUtils.js';
4
- import { ExtensionInstaller } from './ExtensionInstaller.js';
5
- import { SUPPORTED_CLIENTS } from '../../constants.js';
6
- import { isCommandAvailable } from '../../../utils/osUtils.js';
7
3
  /**
8
4
  * Cline client installer implementation
9
5
  * Handles installation of Cline client including extension installation and settings configuration
10
6
  */
11
7
  export class ClineInstaller extends BaseClientInstaller {
12
- /**
13
- * Install Cline client
14
- * @param options Installation options including environment variables and arguments
15
- */
16
- async install(serverConfig, options) {
17
- const operationId = this.generateOperationId();
18
- try {
19
- // Check if VS Code or VS Code Insiders is installed
20
- const isVSCodeInstalled = await isCommandAvailable('code');
21
- const isVSCodeInsidersInstalled = await isCommandAvailable('code-insiders');
22
- if (!isVSCodeInstalled && !isVSCodeInsidersInstalled) {
23
- return {
24
- status: 'failed',
25
- type: 'install',
26
- target: 'server',
27
- message: 'Neither VS Code nor VS Code Insiders are installed on this system',
28
- operationId
29
- };
30
- }
31
- // Install extension
32
- const extensionResult = await ExtensionInstaller.installExtension('Cline');
33
- if (!extensionResult) {
34
- Logger.debug('Failed to install Cline extension');
35
- return {
36
- status: 'failed',
37
- type: 'install',
38
- target: 'server',
39
- message: 'Failed to install Cline extension',
40
- operationId
41
- };
42
- }
43
- const installConfig = await this.setupInstallConfig(serverConfig, options);
44
- // Track success for both VS Code variants
45
- const results = [];
46
- // Update settings for VS Code if installed
47
- if (isVSCodeInstalled) {
48
- try {
49
- const settingPath = SUPPORTED_CLIENTS['Cline'].codeSettingPath;
50
- await this.setupClientSettings(settingPath, serverConfig.name, installConfig);
51
- results.push({ success: true, path: settingPath });
52
- }
53
- catch (error) {
54
- results.push({
55
- success: false,
56
- path: SUPPORTED_CLIENTS['Cline'].codeSettingPath,
57
- error: error instanceof Error ? error.message : String(error)
58
- });
59
- }
60
- }
61
- // Update settings for VS Code Insiders if installed
62
- if (isVSCodeInsidersInstalled) {
63
- try {
64
- const settingPath = SUPPORTED_CLIENTS['Cline'].codeInsiderSettingPath;
65
- await this.setupClientSettings(settingPath, serverConfig.name, installConfig);
66
- results.push({ success: true, path: settingPath });
67
- }
68
- catch (error) {
69
- results.push({
70
- success: false,
71
- path: SUPPORTED_CLIENTS['Cline'].codeInsiderSettingPath,
72
- error: error instanceof Error ? error.message : String(error)
73
- });
74
- }
75
- }
76
- // Determine overall success
77
- const anySuccess = results.some(r => r.success);
78
- const successPaths = results.filter(r => r.success).map(r => r.path);
79
- const errors = results.filter(r => !r.success).map(r => r.error);
80
- return {
81
- status: anySuccess ? 'completed' : 'failed',
82
- type: 'install',
83
- target: 'server',
84
- message: anySuccess
85
- ? `Successfully installed Cline client. Updated settings in: ${successPaths.join(', ')}`
86
- : `Failed to install Cline client. Errors: ${errors.join('; ')}`,
87
- operationId,
88
- error: anySuccess ? undefined : errors.join('; ')
89
- };
90
- }
91
- catch (error) {
92
- return {
93
- status: 'failed',
94
- type: 'install',
95
- target: 'server',
96
- message: `Unexpected error installing Cline client: ${error instanceof Error ? error.message : String(error)}`,
97
- operationId,
98
- error: error instanceof Error ? error.message : String(error)
99
- };
100
- }
101
- }
8
+ clientName = 'Cline';
102
9
  /**
103
10
  * Set up Cline client settings
104
11
  * Updates VS Code settings with MCP server configuration
@@ -1,6 +1,6 @@
1
1
  import { exec } from 'child_process';
2
2
  import { promisify } from 'util';
3
- import { SUPPORTED_CLIENTS } from '../../constants.js';
3
+ import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
4
4
  import { Logger } from '../../../utils/logger.js';
5
5
  import { handleGitHubRelease } from '../../../utils/githubUtils.js';
6
6
  import { compareVersions } from '../../../utils/versionUtils.js';
@@ -1,15 +1,10 @@
1
1
  import { BaseClientInstaller } from './BaseClientInstaller.js';
2
- import { ServerInstallOptions, OperationStatus, McpConfig } from '../../types.js';
3
2
  /**
4
3
  * Github Copilot client installer implementation
5
4
  * Handles installation of Github Copilot client including extension installation and settings configuration
6
5
  */
7
6
  export declare class GithubCopilotInstaller extends BaseClientInstaller {
8
- /**
9
- * Install Github Copilot client
10
- * @param options Installation options including environment variables and arguments
11
- */
12
- install(serverConfig: McpConfig, options: ServerInstallOptions): Promise<OperationStatus>;
7
+ protected readonly clientName: string;
13
8
  /**
14
9
  * Initialize settings with GithubCopilot-specific structure
15
10
  * Overrides base method to provide custom initialization
@@ -1,104 +1,11 @@
1
1
  import { BaseClientInstaller } from './BaseClientInstaller.js';
2
- import { Logger } from '../../../utils/logger.js';
3
2
  import { readJsonFile, writeJsonFile } from '../../../utils/clientUtils.js';
4
- import { ExtensionInstaller } from './ExtensionInstaller.js';
5
- import { SUPPORTED_CLIENTS } from '../../constants.js';
6
- import { isCommandAvailable } from '../../../utils/osUtils.js';
7
3
  /**
8
4
  * Github Copilot client installer implementation
9
5
  * Handles installation of Github Copilot client including extension installation and settings configuration
10
6
  */
11
7
  export class GithubCopilotInstaller extends BaseClientInstaller {
12
- /**
13
- * Install Github Copilot client
14
- * @param options Installation options including environment variables and arguments
15
- */
16
- async install(serverConfig, options) {
17
- const operationId = this.generateOperationId();
18
- try {
19
- // Check if VS Code or VS Code Insiders is installed
20
- const isVSCodeInstalled = await isCommandAvailable('code');
21
- const isVSCodeInsidersInstalled = await isCommandAvailable('code-insiders');
22
- if (!isVSCodeInstalled && !isVSCodeInsidersInstalled) {
23
- return {
24
- status: 'failed',
25
- type: 'install',
26
- target: 'server',
27
- message: 'Neither VS Code nor VS Code Insiders are installed on this system',
28
- operationId
29
- };
30
- }
31
- // Install extension
32
- const extensionResult = await ExtensionInstaller.installExtension('GithubCopilot');
33
- if (!extensionResult) {
34
- Logger.debug('Failed to install Github Copilot extension');
35
- return {
36
- status: 'failed',
37
- type: 'install',
38
- target: 'server',
39
- message: 'Failed to install Github Copilot extension',
40
- operationId
41
- };
42
- }
43
- const installConfig = await this.setupInstallConfig(serverConfig, options);
44
- // Track success for both VS Code variants
45
- const results = [];
46
- // Update settings for VS Code if installed
47
- if (isVSCodeInstalled) {
48
- try {
49
- const settingPath = SUPPORTED_CLIENTS['GithubCopilot'].codeSettingPath;
50
- await this.setupClientSettings(settingPath, serverConfig.name, installConfig);
51
- results.push({ success: true, path: settingPath });
52
- }
53
- catch (error) {
54
- results.push({
55
- success: false,
56
- path: SUPPORTED_CLIENTS['GithubCopilot'].codeSettingPath,
57
- error: error instanceof Error ? error.message : String(error)
58
- });
59
- }
60
- }
61
- // Update settings for VS Code Insiders if installed
62
- if (isVSCodeInsidersInstalled) {
63
- try {
64
- const settingPath = SUPPORTED_CLIENTS['GithubCopilot'].codeInsiderSettingPath;
65
- await this.setupClientSettings(settingPath, serverConfig.name, installConfig);
66
- results.push({ success: true, path: settingPath });
67
- }
68
- catch (error) {
69
- results.push({
70
- success: false,
71
- path: SUPPORTED_CLIENTS['GithubCopilot'].codeInsiderSettingPath,
72
- error: error instanceof Error ? error.message : String(error)
73
- });
74
- }
75
- }
76
- // Determine overall success
77
- const anySuccess = results.some(r => r.success);
78
- const successPaths = results.filter(r => r.success).map(r => r.path);
79
- const errors = results.filter(r => !r.success).map(r => r.error);
80
- return {
81
- status: anySuccess ? 'completed' : 'failed',
82
- type: 'install',
83
- target: 'server',
84
- message: anySuccess
85
- ? `Successfully installed Github Copilot client. Updated settings in: ${successPaths.join(', ')}`
86
- : `Failed to install Github Copilot client. Errors: ${errors.join('; ')}`,
87
- operationId,
88
- error: anySuccess ? undefined : errors.join('; ')
89
- };
90
- }
91
- catch (error) {
92
- return {
93
- status: 'failed',
94
- type: 'install',
95
- target: 'server',
96
- message: `Unexpected error installing Github Copilot client: ${error instanceof Error ? error.message : String(error)}`,
97
- operationId,
98
- error: error instanceof Error ? error.message : String(error)
99
- };
100
- }
101
- }
8
+ clientName = 'GithubCopilot';
102
9
  /**
103
10
  * Initialize settings with GithubCopilot-specific structure
104
11
  * Overrides base method to provide custom initialization
@@ -1,13 +1,9 @@
1
1
  import { BaseClientInstaller } from './BaseClientInstaller.js';
2
- import { ServerInstallOptions, OperationStatus, McpConfig } from '../../types.js';
3
2
  /**
4
3
  * MSRooCode client installer implementation
5
4
  */
6
5
  export declare class MSRooCodeInstaller extends BaseClientInstaller {
7
- /**
8
- * Install MSRooCode client
9
- */
10
- install(serverConfig: McpConfig, options: ServerInstallOptions): Promise<OperationStatus>;
6
+ protected readonly clientName: string;
11
7
  /**
12
8
  * Set up MSRooCode client settings
13
9
  */