viewgate-mcp 1.0.29 → 1.0.31

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 +26 -4
  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) => {
@@ -239,6 +252,9 @@ function createMcpServer(apiKey, personalKey) {
239
252
  const pendingCorrection = Array.isArray(ann.corrections)
240
253
  ? ann.corrections.find((c) => c.status === 'pending')
241
254
  : (typeof ann.corrections === 'string' ? { text: ann.corrections } : null);
255
+ const figmaLinks = Array.isArray(ann.figmaReference)
256
+ ? ann.figmaReference.filter((fr) => fr.link).map((fr) => `[${fr.name || 'Design'}](${fr.link})`).join(', ')
257
+ : (ann.figmaReference && typeof ann.figmaReference === 'string' ? ann.figmaReference : null);
242
258
  return {
243
259
  id: ann._id,
244
260
  key: ann.key,
@@ -251,8 +267,14 @@ function createMcpServer(apiKey, personalKey) {
251
267
  line: ann.line || (line ? parseInt(line) : undefined),
252
268
  vgId: ann.reference?.vgId,
253
269
  outerHtml: ann.reference?.outerHtml,
270
+ focusAreas: ann.focusAreas || [],
271
+ componentName: ann.componentName,
272
+ figmaReference: ann.figmaReference,
273
+ backendEndpoints: ann.backendEndpoints || [],
254
274
  _ia_fix_instruction: `### 🎯 DESIGN CONTEXT (Figma)
255
- ${ann.figmaReference ? `A design reference is available: ${ann.figmaReference}` : 'No explicit design linked.'}
275
+ ${figmaLinks ? `Design references: ${figmaLinks}` : 'No explicit design linked.'}
276
+
277
+ ${ann.backendEndpoints?.length ? `### 🔌 BACKEND CONTEXT\nRelated endpoints: ${ann.backendEndpoints.join(', ')}` : ''}
256
278
 
257
279
  ${pendingCorrection ? `### ⚠️ PENDING CORRECTION\nUser feedback: "${pendingCorrection.text}"` : ''}
258
280
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-mcp",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "viewgate-mcp": "./dist/index.js"