viewgate-mcp 1.0.29 → 1.0.30

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 (2) hide show
  1. package/dist/index.js +16 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -208,7 +208,8 @@ function createMcpServer(apiKey, personalKey) {
208
208
  if (!Array.isArray(rawAnnotations)) {
209
209
  return { content: [{ type: "text", text: "Error: Invalid format from backend" }], isError: true };
210
210
  }
211
- // Local filtering fallback (for older backend versions)
211
+ console.error(`[MCP] Received ${rawAnnotations.length} annotations from backend.`);
212
+ // Local filtering fallback (for older backend versions or additional client-side safety)
212
213
  if (search) {
213
214
  const lowSearch = search.toLowerCase();
214
215
  rawAnnotations = rawAnnotations.filter((ann) => (ann.message && ann.message.toLowerCase().includes(lowSearch)) ||
@@ -216,12 +217,24 @@ function createMcpServer(apiKey, personalKey) {
216
217
  (ann.key && ann.key.toLowerCase().includes(lowSearch)));
217
218
  }
218
219
  if (combinedKey) {
219
- const keyList = combinedKey.split(',').map(k => k.trim());
220
- rawAnnotations = rawAnnotations.filter((ann) => keyList.includes(ann.key) || keyList.includes(ann._id));
220
+ // Normalize keyList for case-insensitive matching and handle VG- prefix
221
+ const keyList = combinedKey.split(',').map(k => k.trim().toUpperCase());
222
+ const baseKeys = keyList.map(k => k.startsWith('VG-') ? k.substring(3) : k);
223
+ rawAnnotations = rawAnnotations.filter((ann) => {
224
+ if (!ann.key)
225
+ return keyList.includes(ann._id);
226
+ const annKeyUpper = ann.key.toUpperCase();
227
+ const annBaseKey = annKeyUpper.startsWith('VG-') ? annKeyUpper.substring(3) : annKeyUpper;
228
+ return keyList.includes(annKeyUpper) ||
229
+ baseKeys.includes(annBaseKey) ||
230
+ keyList.includes(ann._id);
231
+ });
232
+ console.error(`[MCP] Filtered with keys. Remaining: ${rawAnnotations.length}`);
221
233
  }
222
234
  if (idsToFetch) {
223
235
  const idList = idsToFetch.split(',').map(i => i.trim());
224
236
  rawAnnotations = rawAnnotations.filter((ann) => idList.includes(ann._id));
237
+ console.error(`[MCP] Filtered with IDs. Remaining: ${rawAnnotations.length}`);
225
238
  }
226
239
  const priorityMap = { 'urgente': 4, 'urgent': 4, 'alta': 3, 'high': 3, 'media': 2, 'medium': 2, 'baja': 1, 'low': 1 };
227
240
  const sortedAnnotations = rawAnnotations.sort((a, b) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-mcp",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "viewgate-mcp": "./dist/index.js"