viewgate-mcp 1.0.26 → 1.0.28

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 +32 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -55,7 +55,9 @@ function createMcpServer(apiKey, personalKey) {
55
55
  limit: { type: "number", description: "Maximum number of annotations to retrieve (default: 3)", default: 3 },
56
56
  status: { type: "string", description: "Comma-separated list (e.g. 'pending,bug_fixing'). Use 'all' for any state.", default: "pending,bug_fixing" },
57
57
  search: { type: "string", description: "Search term to filter by message or file." },
58
- key: { type: "string", description: "Human key (e.g. VG-XXXX) to find a specific annotation." }
58
+ key: { type: "string", description: "Human key (e.g. VG-XXXX) or comma-separated keys to find specific annotations." },
59
+ keys: { type: "array", items: { type: "string" }, description: "List of human keys to find specific annotations." },
60
+ ids: { type: "string", description: "Comma-separated internal IDs to find specific annotations." }
59
61
  },
60
62
  },
61
63
  },
@@ -171,7 +173,14 @@ function createMcpServer(apiKey, personalKey) {
171
173
  const limit = args.limit || 3;
172
174
  const statuses = args.status || 'pending,bug_fixing';
173
175
  const search = args.search || '';
174
- const key = args.key || '';
176
+ // Normalize keys and ids
177
+ let keysToFetch = [];
178
+ if (args.key)
179
+ keysToFetch = keysToFetch.concat(args.key.split(',').map(s => s.trim()));
180
+ if (args.keys)
181
+ keysToFetch = keysToFetch.concat(args.keys);
182
+ const combinedKey = keysToFetch.filter(k => k).join(',');
183
+ const idsToFetch = args.ids || '';
175
184
  let fetchUrl = `${BACKEND_URL}/api/mcp/annotations?lock=true`;
176
185
  if (statuses && statuses !== 'all')
177
186
  fetchUrl += `&status=${statuses}`;
@@ -179,16 +188,21 @@ function createMcpServer(apiKey, personalKey) {
179
188
  fetchUrl += `&limit=${limit}`;
180
189
  if (search)
181
190
  fetchUrl += `&search=${encodeURIComponent(search)}`;
182
- if (key)
183
- fetchUrl += `&key=${encodeURIComponent(key)}`;
191
+ if (combinedKey)
192
+ fetchUrl += `&key=${encodeURIComponent(combinedKey)}`;
193
+ if (idsToFetch)
194
+ fetchUrl += `&ids=${encodeURIComponent(idsToFetch)}`;
195
+ console.error(`[MCP] Fetching: ${fetchUrl}`);
184
196
  const response = await fetch(fetchUrl, {
185
197
  headers: {
186
198
  'x-api-key': apiKey,
187
199
  ...(personalKey ? { 'x-personal-key': personalKey } : {})
188
200
  }
189
201
  });
190
- if (!response.ok)
191
- throw new Error(`Backend responded with ${response.status}`);
202
+ if (!response.ok) {
203
+ const errorBody = await response.text();
204
+ throw new Error(`Backend responded with ${response.status}: ${errorBody}`);
205
+ }
192
206
  const rawData = (await response.json());
193
207
  let rawAnnotations = Array.isArray(rawData) ? rawData : (rawData?.data || rawData?.annotations || []);
194
208
  if (!Array.isArray(rawAnnotations)) {
@@ -201,8 +215,13 @@ function createMcpServer(apiKey, personalKey) {
201
215
  (ann.reference?.source && ann.reference.source.toLowerCase().includes(lowSearch)) ||
202
216
  (ann.key && ann.key.toLowerCase().includes(lowSearch)));
203
217
  }
204
- if (key) {
205
- rawAnnotations = rawAnnotations.filter((ann) => ann.key === key || ann._id === key);
218
+ if (combinedKey) {
219
+ const keyList = combinedKey.split(',').map(k => k.trim());
220
+ rawAnnotations = rawAnnotations.filter((ann) => keyList.includes(ann.key) || keyList.includes(ann._id));
221
+ }
222
+ if (idsToFetch) {
223
+ const idList = idsToFetch.split(',').map(i => i.trim());
224
+ rawAnnotations = rawAnnotations.filter((ann) => idList.includes(ann._id));
206
225
  }
207
226
  const priorityMap = { 'urgente': 4, 'urgent': 4, 'alta': 3, 'high': 3, 'media': 2, 'medium': 2, 'baja': 1, 'low': 1 };
208
227
  const sortedAnnotations = rawAnnotations.sort((a, b) => {
@@ -252,13 +271,16 @@ Instruction: ${ann.message}`
252
271
  case "mark_annotation_ready": {
253
272
  const args = request.params.arguments;
254
273
  console.error(`[MCP] Marking ${args.results.length} annotations as ready.`);
274
+ console.error(`[MCP] Batch ready update: ${BACKEND_URL}/api/mcp/annotations/batch-ready`);
255
275
  const response = await fetch(`${BACKEND_URL}/api/mcp/annotations/batch-ready`, {
256
276
  method: 'PATCH',
257
277
  headers: { 'Content-Type': 'application/json', 'x-api-key': apiKey, ...(personalKey ? { 'x-personal-key': personalKey } : {}) },
258
278
  body: JSON.stringify({ results: args.results })
259
279
  });
260
- if (!response.ok)
261
- throw new Error(`Backend responded with ${response.status}`);
280
+ if (!response.ok) {
281
+ const errorBody = await response.text();
282
+ throw new Error(`Backend responded with ${response.status}: ${errorBody}`);
283
+ }
262
284
  const result = await response.json();
263
285
  return { content: [{ type: "text", text: `Processed: ${JSON.stringify(result, null, 2)}` }] };
264
286
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-mcp",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "viewgate-mcp": "./dist/index.js"