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.
- package/dist/cli/commands/install.js +2 -2
- package/dist/cli/commands/list.js +2 -2
- package/dist/cli/commands/serve.js +3 -2
- package/dist/core/RequirementService.d.ts +0 -12
- package/dist/core/RequirementService.js +0 -24
- package/dist/core/installers/clients/BaseClientInstaller.d.ts +26 -3
- package/dist/core/installers/clients/BaseClientInstaller.js +121 -0
- package/dist/core/installers/clients/ClientInstaller.d.ts +1 -1
- package/dist/core/installers/clients/ClientInstaller.js +1 -1
- package/dist/core/installers/clients/ClientInstallerFactory.js +1 -1
- package/dist/core/installers/clients/ClineInstaller.d.ts +1 -6
- package/dist/core/installers/clients/ClineInstaller.js +1 -94
- package/dist/core/installers/clients/ExtensionInstaller.js +1 -1
- package/dist/core/installers/clients/GithubCopilotInstaller.d.ts +1 -6
- package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -94
- package/dist/core/installers/clients/MSRooCodeInstaller.d.ts +1 -5
- package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -94
- package/dist/core/installers/requirements/BaseInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/BaseInstaller.js +1 -1
- package/dist/core/installers/requirements/CommandInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/CommandInstaller.js +1 -1
- package/dist/core/installers/requirements/GeneralInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/InstallerFactory.d.ts +1 -1
- package/dist/core/installers/requirements/NpmInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/NpmInstaller.js +1 -1
- package/dist/core/installers/requirements/PipInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/RequirementInstaller.d.ts +1 -1
- package/dist/core/loaders/ConfigurationLoader.d.ts +35 -0
- package/dist/core/loaders/ConfigurationLoader.js +257 -0
- package/dist/core/loaders/ConfigurationProvider.d.ts +38 -0
- package/dist/core/loaders/ConfigurationProvider.js +384 -0
- package/dist/core/loaders/ServerSchemaLoader.d.ts +22 -0
- package/dist/core/loaders/ServerSchemaLoader.js +109 -0
- package/dist/core/loaders/ServerSchemaProvider.d.ts +14 -0
- package/dist/core/loaders/ServerSchemaProvider.js +90 -0
- package/dist/core/metadatas/constants.d.ts +47 -0
- package/dist/core/metadatas/constants.js +94 -0
- package/dist/core/metadatas/types.d.ts +167 -0
- package/dist/core/metadatas/types.js +16 -0
- package/dist/core/onboard/FeedOnboardService.d.ts +15 -8
- package/dist/core/onboard/FeedOnboardService.js +215 -130
- package/dist/core/onboard/OnboardProcessor.d.ts +8 -2
- package/dist/core/onboard/OnboardProcessor.js +53 -9
- package/dist/core/onboard/OnboardStatus.d.ts +7 -2
- package/dist/core/onboard/OnboardStatusManager.d.ts +71 -25
- package/dist/core/onboard/OnboardStatusManager.js +231 -47
- package/dist/core/validators/FeedValidator.d.ts +8 -3
- package/dist/core/validators/FeedValidator.js +61 -7
- package/dist/core/validators/IServerValidator.d.ts +1 -1
- package/dist/core/validators/SSEServerValidator.d.ts +1 -1
- package/dist/core/validators/ServerValidatorFactory.d.ts +1 -1
- package/dist/core/validators/StdioServerValidator.d.ts +1 -1
- package/dist/core/validators/StdioServerValidator.js +85 -33
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/services/InstallationService.d.ts +50 -0
- package/dist/services/InstallationService.js +350 -0
- package/dist/services/MCPManager.d.ts +29 -0
- package/dist/services/MCPManager.js +192 -0
- package/dist/services/RequirementService.d.ts +40 -0
- package/dist/services/RequirementService.js +110 -0
- package/dist/services/ServerService.d.ts +2 -2
- package/dist/services/ServerService.js +6 -6
- package/dist/utils/adoUtils.d.ts +2 -2
- package/dist/utils/adoUtils.js +1 -1
- package/dist/utils/feedUtils.js +1 -1
- package/dist/utils/githubUtils.d.ts +1 -1
- package/dist/utils/githubUtils.js +1 -1
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/logger.js +11 -1
- package/dist/utils/macroExpressionUtils.d.ts +1 -1
- package/dist/utils/osUtils.d.ts +1 -1
- package/dist/utils/osUtils.js +1 -1
- package/dist/web/contract/serverContract.d.ts +1 -1
- package/dist/web/public/index.html +1 -3
- package/dist/web/public/js/api.js +2 -80
- package/dist/web/public/js/modal/installation.js +1 -1
- package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +41 -9
- package/dist/web/public/js/onboard/formProcessor.js +200 -34
- package/dist/web/public/js/onboard/index.js +2 -2
- package/dist/web/public/js/onboard/publishHandler.js +30 -22
- package/dist/web/public/js/onboard/templates.js +34 -40
- package/dist/web/public/js/onboard/uiHandlers.js +175 -84
- package/dist/web/public/js/onboard/validationHandlers.js +147 -64
- package/dist/web/public/js/serverCategoryDetails.js +19 -4
- package/dist/web/public/js/serverCategoryList.js +13 -1
- package/dist/web/public/onboard.html +1 -1
- package/dist/web/server.js +21 -8
- package/package.json +1 -1
- package/src/cli/commands/install.ts +3 -3
- package/src/cli/commands/list.ts +2 -2
- package/src/cli/commands/serve.ts +3 -2
- package/src/cli/index.ts +1 -1
- package/src/core/installers/clients/BaseClientInstaller.ts +134 -3
- package/src/core/installers/clients/ClientInstaller.ts +3 -3
- package/src/core/installers/clients/ClientInstallerFactory.ts +1 -1
- package/src/core/installers/clients/ClineInstaller.ts +1 -101
- package/src/core/installers/clients/ExtensionInstaller.ts +1 -1
- package/src/core/installers/clients/GithubCopilotInstaller.ts +1 -101
- package/src/core/installers/clients/MSRooCodeInstaller.ts +1 -102
- package/src/core/installers/requirements/BaseInstaller.ts +2 -2
- package/src/core/installers/requirements/CommandInstaller.ts +1 -1
- package/src/core/installers/requirements/GeneralInstaller.ts +1 -1
- package/src/core/installers/requirements/InstallerFactory.ts +1 -1
- package/src/core/installers/requirements/NpmInstaller.ts +12 -12
- package/src/core/installers/requirements/PipInstaller.ts +1 -1
- package/src/core/installers/requirements/RequirementInstaller.ts +1 -1
- package/src/core/{ConfigurationLoader.ts → loaders/ConfigurationLoader.ts} +31 -7
- package/src/core/{ConfigurationProvider.ts → loaders/ConfigurationProvider.ts} +18 -10
- package/src/core/loaders/ServerSchemaLoader.ts +117 -0
- package/src/core/loaders/ServerSchemaProvider.ts +99 -0
- package/src/core/{types.ts → metadatas/types.ts} +3 -2
- package/src/core/onboard/FeedOnboardService.ts +270 -146
- package/src/core/onboard/OnboardProcessor.ts +60 -11
- package/src/core/onboard/OnboardStatus.ts +7 -2
- package/src/core/onboard/OnboardStatusManager.ts +270 -43
- package/src/core/validators/FeedValidator.ts +65 -9
- package/src/core/validators/IServerValidator.ts +1 -1
- package/src/core/validators/SSEServerValidator.ts +2 -2
- package/src/core/validators/ServerValidatorFactory.ts +1 -1
- package/src/core/validators/StdioServerValidator.ts +86 -34
- package/src/index.ts +3 -3
- package/src/{core → services}/InstallationService.ts +5 -5
- package/src/{core → services}/MCPManager.ts +10 -5
- package/src/{core → services}/RequirementService.ts +2 -31
- package/src/services/ServerService.ts +7 -7
- package/src/utils/adoUtils.ts +3 -3
- package/src/utils/feedUtils.ts +2 -2
- package/src/utils/githubUtils.ts +2 -2
- package/src/utils/logger.ts +13 -1
- package/src/utils/macroExpressionUtils.ts +1 -1
- package/src/utils/osUtils.ts +4 -4
- package/src/web/contract/serverContract.ts +2 -2
- package/src/web/public/index.html +1 -3
- package/src/web/public/js/api.js +2 -80
- package/src/web/public/js/modal/installation.js +1 -1
- package/src/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +41 -9
- package/src/web/public/js/onboard/formProcessor.js +200 -34
- package/src/web/public/js/onboard/index.js +2 -2
- package/src/web/public/js/onboard/publishHandler.js +30 -22
- package/src/web/public/js/onboard/templates.js +34 -40
- package/src/web/public/js/onboard/uiHandlers.js +175 -84
- package/src/web/public/js/onboard/validationHandlers.js +147 -64
- package/src/web/public/js/serverCategoryDetails.js +19 -4
- package/src/web/public/js/serverCategoryList.js +13 -1
- package/src/web/public/onboard.html +1 -1
- package/src/web/server.ts +30 -14
- package/src/core/ServerSchemaLoader.ts +0 -48
- package/src/core/ServerSchemaProvider.ts +0 -137
- package/src/services/InstallRequestValidator.ts +0 -112
- /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();
|
|
File without changes
|