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
@@ -1,112 +0,0 @@
1
- import fs from 'fs/promises';
2
- import path from 'path';
3
- import { FeedConfiguration, EnvVariableConfig, ServerInstallOptions } from '../core/types.js';
4
- import { InstallServersRequestBody } from '../web/contract/serverContract.js'; // Assuming InstallRequestBody is defined here
5
- import { SUPPORTED_CLIENT_NAMES } from '../core/constants.js';
6
-
7
- export class InstallRequestValidator {
8
- private serverFeedConfigs: Map<string, FeedConfiguration> = new Map();
9
- private feedDirectory: string;
10
-
11
- constructor(feedDirectory: string = path.join(__dirname, '../feeds')) {
12
- this.feedDirectory = feedDirectory;
13
- // Consider loading configs lazily or providing an explicit load method
14
- // For now, let's assume pre-loading or loading on demand in validate
15
- }
16
-
17
- private async loadServerFeedConfiguration(serverName: string): Promise<FeedConfiguration | undefined> {
18
- if (this.serverFeedConfigs.has(serverName)) {
19
- return this.serverFeedConfigs.get(serverName);
20
- }
21
-
22
- const filePath = path.join(this.feedDirectory, `${serverName}.json`);
23
- try {
24
- const fileContent = await fs.readFile(filePath, 'utf-8');
25
- const config: FeedConfiguration = JSON.parse(fileContent);
26
- // Basic validation of the loaded config structure could be added here
27
- if (config && config.name === serverName) {
28
- this.serverFeedConfigs.set(serverName, config);
29
- return config;
30
- }
31
- console.error(`Configuration name mismatch in ${filePath}`);
32
- return undefined;
33
- } catch (error) {
34
- if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
35
- console.warn(`Server feed configuration not found for: ${serverName} at ${filePath}`);
36
- } else {
37
- console.error(`Error loading server feed configuration for ${serverName}:`, error);
38
- }
39
- return undefined;
40
- }
41
- }
42
-
43
- /**
44
- * Validates the install request body for a specific server.
45
- * @param serverName The name of the server to validate against.
46
- * @param requestBody The installation request body.
47
- * @returns An array of error messages, or an empty array if validation passes.
48
- */
49
- async validate(serverName: string, requestBody: ServerInstallOptions): Promise<string[]> {
50
- const errors: string[] = [];
51
- const config = await this.loadServerFeedConfiguration(serverName);
52
-
53
- if (!config) {
54
- errors.push(`Server configuration feed not found for '${serverName}'.`);
55
- // Cannot perform further validation without the config
56
- return errors;
57
- }
58
-
59
- // 1.2 Validate required environment variables
60
- config.mcpServers.forEach(mcp => {
61
- if (mcp.installation?.env) {
62
- Object.entries(mcp.installation.env).forEach(([envVar, envConfig]) => {
63
- if (envConfig.Required) {
64
- if (!requestBody.env || !(envVar in requestBody.env) || !requestBody.env[envVar]) {
65
- errors.push(`Missing required environment variable '${envVar}' for server '${serverName}' (category: ${mcp.name}).`);
66
- }
67
- }
68
- });
69
- }
70
- });
71
-
72
- // 1.3 Validate target clients
73
- if (!requestBody.targetClients || requestBody.targetClients.length === 0) {
74
- errors.push(`Request body must include a non-empty 'targetClients' array for server '${serverName}'.`);
75
- } else {
76
- requestBody.targetClients.forEach((client: string) => {
77
- if (!SUPPORTED_CLIENT_NAMES.includes(client)) {
78
- errors.push(`Unsupported target client '${client}' specified for server '${serverName}'. Supported clients are: ${SUPPORTED_CLIENT_NAMES.join(', ')}.`);
79
- }
80
- });
81
- }
82
-
83
- // Add other validation rules as needed
84
-
85
- return errors;
86
- }
87
-
88
- /**
89
- * Validates the install request body for multiple servers.
90
- * @param requestBody The installation request body containing multiple server names.
91
- * @returns An object mapping server names to their validation errors. Empty arrays indicate success.
92
- */
93
- async validateMultiple(requestBody: InstallServersRequestBody): Promise<Record<string, string[]>> {
94
- const results: Record<string, string[]> = {};
95
- if (!requestBody.serverList || Object.keys(requestBody.serverList).length === 0) {
96
- return { '_global': ['Request body must include a non-empty \'serverCategoryList\' record.'] };
97
- }
98
-
99
- for (const serverName of Object.keys(requestBody.serverList)) {
100
- results[serverName] = await this.validate(serverName, requestBody.serverList[serverName]);
101
- }
102
-
103
- return results;
104
- }
105
- }
106
-
107
- // Helper __dirname for ES modules
108
- import { fileURLToPath } from 'url';
109
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
110
-
111
- // Export a singleton instance (optional, depends on usage pattern)
112
- // export const installRequestValidator = new InstallRequestValidator();