imcp 0.1.4 → 0.1.5
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/README.md +21 -4
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/start.d.ts +2 -0
- package/dist/cli/commands/start.js +32 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +2 -0
- package/dist/cli/commands/sync.js +17 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/commands/uninstall.js.map +1 -0
- package/dist/cli/index.js +0 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/ConfigurationLoader.d.ts +32 -0
- package/{src/core/loaders/ConfigurationLoader.ts → dist/core/ConfigurationLoader.js} +236 -298
- package/dist/core/ConfigurationLoader.js.map +1 -0
- package/dist/core/ConfigurationProvider.d.ts +35 -0
- package/{src/core/loaders/ConfigurationProvider.ts → dist/core/ConfigurationProvider.js} +375 -462
- package/dist/core/ConfigurationProvider.js.map +1 -0
- package/dist/core/InstallationService.d.ts +50 -0
- package/dist/core/InstallationService.js +350 -0
- package/dist/core/InstallationService.js.map +1 -0
- package/dist/core/MCPManager.d.ts +28 -0
- package/dist/core/MCPManager.js +188 -0
- package/dist/core/MCPManager.js.map +1 -0
- package/dist/core/RequirementService.d.ts +40 -0
- package/dist/core/RequirementService.js +110 -0
- package/dist/core/RequirementService.js.map +1 -0
- package/dist/core/ServerSchemaLoader.d.ts +11 -0
- package/dist/core/ServerSchemaLoader.js +43 -0
- package/dist/core/ServerSchemaLoader.js.map +1 -0
- package/dist/core/ServerSchemaProvider.d.ts +17 -0
- package/dist/core/ServerSchemaProvider.js +120 -0
- package/dist/core/ServerSchemaProvider.js.map +1 -0
- package/dist/core/constants.d.ts +47 -0
- package/dist/core/constants.js +94 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/installers/BaseInstaller.d.ts +74 -0
- package/dist/core/installers/BaseInstaller.js +253 -0
- package/dist/core/installers/BaseInstaller.js.map +1 -0
- package/dist/core/installers/ClientInstaller.d.ts +23 -0
- package/dist/core/installers/ClientInstaller.js +564 -0
- package/dist/core/installers/ClientInstaller.js.map +1 -0
- package/dist/core/installers/CommandInstaller.d.ts +37 -0
- package/{src/core/installers/requirements/CommandInstaller.ts → dist/core/installers/CommandInstaller.js} +173 -231
- package/dist/core/installers/CommandInstaller.js.map +1 -0
- package/dist/core/installers/GeneralInstaller.d.ts +33 -0
- package/dist/core/installers/GeneralInstaller.js +85 -0
- package/dist/core/installers/GeneralInstaller.js.map +1 -0
- package/dist/core/installers/InstallerFactory.d.ts +54 -0
- package/{src/core/installers/requirements/InstallerFactory.ts → dist/core/installers/InstallerFactory.js} +97 -114
- package/dist/core/installers/InstallerFactory.js.map +1 -0
- package/dist/core/installers/NpmInstaller.d.ts +26 -0
- package/dist/core/installers/NpmInstaller.js +127 -0
- package/dist/core/installers/NpmInstaller.js.map +1 -0
- package/dist/core/installers/PipInstaller.d.ts +28 -0
- package/dist/core/installers/PipInstaller.js +127 -0
- package/dist/core/installers/PipInstaller.js.map +1 -0
- package/{src/core/installers/requirements/RequirementInstaller.ts → dist/core/installers/RequirementInstaller.d.ts} +33 -42
- package/dist/core/installers/RequirementInstaller.js +3 -0
- package/dist/core/installers/RequirementInstaller.js.map +1 -0
- package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
- package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
- package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
- package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
- package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
- package/dist/core/installers/index.js.map +1 -0
- package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
- package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
- package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
- package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
- package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
- package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
- package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
- package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
- package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
- package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
- package/dist/core/loaders/InstallOperationManager.js.map +1 -0
- package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
- package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
- package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
- package/dist/core/metadatas/constants.js.map +1 -0
- package/dist/core/metadatas/recordingConstants.js.map +1 -0
- package/dist/core/metadatas/types.js.map +1 -0
- package/dist/core/onboard/FeedOnboardService.js.map +1 -0
- package/dist/core/onboard/OnboardProcessor.js.map +1 -0
- package/dist/core/onboard/OnboardStatus.js.map +1 -0
- package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
- package/dist/core/types.d.ts +166 -0
- package/dist/core/types.js +16 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/validators/FeedValidator.js.map +1 -0
- package/dist/core/validators/IServerValidator.js.map +1 -0
- package/dist/core/validators/SSEServerValidator.js.map +1 -0
- package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
- package/dist/core/validators/StdioServerValidator.js.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/services/InstallRequestValidator.d.ts +21 -0
- package/dist/services/InstallRequestValidator.js +99 -0
- package/dist/services/InstallRequestValidator.js.map +1 -0
- package/dist/services/InstallationService.js.map +1 -0
- package/dist/services/MCPManager.js.map +1 -0
- package/dist/services/RequirementService.js.map +1 -0
- package/dist/services/ServerService.js.map +1 -0
- package/dist/services/TelemetryService.js.map +1 -0
- package/dist/utils/UpdateCheckTracker.js.map +1 -0
- package/dist/utils/adoUtils.js.map +1 -0
- package/dist/utils/clientUtils.js.map +1 -0
- package/dist/utils/feedUtils.js.map +1 -0
- package/dist/utils/githubAuth.js.map +1 -0
- package/dist/utils/githubUtils.js.map +1 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/macroExpressionUtils.js.map +1 -0
- package/dist/utils/osUtils.js.map +1 -0
- package/dist/utils/versionUtils.js.map +1 -0
- package/dist/web/contract/serverContract.js.map +1 -0
- package/dist/web/public/index.html +1 -1
- package/dist/web/public/js/modal/installHandler.js +227 -0
- package/dist/web/public/js/modal/loadingUI.js +74 -0
- package/dist/web/public/js/modal/messageQueue.js +101 -45
- package/dist/web/public/js/modal/modalUI.js +214 -0
- package/{src/web/public/js/modal/versionUtils.js → dist/web/public/js/modal/version.js} +1 -1
- package/dist/web/public/onboard.html +4 -4
- package/dist/web/server.js.map +1 -0
- package/package.json +5 -1
- package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
- package/.github/acl/access.yml +0 -20
- package/.github/compliance/inventory.yml +0 -5
- package/.github/policies/jit.yml +0 -19
- package/.roo/rules-code/rules.md +0 -88
- package/dist/core/onboard/InstallOperationManager.d.ts +0 -23
- package/dist/core/onboard/InstallOperationManager.js +0 -144
- package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
- package/docs/Telemetry.md +0 -136
- package/memory-bank/activeContext.md +0 -26
- package/memory-bank/decisionLog.md +0 -91
- package/memory-bank/productContext.md +0 -41
- package/memory-bank/progress.md +0 -35
- package/memory-bank/systemPatterns.md +0 -10
- package/src/cli/commands/install.ts +0 -139
- package/src/cli/commands/list.ts +0 -113
- package/src/cli/commands/pull.ts +0 -16
- package/src/cli/commands/serve.ts +0 -39
- package/src/cli/commands/uninstall.ts +0 -64
- package/src/cli/index.ts +0 -82
- package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
- package/src/core/installers/clients/ClientInstaller.ts +0 -222
- package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
- package/src/core/installers/clients/ClineInstaller.ts +0 -35
- package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
- package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
- package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
- package/src/core/installers/index.ts +0 -11
- package/src/core/installers/requirements/BaseInstaller.ts +0 -85
- package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
- package/src/core/installers/requirements/NpmInstaller.ts +0 -271
- package/src/core/installers/requirements/NugetInstaller.ts +0 -203
- package/src/core/installers/requirements/PipInstaller.ts +0 -207
- package/src/core/loaders/InstallOperationManager.ts +0 -367
- package/src/core/loaders/ServerSchemaLoader.ts +0 -117
- package/src/core/loaders/ServerSchemaProvider.ts +0 -99
- package/src/core/loaders/SystemSettingsManager.ts +0 -278
- package/src/core/metadatas/constants.ts +0 -122
- package/src/core/metadatas/recordingConstants.ts +0 -65
- package/src/core/metadatas/types.ts +0 -202
- package/src/core/onboard/FeedOnboardService.ts +0 -501
- package/src/core/onboard/OnboardProcessor.ts +0 -356
- package/src/core/onboard/OnboardStatus.ts +0 -60
- package/src/core/onboard/OnboardStatusManager.ts +0 -416
- package/src/core/validators/FeedValidator.ts +0 -135
- package/src/core/validators/IServerValidator.ts +0 -21
- package/src/core/validators/SSEServerValidator.ts +0 -43
- package/src/core/validators/ServerValidatorFactory.ts +0 -51
- package/src/core/validators/StdioServerValidator.ts +0 -313
- package/src/index.ts +0 -44
- package/src/services/InstallationService.ts +0 -102
- package/src/services/MCPManager.ts +0 -249
- package/src/services/RequirementService.ts +0 -627
- package/src/services/ServerService.ts +0 -161
- package/src/services/TelemetryService.ts +0 -59
- package/src/utils/UpdateCheckTracker.ts +0 -86
- package/src/utils/adoUtils.ts +0 -293
- package/src/utils/clientUtils.ts +0 -72
- package/src/utils/feedUtils.ts +0 -31
- package/src/utils/githubAuth.ts +0 -212
- package/src/utils/githubUtils.ts +0 -164
- package/src/utils/logger.ts +0 -195
- package/src/utils/macroExpressionUtils.ts +0 -104
- package/src/utils/osUtils.ts +0 -700
- package/src/utils/versionUtils.ts +0 -114
- package/src/web/contract/serverContract.ts +0 -74
- package/src/web/public/css/detailsWidget.css +0 -235
- package/src/web/public/css/modal.css +0 -757
- package/src/web/public/css/notifications.css +0 -101
- package/src/web/public/css/onboard.css +0 -107
- package/src/web/public/css/serverCategoryList.css +0 -120
- package/src/web/public/css/serverDetails.css +0 -139
- package/src/web/public/index.html +0 -359
- package/src/web/public/js/api.js +0 -132
- package/src/web/public/js/detailsWidget.js +0 -264
- package/src/web/public/js/flights/flights.js +0 -127
- package/src/web/public/js/modal/index.js +0 -52
- package/src/web/public/js/modal/installModal.js +0 -162
- package/src/web/public/js/modal/installation.js +0 -266
- package/src/web/public/js/modal/loadingModal.js +0 -182
- package/src/web/public/js/modal/modalSetup.js +0 -595
- package/src/web/public/js/modal/modalUtils.js +0 -37
- package/src/web/public/js/modal.js +0 -42
- package/src/web/public/js/notifications.js +0 -137
- package/src/web/public/js/onboard/formProcessor.js +0 -1037
- package/src/web/public/js/onboard/index.js +0 -374
- package/src/web/public/js/onboard/publishHandler.js +0 -172
- package/src/web/public/js/onboard/state.js +0 -76
- package/src/web/public/js/onboard/templates.js +0 -342
- package/src/web/public/js/onboard/uiHandlers.js +0 -1076
- package/src/web/public/js/onboard/validationHandlers.js +0 -493
- package/src/web/public/js/serverCategoryDetails.js +0 -364
- package/src/web/public/js/serverCategoryList.js +0 -241
- package/src/web/public/js/settings.js +0 -314
- package/src/web/public/modal.html +0 -84
- package/src/web/public/onboard.html +0 -296
- package/src/web/public/settings.html +0 -135
- package/src/web/public/styles.css +0 -277
- package/src/web/server.ts +0 -478
- package/tsconfig.json +0 -18
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { ConfigurationProvider } from '../core/loaders/ConfigurationProvider.js';
|
|
3
|
-
import { ServerSchemaProvider } from '../core/loaders/ServerSchemaProvider.js';
|
|
4
|
-
import { InstallationService } from './InstallationService.js';
|
|
5
|
-
import {
|
|
6
|
-
MCPEvent,
|
|
7
|
-
MCPEventData,
|
|
8
|
-
MCPServerCategory,
|
|
9
|
-
ServerInstallOptions,
|
|
10
|
-
ServerCategoryListOptions,
|
|
11
|
-
ServerOperationResult,
|
|
12
|
-
ServerUninstallOptions,
|
|
13
|
-
InstallationStatus,
|
|
14
|
-
FeedConfiguration,
|
|
15
|
-
} from '../core/metadatas/types.js';
|
|
16
|
-
import { OnboardingProcessStatus, OperationStatus } from '../core/onboard/OnboardStatus.js';
|
|
17
|
-
import { Logger, EventType, EventStatus } from '../utils/logger.js';
|
|
18
|
-
import { FeedOnboardService } from '../core/onboard/FeedOnboardService.js';
|
|
19
|
-
import path from 'path';
|
|
20
|
-
import { Server } from 'http';
|
|
21
|
-
import { RequirementService } from './RequirementService.js';
|
|
22
|
-
|
|
23
|
-
export class MCPManager extends EventEmitter {
|
|
24
|
-
private installationService: InstallationService;
|
|
25
|
-
private configProvider: ConfigurationProvider;
|
|
26
|
-
private feedOnboardService: FeedOnboardService;
|
|
27
|
-
private schemaProvider: ServerSchemaProvider;
|
|
28
|
-
private requirementsService: RequirementService;
|
|
29
|
-
|
|
30
|
-
constructor() {
|
|
31
|
-
super();
|
|
32
|
-
this.configProvider = ConfigurationProvider.getInstance();
|
|
33
|
-
this.schemaProvider = ServerSchemaProvider.getInstance();
|
|
34
|
-
this.installationService = new InstallationService();
|
|
35
|
-
this.feedOnboardService = new FeedOnboardService();
|
|
36
|
-
this.requirementsService = RequirementService.getInstance();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async syncFeeds(): Promise<void> {
|
|
40
|
-
await this.configProvider.syncFeeds();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async initialize(feedFile?: string, schemasDirectory?: string): Promise<void> {
|
|
44
|
-
try {
|
|
45
|
-
await this.configProvider.initialize(feedFile);
|
|
46
|
-
await this.schemaProvider.initialize(schemasDirectory);
|
|
47
|
-
await this.requirementsService.checkRequirementForUpdateAsync();
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error("Error during MCPManager initialization:", error);
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async listServerCategories(options: ServerCategoryListOptions = {}): Promise<MCPServerCategory[]> {
|
|
55
|
-
const { local = true } = options;
|
|
56
|
-
if (local) {
|
|
57
|
-
return await this.configProvider.getServerCategories();
|
|
58
|
-
}
|
|
59
|
-
return [];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async getFeedConfiguration(categoryName: string) {
|
|
63
|
-
return this.configProvider.getFeedConfiguration(categoryName);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async getServerMcpConfig(categoryName: string, serverName: string) {
|
|
67
|
-
return this.configProvider.getServerMcpConfig(categoryName, serverName);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async installServer(
|
|
71
|
-
categoryName: string,
|
|
72
|
-
serverName: string,
|
|
73
|
-
requestOptions: ServerInstallOptions = {}
|
|
74
|
-
): Promise<ServerOperationResult> {
|
|
75
|
-
try {
|
|
76
|
-
const server = await this.configProvider.getServerCategory(categoryName);
|
|
77
|
-
if (!server) {
|
|
78
|
-
return {
|
|
79
|
-
success: false,
|
|
80
|
-
message: `Server category ${categoryName} is not onboarded`,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
const installResult = await this.installationService.install(categoryName, serverName, requestOptions);
|
|
84
|
-
|
|
85
|
-
// Log the event with appropriate status
|
|
86
|
-
Logger.trackEvent(EventType.SERVER_INSTALL, {
|
|
87
|
-
status: installResult.success ? EventStatus.SUCCESS : EventStatus.FAILED,
|
|
88
|
-
errorMessage: !installResult.success ? installResult.message : undefined,
|
|
89
|
-
categoryName,
|
|
90
|
-
serverName,
|
|
91
|
-
...requestOptions
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
if (!installResult.success) {
|
|
95
|
-
return installResult;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
this.emit(MCPEvent.SERVER_INSTALLED, { server });
|
|
99
|
-
return installResult;
|
|
100
|
-
|
|
101
|
-
} catch (error) {
|
|
102
|
-
const errorMessage = `Failed to install ${serverName}: ${error instanceof Error ? error.message : String(error)}`;
|
|
103
|
-
Logger.error(errorMessage, error);
|
|
104
|
-
Logger.trackEvent(EventType.SERVER_INSTALL, {
|
|
105
|
-
status: EventStatus.FAILED,
|
|
106
|
-
errorMessage,
|
|
107
|
-
categoryName,
|
|
108
|
-
serverName,
|
|
109
|
-
...requestOptions
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
success: false,
|
|
114
|
-
message: errorMessage,
|
|
115
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async uninstallServer(
|
|
121
|
-
categoryName: string,
|
|
122
|
-
serverName: string,
|
|
123
|
-
options: ServerUninstallOptions = {}
|
|
124
|
-
): Promise<ServerOperationResult> {
|
|
125
|
-
const { targets = [], removeData = false } = options;
|
|
126
|
-
|
|
127
|
-
try {
|
|
128
|
-
const serverCategory = await this.configProvider.getServerCategory(categoryName);
|
|
129
|
-
if (!serverCategory) {
|
|
130
|
-
return {
|
|
131
|
-
success: false,
|
|
132
|
-
message: `Server category ${categoryName} is not onboarded`,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Clear installation status for specified targets
|
|
137
|
-
const currentStatus: InstallationStatus = serverCategory.installationStatus || {
|
|
138
|
-
requirementsStatus: {},
|
|
139
|
-
serversStatus: {},
|
|
140
|
-
lastUpdated: new Date().toISOString()
|
|
141
|
-
};
|
|
142
|
-
const serversStatus = currentStatus.serversStatus || {};
|
|
143
|
-
const serverStatus = serversStatus[serverName] || { installedStatus: {}, name: serverName };
|
|
144
|
-
|
|
145
|
-
// Only reset installedStatus for specified targets
|
|
146
|
-
for (const target of targets) {
|
|
147
|
-
if (serverStatus.installedStatus) {
|
|
148
|
-
delete serverStatus.installedStatus[target];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (removeData) {
|
|
152
|
-
for (const target of targets) {
|
|
153
|
-
await this.configProvider.removeServerFromClientMCPSettings(serverName, target);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Update server status
|
|
158
|
-
serversStatus[serverName] = serverStatus;
|
|
159
|
-
|
|
160
|
-
// Update status keeping requirements
|
|
161
|
-
await this.configProvider.updateInstallationStatus(
|
|
162
|
-
categoryName,
|
|
163
|
-
currentStatus.requirementsStatus || {},
|
|
164
|
-
serversStatus
|
|
165
|
-
);
|
|
166
|
-
Logger.trackEvent(EventType.SERVER_UNINSTALL, {
|
|
167
|
-
status: EventStatus.SUCCESS,
|
|
168
|
-
categoryName,
|
|
169
|
-
serverName,
|
|
170
|
-
targets,
|
|
171
|
-
removeData
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
this.emit(MCPEvent.SERVER_UNINSTALLED, { serverName, targets });
|
|
175
|
-
|
|
176
|
-
return {
|
|
177
|
-
success: true,
|
|
178
|
-
message: `Successfully uninstalled ${serverName} from ${targets.join(', ')}`,
|
|
179
|
-
};
|
|
180
|
-
} catch (error) {
|
|
181
|
-
const errorMessage = `Failed to uninstall ${serverName}: ${error instanceof Error ? error.message : String(error)}`;
|
|
182
|
-
|
|
183
|
-
Logger.trackEvent(EventType.SERVER_UNINSTALL, {
|
|
184
|
-
status: EventStatus.FAILED,
|
|
185
|
-
errorMessage,
|
|
186
|
-
categoryName,
|
|
187
|
-
serverName,
|
|
188
|
-
targets: targets || [],
|
|
189
|
-
removeData: removeData || false
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
return {
|
|
193
|
-
success: false,
|
|
194
|
-
message: errorMessage,
|
|
195
|
-
error: error as Error,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Onboards a new feed configuration
|
|
202
|
-
* @param config The feed configuration to onboard
|
|
203
|
-
*/
|
|
204
|
-
async onboardFeed(config: FeedConfiguration): Promise<OperationStatus & { feedConfiguration?: FeedConfiguration }> {
|
|
205
|
-
try {
|
|
206
|
-
const result = await this.feedOnboardService.onboardFeed(config);
|
|
207
|
-
|
|
208
|
-
Logger.trackEvent(EventType.FEED_ONBOARD, {
|
|
209
|
-
status: result.status === OnboardingProcessStatus.SUCCEEDED ? EventStatus.SUCCESS : EventStatus.FAILED,
|
|
210
|
-
errorMessage: result.message,
|
|
211
|
-
feedConfig: config
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
// After successful onboarding initiation, sync feeds to get the latest changes
|
|
215
|
-
// Syncing should ideally happen after the PR is merged, but for now,
|
|
216
|
-
// syncing here makes the new (pending) category available locally if needed.
|
|
217
|
-
// Consider if syncFeeds should be conditional based on operation status or handled differently.
|
|
218
|
-
await this.syncFeeds();
|
|
219
|
-
return result;
|
|
220
|
-
} catch (error) {
|
|
221
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
222
|
-
Logger.error('Failed to onboard feed in MCPManager:', error);
|
|
223
|
-
|
|
224
|
-
Logger.trackEvent(EventType.FEED_ONBOARD, {
|
|
225
|
-
status: EventStatus.FAILED,
|
|
226
|
-
errorMessage,
|
|
227
|
-
feedName: config.name
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
throw error; // Rethrow or handle by returning a failed OperationStatus
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// Type-safe event emitter methods
|
|
235
|
-
emit<E extends MCPEvent>(event: E, data: MCPEventData[E]): boolean {
|
|
236
|
-
return super.emit(event, data);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
on<E extends MCPEvent>(event: E, listener: (data: MCPEventData[E]) => void): this {
|
|
240
|
-
return super.on(event, listener);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
off<E extends MCPEvent>(event: E, listener: (data: MCPEventData[E]) => void): this {
|
|
244
|
-
return super.off(event, listener);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// Export a singleton instance
|
|
249
|
-
export const mcpManager = new MCPManager();
|