imcp 0.0.5 → 0.0.7
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/core/ConfigurationLoader.js +1 -1
- package/dist/core/ConfigurationProvider.js +17 -10
- package/dist/web/public/js/serverCategoryList.js +42 -7
- package/package.json +1 -1
- package/src/core/ConfigurationLoader.ts +1 -1
- package/src/core/ConfigurationProvider.ts +17 -10
- package/src/web/public/js/serverCategoryList.js +42 -7
|
@@ -113,7 +113,7 @@ export class ConfigurationLoader {
|
|
|
113
113
|
!server.installationStatus.requirementsStatus ||
|
|
114
114
|
Object.keys(server.installationStatus.requirementsStatus).length === 0 ||
|
|
115
115
|
!server.installationStatus.serversStatus ||
|
|
116
|
-
Object.keys(server.installationStatus.serversStatus).length
|
|
116
|
+
Object.keys(server.installationStatus.serversStatus).length < Object.keys(server.feedConfiguration?.mcpServers || []).length) {
|
|
117
117
|
server.installationStatus = ConfigurationLoader.initializeInstallationStatus(server.feedConfiguration);
|
|
118
118
|
}
|
|
119
119
|
return server;
|
|
@@ -48,17 +48,24 @@ export class ConfigurationProvider {
|
|
|
48
48
|
const configDir = path.dirname(this.configPath);
|
|
49
49
|
await fs.mkdir(configDir, { recursive: true });
|
|
50
50
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
try {
|
|
52
|
+
const config = JSON.parse(await fs.readFile(this.configPath, 'utf8'));
|
|
53
|
+
this.configuration = config;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (error.code !== 'ENOENT') {
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
// File doesn't exist, use default empty configuration
|
|
60
|
+
await this.saveConfiguration();
|
|
61
|
+
}
|
|
62
|
+
// Always load feeds and client settings, whether file existed or not
|
|
63
|
+
await this.loadFeedsIntoConfiguration();
|
|
64
|
+
await this.loadClientMCPSettings();
|
|
55
65
|
}
|
|
56
66
|
catch (error) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
// File doesn't exist, use default empty configuration
|
|
61
|
-
await this.saveConfiguration();
|
|
67
|
+
Logger.error('Error during initialization', error);
|
|
68
|
+
throw error;
|
|
62
69
|
}
|
|
63
70
|
});
|
|
64
71
|
}
|
|
@@ -256,7 +263,7 @@ export class ConfigurationProvider {
|
|
|
256
263
|
});
|
|
257
264
|
}
|
|
258
265
|
Logger.debug('Updating local feeds...');
|
|
259
|
-
|
|
266
|
+
await fs.rm(LOCAL_FEEDS_DIR, { recursive: true, force: true });
|
|
260
267
|
const sourceFeedsDir = path.join(this.tempDir, GITHUB_REPO.feedsPath);
|
|
261
268
|
try {
|
|
262
269
|
await fs.access(sourceFeedsDir);
|
|
@@ -2,6 +2,15 @@ import { allServerCategoriesData, fetchServerCategories } from './api.js';
|
|
|
2
2
|
import { showServerDetails } from './serverCategoryDetails.js';
|
|
3
3
|
import { showToast } from './notifications.js';
|
|
4
4
|
|
|
5
|
+
// Wait for data to be loaded
|
|
6
|
+
async function waitForData() {
|
|
7
|
+
if (allServerCategoriesData && allServerCategoriesData.length > 0) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
await fetchServerCategories();
|
|
11
|
+
return allServerCategoriesData && allServerCategoriesData.length > 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
// Function to show the last selected category on page load
|
|
6
15
|
async function loadLastSelectedCategory() {
|
|
7
16
|
const lastSelected = localStorage.getItem('lastSelectedCategory');
|
|
@@ -78,17 +87,43 @@ function renderServerCategoryList(servers) {
|
|
|
78
87
|
|
|
79
88
|
// Setup search functionality
|
|
80
89
|
function setupSearch() {
|
|
81
|
-
document.getElementById('searchBox')
|
|
90
|
+
const searchBox = document.getElementById('searchBox');
|
|
91
|
+
|
|
92
|
+
searchBox.addEventListener('input', async function () {
|
|
82
93
|
const searchTerm = this.value.toLowerCase();
|
|
83
94
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
(server
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
try {
|
|
96
|
+
// Ensure data is loaded
|
|
97
|
+
if (!(await waitForData())) {
|
|
98
|
+
showToast('Error: Unable to load server data', 'error');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Filter the servers list based on search
|
|
103
|
+
const filteredServers = allServerCategoriesData.filter(server => {
|
|
104
|
+
// Check category name/display name
|
|
105
|
+
const categoryMatch = (server.displayName || server.name).toLowerCase().includes(searchTerm);
|
|
106
|
+
|
|
107
|
+
// Check description
|
|
108
|
+
const descriptionMatch = (server.description || '').toLowerCase().includes(searchTerm);
|
|
109
|
+
|
|
110
|
+
// Check MCP server names from feedConfiguration
|
|
111
|
+
const mcpServerMatch = server.feedConfiguration?.mcpServers?.some(mcpServer =>
|
|
112
|
+
(mcpServer.displayName || mcpServer.name).toLowerCase().includes(searchTerm)
|
|
113
|
+
) || false;
|
|
114
|
+
|
|
115
|
+
// Check installed server names from installationStatus
|
|
116
|
+
const installedServerMatch = server.installationStatus?.serversStatus &&
|
|
117
|
+
Object.keys(server.installationStatus.serversStatus)
|
|
118
|
+
.some(serverName => serverName.toLowerCase().includes(searchTerm));
|
|
119
|
+
|
|
120
|
+
return categoryMatch || descriptionMatch || mcpServerMatch || installedServerMatch;
|
|
121
|
+
});
|
|
90
122
|
|
|
91
123
|
renderServerCategoryList(filteredServers);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error('Error in search:', error);
|
|
126
|
+
showToast('Error performing search', 'error');
|
|
92
127
|
}
|
|
93
128
|
});
|
|
94
129
|
}
|
package/package.json
CHANGED
|
@@ -143,7 +143,7 @@ export class ConfigurationLoader {
|
|
|
143
143
|
!server.installationStatus.requirementsStatus ||
|
|
144
144
|
Object.keys(server.installationStatus.requirementsStatus).length === 0 ||
|
|
145
145
|
!server.installationStatus.serversStatus ||
|
|
146
|
-
Object.keys(server.installationStatus.serversStatus).length
|
|
146
|
+
Object.keys(server.installationStatus.serversStatus).length < Object.keys(server.feedConfiguration?.mcpServers || []).length
|
|
147
147
|
) {
|
|
148
148
|
server.installationStatus = ConfigurationLoader.initializeInstallationStatus(server.feedConfiguration);
|
|
149
149
|
}
|
|
@@ -63,16 +63,23 @@ export class ConfigurationProvider {
|
|
|
63
63
|
await fs.mkdir(configDir, { recursive: true });
|
|
64
64
|
|
|
65
65
|
try {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
try {
|
|
67
|
+
const config = JSON.parse(await fs.readFile(this.configPath, 'utf8'));
|
|
68
|
+
this.configuration = config;
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
// File doesn't exist, use default empty configuration
|
|
74
|
+
await this.saveConfiguration();
|
|
73
75
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
|
|
77
|
+
// Always load feeds and client settings, whether file existed or not
|
|
78
|
+
await this.loadFeedsIntoConfiguration();
|
|
79
|
+
await this.loadClientMCPSettings();
|
|
80
|
+
} catch (error) {
|
|
81
|
+
Logger.error('Error during initialization', error);
|
|
82
|
+
throw error;
|
|
76
83
|
}
|
|
77
84
|
});
|
|
78
85
|
}
|
|
@@ -314,7 +321,7 @@ export class ConfigurationProvider {
|
|
|
314
321
|
}
|
|
315
322
|
|
|
316
323
|
Logger.debug('Updating local feeds...');
|
|
317
|
-
|
|
324
|
+
await fs.rm(LOCAL_FEEDS_DIR, { recursive: true, force: true });
|
|
318
325
|
const sourceFeedsDir = path.join(this.tempDir, GITHUB_REPO.feedsPath);
|
|
319
326
|
|
|
320
327
|
try {
|
|
@@ -2,6 +2,15 @@ import { allServerCategoriesData, fetchServerCategories } from './api.js';
|
|
|
2
2
|
import { showServerDetails } from './serverCategoryDetails.js';
|
|
3
3
|
import { showToast } from './notifications.js';
|
|
4
4
|
|
|
5
|
+
// Wait for data to be loaded
|
|
6
|
+
async function waitForData() {
|
|
7
|
+
if (allServerCategoriesData && allServerCategoriesData.length > 0) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
await fetchServerCategories();
|
|
11
|
+
return allServerCategoriesData && allServerCategoriesData.length > 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
// Function to show the last selected category on page load
|
|
6
15
|
async function loadLastSelectedCategory() {
|
|
7
16
|
const lastSelected = localStorage.getItem('lastSelectedCategory');
|
|
@@ -78,17 +87,43 @@ function renderServerCategoryList(servers) {
|
|
|
78
87
|
|
|
79
88
|
// Setup search functionality
|
|
80
89
|
function setupSearch() {
|
|
81
|
-
document.getElementById('searchBox')
|
|
90
|
+
const searchBox = document.getElementById('searchBox');
|
|
91
|
+
|
|
92
|
+
searchBox.addEventListener('input', async function () {
|
|
82
93
|
const searchTerm = this.value.toLowerCase();
|
|
83
94
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
(server
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
try {
|
|
96
|
+
// Ensure data is loaded
|
|
97
|
+
if (!(await waitForData())) {
|
|
98
|
+
showToast('Error: Unable to load server data', 'error');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Filter the servers list based on search
|
|
103
|
+
const filteredServers = allServerCategoriesData.filter(server => {
|
|
104
|
+
// Check category name/display name
|
|
105
|
+
const categoryMatch = (server.displayName || server.name).toLowerCase().includes(searchTerm);
|
|
106
|
+
|
|
107
|
+
// Check description
|
|
108
|
+
const descriptionMatch = (server.description || '').toLowerCase().includes(searchTerm);
|
|
109
|
+
|
|
110
|
+
// Check MCP server names from feedConfiguration
|
|
111
|
+
const mcpServerMatch = server.feedConfiguration?.mcpServers?.some(mcpServer =>
|
|
112
|
+
(mcpServer.displayName || mcpServer.name).toLowerCase().includes(searchTerm)
|
|
113
|
+
) || false;
|
|
114
|
+
|
|
115
|
+
// Check installed server names from installationStatus
|
|
116
|
+
const installedServerMatch = server.installationStatus?.serversStatus &&
|
|
117
|
+
Object.keys(server.installationStatus.serversStatus)
|
|
118
|
+
.some(serverName => serverName.toLowerCase().includes(searchTerm));
|
|
119
|
+
|
|
120
|
+
return categoryMatch || descriptionMatch || mcpServerMatch || installedServerMatch;
|
|
121
|
+
});
|
|
90
122
|
|
|
91
123
|
renderServerCategoryList(filteredServers);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error('Error in search:', error);
|
|
126
|
+
showToast('Error performing search', 'error');
|
|
92
127
|
}
|
|
93
128
|
});
|
|
94
129
|
}
|