viewgate-mcp 1.0.23 → 1.0.24

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 +11 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -180,17 +180,17 @@ function createMcpServer(apiKey, personalKey) {
180
180
  const statuses = args.status || 'pending,bug_fixing';
181
181
  const search = args.search || '';
182
182
  const key = args.key || '';
183
- const url = new URL(`${BACKEND_URL}/api/mcp/annotations`);
183
+ let fetchUrl = `${BACKEND_URL}/api/mcp/annotations?lock=true`;
184
184
  if (statuses && statuses !== 'all')
185
- url.searchParams.append('status', statuses);
185
+ fetchUrl += `&status=${statuses}`;
186
186
  if (limit)
187
- url.searchParams.append('limit', limit.toString());
187
+ fetchUrl += `&limit=${limit}`;
188
188
  if (search)
189
- url.searchParams.append('search', search);
189
+ fetchUrl += `&search=${encodeURIComponent(search)}`;
190
190
  if (key)
191
- url.searchParams.append('key', key);
192
- url.searchParams.append('lock', 'true');
193
- const response = await fetch(url.toString(), {
191
+ fetchUrl += `&key=${encodeURIComponent(key)}`;
192
+ console.error(`[MCP] Fetching annotations from: ${fetchUrl}`);
193
+ const response = await fetch(fetchUrl, {
194
194
  headers: {
195
195
  'x-api-key': apiKey,
196
196
  ...(personalKey ? { 'x-personal-key': personalKey } : {})
@@ -368,12 +368,13 @@ Instruction: ${ann.message}${pendingCorrection ? `\nCorrection Needed: ${pending
368
368
  throw new Error(`Backend responded with ${response.status}`);
369
369
  }
370
370
  const data = (await response.json());
371
+ const backlogNodes = Array.isArray(data) ? data : (data.data || data.backlog || []);
371
372
  return {
372
373
  content: [{
373
374
  type: "text",
374
375
  text: JSON.stringify({
375
376
  preferredLanguage: data.preferredLanguage || 'en',
376
- backlog: data.data || []
377
+ backlog: backlogNodes
377
378
  }, null, 2)
378
379
  }]
379
380
  };
@@ -451,10 +452,11 @@ Instruction: ${ann.message}${pendingCorrection ? `\nCorrection Needed: ${pending
451
452
  throw new Error(`Backend responded with ${response.status}`);
452
453
  }
453
454
  const data = (await response.json());
455
+ const endpointsList = Array.isArray(data) ? data : (data.endpoints || data.routes || data.data || []);
454
456
  return {
455
457
  content: [{
456
458
  type: "text",
457
- text: JSON.stringify(data.endpoints || [], null, 2)
459
+ text: JSON.stringify(endpointsList, null, 2)
458
460
  }]
459
461
  };
460
462
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-mcp",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "viewgate-mcp": "./dist/index.js"