imcp 0.1.7 → 0.1.8-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/install.js +1 -106
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/list.js +1 -90
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/pull.js +1 -16
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/commands/serve.js +1 -33
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/uninstall.js +1 -46
- package/dist/cli/commands/uninstall.js.map +1 -0
- package/dist/cli/index.js +1 -65
- package/dist/cli/index.js.map +1 -0
- package/dist/core/installers/clients/BaseClientInstaller.js +1 -282
- package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstaller.js +1 -163
- package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstallerFactory.js +1 -36
- package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
- package/dist/core/installers/clients/ClineInstaller.js +1 -30
- package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
- package/dist/core/installers/clients/ExtensionInstaller.js +1 -151
- package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
- package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -68
- package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
- package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -28
- package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
- package/dist/core/installers/index.js +1 -8
- package/dist/core/installers/index.js.map +1 -0
- package/dist/core/installers/requirements/BaseInstaller.js +1 -56
- package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
- package/dist/core/installers/requirements/CommandInstaller.js +1 -213
- package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
- package/dist/core/installers/requirements/GeneralInstaller.js +1 -126
- package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
- package/dist/core/installers/requirements/InstallerFactory.js +1 -99
- package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
- package/dist/core/installers/requirements/NpmInstaller.js +1 -235
- package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
- package/dist/core/installers/requirements/NugetInstaller.js +1 -188
- package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
- package/dist/core/installers/requirements/PipInstaller.js +1 -192
- package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
- package/dist/core/installers/requirements/RequirementInstaller.js +1 -2
- package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
- package/dist/core/loaders/ConfigurationLoader.js +1 -256
- package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
- package/dist/core/loaders/ConfigurationProvider.js +1 -383
- package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
- package/dist/core/loaders/InstallOperationManager.js +1 -310
- package/dist/core/loaders/InstallOperationManager.js.map +1 -0
- package/dist/core/loaders/ServerSchemaLoader.js +1 -108
- package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
- package/dist/core/loaders/ServerSchemaProvider.js +1 -89
- package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
- package/dist/core/loaders/SystemSettingsManager.js +1 -256
- package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
- package/dist/core/metadatas/constants.js +1 -100
- package/dist/core/metadatas/constants.js.map +1 -0
- package/dist/core/metadatas/recordingConstants.js +1 -46
- package/dist/core/metadatas/recordingConstants.js.map +1 -0
- package/dist/core/metadatas/types.js +1 -15
- package/dist/core/metadatas/types.js.map +1 -0
- package/dist/core/onboard/FeedOnboardService.js +1 -422
- package/dist/core/onboard/FeedOnboardService.js.map +1 -0
- package/dist/core/onboard/OnboardProcessor.js +1 -333
- package/dist/core/onboard/OnboardProcessor.js.map +1 -0
- package/dist/core/onboard/OnboardStatus.js +1 -9
- package/dist/core/onboard/OnboardStatus.js.map +1 -0
- package/dist/core/onboard/OnboardStatusManager.js +1 -360
- package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
- package/dist/core/validators/FeedValidator.js +1 -133
- package/dist/core/validators/FeedValidator.js.map +1 -0
- package/dist/core/validators/IServerValidator.js +1 -1
- package/dist/core/validators/IServerValidator.js.map +1 -0
- package/dist/core/validators/SSEServerValidator.js +1 -38
- package/dist/core/validators/SSEServerValidator.js.map +1 -0
- package/dist/core/validators/ServerValidatorFactory.js +1 -44
- package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
- package/dist/core/validators/StdioServerValidator.js +1 -281
- package/dist/core/validators/StdioServerValidator.js.map +1 -0
- package/dist/index.js +1 -18
- package/dist/index.js.map +1 -0
- package/dist/services/InstallationService.js +1 -81
- package/dist/services/InstallationService.js.map +1 -0
- package/dist/services/MCPManager.js +1 -197
- package/dist/services/MCPManager.js.map +1 -0
- package/dist/services/RequirementService.js +1 -548
- package/dist/services/RequirementService.js.map +1 -0
- package/dist/services/ServerService.js +1 -127
- package/dist/services/ServerService.js.map +1 -0
- package/dist/services/TelemetryService.js +1 -53
- package/dist/services/TelemetryService.js.map +1 -0
- package/dist/utils/UpdateCheckTracker.js +1 -79
- package/dist/utils/UpdateCheckTracker.js.map +1 -0
- package/dist/utils/adoUtils.js +1 -254
- package/dist/utils/adoUtils.js.map +1 -0
- package/dist/utils/clientUtils.js +1 -65
- package/dist/utils/clientUtils.js.map +1 -0
- package/dist/utils/feedUtils.js +1 -28
- package/dist/utils/feedUtils.js.map +1 -0
- package/dist/utils/githubAuth.js +1 -177
- package/dist/utils/githubAuth.js.map +1 -0
- package/dist/utils/githubUtils.js +1 -125
- package/dist/utils/githubUtils.js.map +1 -0
- package/dist/utils/logger.js +1 -176
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/macroExpressionUtils.js +1 -93
- package/dist/utils/macroExpressionUtils.js.map +1 -0
- package/dist/utils/osUtils.js +1 -664
- package/dist/utils/osUtils.js.map +1 -0
- package/dist/utils/versionUtils.js +1 -101
- package/dist/utils/versionUtils.js.map +1 -0
- package/dist/web/contract/serverContract.js +1 -1
- package/dist/web/contract/serverContract.js.map +1 -0
- package/dist/web/public/js/api.js +2 -132
- package/dist/web/public/js/api.js.map +1 -0
- package/dist/web/public/js/detailsWidget.js +2 -264
- package/dist/web/public/js/detailsWidget.js.map +1 -0
- package/dist/web/public/js/flights/flights.js +2 -127
- package/dist/web/public/js/flights/flights.js.map +1 -0
- package/dist/web/public/js/modal/index.js +2 -52
- package/dist/web/public/js/modal/index.js.map +1 -0
- package/dist/web/public/js/modal/installModal.js +2 -162
- package/dist/web/public/js/modal/installModal.js.map +1 -0
- package/dist/web/public/js/modal/installation.js +2 -266
- package/dist/web/public/js/modal/installation.js.map +1 -0
- package/dist/web/public/js/modal/loadingModal.js +2 -182
- package/dist/web/public/js/modal/loadingModal.js.map +1 -0
- package/dist/web/public/js/modal/modalSetup.js +2 -595
- package/dist/web/public/js/modal/modalSetup.js.map +1 -0
- package/dist/web/public/js/modal/modalUtils.js +2 -37
- package/dist/web/public/js/modal/modalUtils.js.map +1 -0
- package/dist/web/public/js/modal/versionUtils.js +2 -20
- package/dist/web/public/js/modal/versionUtils.js.map +1 -0
- package/dist/web/public/js/modal.js +2 -42
- package/dist/web/public/js/modal.js.map +1 -0
- package/dist/web/public/js/notifications.js +2 -137
- package/dist/web/public/js/notifications.js.map +1 -0
- package/dist/web/public/js/onboard/formProcessor.js +2 -1037
- package/dist/web/public/js/onboard/formProcessor.js.map +1 -0
- package/dist/web/public/js/onboard/index.js +2 -374
- package/dist/web/public/js/onboard/index.js.map +1 -0
- package/dist/web/public/js/onboard/publishHandler.js +2 -172
- package/dist/web/public/js/onboard/publishHandler.js.map +1 -0
- package/dist/web/public/js/onboard/state.js +2 -76
- package/dist/web/public/js/onboard/state.js.map +1 -0
- package/dist/web/public/js/onboard/templates.js +2 -342
- package/dist/web/public/js/onboard/templates.js.map +1 -0
- package/dist/web/public/js/onboard/uiHandlers.js +2 -1076
- package/dist/web/public/js/onboard/uiHandlers.js.map +1 -0
- package/dist/web/public/js/onboard/validationHandlers.js +2 -493
- package/dist/web/public/js/onboard/validationHandlers.js.map +1 -0
- package/dist/web/public/js/serverCategoryDetails.js +2 -364
- package/dist/web/public/js/serverCategoryDetails.js.map +1 -0
- package/dist/web/public/js/serverCategoryList.js +2 -241
- package/dist/web/public/js/serverCategoryList.js.map +1 -0
- package/dist/web/public/js/settings.js +2 -314
- package/dist/web/public/js/settings.js.map +1 -0
- package/dist/web/server.js +1 -404
- package/dist/web/server.js.map +1 -0
- package/package.json +8 -2
- 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/.github/workflows/build.yml +0 -28
- package/.roo/rules-code/rules.md +0 -88
- package/dist/cli/commands/start.d.ts +0 -2
- package/dist/cli/commands/start.js +0 -32
- package/dist/cli/commands/sync.d.ts +0 -2
- package/dist/cli/commands/sync.js +0 -17
- package/dist/core/ConfigurationLoader.d.ts +0 -32
- package/dist/core/ConfigurationLoader.js +0 -236
- package/dist/core/ConfigurationProvider.d.ts +0 -35
- package/dist/core/ConfigurationProvider.js +0 -375
- package/dist/core/InstallationService.d.ts +0 -50
- package/dist/core/InstallationService.js +0 -350
- package/dist/core/MCPManager.d.ts +0 -28
- package/dist/core/MCPManager.js +0 -188
- package/dist/core/RequirementService.d.ts +0 -40
- package/dist/core/RequirementService.js +0 -110
- package/dist/core/ServerSchemaLoader.d.ts +0 -11
- package/dist/core/ServerSchemaLoader.js +0 -43
- package/dist/core/ServerSchemaProvider.d.ts +0 -17
- package/dist/core/ServerSchemaProvider.js +0 -120
- package/dist/core/constants.d.ts +0 -47
- package/dist/core/constants.js +0 -94
- package/dist/core/installers/BaseInstaller.d.ts +0 -74
- package/dist/core/installers/BaseInstaller.js +0 -253
- package/dist/core/installers/ClientInstaller.d.ts +0 -23
- package/dist/core/installers/ClientInstaller.js +0 -564
- package/dist/core/installers/CommandInstaller.d.ts +0 -37
- package/dist/core/installers/CommandInstaller.js +0 -173
- package/dist/core/installers/GeneralInstaller.d.ts +0 -33
- package/dist/core/installers/GeneralInstaller.js +0 -85
- package/dist/core/installers/InstallerFactory.d.ts +0 -54
- package/dist/core/installers/InstallerFactory.js +0 -97
- package/dist/core/installers/NpmInstaller.d.ts +0 -26
- package/dist/core/installers/NpmInstaller.js +0 -127
- package/dist/core/installers/PipInstaller.d.ts +0 -28
- package/dist/core/installers/PipInstaller.js +0 -127
- package/dist/core/installers/RequirementInstaller.d.ts +0 -33
- package/dist/core/installers/RequirementInstaller.js +0 -3
- package/dist/core/types.d.ts +0 -166
- package/dist/core/types.js +0 -16
- package/dist/services/InstallRequestValidator.d.ts +0 -21
- package/dist/services/InstallRequestValidator.js +0 -99
- package/dist/web/public/js/modal/installHandler.js +0 -227
- package/dist/web/public/js/modal/loadingUI.js +0 -74
- package/dist/web/public/js/modal/messageQueue.js +0 -112
- package/dist/web/public/js/modal/modalUI.js +0 -214
- package/dist/web/public/js/modal/version.js +0 -20
- package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +0 -370
- 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/CommandInstaller.ts +0 -231
- package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
- package/src/core/installers/requirements/InstallerFactory.ts +0 -114
- 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/installers/requirements/RequirementInstaller.ts +0 -42
- package/src/core/loaders/ConfigurationLoader.ts +0 -298
- package/src/core/loaders/ConfigurationProvider.ts +0 -462
- 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/versionUtils.js +0 -20
- 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
- package/wiki/Installation.md +0 -3
- package/wiki/Publish.md +0 -3
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
import { allServerCategoriesData, fetchServerCategories } from './api.js';
|
|
2
|
-
import { showInstallModal } from './modal.js';
|
|
3
|
-
import { showToast, showConfirm } from './notifications.js';
|
|
4
|
-
import { DetailsWidget } from './detailsWidget.js';
|
|
5
|
-
|
|
6
|
-
const REFRESH_INTERVAL = 2000; // 2 seconds
|
|
7
|
-
let refreshTimer = null;
|
|
8
|
-
let activeDetailsWidget = null;
|
|
9
|
-
const MAX_RETRIES = 3;
|
|
10
|
-
const RETRY_DELAY = 1000;
|
|
11
|
-
|
|
12
|
-
// Start refresh timer for installation status
|
|
13
|
-
function startRefreshTimer(serverName) {
|
|
14
|
-
if (refreshTimer) {
|
|
15
|
-
clearInterval(refreshTimer);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
refreshTimer = setInterval(async () => {
|
|
19
|
-
try {
|
|
20
|
-
const server = allServerCategoriesData.find(s => s.name === serverName);
|
|
21
|
-
if (!server?.installationStatus?.serversStatus) return;
|
|
22
|
-
|
|
23
|
-
const hasPendingInstallation = Object.values(server.installationStatus.serversStatus).some(serverStatus =>
|
|
24
|
-
Object.values(serverStatus.installedStatus || {}).some(status =>
|
|
25
|
-
status.status === 'pending' || status.status === 'in-progress'
|
|
26
|
-
)
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
if (hasPendingInstallation) {
|
|
30
|
-
await fetchServerCategories();
|
|
31
|
-
await showServerDetails(serverName);
|
|
32
|
-
} else {
|
|
33
|
-
clearInterval(refreshTimer);
|
|
34
|
-
}
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error('Error in refresh timer:', error);
|
|
37
|
-
clearInterval(refreshTimer);
|
|
38
|
-
}
|
|
39
|
-
}, REFRESH_INTERVAL);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Show server details with retry mechanism
|
|
43
|
-
async function showServerDetails(serverName, retryCount = 0) {
|
|
44
|
-
console.log("Showing details for:", serverName);
|
|
45
|
-
try {
|
|
46
|
-
localStorage.setItem('lastSelectedCategory', serverName);
|
|
47
|
-
|
|
48
|
-
// If server data is not available, attempt to fetch it
|
|
49
|
-
if (allServerCategoriesData.length === 0) {
|
|
50
|
-
await fetchServerCategories();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const server = allServerCategoriesData.find(s => s.name === serverName);
|
|
54
|
-
const detailsDiv = document.getElementById('serverCategoryDetails');
|
|
55
|
-
|
|
56
|
-
if (!server) {
|
|
57
|
-
if (retryCount < MAX_RETRIES) {
|
|
58
|
-
console.log(`Server data not found, retrying (${retryCount + 1}/${MAX_RETRIES})...`);
|
|
59
|
-
await new Promise(resolve => setTimeout(resolve, RETRY_DELAY));
|
|
60
|
-
await fetchServerCategories(); // Refresh the data
|
|
61
|
-
return showServerDetails(serverName, retryCount + 1);
|
|
62
|
-
}
|
|
63
|
-
throw new Error('Server data not found after retries');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let pullRequestHtml = '';
|
|
67
|
-
if (server.feedConfiguration?.PullRequest) {
|
|
68
|
-
pullRequestHtml = `
|
|
69
|
-
<p class="mb-1 text-sm">
|
|
70
|
-
<span class="font-semibold">Pull Request:</span>
|
|
71
|
-
<a href="${server.feedConfiguration.PullRequest}" target="_blank" class="text-blue-600 hover:underline">${server.feedConfiguration.PullRequest}</a>
|
|
72
|
-
</p>`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
detailsDiv.innerHTML = `
|
|
76
|
-
<h3 class="text-xl font-semibold mb-2 text-gray-800">${server.displayName || server.name}</h3>
|
|
77
|
-
<p class="mb-1"><span class="font-semibold">Description:</span> ${server.description || 'N/A'}</p>
|
|
78
|
-
${pullRequestHtml}
|
|
79
|
-
<div id="toolMcpsList" class="mt-4">
|
|
80
|
-
<div class="animate-pulse flex space-x-4">
|
|
81
|
-
<div class="flex-1 space-y-4 py-1">
|
|
82
|
-
<div class="h-4 bg-gray-200 rounded w-3/4"></div>
|
|
83
|
-
<div class="space-y-2">
|
|
84
|
-
<div class="h-4 bg-gray-200 rounded"></div>
|
|
85
|
-
<div class="h-4 bg-gray-200 rounded w-5/6"></div>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
`;
|
|
91
|
-
|
|
92
|
-
const serversListHtml = await renderServersList(server);
|
|
93
|
-
const toolMcpsList = document.getElementById('toolMcpsList');
|
|
94
|
-
if (!toolMcpsList) {
|
|
95
|
-
throw new Error('toolMcpsList element not found');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
toolMcpsList.innerHTML = serversListHtml;
|
|
99
|
-
|
|
100
|
-
// Setup server items click handlers
|
|
101
|
-
const serverItems = document.querySelectorAll('.server-item-content');
|
|
102
|
-
console.log(`Found ${serverItems.length} server items`);
|
|
103
|
-
|
|
104
|
-
serverItems.forEach(item => {
|
|
105
|
-
const mcpServerName = item.dataset.serverName;
|
|
106
|
-
console.log(`Setting up click handler for server: ${mcpServerName}`);
|
|
107
|
-
|
|
108
|
-
const mcpServer = server.feedConfiguration?.mcpServers?.find(
|
|
109
|
-
s => s.name === mcpServerName
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
if (mcpServer) {
|
|
113
|
-
const detailsWidget = new DetailsWidget(item);
|
|
114
|
-
|
|
115
|
-
// Initially set description
|
|
116
|
-
detailsWidget.setContent(mcpServer.description);
|
|
117
|
-
|
|
118
|
-
// Fetch and display schema when expanded
|
|
119
|
-
const fetchSchema = async () => {
|
|
120
|
-
try {
|
|
121
|
-
const response = await fetch(`/api/categories/${server.name}/servers/${mcpServerName}/schema`);
|
|
122
|
-
if (!response.ok) return;
|
|
123
|
-
|
|
124
|
-
const result = await response.json();
|
|
125
|
-
if (result.success && result.data) {
|
|
126
|
-
detailsWidget.setContent(result.data);
|
|
127
|
-
}
|
|
128
|
-
} catch (error) {
|
|
129
|
-
console.error('Error fetching schema:', error);
|
|
130
|
-
// Silently fail - don't show error in UI
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
item.addEventListener('click', async (event) => {
|
|
135
|
-
if (!event.target.closest('button')) {
|
|
136
|
-
if (detailsWidget === activeDetailsWidget) {
|
|
137
|
-
// Only toggle if clicking the currently active item
|
|
138
|
-
detailsWidget.toggle();
|
|
139
|
-
if (!detailsWidget.isVisible()) {
|
|
140
|
-
activeDetailsWidget = null;
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
// Expand the clicked item without collapsing others
|
|
144
|
-
detailsWidget.expand();
|
|
145
|
-
activeDetailsWidget = detailsWidget;
|
|
146
|
-
await fetchSchema();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
startRefreshTimer(serverName);
|
|
154
|
-
} catch (error) {
|
|
155
|
-
console.error('Error in showServerDetails:', error);
|
|
156
|
-
const detailsDiv = document.getElementById('serverCategoryDetails');
|
|
157
|
-
if (detailsDiv) {
|
|
158
|
-
detailsDiv.innerHTML = `<p class="text-red-500">Error loading server details: ${error.message}</p>`;
|
|
159
|
-
}
|
|
160
|
-
showToast(`Error loading server details: ${error.message}`, 'error');
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Checks if any defined requirement for an MCP server has a pending update.
|
|
166
|
-
* An update is pending if a requirement has an `availableUpdate` or if its installed version
|
|
167
|
-
* differs from the version defined in the feed.
|
|
168
|
-
* @param {object} mcpServer - The MCP server configuration object from the feed.
|
|
169
|
-
* @param {object} requirementsStatus - The status of requirements for this server, typically from `installationStatus.requirementsStatus`.
|
|
170
|
-
* @returns {{ needsUpdate: boolean, updateMessage: string|null }} - True and message if update is available, else false/null.
|
|
171
|
-
*/
|
|
172
|
-
function checkNeedsRequirementUpdate(mcpServer, requirementsStatus) {
|
|
173
|
-
const definedReqs = mcpServer?.dependencies?.requirements || [];
|
|
174
|
-
if (definedReqs.length === 0) {
|
|
175
|
-
return false; // No requirements defined in the feed for this server.
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const currentReqsStatus = requirementsStatus || {};
|
|
179
|
-
|
|
180
|
-
for (const defReq of definedReqs) {
|
|
181
|
-
const alias = defReq.alias || defReq.name;
|
|
182
|
-
if (!alias) continue;
|
|
183
|
-
|
|
184
|
-
const statusEntry = currentReqsStatus[alias];
|
|
185
|
-
|
|
186
|
-
if (statusEntry) {
|
|
187
|
-
// Check 1: Explicit 'availableUpdate' information
|
|
188
|
-
if (statusEntry.availableUpdate && statusEntry.availableUpdate.version) {
|
|
189
|
-
return {needsUpdate: true, updateMessage: `${statusEntry.name}: ${statusEntry.availableUpdate.message}` || null};
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return { needsUpdate: false, updateMessage: null };
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
async function renderServersList(serverCategory) {
|
|
197
|
-
try {
|
|
198
|
-
const targetResponse = await fetch('/api/targets');
|
|
199
|
-
const targetData = await targetResponse.json();
|
|
200
|
-
const availableTargets = targetData.success ? targetData.data : [];
|
|
201
|
-
|
|
202
|
-
if (!serverCategory.feedConfiguration?.mcpServers) {
|
|
203
|
-
return '<p class="text-gray-500">No MCP Servers found for this server.</p>';
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
const mcpServers = serverCategory.feedConfiguration.mcpServers;
|
|
207
|
-
if (mcpServers.length === 0) {
|
|
208
|
-
return '<p class="text-gray-500">No MCP Servers found for this server.</p>';
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
let toolsHtml = `
|
|
212
|
-
<div class="flex justify-between items-center mb-4">
|
|
213
|
-
<h2 class="text-lg font-semibold text-gray-600">MCP Servers</h2>
|
|
214
|
-
</div>`;
|
|
215
|
-
|
|
216
|
-
mcpServers.forEach(mcpServer => {
|
|
217
|
-
const isInstalled = mcpServer.installed;
|
|
218
|
-
const envRequirements = mcpServer.installation?.['env:'] || mcpServer.installation?.env || {};
|
|
219
|
-
const hasEnvRequirements = Object.keys(envRequirements).length > 0;
|
|
220
|
-
|
|
221
|
-
toolsHtml += `
|
|
222
|
-
<div class="server-item-content" data-server-name="${mcpServer.name}">
|
|
223
|
-
<div class="server-item-info" style="width: 100%; box-sizing: border-box;">
|
|
224
|
-
<div class="server-item-header">
|
|
225
|
-
<div class="flex items-center flex-wrap">
|
|
226
|
-
<h5 class="font-semibold text-gray-800 mr-2">${mcpServer.displayName || mcpServer.name}</h5>
|
|
227
|
-
${mcpServer.systemTags && Object.keys(mcpServer.systemTags).length > 0 ? `
|
|
228
|
-
<div class="flex flex-wrap gap-1 items-center">
|
|
229
|
-
${Object.entries(mcpServer.systemTags).map(([key, value]) => `<span class="text-xs bg-purple-100 text-purple-700 px-2 py-0.5 rounded-full">${key}: ${value}</span>`).join('')}
|
|
230
|
-
</div>
|
|
231
|
-
` : ''}
|
|
232
|
-
${mcpServer.repository || serverCategory.feedConfiguration?.repository ? (() => {
|
|
233
|
-
const repoUrl = mcpServer.repository || serverCategory.feedConfiguration?.repository;
|
|
234
|
-
const isGithub = repoUrl.toLowerCase().includes('github.com');
|
|
235
|
-
return `
|
|
236
|
-
<a href="${repoUrl}" target="_blank" class="ml-2 flex items-center">
|
|
237
|
-
<span class="text-xs px-2 py-1 bg-gray-100 rounded-md flex items-center text-gray-700 hover:bg-gray-200 transition-colors duration-200">
|
|
238
|
-
${isGithub ? `
|
|
239
|
-
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
240
|
-
<path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"/>
|
|
241
|
-
</svg>
|
|
242
|
-
GitHub` : `
|
|
243
|
-
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
244
|
-
<path d="M21.721 12.752a9.711 9.711 0 00-.945-5.003 1.743 1.743 0 01-1.339-1.647c0-.522.236-1.01.62-1.341a9.707 9.707 0 00-3.62-2.087 1.744 1.744 0 01-2.113-1.334A9.721 9.721 0 0012 1.016 9.721 9.721 0 009.676 1.3 1.744 1.744 0 017.562 2.634a9.707 9.707 0 00-3.62 2.087 1.744 1.744 0 00-.048 2.32 9.711 9.711 0 00-.945 5.003 9.712 9.712 0 00.945 5.003 1.744 1.744 0 01.048 2.32 9.707 9.707 0 003.62 2.087 1.744 1.744 0 012.114 1.334A9.721 9.721 0 0012 22.982a9.721 9.721 0 002.324-.284 1.744 1.744 0 012.114-1.334 9.707 9.707 0 003.62-2.087 1.744 1.744 0 01.048-2.32 9.711 9.711 0 00.945-5.003z"/>
|
|
245
|
-
</svg>
|
|
246
|
-
Website`}
|
|
247
|
-
</span>
|
|
248
|
-
</a>`
|
|
249
|
-
})() : ''}
|
|
250
|
-
</div>
|
|
251
|
-
<p class="text-sm text-gray-600 mb-1 mt-1">${mcpServer.description || 'No description'}</p>
|
|
252
|
-
</div>
|
|
253
|
-
<div class="flex flex-col mt-3">
|
|
254
|
-
<span class="text-xs font-semibold mb-2">Client Status:</span>
|
|
255
|
-
<div class="flex flex-wrap gap-2">
|
|
256
|
-
${availableTargets.map(client => {
|
|
257
|
-
const status = (serverCategory.installationStatus?.serversStatus[mcpServer.name]?.installedStatus || {})[client];
|
|
258
|
-
const isInstalled = status?.status === 'completed';
|
|
259
|
-
return `
|
|
260
|
-
<span class="text-xs flex items-center ${isInstalled ? 'text-green-600 bg-green-50' : 'text-gray-600 bg-gray-50'} px-3 py-1 rounded-full shadow">
|
|
261
|
-
<svg class="w-3 h-3 mr-1" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
262
|
-
${isInstalled
|
|
263
|
-
? '<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"></path>'
|
|
264
|
-
: '<path d="M7 3.5A1.5 1.5 0 018.5 2h3.879a1.5 1.5 0 011.06.44l3.122 3.12A1.5 1.5 0 0117 6.622V12.5a1.5 1.5 0 01-1.5 1.5h-1v-3.379a1.5 1.5 0 00-.44-1.06L10.94 6.44A1.5 1.5 0 009.879 6H7V3.5z M6 6h2.879A1.5 1.5 0 0110 7.5v1.379a1.5 1.5 0 01-.44 1.06L6.44 13.06A1.5 1.5 0 015.379 13H4.5A1.5 1.5 0 013 11.5V7.5A1.5 1.5 0 014.5 6H6z"></path>'
|
|
265
|
-
}
|
|
266
|
-
</svg>
|
|
267
|
-
${client}
|
|
268
|
-
</span>
|
|
269
|
-
`;
|
|
270
|
-
}).join('')}
|
|
271
|
-
</div>
|
|
272
|
-
</div>
|
|
273
|
-
<div class="action-buttons">
|
|
274
|
-
${(() => {
|
|
275
|
-
const serverInstallationStatus = serverCategory.installationStatus;
|
|
276
|
-
const requirementsStatus = serverInstallationStatus?.requirementsStatus;
|
|
277
|
-
// dependencies is a simple array of names
|
|
278
|
-
const { needsUpdate, updateMessage } = checkNeedsRequirementUpdate(mcpServer, requirementsStatus);
|
|
279
|
-
|
|
280
|
-
if (isInstalled) {
|
|
281
|
-
return `
|
|
282
|
-
<button onclick="event.stopPropagation(); window.uninstallTools('${serverCategory.name}', ['${mcpServer.name}'])"
|
|
283
|
-
class="bg-red-500 hover:bg-red-700 text-white text-sm font-bold py-2 px-4 rounded-full shadow-sm ease-in-out">
|
|
284
|
-
Uninstall
|
|
285
|
-
</button>`;
|
|
286
|
-
} else {
|
|
287
|
-
let buttonText = 'Setup';
|
|
288
|
-
let titleAttr = '';
|
|
289
|
-
if (needsUpdate) {
|
|
290
|
-
buttonText = 'Update';
|
|
291
|
-
if (updateMessage) {
|
|
292
|
-
titleAttr = ` title="${updateMessage.replace(/"/g, '"')}"`;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return `
|
|
296
|
-
<button onclick="event.stopPropagation(); window.showInstallModal('${serverCategory.name}', '${mcpServer.name}')"
|
|
297
|
-
class="${needsUpdate ? 'btn-update' : 'bg-blue-500 hover:bg-blue-700'} text-white text-xs font-bold py-2 px-4 rounded-full shadow-sm ease-in-out"${titleAttr}>
|
|
298
|
-
${buttonText}
|
|
299
|
-
</button>`;
|
|
300
|
-
}
|
|
301
|
-
})()}
|
|
302
|
-
</div>
|
|
303
|
-
${hasEnvRequirements ? `<div class="mt-3 text-xs text-blue-600">
|
|
304
|
-
<svg class="w-3 h-3 inline mr-1" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
305
|
-
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path>
|
|
306
|
-
</svg>
|
|
307
|
-
Requires environment configuration
|
|
308
|
-
</div>` : ''}
|
|
309
|
-
</div>
|
|
310
|
-
</div>
|
|
311
|
-
`;
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
return toolsHtml;
|
|
315
|
-
} catch (error) {
|
|
316
|
-
console.error('Error in renderServersList:', error);
|
|
317
|
-
throw error;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
window.uninstallTools = async function (serverName, toolList) {
|
|
322
|
-
try {
|
|
323
|
-
const confirmed = await showConfirm(`Are you sure you want to uninstall ${toolList.length} tool(s)?`);
|
|
324
|
-
if (!confirmed) return;
|
|
325
|
-
|
|
326
|
-
const response = await fetch(`/api/categories/${serverName}/uninstall`, {
|
|
327
|
-
method: 'POST',
|
|
328
|
-
headers: { 'Content-Type': 'application/json' },
|
|
329
|
-
body: JSON.stringify({ toolList })
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
if (!response.ok) {
|
|
333
|
-
const errorData = await response.text();
|
|
334
|
-
throw new Error(`Uninstallation failed: ${errorData || response.statusText}`);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
const result = await response.json();
|
|
338
|
-
if (!result.success) {
|
|
339
|
-
throw new Error(result.error || 'Uninstallation failed');
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
showToast('Tools uninstalled successfully!', 'success');
|
|
343
|
-
await fetchServerCategories();
|
|
344
|
-
await showServerDetails(serverName);
|
|
345
|
-
} catch (error) {
|
|
346
|
-
console.error('Error uninstalling tools:', error);
|
|
347
|
-
showToast(`Error uninstalling tools: ${error.message}`, 'error');
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
window.showServerDetails = async function (serverName) {
|
|
352
|
-
try {
|
|
353
|
-
await showServerDetails(serverName);
|
|
354
|
-
} catch (error) {
|
|
355
|
-
console.error('Error in window.showServerDetails:', error);
|
|
356
|
-
const detailsDiv = document.getElementById('serverCategoryDetails');
|
|
357
|
-
if (detailsDiv) {
|
|
358
|
-
detailsDiv.innerHTML = `<p class="text-red-500">Error loading server details: ${error.message}</p>`;
|
|
359
|
-
}
|
|
360
|
-
showToast(`Error loading server details: ${error.message}`, 'error');
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
export { showServerDetails };
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { allServerCategoriesData, fetchServerCategories } from './api.js';
|
|
2
|
-
import { showServerDetails } from './serverCategoryDetails.js'; // Still needed for initial load and direct calls
|
|
3
|
-
import { showToast } from './notifications.js';
|
|
4
|
-
import { buildUrlWithFlights } from './flights/flights.js';
|
|
5
|
-
|
|
6
|
-
// Store state for categories
|
|
7
|
-
let pinnedCategories = {};
|
|
8
|
-
|
|
9
|
-
// Wait for data to be loaded
|
|
10
|
-
async function waitForData() {
|
|
11
|
-
if (allServerCategoriesData && allServerCategoriesData.length > 0) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
await fetchServerCategories();
|
|
15
|
-
return allServerCategoriesData && allServerCategoriesData.length > 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Load pinned state from localStorage
|
|
19
|
-
function loadPinnedState() {
|
|
20
|
-
const saved = localStorage.getItem('pinnedCategories');
|
|
21
|
-
if (saved) {
|
|
22
|
-
try {
|
|
23
|
-
pinnedCategories = JSON.parse(saved);
|
|
24
|
-
} catch (e) {
|
|
25
|
-
console.error('Error parsing pinned categories from localStorage:', e);
|
|
26
|
-
pinnedCategories = {};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Save pinned state to localStorage
|
|
32
|
-
function savePinnedState() {
|
|
33
|
-
localStorage.setItem('pinnedCategories', JSON.stringify(pinnedCategories));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Toggle pin status for a category
|
|
37
|
-
function togglePinCategory(categoryName, event) {
|
|
38
|
-
// Stop propagation to prevent navigation
|
|
39
|
-
event.stopPropagation();
|
|
40
|
-
|
|
41
|
-
// Toggle pin status
|
|
42
|
-
if (pinnedCategories[categoryName]) {
|
|
43
|
-
delete pinnedCategories[categoryName];
|
|
44
|
-
} else {
|
|
45
|
-
pinnedCategories[categoryName] = true;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Save to localStorage
|
|
49
|
-
savePinnedState();
|
|
50
|
-
|
|
51
|
-
// Find the server item element and add a temporary animation class
|
|
52
|
-
const serverItem = event.target.closest('.server-item');
|
|
53
|
-
if (serverItem) {
|
|
54
|
-
serverItem.classList.add('pin-animation');
|
|
55
|
-
setTimeout(() => {
|
|
56
|
-
serverItem.classList.remove('pin-animation');
|
|
57
|
-
}, 300); // Animation duration
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Re-render list with updated pin status
|
|
61
|
-
if (allServerCategoriesData && allServerCategoriesData.length > 0) {
|
|
62
|
-
renderServerCategoryList(allServerCategoriesData);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Function to show the last selected category on page load
|
|
67
|
-
async function loadLastSelectedCategory() {
|
|
68
|
-
const lastSelected = localStorage.getItem('lastSelectedCategory');
|
|
69
|
-
if (lastSelected && allServerCategoriesData) {
|
|
70
|
-
// Check if the category still exists
|
|
71
|
-
const categoryExists = allServerCategoriesData.some(server => server.name === lastSelected);
|
|
72
|
-
if (categoryExists) {
|
|
73
|
-
await showServerDetails(lastSelected);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Function to render server list (used by fetchServerCategories and search)
|
|
79
|
-
function renderServerCategoryList(servers) {
|
|
80
|
-
const serverCategoryList = document.getElementById('serverCategoryList');
|
|
81
|
-
|
|
82
|
-
if (servers.length === 0) {
|
|
83
|
-
serverCategoryList.innerHTML = '<p class="text-gray-500">No servers found matching search.</p>';
|
|
84
|
-
document.getElementById('serverCategoryDetails').innerHTML = '<p>Select a server from the list to see details.</p>'; // Clear details
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Load pinned state
|
|
89
|
-
loadPinnedState();
|
|
90
|
-
|
|
91
|
-
// Create a copy of the servers array to avoid modifying the original
|
|
92
|
-
const sortedServers = [...servers];
|
|
93
|
-
|
|
94
|
-
// Sort servers with pinned ones at the top
|
|
95
|
-
sortedServers.sort((a, b) => {
|
|
96
|
-
const isPinnedA = pinnedCategories[a.name] === true;
|
|
97
|
-
const isPinnedB = pinnedCategories[b.name] === true;
|
|
98
|
-
|
|
99
|
-
if (isPinnedA && !isPinnedB) return -1;
|
|
100
|
-
if (!isPinnedA && isPinnedB) return 1;
|
|
101
|
-
return 0; // Keep original order for items with same pin status
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
serverCategoryList.innerHTML = sortedServers.map(server => {
|
|
105
|
-
let statusHtml = '';
|
|
106
|
-
|
|
107
|
-
// Add tool status summary if available
|
|
108
|
-
if (server.installationStatus && server.installationStatus.serversStatus) {
|
|
109
|
-
const totalTools = Object.keys(server.installationStatus.serversStatus).length;
|
|
110
|
-
const installedTools = Object.values(server.installationStatus.serversStatus)
|
|
111
|
-
.filter(serverStatus =>
|
|
112
|
-
Object.values(serverStatus.installedStatus || {})
|
|
113
|
-
.some(opStatus => opStatus.status === 'completed' && opStatus.type === 'install')
|
|
114
|
-
).length;
|
|
115
|
-
|
|
116
|
-
if (totalTools > 0) {
|
|
117
|
-
let colorClass, icon, statusText;
|
|
118
|
-
|
|
119
|
-
if (installedTools === totalTools) {
|
|
120
|
-
// All tools installed
|
|
121
|
-
colorClass = "text-green-600 bg-green-50";
|
|
122
|
-
icon = '<svg class="w-5 h-5 mr-1" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg>';
|
|
123
|
-
statusText = "Fully Configured";
|
|
124
|
-
} else if (installedTools > 0) {
|
|
125
|
-
// Some tools installed
|
|
126
|
-
colorClass = "text-green-600 bg-green-50";
|
|
127
|
-
icon = '<svg class="w-5 h-5 mr-1" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg>';
|
|
128
|
-
statusText = "Partial Configured";
|
|
129
|
-
} else {
|
|
130
|
-
// No tools installed
|
|
131
|
-
colorClass = "text-yellow-600 bg-orange-50";
|
|
132
|
-
icon = '<svg class="w-5 h-5 mr-1" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM10 13a1 1 0 110-2 1 1 0 010 2zm-1.75-5.75a.75.75 0 00-1.5 0v3a.75.75 0 001.5 0v-3z" clip-rule="evenodd" /></svg>';
|
|
133
|
-
statusText = "Not Configured";
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
statusHtml = `<span class="${colorClass} inline-flex items-center px-2 py-1 rounded-full text-xs" style="width: fit-content; max-width: 100%;">
|
|
137
|
-
${icon}<span class="truncate">${statusText} (${installedTools}/${totalTools})</span>
|
|
138
|
-
</span>`;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
let systemTagsHtml = '';
|
|
143
|
-
if (server.feedConfiguration?.systemTags && Object.keys(server.feedConfiguration.systemTags).length > 0) {
|
|
144
|
-
systemTagsHtml += '<div class="flex flex-wrap gap-1 ml-2">'; // Added ml-2 for spacing
|
|
145
|
-
for (const [key, value] of Object.entries(server.feedConfiguration.systemTags)) {
|
|
146
|
-
systemTagsHtml += `<span class="text-xs bg-blue-100 text-blue-700 px-2 py-0.5 rounded-full">${key}: ${value}</span>`;
|
|
147
|
-
}
|
|
148
|
-
systemTagsHtml += '</div>';
|
|
149
|
-
}
|
|
150
|
-
// Check if this server is pinned
|
|
151
|
-
const isPinned = pinnedCategories[server.name] === true;
|
|
152
|
-
const pinnedClass = isPinned ? 'pinned' : '';
|
|
153
|
-
|
|
154
|
-
// Pin/unpin button with appropriate icon
|
|
155
|
-
const pinIcon = isPinned
|
|
156
|
-
? '<i class="bx bxs-pin"></i>' // Solid pin icon for pinned items
|
|
157
|
-
: '<i class="bx bx-pin"></i>'; // Outline pin icon for unpinned items
|
|
158
|
-
|
|
159
|
-
return `
|
|
160
|
-
<div class="server-item border border-gray-200 p-3 rounded hover:bg-gray-50 cursor-pointer transition duration-150 ease-in-out ${pinnedClass}"
|
|
161
|
-
data-server-name="${server.name}" onclick="navigateToCategory('${server.name}')">
|
|
162
|
-
<div class="flex justify-between items-center">
|
|
163
|
-
<h3 class="font-semibold text-gray-800">${server.displayName || server.name}</h3>
|
|
164
|
-
<div class="flex items-center">
|
|
165
|
-
<div class="pin-button ${pinnedClass}" onclick="togglePinCategoryItem('${server.name}', event)" title="${isPinned ? 'Unpin' : 'Pin'} this category">
|
|
166
|
-
${pinIcon}
|
|
167
|
-
</div>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
<div class="text-sm text-gray-500 flex items-center mt-1">
|
|
171
|
-
${statusHtml}
|
|
172
|
-
${systemTagsHtml}
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
`;
|
|
176
|
-
}).join('');
|
|
177
|
-
|
|
178
|
-
// After rendering, try to load the last selected category
|
|
179
|
-
loadLastSelectedCategory();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Setup search functionality
|
|
183
|
-
function setupSearch() {
|
|
184
|
-
const searchBox = document.getElementById('searchBox');
|
|
185
|
-
|
|
186
|
-
// Load pinned state on page load
|
|
187
|
-
loadPinnedState();
|
|
188
|
-
|
|
189
|
-
searchBox.addEventListener('input', async function () {
|
|
190
|
-
const searchTerm = this.value.toLowerCase();
|
|
191
|
-
|
|
192
|
-
try {
|
|
193
|
-
// Ensure data is loaded
|
|
194
|
-
if (!(await waitForData())) {
|
|
195
|
-
showToast('Error: Unable to load server data', 'error');
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Filter the servers list based on search
|
|
200
|
-
const filteredServers = allServerCategoriesData.filter(server => {
|
|
201
|
-
// Check category name/display name
|
|
202
|
-
const categoryMatch = (server.displayName || server.name).toLowerCase().includes(searchTerm);
|
|
203
|
-
|
|
204
|
-
// Check description
|
|
205
|
-
const descriptionMatch = (server.description || '').toLowerCase().includes(searchTerm);
|
|
206
|
-
|
|
207
|
-
// Check MCP server names from feedConfiguration
|
|
208
|
-
const mcpServerMatch = server.feedConfiguration?.mcpServers?.some(mcpServer =>
|
|
209
|
-
(mcpServer.displayName || mcpServer.name).toLowerCase().includes(searchTerm)
|
|
210
|
-
) || false;
|
|
211
|
-
|
|
212
|
-
// Check installed server names from installationStatus
|
|
213
|
-
const installedServerMatch = server.installationStatus?.serversStatus &&
|
|
214
|
-
Object.keys(server.installationStatus.serversStatus)
|
|
215
|
-
.some(serverName => serverName.toLowerCase().includes(searchTerm));
|
|
216
|
-
|
|
217
|
-
return categoryMatch || descriptionMatch || mcpServerMatch || installedServerMatch;
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
renderServerCategoryList(filteredServers);
|
|
221
|
-
} catch (error) {
|
|
222
|
-
console.error('Error in search:', error);
|
|
223
|
-
showToast('Error performing search', 'error');
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function navigateToCategory(categoryName) {
|
|
229
|
-
// This function will now handle the navigation, ensuring flight params are preserved.
|
|
230
|
-
// It constructs the new URL with the selected category and existing flight params.
|
|
231
|
-
window.location.href = buildUrlWithFlights('index.html', { category: categoryName });
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// Make navigateToCategory globally accessible if it's directly used in HTML onclick
|
|
235
|
-
// Alternatively, attach event listeners dynamically after rendering the list.
|
|
236
|
-
// For simplicity with current structure, we'll make it global.
|
|
237
|
-
window.navigateToCategory = navigateToCategory;
|
|
238
|
-
window.togglePinCategoryItem = togglePinCategory;
|
|
239
|
-
|
|
240
|
-
// Export functions
|
|
241
|
-
export { renderServerCategoryList, setupSearch, loadLastSelectedCategory, togglePinCategory };
|