imcp 0.1.4 → 0.1.6

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 (57) hide show
  1. package/.github/workflows/build.yml +28 -0
  2. package/README.md +21 -4
  3. package/dist/cli/commands/start.d.ts +2 -0
  4. package/dist/cli/commands/start.js +32 -0
  5. package/dist/cli/commands/sync.d.ts +2 -0
  6. package/dist/cli/commands/sync.js +17 -0
  7. package/dist/cli/index.js +0 -0
  8. package/dist/core/ConfigurationLoader.d.ts +32 -0
  9. package/dist/core/ConfigurationLoader.js +236 -0
  10. package/dist/core/ConfigurationProvider.d.ts +35 -0
  11. package/dist/core/ConfigurationProvider.js +375 -0
  12. package/dist/core/InstallationService.d.ts +50 -0
  13. package/dist/core/InstallationService.js +350 -0
  14. package/dist/core/MCPManager.d.ts +28 -0
  15. package/dist/core/MCPManager.js +188 -0
  16. package/dist/core/RequirementService.d.ts +40 -0
  17. package/dist/core/RequirementService.js +110 -0
  18. package/dist/core/ServerSchemaLoader.d.ts +11 -0
  19. package/dist/core/ServerSchemaLoader.js +43 -0
  20. package/dist/core/ServerSchemaProvider.d.ts +17 -0
  21. package/dist/core/ServerSchemaProvider.js +120 -0
  22. package/dist/core/constants.d.ts +47 -0
  23. package/dist/core/constants.js +94 -0
  24. package/dist/core/installers/BaseInstaller.d.ts +74 -0
  25. package/dist/core/installers/BaseInstaller.js +253 -0
  26. package/dist/core/installers/ClientInstaller.d.ts +23 -0
  27. package/dist/core/installers/ClientInstaller.js +564 -0
  28. package/dist/core/installers/CommandInstaller.d.ts +37 -0
  29. package/dist/core/installers/CommandInstaller.js +173 -0
  30. package/dist/core/installers/GeneralInstaller.d.ts +33 -0
  31. package/dist/core/installers/GeneralInstaller.js +85 -0
  32. package/dist/core/installers/InstallerFactory.d.ts +54 -0
  33. package/dist/core/installers/InstallerFactory.js +97 -0
  34. package/dist/core/installers/NpmInstaller.d.ts +26 -0
  35. package/dist/core/installers/NpmInstaller.js +127 -0
  36. package/dist/core/installers/PipInstaller.d.ts +28 -0
  37. package/dist/core/installers/PipInstaller.js +127 -0
  38. package/dist/core/installers/RequirementInstaller.d.ts +33 -0
  39. package/dist/core/installers/RequirementInstaller.js +3 -0
  40. package/dist/core/types.d.ts +166 -0
  41. package/dist/core/types.js +16 -0
  42. package/dist/services/InstallRequestValidator.d.ts +21 -0
  43. package/dist/services/InstallRequestValidator.js +99 -0
  44. package/dist/web/public/index.html +1 -1
  45. package/dist/web/public/js/modal/installHandler.js +227 -0
  46. package/dist/web/public/js/modal/loadingUI.js +74 -0
  47. package/dist/web/public/js/modal/messageQueue.js +101 -45
  48. package/dist/web/public/js/modal/modalUI.js +214 -0
  49. package/dist/web/public/js/modal/version.js +20 -0
  50. package/dist/web/public/onboard.html +4 -4
  51. package/package.json +1 -1
  52. package/src/web/public/index.html +1 -1
  53. package/src/web/public/onboard.html +4 -4
  54. package/wiki/Installation.md +3 -0
  55. package/wiki/Publish.md +3 -0
  56. package/dist/core/onboard/InstallOperationManager.d.ts +0 -23
  57. package/dist/core/onboard/InstallOperationManager.js +0 -144
@@ -49,11 +49,11 @@
49
49
  <div class="flex items-center justify-between mb-8">
50
50
  <h1 class="text-3xl font-bold text-gray-900 flex items-center">
51
51
  <i class='bx bx-server mr-3 text-blue-600'></i>
52
- Onboard MCP Category
52
+ Publish MCP Server
53
53
  </h1>
54
54
  <a href="index.html" class="text-gray-600 hover:text-gray-900 flex items-center">
55
55
  <i class='bx bx-arrow-back mr-2'></i>
56
- Back to Servers
56
+ Server List
57
57
  </a>
58
58
  </div>
59
59
 
@@ -62,10 +62,10 @@
62
62
  <div class="mb-6 border-b border-gray-200">
63
63
  <nav class="flex space-x-8" aria-label="Tabs">
64
64
  <button id="tab-create-category" class="py-2 px-4 text-blue-600 border-b-2 border-blue-600 font-semibold focus:outline-none" type="button">
65
- Create New Server Category
65
+ Add New Server Category
66
66
  </button>
67
67
  <button id="tab-create-server" class="py-2 px-4 text-gray-600 border-b-2 border-transparent hover:text-blue-600 hover:border-blue-600 font-semibold focus:outline-none" type="button">
68
- Create New Server in Existing Category
68
+ Add New Server in Existing Category
69
69
  </button>
70
70
  </nav>
71
71
  <!-- View Mode Toggle Switch -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imcp",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Node.js SDK for Model Context Protocol (MCP)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -47,7 +47,7 @@
47
47
  <button id="onboardButton" style="display: none;"
48
48
  class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center">
49
49
  <i class='bx bx-plus-circle mr-2'></i>
50
- Onboard
50
+ Publish Server
51
51
  </button>
52
52
  </div>
53
53
  <script>
@@ -49,11 +49,11 @@
49
49
  <div class="flex items-center justify-between mb-8">
50
50
  <h1 class="text-3xl font-bold text-gray-900 flex items-center">
51
51
  <i class='bx bx-server mr-3 text-blue-600'></i>
52
- Onboard MCP Category
52
+ Publish MCP Server
53
53
  </h1>
54
54
  <a href="index.html" class="text-gray-600 hover:text-gray-900 flex items-center">
55
55
  <i class='bx bx-arrow-back mr-2'></i>
56
- Back to Servers
56
+ Server List
57
57
  </a>
58
58
  </div>
59
59
 
@@ -62,10 +62,10 @@
62
62
  <div class="mb-6 border-b border-gray-200">
63
63
  <nav class="flex space-x-8" aria-label="Tabs">
64
64
  <button id="tab-create-category" class="py-2 px-4 text-blue-600 border-b-2 border-blue-600 font-semibold focus:outline-none" type="button">
65
- Create New Server Category
65
+ Add New Server Category
66
66
  </button>
67
67
  <button id="tab-create-server" class="py-2 px-4 text-gray-600 border-b-2 border-transparent hover:text-blue-600 hover:border-blue-600 font-semibold focus:outline-none" type="button">
68
- Create New Server in Existing Category
68
+ Add New Server in Existing Category
69
69
  </button>
70
70
  </nav>
71
71
  <!-- View Mode Toggle Switch -->
@@ -0,0 +1,3 @@
1
+ # MCP Server Installation
2
+
3
+ This document describes how to install MCP servers.
@@ -0,0 +1,3 @@
1
+ # MCP Server Publish
2
+
3
+ This document describes how to publish MCP servers.
@@ -1,23 +0,0 @@
1
- import { InstallOperationDetails } from '../metadatas/types.js';
2
- export declare class InstallOperationManager {
3
- private static instance;
4
- private installOperationStatus;
5
- private statusLock;
6
- private constructor();
7
- static getInstance(): InstallOperationManager;
8
- private withLock;
9
- private loadStatuses;
10
- private saveStatuses;
11
- private createOperationKey;
12
- recordStep(categoryName: string, serverName: string, stepName: string, isSucceeded: boolean, message?: string): Promise<InstallOperationDetails>;
13
- /**
14
- * Resets (deletes) the operation status for a given category and server.
15
- * This is useful to call before starting a new installation attempt.
16
- * @param categoryName The name of the category.
17
- * @param serverName The name of the server.
18
- */
19
- resetOperation(categoryName: string, serverName: string): Promise<void>;
20
- getDetails(categoryName: string, serverName: string): Promise<InstallOperationDetails | undefined>;
21
- getAllDetails(): Promise<Record<string, InstallOperationDetails>>;
22
- }
23
- export declare const installOperationManager: InstallOperationManager;
@@ -1,144 +0,0 @@
1
- import fs from 'fs/promises';
2
- import path from 'path';
3
- import { SETTINGS_DIR } from '../metadatas/constants.js';
4
- import { Logger } from '../../utils/logger.js';
5
- const INSTALL_STATUS_DIR = path.join(SETTINGS_DIR, 'install');
6
- const INSTALL_OPERATION_STATUS_FILE = path.join(INSTALL_STATUS_DIR, 'InstallOperationStatus.json');
7
- export class InstallOperationManager {
8
- static instance;
9
- installOperationStatus = {};
10
- statusLock = Promise.resolve();
11
- constructor() {
12
- this.loadStatuses().catch(error => Logger.error('Failed to initialize InstallOperationManager:', error));
13
- }
14
- static getInstance() {
15
- if (!InstallOperationManager.instance) {
16
- InstallOperationManager.instance = new InstallOperationManager();
17
- }
18
- return InstallOperationManager.instance;
19
- }
20
- async withLock(operation) {
21
- const current = this.statusLock;
22
- let resolve;
23
- this.statusLock = new Promise(r => resolve = r);
24
- try {
25
- await current;
26
- return await operation();
27
- }
28
- finally {
29
- resolve();
30
- }
31
- }
32
- async loadStatuses() {
33
- await this.withLock(async () => {
34
- try {
35
- await fs.mkdir(INSTALL_STATUS_DIR, { recursive: true });
36
- const data = await fs.readFile(INSTALL_OPERATION_STATUS_FILE, 'utf-8');
37
- this.installOperationStatus = JSON.parse(data);
38
- }
39
- catch (error) {
40
- if (error.code === 'ENOENT') {
41
- this.installOperationStatus = {};
42
- await this.saveStatuses(); // Create the file if it doesn't exist
43
- }
44
- else {
45
- Logger.error('Failed to load install operation statuses:', error);
46
- this.installOperationStatus = {}; // Initialize with empty statuses in case of other errors
47
- }
48
- }
49
- });
50
- }
51
- async saveStatuses() {
52
- await fs.mkdir(INSTALL_STATUS_DIR, { recursive: true });
53
- await fs.writeFile(INSTALL_OPERATION_STATUS_FILE, JSON.stringify(this.installOperationStatus, null, 2));
54
- }
55
- createOperationKey(categoryName, serverName) {
56
- return `${categoryName}-${serverName}`;
57
- }
58
- async recordStep(categoryName, serverName, stepName, isSucceeded, message) {
59
- return await this.withLock(async () => {
60
- const operationKey = this.createOperationKey(categoryName, serverName);
61
- let operationDetails = this.installOperationStatus[operationKey];
62
- const newStep = {
63
- name: stepName,
64
- isSucceeded,
65
- message,
66
- timestamp: new Date().toISOString(),
67
- };
68
- if (!operationDetails) {
69
- operationDetails = {
70
- currentStep: stepName,
71
- steps: [newStep],
72
- lastUpdated: new Date().toISOString(),
73
- error: !isSucceeded ? message : undefined,
74
- overallStatus: isSucceeded ? 'in-progress' : 'failed',
75
- };
76
- }
77
- else {
78
- operationDetails.steps.push(newStep);
79
- operationDetails.currentStep = stepName;
80
- operationDetails.lastUpdated = new Date().toISOString();
81
- if (!isSucceeded) {
82
- operationDetails.overallStatus = 'failed';
83
- if (!operationDetails.error) { // Store the first error
84
- operationDetails.error = message;
85
- }
86
- }
87
- else {
88
- // If this step succeeded, check if all previous steps also succeeded.
89
- // If a previous step failed, the overall status remains 'failed'.
90
- // If all steps are successful so far, it's 'in-progress' unless it's a known completion step.
91
- if (operationDetails.overallStatus !== 'failed') {
92
- if (stepName.toLowerCase().includes('completed') || stepName.toLowerCase().includes('succeeded')) {
93
- // Check if this is a "final" success step
94
- const isFinalSuccess = operationDetails.steps.every(s => s.isSucceeded);
95
- operationDetails.overallStatus = isFinalSuccess ? 'completed' : 'in-progress';
96
- if (isFinalSuccess)
97
- operationDetails.error = undefined; // Clear error on final success
98
- }
99
- else {
100
- operationDetails.overallStatus = 'in-progress';
101
- }
102
- }
103
- }
104
- }
105
- // Special handling for the "InstallCompleted" step or similar final step names
106
- if (stepName === 'InstallCompleted') {
107
- operationDetails.overallStatus = isSucceeded ? 'completed' : 'failed';
108
- if (isSucceeded)
109
- operationDetails.error = undefined;
110
- }
111
- this.installOperationStatus[operationKey] = operationDetails;
112
- await this.saveStatuses();
113
- return operationDetails;
114
- });
115
- }
116
- /**
117
- * Resets (deletes) the operation status for a given category and server.
118
- * This is useful to call before starting a new installation attempt.
119
- * @param categoryName The name of the category.
120
- * @param serverName The name of the server.
121
- */
122
- async resetOperation(categoryName, serverName) {
123
- await this.withLock(async () => {
124
- const operationKey = this.createOperationKey(categoryName, serverName);
125
- if (this.installOperationStatus[operationKey]) {
126
- delete this.installOperationStatus[operationKey];
127
- Logger.info(`Reset installation operation status for ${operationKey}`);
128
- await this.saveStatuses();
129
- }
130
- });
131
- }
132
- async getDetails(categoryName, serverName) {
133
- await this.loadStatuses(); // Ensure latest statuses are loaded
134
- const operationKey = this.createOperationKey(categoryName, serverName);
135
- return this.installOperationStatus[operationKey];
136
- }
137
- async getAllDetails() {
138
- await this.loadStatuses();
139
- return this.installOperationStatus;
140
- }
141
- }
142
- // Export singleton instance
143
- export const installOperationManager = InstallOperationManager.getInstance();
144
- //# sourceMappingURL=InstallOperationManager.js.map