imcp 0.1.1 → 0.1.3
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/index.js +1 -45
- package/dist/core/installers/clients/BaseClientInstaller.d.ts +1 -5
- package/dist/core/installers/clients/BaseClientInstaller.js +40 -38
- package/dist/core/installers/clients/ClientInstaller.d.ts +9 -9
- package/dist/core/installers/clients/ClientInstaller.js +105 -99
- package/dist/core/installers/requirements/BaseInstaller.d.ts +9 -1
- package/dist/core/installers/requirements/CommandInstaller.d.ts +9 -1
- package/dist/core/installers/requirements/CommandInstaller.js +46 -12
- package/dist/core/installers/requirements/GeneralInstaller.d.ts +11 -1
- package/dist/core/installers/requirements/GeneralInstaller.js +46 -10
- package/dist/core/installers/requirements/InstallerFactory.d.ts +3 -1
- package/dist/core/installers/requirements/InstallerFactory.js +3 -2
- package/dist/core/installers/requirements/NpmInstaller.d.ts +4 -2
- package/dist/core/installers/requirements/NpmInstaller.js +38 -22
- package/dist/core/installers/requirements/PipInstaller.d.ts +3 -1
- package/dist/core/installers/requirements/PipInstaller.js +58 -36
- package/dist/core/installers/requirements/RequirementInstaller.d.ts +4 -1
- package/dist/core/loaders/InstallOperationManager.d.ts +115 -0
- package/dist/core/loaders/InstallOperationManager.js +311 -0
- package/dist/core/loaders/SystemSettingsManager.d.ts +54 -0
- package/dist/core/loaders/SystemSettingsManager.js +257 -0
- package/dist/core/metadatas/recordingConstants.d.ts +44 -0
- package/dist/core/metadatas/recordingConstants.js +45 -0
- package/dist/core/metadatas/types.d.ts +21 -0
- package/dist/core/onboard/InstallOperationManager.d.ts +23 -0
- package/dist/core/onboard/InstallOperationManager.js +144 -0
- package/dist/core/onboard/OnboardStatusManager.js +2 -1
- package/dist/core/validators/StdioServerValidator.js +4 -3
- package/dist/services/InstallationService.d.ts +2 -37
- package/dist/services/InstallationService.js +45 -313
- package/dist/services/MCPManager.d.ts +1 -1
- package/dist/services/MCPManager.js +4 -58
- package/dist/services/RequirementService.d.ts +85 -12
- package/dist/services/RequirementService.js +488 -49
- package/dist/services/ServerService.d.ts +0 -6
- package/dist/services/ServerService.js +0 -74
- package/dist/utils/adoUtils.js +6 -3
- package/dist/utils/logger.js +1 -1
- package/dist/utils/macroExpressionUtils.js +3 -25
- package/dist/utils/osUtils.d.ts +22 -1
- package/dist/utils/osUtils.js +92 -1
- package/dist/utils/versionUtils.d.ts +20 -1
- package/dist/utils/versionUtils.js +51 -4
- package/dist/web/public/css/modal.css +292 -1
- package/dist/web/public/css/serverDetails.css +14 -1
- package/dist/web/public/index.html +122 -20
- package/dist/web/public/js/flights/flights.js +1 -0
- package/dist/web/public/js/modal/index.js +8 -14
- package/dist/web/public/js/modal/installModal.js +3 -4
- package/dist/web/public/js/modal/installation.js +122 -137
- package/dist/web/public/js/modal/loadingModal.js +155 -25
- package/dist/web/public/js/modal/messageQueue.js +45 -101
- package/dist/web/public/js/modal/modalSetup.js +125 -43
- package/dist/web/public/js/modal/modalUtils.js +0 -12
- package/dist/web/public/js/modal.js +23 -10
- package/dist/web/public/js/onboard/publishHandler.js +22 -20
- package/dist/web/public/js/serverCategoryDetails.js +60 -11
- package/dist/web/public/js/serverCategoryList.js +2 -2
- package/dist/web/public/js/settings.js +314 -0
- package/dist/web/public/settings.html +135 -0
- package/dist/web/public/styles.css +32 -0
- package/dist/web/server.js +82 -0
- package/memory-bank/activeContext.md +13 -1
- package/memory-bank/decisionLog.md +63 -0
- package/memory-bank/progress.md +30 -0
- package/memory-bank/systemPatterns.md +7 -0
- package/package.json +1 -1
- package/src/cli/index.ts +1 -48
- package/src/core/installers/clients/BaseClientInstaller.ts +64 -50
- package/src/core/installers/clients/ClientInstaller.ts +130 -130
- package/src/core/installers/requirements/BaseInstaller.ts +9 -1
- package/src/core/installers/requirements/CommandInstaller.ts +47 -13
- package/src/core/installers/requirements/GeneralInstaller.ts +48 -10
- package/src/core/installers/requirements/InstallerFactory.ts +4 -3
- package/src/core/installers/requirements/NpmInstaller.ts +90 -68
- package/src/core/installers/requirements/PipInstaller.ts +81 -55
- package/src/core/installers/requirements/RequirementInstaller.ts +4 -3
- package/src/core/loaders/InstallOperationManager.ts +367 -0
- package/src/core/loaders/SystemSettingsManager.ts +278 -0
- package/src/core/metadatas/recordingConstants.ts +62 -0
- package/src/core/metadatas/types.ts +23 -0
- package/src/core/onboard/OnboardStatusManager.ts +2 -1
- package/src/core/validators/StdioServerValidator.ts +4 -3
- package/src/services/InstallationService.ts +54 -399
- package/src/services/MCPManager.ts +4 -77
- package/src/services/RequirementService.ts +564 -67
- package/src/services/ServerService.ts +0 -90
- package/src/utils/adoUtils.ts +6 -4
- package/src/utils/logger.ts +1 -1
- package/src/utils/macroExpressionUtils.ts +4 -21
- package/src/utils/osUtils.ts +92 -1
- package/src/utils/versionUtils.ts +71 -19
- package/src/web/public/css/modal.css +292 -1
- package/src/web/public/css/serverDetails.css +14 -1
- package/src/web/public/index.html +122 -20
- package/src/web/public/js/flights/flights.js +1 -1
- package/src/web/public/js/modal/index.js +8 -14
- package/src/web/public/js/modal/installModal.js +3 -4
- package/src/web/public/js/modal/installation.js +122 -137
- package/src/web/public/js/modal/loadingModal.js +155 -25
- package/src/web/public/js/modal/modalSetup.js +125 -43
- package/src/web/public/js/modal/modalUtils.js +0 -12
- package/src/web/public/js/modal.js +23 -10
- package/src/web/public/js/onboard/publishHandler.js +22 -20
- package/src/web/public/js/serverCategoryDetails.js +60 -11
- package/src/web/public/js/serverCategoryList.js +5 -5
- package/src/web/public/js/settings.js +314 -0
- package/src/web/public/settings.html +135 -0
- package/src/web/public/styles.css +32 -0
- package/src/web/server.ts +85 -0
- package/src/web/public/js/modal/messageQueue.js +0 -112
|
@@ -26,3 +26,66 @@ Update this file with a timestamped entry whenever a major decision is made.
|
|
|
26
26
|
- Fix: Modified duplicateServer() to temporarily enable ALL disabled fields before form submission
|
|
27
27
|
- Impact: Ensures complete server data is captured regardless of position in list
|
|
28
28
|
- Files affected: src/web/public/js/onboard/uiHandlers.js
|
|
29
|
+
[2025-05-16 13:27:43] - Refactored requirement management logic from `InstallationService` into a new dedicated `RequirementService`. `InstallationService` now delegates requirement-related tasks (checking status, installing, updating) to `RequirementService`. This improves separation of concerns and modularity.
|
|
30
|
+
|
|
31
|
+
[2025-05-16 16:07:20] - Redesigned the operation status and polling mechanism for Installation in both frontend and backend. This involved creating a new InstallOperationManager, new types for operation details, an API endpoint for status retrieval, and integrating step recording into InstallationService, RequirementService, and BaseClientInstaller. This provides more granular tracking of installation progress.
|
|
32
|
+
|
|
33
|
+
[2025-05-16 16:50:05] - Added 'overallStatus' to InstallOperationDetails and updated InstallOperationManager to manage it. Modified frontend polling in 'src/web/public/js/modal/installation.js' to use the new installation status API and display detailed steps.
|
|
34
|
+
|
|
35
|
+
[2025-05-16 17:03:17] - Enhanced the display of installation steps in the loading modal. Modified 'messageQueue.js' to support step-specific formatting (icons, success/failure states) and updated 'installation.js' to pass these options. Added CSS in 'modal.css' for the new step display styles.
|
|
36
|
+
|
|
37
|
+
[2025-05-16 17:08:31] - Refined installation step display: made fonts smaller, increased compactness, and added timestamps for each step. Updated 'modal.css' and 'messageQueue.js' accordingly. 'installation.js' now passes the timestamp.
|
|
38
|
+
|
|
39
|
+
[2025-05-16 17:19:37] - Overhauled the installation loading modal UI. 'loadingModal.js' now dynamically creates a new structure with an overall status (icon + text) and a detailed steps list. 'installation.js' was updated to use new functions in 'loadingModal.js' for status and step updates. 'messageQueue.js' was simplified as direct DOM manipulation for steps is now in 'loadingModal.js'. Added extensive CSS in 'modal.css' for the new layout and styling.
|
|
40
|
+
|
|
41
|
+
[2025-05-16 17:23:42] - Fixed error caused by removed 'delayedAppendInstallLoadingMessage'. Updated 'modalSetup.js' and 'installation.js' (uninstallTools function) to use the new 'updateOverallInstallStatus' from 'loadingModal.js' for general status messages during uninstallation.
|
|
42
|
+
|
|
43
|
+
[2025-05-16 17:26:13] - Final fix for 'delayedAppendInstallLoadingMessage' error: removed unused import from 'installModal.js'.
|
|
44
|
+
|
|
45
|
+
[2025-05-16 17:29:59] - Corrected 'src/web/public/js/modal/index.js' barrel file: removed imports and re-exports of 'delayedAppendInstallLoadingMessage' and 'appendInstallLoadingMessage' as they no longer exist. Added new exports for 'updateOverallInstallStatus' and 'addInstallationStep'.
|
|
46
|
+
|
|
47
|
+
[2025-05-16 17:31:35] - Corrected 'src/web/public/js/modal.js' (another barrel file): removed import and global assignment of 'appendInstallLoadingMessage'. Added missing exports for 'showInstallLoadingModal' and 'hideInstallLoadingModal'.
|
|
48
|
+
|
|
49
|
+
[2025-05-16 17:46:59] - Implemented reset of installation operation status. Added `resetOperation` method to `InstallOperationManager.ts` to delete existing status for a server. Called this method at the beginning of `InstallationService.ts#install` to ensure a clean state for new installations.
|
|
50
|
+
|
|
51
|
+
[2025-05-16 17:51:01] - UI adjustments for installation loading modal:
|
|
52
|
+
- Added a close button (X) to the top-right corner with functionality to hide the modal.
|
|
53
|
+
- Ensured installation steps are explicitly left-aligned using `justify-content: flex-start`.
|
|
54
|
+
- Modified the 'completed' status icon to be a checkmark within a green circle.
|
|
55
|
+
- Reviewed and confirmed the 'in-progress' spinner icon.
|
|
56
|
+
|
|
57
|
+
[2025-05-16 17:53:42] - Refined step message alignment in installation loading modal: Added `align-items: flex-start` and `text-align: left` to `.step-info`, and `text-align: left` with `width: 100%` to `.step-message` in `modal.css` to ensure text content is fully left-aligned.
|
|
58
|
+
|
|
59
|
+
[2025-05-16 17:55:32] - UI adjustment for installation loading modal: Removed the "Details" header text from above the steps list in `loadingModal.js`.
|
|
60
|
+
|
|
61
|
+
[2025-05-16 17:57:02] - Corrected removal of "Details" header in installation loading modal: Entire line `<div class="steps-list-header">Details</div>` was removed from `loadingModal.js` instead of being commented out with an invalid HTML comment.
|
|
62
|
+
|
|
63
|
+
[2025-05-17 00:26:02] - Refactored InstallOperationManager to require categoryName and serverName in the constructor, removed singleton/static pattern, and changed status file storage to per-category/server at Settings_Dir/InstallOperationStatus/CategoryName/ServerName.json. This enables instance-based management and more granular status persistence.
|
|
64
|
+
|
|
65
|
+
[2025-05-17 15:02:27] - Refactored `RequirementService.ts` to use instance-based `InstallOperationManager`.
|
|
66
|
+
- The `processRequirementUpdates` and `checkAndInstallRequirements` (including its helper `installRequirementsInBackground`) methods in [`src/services/RequirementService.ts`](src/services/RequirementService.ts:0) were updated.
|
|
67
|
+
- They now obtain an `InstallOperationManager` instance using `InstallOperationManager.getInstance(categoryName, serverName)`.
|
|
68
|
+
- The core logic within these methods, and the individual requirement processing loops, are now wrapped with `iom.recording()` or `iom.recordingAsync()` for robust step tracking and error handling.
|
|
69
|
+
- This change aligns `RequirementService.ts` with the new instance-based, per-category/server architecture of `InstallOperationManager` introduced in [2025-05-17 00:26:02].
|
|
70
|
+
- Rationale: Simplifies step recording, centralizes status management within the `InstallOperationManager` instance, and improves consistency across services.
|
|
71
|
+
- Implications: Removed direct calls to the deprecated global `installOperationManager.recordStep` and adopted the more structured `recording` pattern.
|
|
72
|
+
|
|
73
|
+
[2025-05-17 15:26:09] - Updated all requirement installer classes and interface to support step recording via InstallOperationManager. All install methods now accept an optional recorder and record critical steps using recordStep/recording.
|
|
74
|
+
|
|
75
|
+
[2025-05-18 13:21:30] - Implemented main modal refresh on loading modal close, replacing page reload.
|
|
76
|
+
- Rationale: Improve UX by maintaining main modal context and avoiding disruptive page reloads after installation/uninstallation operations shown in the loading modal.
|
|
77
|
+
- Implementation Details:
|
|
78
|
+
- `src/web/public/js/modal/loadingModal.js`: Modified `hideInstallLoadingModal` to dispatch a custom event `refreshMainModalContent` instead of causing a page reload.
|
|
79
|
+
- `src/web/public/js/modal/installation.js`: Modified `handleBulkClientInstall` to store `categoryName` as `lastSelectedCategory` and `serverName` as `lastSelectedServerName` in `localStorage` when an installation process begins. This ensures the context is available for the refresh.
|
|
80
|
+
- `src/web/public/js/modal.js`: Added an event listener for `refreshMainModalContent`. This listener retrieves `lastSelectedCategory` and `lastSelectedServerName` from `localStorage`. If both are valid, it calls `window.showInstallModal(lastSelectedCategory, lastSelectedServerName)` to refresh the content of the main installation modal.
|
|
81
|
+
- Debugging: Iteratively refined the logic in `modal.js` to correctly handle and validate `lastSelectedCategory` and `lastSelectedServerName` to prevent errors when calling `showInstallModal`. This was crucial for ensuring `showInstallModal` received the necessary `serverName` argument, resolving "Server configuration not found" errors.
|
|
82
|
+
[2025-05-18 11:33:12] - Added `src/core/metadatas/recordingConstants.ts` as the canonical source for all step recording names used in installation and onboarding operations. This file centralizes all static step names as constants and documents dynamic step name patterns, improving consistency and discoverability for step-based operation tracking across backend and frontend.
|
|
83
|
+
|
|
84
|
+
[2025-05-18 20:46:46] - Reduced the height and key size in the System Environment Variables section of the settings UI for a more compact and modern appearance. This involved decreasing row padding, shrinking the key column width, and reducing the key font size in `src/web/public/js/settings.js`.
|
|
85
|
+
|
|
86
|
+
[2025-05-18 21:00:26] - Macro resolution logic updated: Now resolves macro values (${PYTHON_PACKAGE}, ${NPMPATH}, ${BROWSER_PATH}) by first checking SystemSettingsManager (system settings), and only falls back to previous behavior if not found. This centralizes macro configuration and improves consistency across the system.
|
|
87
|
+
|
|
88
|
+
[2025-05-19 00:14:06] - Updated settings page UI and functionality:
|
|
89
|
+
- Removed "NPM Global Package Path" field from `src/web/public/settings.html` and `src/web/public/js/settings.js`.
|
|
90
|
+
- Added a descriptive prompt "Stored and used for mcp server installation environments." with a question icon (`bx-help-circle`) on the same line as the "User Configurations" title in `src/web/public/settings.html`.
|
|
91
|
+
- Modified `src/web/public/js/settings.js` to render user configuration values as `type="password"` if the key contains "key". Added an eye icon button *inside* the value input field to toggle visibility for these password fields, maintaining original input box sizes.
|
package/memory-bank/progress.md
CHANGED
|
@@ -3,3 +3,33 @@
|
|
|
3
3
|
- [YYYY-MM-DD HH:MM:SS] - Initializing Memory Bank.
|
|
4
4
|
|
|
5
5
|
- [2025-05-16 09:22:36] - Completed: Made "IMCP Server Manager" title clickable in `src/web/public/index.html`.
|
|
6
|
+
- [2025-05-16 13:28:10] - Completed: Refactored requirement management from `InstallationService` to `RequirementService`. Fixed `reqConfig` scoping and type fallbacks in `RequirementService.processRequirementUpdates`.
|
|
7
|
+
|
|
8
|
+
[2025-05-16 16:07:34] - Completed: Redesign installation operation status and polling mechanism.
|
|
9
|
+
- Added `InstallOperationDetails` type to `src/core/metadatas/types.ts`.
|
|
10
|
+
- Created `InstallOperationManager` in `src/core/loaders/InstallOperationManager.ts`.
|
|
11
|
+
- Added API endpoint for installation status in `src/web/server.ts`.
|
|
12
|
+
- Integrated `recordStep` in `InstallationService`, `RequirementService`, and `BaseClientInstaller`.
|
|
13
|
+
|
|
14
|
+
[2025-05-16 16:50:21] - Enhanced installation status:
|
|
15
|
+
- Added `overallStatus` to `InstallOperationDetails` in `src/core/metadatas/types.ts`.
|
|
16
|
+
- Updated `InstallOperationManager` in `src/core/loaders/InstallOperationManager.ts` to manage `overallStatus`.
|
|
17
|
+
- Modified frontend polling in `src/web/public/js/modal/installation.js` to use the new API `/api/categories/:categoryName/servers/:serverName/installation/status` and display detailed steps.
|
|
18
|
+
|
|
19
|
+
[2025-05-17 00:26:16] - Began refactoring InstallOperationManager to be instance-based per category/server, with new file structure for status. Memory bank updated to reflect architectural and pattern changes.
|
|
20
|
+
|
|
21
|
+
[2025-05-17 15:02:44] - Completed: Refactored `RequirementService.ts` to use instance-based `InstallOperationManager` and its `recording`/`recordingAsync` methods. This involved updating `processRequirementUpdates`, `checkAndInstallRequirements`, and `installRequirementsInBackground`.
|
|
22
|
+
|
|
23
|
+
[2025-05-18 11:33:23] - Completed: Standardized step recording names by creating `src/core/metadatas/recordingConstants.ts`. This centralizes static step names and documents dynamic patterns for installation/onboarding operations.
|
|
24
|
+
|
|
25
|
+
[2025-05-18 13:21:30] - Completed: Implemented main modal refresh logic to replace page reload.
|
|
26
|
+
- `loadingModal.js`: Dispatches `refreshMainModalContent` event on close.
|
|
27
|
+
- `installation.js`: Stores `categoryName` and `serverName` in `localStorage`.
|
|
28
|
+
- `modal.js`: Listens for event, retrieves context from `localStorage`, and calls `showInstallModal` with both `categoryName` and `serverName`.
|
|
29
|
+
- This resolves "Server configuration not found" errors and improves UX.
|
|
30
|
+
[2025-05-17 15:26:15] - Refactored all requirement installer classes and factory to support InstallOperationManager step recording. All install methods now accept a recorder and log critical steps.
|
|
31
|
+
|
|
32
|
+
[2025-05-19 00:14:13] - Completed: Updated settings page (`src/web/public/settings.html` and `src/web/public/js/settings.js`):
|
|
33
|
+
- Removed "NPM Global Package Path" display.
|
|
34
|
+
- Added prompt with a question icon for User Configurations, displayed on the same line as the section title.
|
|
35
|
+
- Implemented secret input type for keys containing "key" in User Configurations, with an eye icon button *inside* the value input field to toggle visibility (maintaining original input box sizes).
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
# System Patterns
|
|
2
2
|
|
|
3
3
|
- [YYYY-MM-DD HH:MM:SS] - Initializing Memory Bank.
|
|
4
|
+
|
|
5
|
+
[2025-05-18 13:21:30] - Implemented an event-driven modal refresh pattern for the installation UI.
|
|
6
|
+
- Pattern: Instead of page reloads, the loading modal (`loadingModal.js`) dispatches a custom DOM event (`refreshMainModalContent`) upon closing.
|
|
7
|
+
- Context Persistence: The initiating action (e.g., in `installation.js`) stores necessary context (like `lastSelectedCategory` and `lastSelectedServerName`) in `localStorage`.
|
|
8
|
+
- Event Handling: The main modal controller (`modal.js`) listens for this event, retrieves context from `localStorage`, and re-initializes/refreshes its content (`showInstallModal`) with the persisted context.
|
|
9
|
+
- Benefit: This decouples the loading modal from the main modal, allows for non-disruptive UI updates, and maintains user context effectively.
|
|
10
|
+
[2025-05-17 00:26:06] - Changed InstallOperationManager from singleton/static to instance-based, with per-category/server file storage pattern: Settings_Dir/InstallOperationStatus/CategoryName/ServerName.json. This introduces a more granular, object-oriented persistence and management pattern for install operation status.
|
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -8,19 +8,9 @@ import { createUninstallCommand } from './commands/uninstall.js';
|
|
|
8
8
|
import { createPullCommand } from './commands/pull.js';
|
|
9
9
|
import { mcpManager } from '../services/MCPManager.js';
|
|
10
10
|
import { Logger } from '../utils/logger.js';
|
|
11
|
-
import
|
|
12
|
-
import path from 'path';
|
|
13
|
-
import { fileURLToPath } from 'url';
|
|
14
|
-
import fs from 'fs';
|
|
15
|
-
import { compareVersions } from '../utils/versionUtils.js';
|
|
11
|
+
import { checkForUpdates } from '../utils/versionUtils.js';
|
|
16
12
|
|
|
17
13
|
// Custom error interface for Commander.js errors
|
|
18
|
-
// ANSI color codes
|
|
19
|
-
const COLORS = {
|
|
20
|
-
reset: '\x1b[0m',
|
|
21
|
-
yellow: '\x1b[33m'
|
|
22
|
-
};
|
|
23
|
-
|
|
24
14
|
interface CommanderError extends Error {
|
|
25
15
|
code?: string;
|
|
26
16
|
}
|
|
@@ -81,43 +71,6 @@ process.on('unhandledRejection', (error: unknown) => {
|
|
|
81
71
|
process.exit(1);
|
|
82
72
|
});
|
|
83
73
|
|
|
84
|
-
/**
|
|
85
|
-
* Check if there's a newer version of the package available
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
async function checkForUpdates(): Promise<void> {
|
|
89
|
-
try {
|
|
90
|
-
// Get the current package version
|
|
91
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
92
|
-
const __dirname = path.dirname(__filename);
|
|
93
|
-
const packagePath = path.resolve(__dirname, '../../package.json');
|
|
94
|
-
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
95
|
-
const currentVersion = packageJson.name && packageJson.version ? packageJson.version : '0.0.0';
|
|
96
|
-
const packageName = packageJson.name || 'imcp';
|
|
97
|
-
|
|
98
|
-
try {
|
|
99
|
-
// Get the latest version from npm registry (only for published packages)
|
|
100
|
-
const npmResponse = await axios.get(`https://registry.npmjs.org/${packageName}`);
|
|
101
|
-
|
|
102
|
-
if (npmResponse.data && npmResponse.data['dist-tags'] && npmResponse.data['dist-tags'].latest) {
|
|
103
|
-
const latestVersion = npmResponse.data['dist-tags'].latest;
|
|
104
|
-
|
|
105
|
-
// Compare versions properly to ensure we're only notifying for newer versions
|
|
106
|
-
if (latestVersion && compareVersions(latestVersion, currentVersion) > 0) {
|
|
107
|
-
console.log(`${COLORS.yellow}Update available for ${packageName}: ${currentVersion} → ${latestVersion}${COLORS.reset}`);
|
|
108
|
-
console.log(`${COLORS.yellow}Run \`npm install -g ${packageName}@latest\` to update${COLORS.reset}`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
} catch (npmError) {
|
|
112
|
-
// Log the npm error
|
|
113
|
-
Logger.debug(`Failed to check npm registry: ${npmError instanceof Error ? npmError.message : String(npmError)}`);
|
|
114
|
-
}
|
|
115
|
-
} catch (error) {
|
|
116
|
-
// Silently fail - don't interrupt the command if update check fails
|
|
117
|
-
Logger.debug(`Failed to check for updates: ${error instanceof Error ? error.message : String(error)}`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
74
|
// Start the CLI
|
|
122
75
|
main().catch((error: unknown) => {
|
|
123
76
|
if (error instanceof Error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Logger } from '../../../utils/logger.js';
|
|
2
2
|
import { exec } from 'child_process';
|
|
3
3
|
import { promisify } from 'util';
|
|
4
|
-
import { isCommandAvailable } from '../../../utils/osUtils.js';
|
|
4
|
+
import { isCommandAvailable, getNpmExecutablePath } from '../../../utils/osUtils.js';
|
|
5
5
|
import { ExtensionInstaller } from './ExtensionInstaller.js';
|
|
6
6
|
import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
|
|
7
7
|
import {
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
MACRO_EXPRESSIONS,
|
|
14
14
|
MacroResolverFunctions
|
|
15
15
|
} from '../../../utils/macroExpressionUtils.js';
|
|
16
|
+
import { InstallOperationManager } from '../../loaders/InstallOperationManager.js';
|
|
17
|
+
import * as RecordingConstants from '../../metadatas/recordingConstants.js';
|
|
16
18
|
|
|
17
19
|
const execAsync = promisify(exec);
|
|
18
20
|
|
|
@@ -123,7 +125,7 @@ export abstract class BaseClientInstaller {
|
|
|
123
125
|
*/
|
|
124
126
|
protected async handleWindowsNpx(config: any): Promise<any> {
|
|
125
127
|
if (process.platform === 'win32' && config.command === 'npx') {
|
|
126
|
-
const npmPath = await
|
|
128
|
+
const npmPath = await getNpmExecutablePath();
|
|
127
129
|
return {
|
|
128
130
|
...config,
|
|
129
131
|
command: 'cmd',
|
|
@@ -179,19 +181,6 @@ export abstract class BaseClientInstaller {
|
|
|
179
181
|
};
|
|
180
182
|
}
|
|
181
183
|
|
|
182
|
-
/**
|
|
183
|
-
* Get the NPM path on Windows
|
|
184
|
-
*/
|
|
185
|
-
private async getNpmPath(): Promise<string> {
|
|
186
|
-
try {
|
|
187
|
-
const { stdout } = await execAsync('powershell -Command "get-command npm | Select-Object -ExpandProperty Source"');
|
|
188
|
-
return stdout.trim().replace(/\\npm\.cmd$/, '');
|
|
189
|
-
} catch (error) {
|
|
190
|
-
Logger.error('Error getting npm path:', error);
|
|
191
|
-
return 'C:\\Program Files\\nodejs';
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
184
|
/**
|
|
196
185
|
* Checks if VS Code or VS Code Insiders is installed and installs the client extension.
|
|
197
186
|
* @param operationId The operation ID for tracking.
|
|
@@ -276,48 +265,73 @@ export abstract class BaseClientInstaller {
|
|
|
276
265
|
* @param serverConfig Server configuration
|
|
277
266
|
* @param options Installation options including environment variables and arguments
|
|
278
267
|
*/
|
|
279
|
-
async install(serverConfig: McpConfig, options: ServerInstallOptions): Promise<OperationStatus> {
|
|
268
|
+
async install(serverConfig: McpConfig, options: ServerInstallOptions, categoryName?: string): Promise<OperationStatus> {
|
|
280
269
|
const operationId = this.generateOperationId();
|
|
281
270
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
271
|
+
const recorder = InstallOperationManager.getInstance(categoryName || serverConfig.name, serverConfig.name);
|
|
272
|
+
return await recorder.recording(
|
|
273
|
+
async () => {
|
|
274
|
+
await recorder.recording(
|
|
275
|
+
() => this.checkVSCodeAndInstallExtension(operationId), {
|
|
276
|
+
stepName: RecordingConstants.STEP_CHECK_VSCODE_AND_INSTALL_EXTENSION,
|
|
277
|
+
onResult: (result) => result?.status !== 'failed'
|
|
278
|
+
}
|
|
279
|
+
)
|
|
287
280
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
281
|
+
const installConfig = await recorder.recording(
|
|
282
|
+
() => this.setupInstallConfig(serverConfig, options), {
|
|
283
|
+
stepName: RecordingConstants.STEP_SETUP_INSTALLATION_CONFIG
|
|
284
|
+
});
|
|
292
285
|
|
|
293
|
-
|
|
294
|
-
|
|
286
|
+
if (serverConfig.mode) {
|
|
287
|
+
installConfig.mode = serverConfig.mode;
|
|
288
|
+
}
|
|
295
289
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
290
|
+
const results = await recorder.recording(
|
|
291
|
+
() => this.updateVSCodeSettings(serverConfig.name, installConfig), {
|
|
292
|
+
stepName: RecordingConstants.STEP_UPDATE_VSCODE_SETTINGS,
|
|
293
|
+
onResult: (result) => result?.some(r => r.success)
|
|
294
|
+
}
|
|
295
|
+
);
|
|
300
296
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
297
|
+
// Determine overall success
|
|
298
|
+
const anySuccess = results.some(r => r.success);
|
|
299
|
+
const successPaths = results.filter(r => r.success).map(r => r.path);
|
|
300
|
+
const errors = results.filter(r => !r.success).map(r => r.error);
|
|
301
|
+
|
|
302
|
+
const finalMessage = anySuccess
|
|
306
303
|
? `Successfully installed ${this.clientName} client. Updated settings in: ${successPaths.join(', ')}`
|
|
307
|
-
: `Failed to install ${this.clientName} client. Errors: ${errors.join('; ')}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
304
|
+
: `Failed to install ${this.clientName} client. Errors: ${errors.join('; ')}`;
|
|
305
|
+
|
|
306
|
+
return {
|
|
307
|
+
status: anySuccess ? 'completed' : 'failed',
|
|
308
|
+
type: 'install',
|
|
309
|
+
target: 'server',
|
|
310
|
+
message: finalMessage,
|
|
311
|
+
operationId,
|
|
312
|
+
error: anySuccess ? undefined : errors.join('; ')
|
|
313
|
+
};
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
stepName: RecordingConstants.STEP_INSTALLATION,
|
|
317
|
+
onResult: (result) => result?.status !== 'failed',
|
|
318
|
+
endMessage: (result) => (result as OperationStatus)?.message,
|
|
319
|
+
onError: (error) => {
|
|
320
|
+
const errorMsg = `Unexpected error installing ${this.clientName} client: ${error instanceof Error ? error.message : String(error)}`;
|
|
321
|
+
return {
|
|
322
|
+
result: {
|
|
323
|
+
status: 'failed',
|
|
324
|
+
type: 'install',
|
|
325
|
+
target: 'server',
|
|
326
|
+
message: errorMsg,
|
|
327
|
+
operationId,
|
|
328
|
+
error: error instanceof Error ? error.message : String(error)
|
|
329
|
+
}, message: errorMsg
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
|
|
321
335
|
}
|
|
322
336
|
|
|
323
337
|
/**
|