imcp 0.0.16 → 0.0.17
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 +1 -1
- package/dist/core/RequirementService.d.ts +0 -12
- package/dist/core/RequirementService.js +0 -24
- package/dist/core/installers/clients/BaseClientInstaller.d.ts +1 -1
- 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 -1
- package/dist/core/installers/clients/ClineInstaller.js +1 -1
- package/dist/core/installers/clients/ExtensionInstaller.js +1 -1
- package/dist/core/installers/clients/GithubCopilotInstaller.d.ts +1 -1
- package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -1
- package/dist/core/installers/clients/MSRooCodeInstaller.d.ts +1 -1
- package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -1
- 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 +32 -0
- package/dist/core/loaders/ConfigurationLoader.js +236 -0
- package/dist/core/loaders/ConfigurationProvider.d.ts +35 -0
- package/dist/core/loaders/ConfigurationProvider.js +375 -0
- package/dist/core/loaders/ServerSchemaLoader.d.ts +11 -0
- package/{src/core/ServerSchemaLoader.ts → dist/core/loaders/ServerSchemaLoader.js} +43 -48
- package/dist/core/loaders/ServerSchemaProvider.d.ts +17 -0
- package/{src/core/ServerSchemaProvider.ts → dist/core/loaders/ServerSchemaProvider.js} +120 -137
- package/dist/core/metadatas/constants.d.ts +47 -0
- package/dist/core/metadatas/constants.js +94 -0
- package/dist/core/metadatas/types.d.ts +166 -0
- package/dist/core/metadatas/types.js +16 -0
- package/dist/core/onboard/FeedOnboardService.d.ts +1 -1
- package/dist/core/onboard/FeedOnboardService.js +1 -1
- package/dist/core/onboard/OnboardProcessor.d.ts +1 -1
- package/dist/core/onboard/OnboardProcessor.js +1 -1
- package/dist/core/onboard/OnboardStatus.d.ts +1 -1
- package/dist/core/onboard/OnboardStatusManager.d.ts +1 -1
- package/dist/core/onboard/OnboardStatusManager.js +1 -1
- package/dist/core/validators/FeedValidator.d.ts +1 -1
- 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 +1 -1
- 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 +28 -0
- package/dist/services/MCPManager.js +188 -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 +5 -5
- 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.js +1 -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/server.js +2 -2
- 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/services/InstallRequestValidator.ts +0 -112
- /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 '../../
|
|
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 '../../
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { startWebServer } from '../../web/server.js';
|
|
3
|
-
import { mcpManager } from '../../
|
|
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')
|
|
@@ -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,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,5 +1,5 @@
|
|
|
1
1
|
import { BaseClientInstaller } from './BaseClientInstaller.js';
|
|
2
|
-
import { ServerInstallOptions, OperationStatus, McpConfig } from '../../types.js';
|
|
2
|
+
import { ServerInstallOptions, OperationStatus, McpConfig } from '../../metadatas/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Cline client installer implementation
|
|
5
5
|
* Handles installation of Cline client including extension installation and settings configuration
|
|
@@ -2,7 +2,7 @@ import { BaseClientInstaller } from './BaseClientInstaller.js';
|
|
|
2
2
|
import { Logger } from '../../../utils/logger.js';
|
|
3
3
|
import { readJsonFile, writeJsonFile } from '../../../utils/clientUtils.js';
|
|
4
4
|
import { ExtensionInstaller } from './ExtensionInstaller.js';
|
|
5
|
-
import { SUPPORTED_CLIENTS } from '../../constants.js';
|
|
5
|
+
import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
|
|
6
6
|
import { isCommandAvailable } from '../../../utils/osUtils.js';
|
|
7
7
|
/**
|
|
8
8
|
* Cline client installer implementation
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import { BaseClientInstaller } from './BaseClientInstaller.js';
|
|
2
|
-
import { ServerInstallOptions, OperationStatus, McpConfig } from '../../types.js';
|
|
2
|
+
import { ServerInstallOptions, OperationStatus, McpConfig } from '../../metadatas/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Github Copilot client installer implementation
|
|
5
5
|
* Handles installation of Github Copilot client including extension installation and settings configuration
|
|
@@ -2,7 +2,7 @@ import { BaseClientInstaller } from './BaseClientInstaller.js';
|
|
|
2
2
|
import { Logger } from '../../../utils/logger.js';
|
|
3
3
|
import { readJsonFile, writeJsonFile } from '../../../utils/clientUtils.js';
|
|
4
4
|
import { ExtensionInstaller } from './ExtensionInstaller.js';
|
|
5
|
-
import { SUPPORTED_CLIENTS } from '../../constants.js';
|
|
5
|
+
import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
|
|
6
6
|
import { isCommandAvailable } from '../../../utils/osUtils.js';
|
|
7
7
|
/**
|
|
8
8
|
* Github Copilot client installer implementation
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseClientInstaller } from './BaseClientInstaller.js';
|
|
2
|
-
import { ServerInstallOptions, OperationStatus, McpConfig } from '../../types.js';
|
|
2
|
+
import { ServerInstallOptions, OperationStatus, McpConfig } from '../../metadatas/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* MSRooCode client installer implementation
|
|
5
5
|
*/
|
|
@@ -2,7 +2,7 @@ import { BaseClientInstaller } from './BaseClientInstaller.js';
|
|
|
2
2
|
import { Logger } from '../../../utils/logger.js';
|
|
3
3
|
import { readJsonFile, writeJsonFile } from '../../../utils/clientUtils.js';
|
|
4
4
|
import { ExtensionInstaller } from './ExtensionInstaller.js';
|
|
5
|
-
import { SUPPORTED_CLIENTS } from '../../constants.js';
|
|
5
|
+
import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
|
|
6
6
|
import { isCommandAvailable } from '../../../utils/osUtils.js';
|
|
7
7
|
/**
|
|
8
8
|
* MSRooCode client installer implementation
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { RequirementInstaller } from './RequirementInstaller.js';
|
|
3
3
|
/**
|
|
4
4
|
* Abstract base class with common functionality for all requirement installers
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { SETTINGS_DIR } from '../../constants.js';
|
|
2
|
+
import { SETTINGS_DIR } from '../../metadatas/constants.js';
|
|
3
3
|
import { Logger } from '../../../utils/logger.js';
|
|
4
4
|
/**
|
|
5
5
|
* Abstract base class with common functionality for all requirement installers
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
3
|
/**
|
|
4
4
|
* Installer implementation for command-line tools
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OSType } from '../../types.js';
|
|
1
|
+
import { OSType } from '../../metadatas/types.js';
|
|
2
2
|
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
3
|
import { getOSType, refreshPathEnv } from '../../../utils/osUtils.js';
|
|
4
4
|
import { Logger } from '../../../utils/logger.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
3
|
/**
|
|
4
4
|
* Installer implementation for general requirements (type 'other')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { RequirementInstaller } from './RequirementInstaller.js';
|
|
3
3
|
import { exec } from 'child_process';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
3
|
/**
|
|
4
4
|
* Installer implementation for NPM packages
|
|
@@ -5,7 +5,7 @@ import { handleGitHubRelease, getGitHubLatestVersion } from '../../../utils/gith
|
|
|
5
5
|
import { handleArtifact as handleAdoArtifact, getArtifactLatestVersion } from '../../../utils/adoUtils.js';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import fs from 'fs/promises';
|
|
8
|
-
import { SETTINGS_DIR } from '../../constants.js'; // Corrected path
|
|
8
|
+
import { SETTINGS_DIR } from '../../metadatas/constants.js'; // Corrected path
|
|
9
9
|
import { Logger } from '../../../utils/logger.js';
|
|
10
10
|
/**
|
|
11
11
|
* Installer implementation for NPM packages
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
3
|
/**
|
|
4
4
|
* Installer implementation for Python packages using pip
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Interface for requirement installers.
|
|
4
4
|
* Implementations should handle specific requirement types.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MCPConfiguration } from '../metadatas/types.js';
|
|
2
|
+
export declare class ConfigurationLoader {
|
|
3
|
+
/**
|
|
4
|
+
* Updates the installed status for a server and client combination
|
|
5
|
+
*/
|
|
6
|
+
private static updateServerInstalledStatus;
|
|
7
|
+
/**
|
|
8
|
+
* Removes a client's status from a server
|
|
9
|
+
*/
|
|
10
|
+
private static removeClientStatus;
|
|
11
|
+
/**
|
|
12
|
+
* Synchronizes server categories with client MCP settings.
|
|
13
|
+
* Uses clientMCPSettings as source of truth for installation status.
|
|
14
|
+
*/
|
|
15
|
+
static syncServerCategoriesWithClientSettings(configuration: MCPConfiguration): MCPConfiguration;
|
|
16
|
+
/**
|
|
17
|
+
* Initializes installation status for a feed configuration
|
|
18
|
+
*/
|
|
19
|
+
private static initializeInstallationStatus;
|
|
20
|
+
/**
|
|
21
|
+
* Synchronizes server categories with feeds
|
|
22
|
+
*/
|
|
23
|
+
private static syncServerCategoriesWithFeeds;
|
|
24
|
+
/**
|
|
25
|
+
* Loads feed configurations into the MCP configuration
|
|
26
|
+
*/
|
|
27
|
+
static loadFeedsIntoConfiguration(configuration: MCPConfiguration, feedFile?: string): Promise<MCPConfiguration>;
|
|
28
|
+
/**
|
|
29
|
+
* Loads MCP client settings into the configuration
|
|
30
|
+
*/
|
|
31
|
+
static loadClientMCPSettings(configuration: MCPConfiguration): Promise<MCPConfiguration>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { LOCAL_FEEDS_DIR, SUPPORTED_CLIENTS } from '../metadatas/constants.js';
|
|
4
|
+
import { Logger } from '../../utils/logger.js';
|
|
5
|
+
import { readJsonFile } from '../../utils/clientUtils.js';
|
|
6
|
+
export class ConfigurationLoader {
|
|
7
|
+
/**
|
|
8
|
+
* Updates the installed status for a server and client combination
|
|
9
|
+
*/
|
|
10
|
+
static updateServerInstalledStatus(serverStatus, clientName, operationStatus) {
|
|
11
|
+
if (!serverStatus.installedStatus) {
|
|
12
|
+
serverStatus.installedStatus = {};
|
|
13
|
+
}
|
|
14
|
+
serverStatus.installedStatus[clientName] = operationStatus;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Removes a client's status from a server
|
|
18
|
+
*/
|
|
19
|
+
static removeClientStatus(serverStatus, clientName) {
|
|
20
|
+
if (serverStatus.installedStatus && serverStatus.installedStatus[clientName]) {
|
|
21
|
+
delete serverStatus.installedStatus[clientName];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Synchronizes server categories with client MCP settings.
|
|
26
|
+
* Uses clientMCPSettings as source of truth for installation status.
|
|
27
|
+
*/
|
|
28
|
+
static syncServerCategoriesWithClientSettings(configuration) {
|
|
29
|
+
if (!configuration.clientMCPSettings) {
|
|
30
|
+
return configuration;
|
|
31
|
+
}
|
|
32
|
+
configuration.localServerCategories = configuration.localServerCategories.map(category => {
|
|
33
|
+
if (!category.installationStatus?.serversStatus) {
|
|
34
|
+
return category;
|
|
35
|
+
}
|
|
36
|
+
const updatedServerStatus = { ...category.installationStatus.serversStatus };
|
|
37
|
+
const clientSettings = configuration.clientMCPSettings;
|
|
38
|
+
for (const [clientName, settings] of Object.entries(clientSettings)) {
|
|
39
|
+
const clientServers = clientName === 'GithubCopilot'
|
|
40
|
+
? settings.servers || {}
|
|
41
|
+
: settings.mcpServers || {};
|
|
42
|
+
Object.keys(updatedServerStatus).forEach(serverName => {
|
|
43
|
+
if (clientServers[serverName]) {
|
|
44
|
+
if (!updatedServerStatus[serverName].installedStatus[clientName]) {
|
|
45
|
+
const operationStatus = {
|
|
46
|
+
status: 'completed',
|
|
47
|
+
type: 'install',
|
|
48
|
+
target: 'server',
|
|
49
|
+
message: `Server ${serverName} is configured for client ${clientName}`
|
|
50
|
+
};
|
|
51
|
+
ConfigurationLoader.updateServerInstalledStatus(updatedServerStatus[serverName], clientName, operationStatus);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
ConfigurationLoader.removeClientStatus(updatedServerStatus[serverName], clientName);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
...category,
|
|
61
|
+
installationStatus: {
|
|
62
|
+
...category.installationStatus,
|
|
63
|
+
serversStatus: updatedServerStatus,
|
|
64
|
+
lastUpdated: new Date().toISOString()
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
return configuration;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Initializes installation status for a feed configuration
|
|
72
|
+
*/
|
|
73
|
+
static initializeInstallationStatus(feedConfig) {
|
|
74
|
+
const requirementsStatus = {};
|
|
75
|
+
const serversStatus = {};
|
|
76
|
+
if (feedConfig) {
|
|
77
|
+
if (feedConfig.requirements) {
|
|
78
|
+
for (const req of feedConfig.requirements) {
|
|
79
|
+
requirementsStatus[req.name] = {
|
|
80
|
+
name: req.name,
|
|
81
|
+
type: req.type,
|
|
82
|
+
installed: false,
|
|
83
|
+
version: req.version,
|
|
84
|
+
error: undefined
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (feedConfig.mcpServers) {
|
|
89
|
+
for (const mcp of feedConfig.mcpServers) {
|
|
90
|
+
serversStatus[mcp.name] = {
|
|
91
|
+
name: mcp.name,
|
|
92
|
+
error: undefined,
|
|
93
|
+
installedStatus: {}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
requirementsStatus,
|
|
100
|
+
serversStatus,
|
|
101
|
+
lastUpdated: new Date().toISOString()
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Synchronizes server categories with feeds
|
|
106
|
+
*/
|
|
107
|
+
static async syncServerCategoriesWithFeeds(configuration) {
|
|
108
|
+
// Filter out categories that don't have corresponding feeds and update existing ones
|
|
109
|
+
configuration.localServerCategories = configuration.localServerCategories
|
|
110
|
+
.filter(server => configuration.feeds[server.name])
|
|
111
|
+
.map(server => {
|
|
112
|
+
server.feedConfiguration = configuration.feeds[server.name];
|
|
113
|
+
if (!server.installationStatus ||
|
|
114
|
+
!server.installationStatus.requirementsStatus ||
|
|
115
|
+
Object.keys(server.installationStatus.requirementsStatus).length === 0 ||
|
|
116
|
+
!server.installationStatus.serversStatus ||
|
|
117
|
+
Object.keys(server.installationStatus.serversStatus).length < Object.keys(server.feedConfiguration?.mcpServers || []).length) {
|
|
118
|
+
server.installationStatus = ConfigurationLoader.initializeInstallationStatus(server.feedConfiguration);
|
|
119
|
+
}
|
|
120
|
+
return server;
|
|
121
|
+
});
|
|
122
|
+
// Add new categories for feeds that don't have a corresponding category
|
|
123
|
+
const existingServerNames = new Set(configuration.localServerCategories.map(category => category.name));
|
|
124
|
+
for (const [feedName, feedConfig] of Object.entries(configuration.feeds)) {
|
|
125
|
+
if (!existingServerNames.has(feedName)) {
|
|
126
|
+
const newServerCategory = {
|
|
127
|
+
name: feedName,
|
|
128
|
+
displayName: feedConfig.displayName || feedName,
|
|
129
|
+
type: 'local',
|
|
130
|
+
description: feedConfig.description || `Local MCP server category: ${feedName}`,
|
|
131
|
+
installationStatus: ConfigurationLoader.initializeInstallationStatus(feedConfig),
|
|
132
|
+
feedConfiguration: feedConfig
|
|
133
|
+
};
|
|
134
|
+
configuration.localServerCategories.push(newServerCategory);
|
|
135
|
+
console.log(`Created new local server entry for feed: ${feedName}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return configuration;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Loads feed configurations into the MCP configuration
|
|
142
|
+
*/
|
|
143
|
+
static async loadFeedsIntoConfiguration(configuration, feedFile) {
|
|
144
|
+
try {
|
|
145
|
+
await fs.mkdir(LOCAL_FEEDS_DIR, { recursive: true });
|
|
146
|
+
const feeds = {};
|
|
147
|
+
// Load provided feed file if specified
|
|
148
|
+
if (feedFile) {
|
|
149
|
+
try {
|
|
150
|
+
const content = await fs.readFile(feedFile, 'utf8');
|
|
151
|
+
const config = JSON.parse(content);
|
|
152
|
+
if (config && config.name) {
|
|
153
|
+
feeds[config.name] = config;
|
|
154
|
+
console.log(`Loaded feed configuration from provided file: ${feedFile}`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
console.log(`Error loading feed configuration from provided file ${feedFile}:`, error);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// Load feeds from LOCAL_FEEDS_DIR
|
|
162
|
+
const files = await fs.readdir(LOCAL_FEEDS_DIR);
|
|
163
|
+
const jsonFiles = files.filter(file => file.endsWith('.json'));
|
|
164
|
+
if (jsonFiles.length === 0 && !feedFile) {
|
|
165
|
+
console.log(`No feed configuration files found in ${LOCAL_FEEDS_DIR}`);
|
|
166
|
+
return configuration;
|
|
167
|
+
}
|
|
168
|
+
for (const file of jsonFiles) {
|
|
169
|
+
try {
|
|
170
|
+
const filePath = path.join(LOCAL_FEEDS_DIR, file);
|
|
171
|
+
const content = await fs.readFile(filePath, 'utf8');
|
|
172
|
+
const config = JSON.parse(content);
|
|
173
|
+
if (config && config.name) {
|
|
174
|
+
// If feed exists from provided file, skip the local one
|
|
175
|
+
if (!feeds[config.name]) {
|
|
176
|
+
feeds[config.name] = config;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
console.log(`Skipping local feed ${config.name} as it was provided via --feed-file`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
console.warn(`Error loading feed configuration from ${file}:`, error);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
configuration.feeds = feeds;
|
|
188
|
+
return await ConfigurationLoader.syncServerCategoriesWithFeeds(configuration);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
console.error("Error loading feed configurations:", error);
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Loads MCP client settings into the configuration
|
|
197
|
+
*/
|
|
198
|
+
static async loadClientMCPSettings(configuration) {
|
|
199
|
+
try {
|
|
200
|
+
Logger.debug('Starting to load MCP client settings...');
|
|
201
|
+
const settings = {};
|
|
202
|
+
for (const [clientName, clientSettings] of Object.entries(SUPPORTED_CLIENTS)) {
|
|
203
|
+
const settingPath = process.env.CODE_INSIDERS
|
|
204
|
+
? clientSettings.codeInsiderSettingPath
|
|
205
|
+
: clientSettings.codeSettingPath;
|
|
206
|
+
try {
|
|
207
|
+
let content = await readJsonFile(settingPath, true);
|
|
208
|
+
if (clientName === 'GithubCopilot') {
|
|
209
|
+
if (!content.mcp) {
|
|
210
|
+
content = {
|
|
211
|
+
servers: {},
|
|
212
|
+
inputs: []
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
content = content.mcp;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
settings[clientName] = content;
|
|
220
|
+
Logger.debug(`Successfully loaded MCP settings for ${clientName}`);
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
Logger.debug(`Warning: Could not load MCP settings for client ${clientName}: ${error instanceof Error ? error.message : String(error)}`);
|
|
224
|
+
settings[clientName] = {};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
configuration.clientMCPSettings = settings;
|
|
228
|
+
return ConfigurationLoader.syncServerCategoriesWithClientSettings(configuration);
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
Logger.error('Error loading client MCP settings:', error);
|
|
232
|
+
throw error;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=ConfigurationLoader.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MCPServerCategory, FeedConfiguration, InstallationStatus, RequirementStatus, MCPServerStatus, OperationStatus, McpConfig } from '../metadatas/types.js';
|
|
2
|
+
export declare class ConfigurationProvider {
|
|
3
|
+
private static instance;
|
|
4
|
+
private configPath;
|
|
5
|
+
private configuration;
|
|
6
|
+
private configLock;
|
|
7
|
+
private tempDir;
|
|
8
|
+
private constructor();
|
|
9
|
+
static getInstance(): ConfigurationProvider;
|
|
10
|
+
private withLock;
|
|
11
|
+
initialize(feedFile?: string): Promise<void>;
|
|
12
|
+
private saveConfiguration;
|
|
13
|
+
getServerCategories(): Promise<MCPServerCategory[]>;
|
|
14
|
+
getServerCategory(categoryName: string): Promise<MCPServerCategory | undefined>;
|
|
15
|
+
getClientMcpSettings(): Promise<Record<string, Record<string, any>> | undefined>;
|
|
16
|
+
getFeedConfiguration(categoryName: string): Promise<FeedConfiguration | undefined>;
|
|
17
|
+
getServerMcpConfig(categoryName: string, serverName: string): Promise<McpConfig | undefined>;
|
|
18
|
+
getInstallationStatus(categoryName: string): Promise<InstallationStatus | undefined>;
|
|
19
|
+
getServerStatus(categoryName: string, serverName: string): Promise<MCPServerStatus | undefined>;
|
|
20
|
+
getRequirementStatus(categoryName: string, requirementName: string): Promise<RequirementStatus | undefined>;
|
|
21
|
+
updateInstallationStatus(categoryName: string, requirementStatus: Record<string, RequirementStatus>, serverStatus: Record<string, MCPServerStatus>): Promise<boolean>;
|
|
22
|
+
updateRequirementStatus(categoryName: string, requirementName: string, status: RequirementStatus): Promise<boolean>;
|
|
23
|
+
updateRequirementOperationStatus(categoryName: string, requirementName: string, operationStatus: OperationStatus): Promise<boolean>;
|
|
24
|
+
updateServerStatus(categoryName: string, serverName: string, status: MCPServerStatus): Promise<boolean>;
|
|
25
|
+
updateServerOperationStatus(categoryName: string, serverName: string, clientName: string, operationStatus: OperationStatus): Promise<boolean>;
|
|
26
|
+
isRequirementsReady(categoryName: string, serverName: string): Promise<boolean>;
|
|
27
|
+
GetServerRequirementStatus(categoryName: string, serverName: string): Promise<RequirementStatus[]>;
|
|
28
|
+
isServerReady(categoryName: string, serverName: string, clients: string[]): Promise<boolean>;
|
|
29
|
+
syncFeeds(): Promise<void>;
|
|
30
|
+
private loadFeedsIntoConfiguration;
|
|
31
|
+
private loadClientMCPSettings;
|
|
32
|
+
reloadClientMCPSettings(): Promise<void>;
|
|
33
|
+
removeServerFromClientMCPSettings(serverName: string, target?: string): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export declare const configProvider: ConfigurationProvider;
|