viewgate-mcp 1.0.26 → 1.0.27
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.
- package/dist/index.js +22 -6
- 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
|
|
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
|
-
|
|
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,8 +188,10 @@ function createMcpServer(apiKey, personalKey) {
|
|
|
179
188
|
fetchUrl += `&limit=${limit}`;
|
|
180
189
|
if (search)
|
|
181
190
|
fetchUrl += `&search=${encodeURIComponent(search)}`;
|
|
182
|
-
if (
|
|
183
|
-
fetchUrl += `&key=${encodeURIComponent(
|
|
191
|
+
if (combinedKey)
|
|
192
|
+
fetchUrl += `&key=${encodeURIComponent(combinedKey)}`;
|
|
193
|
+
if (idsToFetch)
|
|
194
|
+
fetchUrl += `&ids=${encodeURIComponent(idsToFetch)}`;
|
|
184
195
|
const response = await fetch(fetchUrl, {
|
|
185
196
|
headers: {
|
|
186
197
|
'x-api-key': apiKey,
|
|
@@ -201,8 +212,13 @@ function createMcpServer(apiKey, personalKey) {
|
|
|
201
212
|
(ann.reference?.source && ann.reference.source.toLowerCase().includes(lowSearch)) ||
|
|
202
213
|
(ann.key && ann.key.toLowerCase().includes(lowSearch)));
|
|
203
214
|
}
|
|
204
|
-
if (
|
|
205
|
-
|
|
215
|
+
if (combinedKey) {
|
|
216
|
+
const keyList = combinedKey.split(',').map(k => k.trim());
|
|
217
|
+
rawAnnotations = rawAnnotations.filter((ann) => keyList.includes(ann.key) || keyList.includes(ann._id));
|
|
218
|
+
}
|
|
219
|
+
if (idsToFetch) {
|
|
220
|
+
const idList = idsToFetch.split(',').map(i => i.trim());
|
|
221
|
+
rawAnnotations = rawAnnotations.filter((ann) => idList.includes(ann._id));
|
|
206
222
|
}
|
|
207
223
|
const priorityMap = { 'urgente': 4, 'urgent': 4, 'alta': 3, 'high': 3, 'media': 2, 'medium': 2, 'baja': 1, 'low': 1 };
|
|
208
224
|
const sortedAnnotations = rawAnnotations.sort((a, b) => {
|