imcp 0.0.1

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 (124) hide show
  1. package/.github/ISSUE_TEMPLATE/JitAccess.yml +28 -0
  2. package/.github/acl/access.yml +20 -0
  3. package/.github/compliance/inventory.yml +5 -0
  4. package/.github/policies/jit.yml +19 -0
  5. package/README.md +137 -0
  6. package/dist/cli/commands/install.d.ts +2 -0
  7. package/dist/cli/commands/install.js +105 -0
  8. package/dist/cli/commands/list.d.ts +2 -0
  9. package/dist/cli/commands/list.js +90 -0
  10. package/dist/cli/commands/pull.d.ts +2 -0
  11. package/dist/cli/commands/pull.js +17 -0
  12. package/dist/cli/commands/serve.d.ts +2 -0
  13. package/dist/cli/commands/serve.js +32 -0
  14. package/dist/cli/commands/start.d.ts +2 -0
  15. package/dist/cli/commands/start.js +32 -0
  16. package/dist/cli/commands/sync.d.ts +2 -0
  17. package/dist/cli/commands/sync.js +17 -0
  18. package/dist/cli/commands/uninstall.d.ts +2 -0
  19. package/dist/cli/commands/uninstall.js +39 -0
  20. package/dist/cli/index.d.ts +2 -0
  21. package/dist/cli/index.js +114 -0
  22. package/dist/core/ConfigurationProvider.d.ts +31 -0
  23. package/dist/core/ConfigurationProvider.js +416 -0
  24. package/dist/core/InstallationService.d.ts +17 -0
  25. package/dist/core/InstallationService.js +144 -0
  26. package/dist/core/MCPManager.d.ts +17 -0
  27. package/dist/core/MCPManager.js +98 -0
  28. package/dist/core/RequirementService.d.ts +45 -0
  29. package/dist/core/RequirementService.js +123 -0
  30. package/dist/core/constants.d.ts +29 -0
  31. package/dist/core/constants.js +55 -0
  32. package/dist/core/installers/BaseInstaller.d.ts +73 -0
  33. package/dist/core/installers/BaseInstaller.js +247 -0
  34. package/dist/core/installers/ClientInstaller.d.ts +17 -0
  35. package/dist/core/installers/ClientInstaller.js +307 -0
  36. package/dist/core/installers/CommandInstaller.d.ts +36 -0
  37. package/dist/core/installers/CommandInstaller.js +170 -0
  38. package/dist/core/installers/GeneralInstaller.d.ts +32 -0
  39. package/dist/core/installers/GeneralInstaller.js +87 -0
  40. package/dist/core/installers/InstallerFactory.d.ts +52 -0
  41. package/dist/core/installers/InstallerFactory.js +95 -0
  42. package/dist/core/installers/NpmInstaller.d.ts +25 -0
  43. package/dist/core/installers/NpmInstaller.js +123 -0
  44. package/dist/core/installers/PipInstaller.d.ts +25 -0
  45. package/dist/core/installers/PipInstaller.js +114 -0
  46. package/dist/core/installers/RequirementInstaller.d.ts +32 -0
  47. package/dist/core/installers/RequirementInstaller.js +3 -0
  48. package/dist/core/installers/index.d.ts +6 -0
  49. package/dist/core/installers/index.js +7 -0
  50. package/dist/core/types.d.ts +152 -0
  51. package/dist/core/types.js +16 -0
  52. package/dist/index.d.ts +11 -0
  53. package/dist/index.js +19 -0
  54. package/dist/services/InstallRequestValidator.d.ts +21 -0
  55. package/dist/services/InstallRequestValidator.js +99 -0
  56. package/dist/services/ServerService.d.ts +47 -0
  57. package/dist/services/ServerService.js +145 -0
  58. package/dist/utils/UpdateCheckTracker.d.ts +39 -0
  59. package/dist/utils/UpdateCheckTracker.js +80 -0
  60. package/dist/utils/clientUtils.d.ts +29 -0
  61. package/dist/utils/clientUtils.js +105 -0
  62. package/dist/utils/feedUtils.d.ts +5 -0
  63. package/dist/utils/feedUtils.js +29 -0
  64. package/dist/utils/githubAuth.d.ts +1 -0
  65. package/dist/utils/githubAuth.js +123 -0
  66. package/dist/utils/logger.d.ts +14 -0
  67. package/dist/utils/logger.js +90 -0
  68. package/dist/utils/osUtils.d.ts +16 -0
  69. package/dist/utils/osUtils.js +235 -0
  70. package/dist/web/public/css/modal.css +250 -0
  71. package/dist/web/public/css/notifications.css +70 -0
  72. package/dist/web/public/index.html +157 -0
  73. package/dist/web/public/js/api.js +213 -0
  74. package/dist/web/public/js/modal.js +572 -0
  75. package/dist/web/public/js/notifications.js +99 -0
  76. package/dist/web/public/js/serverCategoryDetails.js +210 -0
  77. package/dist/web/public/js/serverCategoryList.js +82 -0
  78. package/dist/web/public/modal.html +61 -0
  79. package/dist/web/public/styles.css +155 -0
  80. package/dist/web/server.d.ts +5 -0
  81. package/dist/web/server.js +150 -0
  82. package/package.json +53 -0
  83. package/src/cli/commands/install.ts +140 -0
  84. package/src/cli/commands/list.ts +112 -0
  85. package/src/cli/commands/pull.ts +16 -0
  86. package/src/cli/commands/serve.ts +37 -0
  87. package/src/cli/commands/uninstall.ts +54 -0
  88. package/src/cli/index.ts +127 -0
  89. package/src/core/ConfigurationProvider.ts +489 -0
  90. package/src/core/InstallationService.ts +173 -0
  91. package/src/core/MCPManager.ts +134 -0
  92. package/src/core/RequirementService.ts +147 -0
  93. package/src/core/constants.ts +61 -0
  94. package/src/core/installers/BaseInstaller.ts +292 -0
  95. package/src/core/installers/ClientInstaller.ts +423 -0
  96. package/src/core/installers/CommandInstaller.ts +185 -0
  97. package/src/core/installers/GeneralInstaller.ts +89 -0
  98. package/src/core/installers/InstallerFactory.ts +109 -0
  99. package/src/core/installers/NpmInstaller.ts +128 -0
  100. package/src/core/installers/PipInstaller.ts +121 -0
  101. package/src/core/installers/RequirementInstaller.ts +38 -0
  102. package/src/core/installers/index.ts +9 -0
  103. package/src/core/types.ts +163 -0
  104. package/src/index.ts +44 -0
  105. package/src/services/InstallRequestValidator.ts +112 -0
  106. package/src/services/ServerService.ts +181 -0
  107. package/src/utils/UpdateCheckTracker.ts +86 -0
  108. package/src/utils/clientUtils.ts +112 -0
  109. package/src/utils/feedUtils.ts +31 -0
  110. package/src/utils/githubAuth.ts +142 -0
  111. package/src/utils/logger.ts +101 -0
  112. package/src/utils/osUtils.ts +250 -0
  113. package/src/web/public/css/modal.css +250 -0
  114. package/src/web/public/css/notifications.css +70 -0
  115. package/src/web/public/index.html +157 -0
  116. package/src/web/public/js/api.js +213 -0
  117. package/src/web/public/js/modal.js +572 -0
  118. package/src/web/public/js/notifications.js +99 -0
  119. package/src/web/public/js/serverCategoryDetails.js +210 -0
  120. package/src/web/public/js/serverCategoryList.js +82 -0
  121. package/src/web/public/modal.html +61 -0
  122. package/src/web/public/styles.css +155 -0
  123. package/src/web/server.ts +195 -0
  124. package/tsconfig.json +18 -0
@@ -0,0 +1,144 @@
1
+ import path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ import { exec } from 'child_process';
4
+ import util from 'util';
5
+ import { createInstallerFactory } from './installers/index.js';
6
+ import { SUPPORTED_CLIENTS } from './constants.js';
7
+ import { ClientInstaller } from './installers/ClientInstaller.js';
8
+ import { ConfigurationProvider } from './ConfigurationProvider.js';
9
+ const execPromise = util.promisify(exec);
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ /**
12
+ * Handles the actual installation process for an MCP server.
13
+ */
14
+ export class InstallationService {
15
+ activeInstallations = new Map();
16
+ installerFactory;
17
+ constructor() {
18
+ this.installerFactory = createInstallerFactory();
19
+ }
20
+ generateOperationId() {
21
+ return `install-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
22
+ }
23
+ /**
24
+ * Installs a server based on the provided options and feed configuration.
25
+ * @param serverName The name of the server to install.
26
+ * @param options The installation options.
27
+ * @returns A result object indicating success or failure.
28
+ */
29
+ async install(categoryName, serverName, options) {
30
+ const configProvider = ConfigurationProvider.getInstance();
31
+ const clients = options.targetClients || Object.keys(SUPPORTED_CLIENTS);
32
+ // Check if server is already ready
33
+ const isReady = await configProvider.isServerReady(categoryName, serverName, clients);
34
+ if (isReady) {
35
+ return {
36
+ success: true,
37
+ message: 'Server and clients are already installed and ready',
38
+ status: [{
39
+ status: 'completed',
40
+ type: 'install',
41
+ target: 'server',
42
+ message: 'Server and clients are already installed and ready'
43
+ }]
44
+ };
45
+ }
46
+ // Create new ClientInstaller instance for handling installation
47
+ const clientInstaller = new ClientInstaller(categoryName, serverName, clients);
48
+ // Check requirements readiness
49
+ const requirementsReady = await configProvider.isRequirementsReady(categoryName, serverName);
50
+ if (!requirementsReady) {
51
+ // Get feed configuration to get requirements
52
+ const feedConfig = await configProvider.getFeedConfiguration(categoryName);
53
+ if (!feedConfig) {
54
+ return {
55
+ success: false,
56
+ message: 'Feed configuration not found',
57
+ status: [{
58
+ status: 'failed',
59
+ type: 'install',
60
+ target: 'server',
61
+ message: 'Feed configuration not found'
62
+ }]
63
+ };
64
+ }
65
+ // Find server config
66
+ const serverConfig = feedConfig.mcpServers.find((s) => s.name === serverName);
67
+ if (!serverConfig?.dependencies?.requirements) {
68
+ return {
69
+ success: false,
70
+ message: 'Server configuration or requirements not found',
71
+ status: [{
72
+ status: 'failed',
73
+ type: 'install',
74
+ target: 'server',
75
+ message: 'Server configuration or requirements not found'
76
+ }]
77
+ };
78
+ }
79
+ // Install requirements asynchronously
80
+ for (const requirement of serverConfig.dependencies.requirements) {
81
+ // Create full RequirementConfig from dependency requirement
82
+ const feeds = await configProvider.getFeedConfiguration(categoryName);
83
+ const requirementConfig = feeds?.requirements?.find((r) => r.name === requirement.name) || {
84
+ name: requirement.name,
85
+ version: requirement.version,
86
+ type: 'npm' // Default to npm, can be enhanced to determine from requirement or config
87
+ };
88
+ const installer = this.installerFactory.getInstaller(requirementConfig);
89
+ if (!installer) {
90
+ await configProvider.updateRequirementStatus(categoryName, requirement.name, {
91
+ name: requirement.name,
92
+ type: requirementConfig.type,
93
+ installed: false,
94
+ error: `No installer found for requirement type: ${requirementConfig.type}`,
95
+ operationStatus: {
96
+ status: 'failed',
97
+ type: 'install',
98
+ target: 'requirement',
99
+ message: `No installer found for requirement type: ${requirementConfig.type}`,
100
+ operationId: this.generateOperationId()
101
+ }
102
+ });
103
+ continue;
104
+ }
105
+ // Create operation status for requirement
106
+ const operationStatus = {
107
+ status: 'pending',
108
+ type: 'install',
109
+ target: 'requirement',
110
+ message: `Installing requirement: ${requirement.name}`,
111
+ operationId: this.generateOperationId()
112
+ };
113
+ // Update requirement status
114
+ await configProvider.updateRequirementStatus(categoryName, requirement.name, {
115
+ name: requirement.name,
116
+ type: requirementConfig.type,
117
+ installed: false,
118
+ inProgress: true,
119
+ operationStatus
120
+ });
121
+ // Start async installation
122
+ installer.install(requirementConfig).then(async (installStatus) => {
123
+ const status = {
124
+ ...installStatus,
125
+ operationStatus: {
126
+ status: installStatus.installed ? 'completed' : 'failed',
127
+ type: 'install',
128
+ target: 'requirement',
129
+ message: installStatus.installed ? `Requirement ${requirement.name} installed successfully` : `Failed to install ${requirement.name}`,
130
+ operationId: operationStatus.operationId
131
+ }
132
+ };
133
+ await configProvider.updateRequirementStatus(categoryName, requirement.name, status);
134
+ });
135
+ }
136
+ }
137
+ // Process client installation regardless of requirements state
138
+ // Each client installer will check requirements before actual installation
139
+ return await clientInstaller.install(options);
140
+ }
141
+ }
142
+ // Export a singleton instance (optional)
143
+ // export const installationService = new InstallationService();
144
+ //# sourceMappingURL=InstallationService.js.map
@@ -0,0 +1,17 @@
1
+ import { EventEmitter } from 'events';
2
+ import { MCPEvent, MCPEventData, MCPServerCategory, ServerInstallOptions, ServerCategoryListOptions, ServerOperationResult, ServerUninstallOptions } from './types.js';
3
+ export declare class MCPManager extends EventEmitter {
4
+ private installationService;
5
+ private configProvider;
6
+ constructor();
7
+ syncFeeds(): Promise<void>;
8
+ initialize(): Promise<void>;
9
+ listServerCategories(options?: ServerCategoryListOptions): Promise<MCPServerCategory[]>;
10
+ getFeedConfiguration(categoryName: string): Promise<import("./types.js").FeedConfiguration | undefined>;
11
+ installServer(categoryName: string, serverName: string, requestOptions?: ServerInstallOptions): Promise<ServerOperationResult>;
12
+ uninstallServer(categoryName: string, serverName: string, options?: ServerUninstallOptions): Promise<ServerOperationResult>;
13
+ emit<E extends MCPEvent>(event: E, data: MCPEventData[E]): boolean;
14
+ on<E extends MCPEvent>(event: E, listener: (data: MCPEventData[E]) => void): this;
15
+ off<E extends MCPEvent>(event: E, listener: (data: MCPEventData[E]) => void): this;
16
+ }
17
+ export declare const mcpManager: MCPManager;
@@ -0,0 +1,98 @@
1
+ import { EventEmitter } from 'events';
2
+ import { ConfigurationProvider } from './ConfigurationProvider.js';
3
+ import { InstallationService } from './InstallationService.js';
4
+ import { MCPEvent } from './types.js';
5
+ export class MCPManager extends EventEmitter {
6
+ installationService;
7
+ configProvider;
8
+ constructor() {
9
+ super();
10
+ this.configProvider = ConfigurationProvider.getInstance();
11
+ this.installationService = new InstallationService();
12
+ }
13
+ async syncFeeds() {
14
+ await this.configProvider.syncFeeds();
15
+ }
16
+ async initialize() {
17
+ try {
18
+ await this.configProvider.initialize();
19
+ }
20
+ catch (error) {
21
+ console.error("Error during MCPManager initialization:", error);
22
+ throw error;
23
+ }
24
+ }
25
+ async listServerCategories(options = {}) {
26
+ const { local = true } = options;
27
+ if (local) {
28
+ return await this.configProvider.getServerCategories();
29
+ }
30
+ return [];
31
+ }
32
+ async getFeedConfiguration(categoryName) {
33
+ return this.configProvider.getFeedConfiguration(categoryName);
34
+ }
35
+ async installServer(categoryName, serverName, requestOptions = {}) {
36
+ try {
37
+ const server = await this.configProvider.getServerCategory(categoryName);
38
+ if (!server) {
39
+ return {
40
+ success: false,
41
+ message: `Server category ${categoryName} is not onboarded`,
42
+ };
43
+ }
44
+ const installResult = await this.installationService.install(categoryName, serverName, requestOptions);
45
+ if (!installResult.success) {
46
+ return installResult;
47
+ }
48
+ this.emit(MCPEvent.SERVER_INSTALLED, { server });
49
+ return installResult;
50
+ }
51
+ catch (error) {
52
+ console.error(`Unexpected error during installServer for ${serverName}:`, error);
53
+ return {
54
+ success: false,
55
+ message: `Failed to install ${serverName}: ${error instanceof Error ? error.message : String(error)}`,
56
+ error: error instanceof Error ? error : new Error(String(error)),
57
+ };
58
+ }
59
+ }
60
+ async uninstallServer(categoryName, serverName, options = {}) {
61
+ try {
62
+ const serverCategory = await this.configProvider.getServerCategory(categoryName);
63
+ if (!serverCategory) {
64
+ return {
65
+ success: false,
66
+ message: `Server category ${categoryName} is not onboarded`,
67
+ };
68
+ }
69
+ // Clear installation status
70
+ await this.configProvider.updateInstallationStatus(categoryName, {}, {});
71
+ this.emit(MCPEvent.SERVER_UNINSTALLED, { serverName });
72
+ return {
73
+ success: true,
74
+ message: `Successfully uninstalled ${serverName}`,
75
+ };
76
+ }
77
+ catch (error) {
78
+ return {
79
+ success: false,
80
+ message: `Failed to uninstall ${serverName}`,
81
+ error: error,
82
+ };
83
+ }
84
+ }
85
+ // Type-safe event emitter methods
86
+ emit(event, data) {
87
+ return super.emit(event, data);
88
+ }
89
+ on(event, listener) {
90
+ return super.on(event, listener);
91
+ }
92
+ off(event, listener) {
93
+ return super.off(event, listener);
94
+ }
95
+ }
96
+ // Export a singleton instance
97
+ export const mcpManager = new MCPManager();
98
+ //# sourceMappingURL=MCPManager.js.map
@@ -0,0 +1,45 @@
1
+ import { RequirementConfig, RequirementStatus } from './types.js';
2
+ /**
3
+ * Service responsible for managing requirements installation and status
4
+ */
5
+ export declare class RequirementService {
6
+ private static instance;
7
+ private installerFactory;
8
+ private constructor();
9
+ /**
10
+ * Get the singleton instance of RequirementService
11
+ * @returns The RequirementService instance
12
+ */
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): Promise<RequirementStatus>;
20
+ /**
21
+ * Check the installation status of a requirement
22
+ * @param requirement The requirement to check
23
+ * @returns The installation status
24
+ */
25
+ checkRequirementStatus(requirement: RequirementConfig): Promise<RequirementStatus>;
26
+ /**
27
+ * Check if updates are available for a requirement
28
+ * @param requirement The requirement to check for updates
29
+ * @returns Updated status with available updates information
30
+ */
31
+ checkRequirementForUpdates(requirement: RequirementConfig): Promise<RequirementStatus>;
32
+ /**
33
+ * Install multiple requirements
34
+ * @param requirements The requirements to install
35
+ * @returns A map of requirement names to their installation status
36
+ */
37
+ installRequirements(requirements: RequirementConfig[]): Promise<Record<string, RequirementStatus>>;
38
+ /**
39
+ * Validate a requirement configuration
40
+ * @param requirement The requirement to validate
41
+ * @throws Error if the requirement is invalid
42
+ */
43
+ private validateRequirement;
44
+ }
45
+ export declare const requirementService: RequirementService;
@@ -0,0 +1,123 @@
1
+ import { createInstallerFactory } from './installers/index.js';
2
+ import { exec } from 'child_process';
3
+ import util from 'util';
4
+ /**
5
+ * Service responsible for managing requirements installation and status
6
+ */
7
+ export class RequirementService {
8
+ static instance;
9
+ installerFactory = createInstallerFactory(util.promisify(exec));
10
+ constructor() { }
11
+ /**
12
+ * Get the singleton instance of RequirementService
13
+ * @returns The RequirementService instance
14
+ */
15
+ static getInstance() {
16
+ if (!RequirementService.instance) {
17
+ RequirementService.instance = new RequirementService();
18
+ }
19
+ return RequirementService.instance;
20
+ }
21
+ /**
22
+ * Install a requirement
23
+ * @param requirement The requirement to install
24
+ * @returns The installation status
25
+ */
26
+ async installRequirement(requirement) {
27
+ // Validate requirement
28
+ this.validateRequirement(requirement);
29
+ // Install the requirement
30
+ return await this.installerFactory.install(requirement);
31
+ }
32
+ /**
33
+ * Check the installation status of a requirement
34
+ * @param requirement The requirement to check
35
+ * @returns The installation status
36
+ */
37
+ async checkRequirementStatus(requirement) {
38
+ // Validate requirement
39
+ this.validateRequirement(requirement);
40
+ // Check the installation status
41
+ return await this.installerFactory.checkInstallation(requirement);
42
+ }
43
+ /**
44
+ * Check if updates are available for a requirement
45
+ * @param requirement The requirement to check for updates
46
+ * @returns Updated status with available updates information
47
+ */
48
+ async checkRequirementForUpdates(requirement) {
49
+ // Validate requirement
50
+ this.validateRequirement(requirement);
51
+ // Get current status
52
+ const status = await this.checkRequirementStatus(requirement);
53
+ // Check for updates using the appropriate installer
54
+ const installer = this.installerFactory.getInstaller(requirement);
55
+ if (!installer) {
56
+ return status;
57
+ }
58
+ // If the installer supports update checking, use it
59
+ if ('checkForUpdates' in installer) {
60
+ return await installer.checkForUpdates(requirement, status);
61
+ }
62
+ return status;
63
+ }
64
+ /**
65
+ * Install multiple requirements
66
+ * @param requirements The requirements to install
67
+ * @returns A map of requirement names to their installation status
68
+ */
69
+ async installRequirements(requirements) {
70
+ const results = {};
71
+ // Process each requirement sequentially to avoid conflicts
72
+ for (const requirement of requirements) {
73
+ results[requirement.name] = await this.installRequirement(requirement);
74
+ }
75
+ return results;
76
+ }
77
+ /**
78
+ * Validate a requirement configuration
79
+ * @param requirement The requirement to validate
80
+ * @throws Error if the requirement is invalid
81
+ */
82
+ validateRequirement(requirement) {
83
+ // Ensure requirement has required fields
84
+ if (!requirement.name) {
85
+ throw new Error('Requirement name is required');
86
+ }
87
+ if (!requirement.type) {
88
+ throw new Error('Requirement type is required');
89
+ }
90
+ // For type 'other', registry must be specified
91
+ if (requirement.type === 'other' && !requirement.registry) {
92
+ throw new Error('Registry must be specified for requirement type "other"');
93
+ }
94
+ // Validate registry configuration if provided
95
+ if (requirement.registry) {
96
+ const { githubRelease, artifacts, local } = requirement.registry;
97
+ // Validate GitHub release configuration
98
+ if (githubRelease) {
99
+ if (!githubRelease.repository) {
100
+ throw new Error('Repository is required for GitHub release registry');
101
+ }
102
+ if (!githubRelease.assetName) {
103
+ throw new Error('Asset name is required for GitHub release registry');
104
+ }
105
+ }
106
+ // Validate artifacts registry configuration
107
+ if (artifacts) {
108
+ if (!artifacts.registryUrl) {
109
+ throw new Error('Registry URL is required for artifacts registry');
110
+ }
111
+ }
112
+ // Validate local registry configuration
113
+ if (local) {
114
+ if (!local.localPath) {
115
+ throw new Error('Local path is required for local registry');
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ // Export a singleton instance
122
+ export const requirementService = RequirementService.getInstance();
123
+ //# sourceMappingURL=RequirementService.js.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Defines constants used across the application.
3
+ */
4
+ /**
5
+ * GitHub repository configuration for feeds
6
+ */
7
+ export declare const GITHUB_REPO: {
8
+ url: string;
9
+ feedsPath: string;
10
+ };
11
+ /**
12
+ * Local settings directory path based on OS
13
+ */
14
+ export declare const SETTINGS_DIR: string;
15
+ /**
16
+ * Local feeds directory path
17
+ */
18
+ export declare const LOCAL_FEEDS_DIR: string;
19
+ /**
20
+ * Supported client configurations.
21
+ * Key: Client name (e.g., 'vscode')
22
+ * Value: Client-specific settings or configuration details.
23
+ * TODO: Define actual client settings structure.
24
+ */
25
+ export declare const SUPPORTED_CLIENTS: Record<string, any>;
26
+ /**
27
+ * List of supported client names.
28
+ */
29
+ export declare const SUPPORTED_CLIENT_NAMES: string[];
@@ -0,0 +1,55 @@
1
+ import os from 'os';
2
+ import path from 'path';
3
+ /**
4
+ * Defines constants used across the application.
5
+ */
6
+ /**
7
+ * GitHub repository configuration for feeds
8
+ */
9
+ export const GITHUB_REPO = {
10
+ url: 'https://github.com/ai-microsoft/imcp-feed.git',
11
+ feedsPath: 'feeds'
12
+ };
13
+ /**
14
+ * Local settings directory path based on OS
15
+ */
16
+ export const SETTINGS_DIR = (() => {
17
+ switch (process.platform) {
18
+ case 'win32':
19
+ return path.join(os.homedir(), '.imcp');
20
+ default: // linux, darwin (macOS), etc.
21
+ return path.join(os.homedir(), '.imcp');
22
+ }
23
+ })();
24
+ /**
25
+ * Local feeds directory path
26
+ */
27
+ export const LOCAL_FEEDS_DIR = path.join(SETTINGS_DIR, 'feeds');
28
+ const CODE_STRORAGE_DIR = path.join(os.homedir(), 'AppData', 'Roaming', 'Code', 'User');
29
+ const CODE_INSIDER_STRORAGE_DIR = path.join(os.homedir(), 'AppData', 'Roaming', 'Code - Insiders', 'User');
30
+ /**
31
+ * Supported client configurations.
32
+ * Key: Client name (e.g., 'vscode')
33
+ * Value: Client-specific settings or configuration details.
34
+ * TODO: Define actual client settings structure.
35
+ */
36
+ export const SUPPORTED_CLIENTS = {
37
+ 'Cline': {
38
+ codeSettingPath: path.join(CODE_STRORAGE_DIR, 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'),
39
+ codeInsiderSettingPath: path.join(CODE_INSIDER_STRORAGE_DIR, 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'),
40
+ },
41
+ 'MSRooCode': {
42
+ codeSettingPath: path.join(CODE_STRORAGE_DIR, 'globalStorage', 'microsoftai.ms-roo-cline', 'settings', 'cline_mcp_settings.json'),
43
+ codeInsiderSettingPath: path.join(CODE_INSIDER_STRORAGE_DIR, 'globalStorage', 'microsoftai.ms-roo-clinev', 'settings', 'cline_mcp_settings.json'),
44
+ },
45
+ 'GithubCopilot': {
46
+ codeSettingPath: path.join(CODE_STRORAGE_DIR, 'settings.json'),
47
+ codeInsiderSettingPath: path.join(CODE_INSIDER_STRORAGE_DIR, 'settings.json'),
48
+ },
49
+ // Add other supported clients here
50
+ };
51
+ /**
52
+ * List of supported client names.
53
+ */
54
+ export const SUPPORTED_CLIENT_NAMES = Object.keys(SUPPORTED_CLIENTS);
55
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,73 @@
1
+ import { RequirementConfig, RequirementStatus, RegistryConfig } from '../types.js';
2
+ import { RequirementInstaller } from './RequirementInstaller.js';
3
+ /**
4
+ * Abstract base class with common functionality for all requirement installers
5
+ */
6
+ export declare abstract class BaseInstaller implements RequirementInstaller {
7
+ protected execPromise: (command: string) => Promise<{
8
+ stdout: string;
9
+ stderr: string;
10
+ }>;
11
+ protected downloadsDir: string;
12
+ constructor(execPromise: (command: string) => Promise<{
13
+ stdout: string;
14
+ stderr: string;
15
+ }>);
16
+ abstract canHandle(requirement: RequirementConfig): boolean;
17
+ abstract install(requirement: RequirementConfig): Promise<RequirementStatus>;
18
+ abstract checkInstallation(requirement: RequirementConfig): Promise<RequirementStatus>;
19
+ /**
20
+ * Check if updates are available for the requirement
21
+ * @param requirement The requirement to check
22
+ * @param currentStatus The current status of the requirement
23
+ * @returns The status of the requirement with update information
24
+ */
25
+ checkForUpdates(requirement: RequirementConfig, currentStatus: RequirementStatus): Promise<RequirementStatus>;
26
+ /**
27
+ * Helper method to ensure downloads directory exists
28
+ */
29
+ protected ensureDownloadsDir(): Promise<void>;
30
+ /**
31
+ * Helper to handle GitHub release downloads
32
+ * @param requirement The requirement configuration
33
+ * @param registry The GitHub release registry configuration
34
+ * @returns The path to the downloaded file
35
+ */
36
+ protected handleGitHubRelease(requirement: RequirementConfig, registry: RegistryConfig['githubRelease']): Promise<{
37
+ resolvedVersion: string;
38
+ resolvedPath: string;
39
+ }>;
40
+ /**
41
+ * Helper to handle artifact registry downloads
42
+ * @param requirement The requirement configuration
43
+ * @param registry The artifacts registry configuration
44
+ * @returns The registry URL
45
+ */
46
+ protected handleArtifactsRegistry(requirement: RequirementConfig, registry: RegistryConfig['artifacts']): Promise<string>;
47
+ /**
48
+ * Helper to handle local path registry
49
+ * @param requirement The requirement configuration
50
+ * @param registry The local registry configuration
51
+ * @returns The local path or extracted asset path
52
+ */
53
+ protected handleLocalRegistry(requirement: RequirementConfig, registry: RegistryConfig['local']): Promise<string>;
54
+ private fileExists;
55
+ /**
56
+ * Get the latest version available for a GitHub repository
57
+ * @param repository The GitHub repository in format 'owner/repo'
58
+ * @returns The latest version or tag
59
+ */
60
+ protected getGitHubLatestVersion(repository: string): Promise<string>;
61
+ /**
62
+ * Get the latest version available for an NPM package
63
+ * @param packageName The name of the NPM package
64
+ * @returns The latest version
65
+ */
66
+ protected getNpmLatestVersion(packageName: string): Promise<string>;
67
+ /**
68
+ * Get the latest version available for a pip package
69
+ * @param packageName The name of the pip package
70
+ * @returns The latest version
71
+ */
72
+ protected getPipLatestVersion(packageName: string): Promise<string>;
73
+ }