imcp 0.0.5 → 0.0.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.
@@ -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 === 0) {
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;
@@ -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').addEventListener('input', function () {
90
+ const searchBox = document.getElementById('searchBox');
91
+
92
+ searchBox.addEventListener('input', async function () {
82
93
  const searchTerm = this.value.toLowerCase();
83
94
 
84
- // Filter the servers list based on search
85
- if (allServerCategorisData && allServerCategorisData.length > 0) {
86
- const filteredServers = allServerCategorisData.filter(server =>
87
- (server.displayName || server.name).toLowerCase().includes(searchTerm) ||
88
- (server.description || '').toLowerCase().includes(searchTerm)
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imcp",
3
- "version": "0.0.5",
3
+ "version": "0.0.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",
@@ -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 === 0
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
  }
@@ -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').addEventListener('input', function () {
90
+ const searchBox = document.getElementById('searchBox');
91
+
92
+ searchBox.addEventListener('input', async function () {
82
93
  const searchTerm = this.value.toLowerCase();
83
94
 
84
- // Filter the servers list based on search
85
- if (allServerCategorisData && allServerCategorisData.length > 0) {
86
- const filteredServers = allServerCategorisData.filter(server =>
87
- (server.displayName || server.name).toLowerCase().includes(searchTerm) ||
88
- (server.description || '').toLowerCase().includes(searchTerm)
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
  }