viewgate-mcp 1.0.9 → 1.0.11
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 +59 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ function createMcpServer(apiKey) {
|
|
|
48
48
|
tools: [
|
|
49
49
|
{
|
|
50
50
|
name: "get_annotations",
|
|
51
|
-
description: "Retrieves all feedback annotations. WORKFLOW: 1. Read these annotations, 2. Open the source files and apply SURGICAL fixes based on '_ia_fix_instruction'. 3. IMMEDIATELY call 'mark_annotation_ready' with the results for EACH ticket you fixed. Use 'outerHtml' and 'source' (file:line) to locate the exact code block without manual searching. IMPORTANT: All AI analysis and comments MUST be in the 'preferredLanguage' specified in the output.",
|
|
51
|
+
description: "Retrieves all feedback annotations. WORKFLOW: 1. Read these annotations, 2. Open the source files and apply SURGICAL fixes based on '_ia_fix_instruction'. 3. IMMEDIATELY call 'mark_annotation_ready' with the results for EACH ticket you fixed. Use 'outerHtml' and 'source' (file:line) to locate the exact code block without manual searching. IMPORTANT: All AI analysis and comments MUST be in the 'preferredLanguage' specified in the output. Failure to follow the language setting is UNACCEPTABLE.",
|
|
52
52
|
inputSchema: {
|
|
53
53
|
type: "object",
|
|
54
54
|
properties: {},
|
|
@@ -56,7 +56,7 @@ function createMcpServer(apiKey) {
|
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
name: "mark_annotation_ready",
|
|
59
|
-
description: "CRITICAL: Call this tool AFTER applying code fixes for annotations. It marks tickets as 'Ready for Review' in the ViewGate dashboard and stores your AI-generated change summary. Support batch processing of multiple tickets at once. IMPORTANT: The 'appliedChanges' summary MUST be written in the 'preferredLanguage' specified by 'get_annotations' output.",
|
|
59
|
+
description: "CRITICAL: Call this tool AFTER applying code fixes for annotations. It marks tickets as 'Ready for Review' in the ViewGate dashboard and stores your AI-generated change summary. Support batch processing of multiple tickets at once. IMPORTANT: The 'appliedChanges' summary MUST be written in the 'preferredLanguage' specified by 'get_annotations' output. DO NOT use English if the preferred language is Spanish.",
|
|
60
60
|
inputSchema: {
|
|
61
61
|
type: "object",
|
|
62
62
|
properties: {
|
|
@@ -66,7 +66,7 @@ function createMcpServer(apiKey) {
|
|
|
66
66
|
type: "object",
|
|
67
67
|
properties: {
|
|
68
68
|
id: { type: "string", description: "The ID of the annotation to mark as ready" },
|
|
69
|
-
appliedChanges: { type: "string", description: "Descriptive summary of what was changed in the code for this specific ticket" }
|
|
69
|
+
appliedChanges: { type: "string", description: "Descriptive summary of what was changed in the code for this specific ticket. MUST be in the preferredLanguage." }
|
|
70
70
|
},
|
|
71
71
|
required: ["id", "appliedChanges"]
|
|
72
72
|
}
|
|
@@ -77,7 +77,7 @@ function createMcpServer(apiKey) {
|
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
name: "planning",
|
|
80
|
-
description: "Planning tool for backlog tickets. CALL WITHOUT ARGUMENTS to fetch backlog tickets that need analysis. CALL WITH 'results' to submit AI analysis in batch. Rules: complejidad (1-3), incertidumbre (1-3), impacto (1-3), riesgo (1-3), tipo (AI-friendly|AI-assisted|Human-critical). IMPORTANT: All AI analysis and comments MUST be in the 'preferredLanguage' specified in the output.",
|
|
80
|
+
description: "Planning tool for backlog tickets. CALL WITHOUT ARGUMENTS to fetch backlog tickets that need analysis. CALL WITH 'results' to submit AI analysis in batch. Rules: complejidad (1-3), incertidumbre (1-3), impacto (1-3), riesgo (1-3), tipo (AI-friendly|AI-assisted|Human-critical). IMPORTANT: All AI analysis, 'aiAnalysis' descriptions, and comments MUST be in the 'preferredLanguage' specified in the output.",
|
|
81
81
|
inputSchema: {
|
|
82
82
|
type: "object",
|
|
83
83
|
properties: {
|
|
@@ -92,7 +92,7 @@ function createMcpServer(apiKey) {
|
|
|
92
92
|
impacto: { type: "number", minimum: 1, maximum: 3 },
|
|
93
93
|
riesgo: { type: "number", minimum: 1, maximum: 3 },
|
|
94
94
|
tipo: { type: "string", enum: ["AI-friendly", "AI-assisted", "Human-critical"] },
|
|
95
|
-
aiAnalysis: { type: "string", description: "Reasoning or summary of the analysis" }
|
|
95
|
+
aiAnalysis: { type: "string", description: "Reasoning or summary of the analysis. MUST be in the preferredLanguage." }
|
|
96
96
|
},
|
|
97
97
|
required: ["id", "complejidad", "incertidumbre", "impacto", "riesgo", "tipo", "aiAnalysis"]
|
|
98
98
|
}
|
|
@@ -106,7 +106,7 @@ function createMcpServer(apiKey) {
|
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
name: "sync_endpoints",
|
|
109
|
-
description: "Synchronizes a batch of backend endpoints with the ViewGate server. High-performance batch processing for language-agnostic mapping (Express, Java, .NET, Python, etc.).",
|
|
109
|
+
description: "Synchronizes a batch of backend endpoints with the ViewGate server. High-performance batch processing for language-agnostic mapping (Express, Java, .NET, Python, etc.). IMPORTANT: The 'description' for each endpoint MUST be written in the project's preferred language (e.g., Spanish if preferredLanguage is 'es').",
|
|
110
110
|
inputSchema: {
|
|
111
111
|
type: "object",
|
|
112
112
|
properties: {
|
|
@@ -117,14 +117,31 @@ function createMcpServer(apiKey) {
|
|
|
117
117
|
properties: {
|
|
118
118
|
path: { type: "string", description: "The relative path of the endpoint" },
|
|
119
119
|
method: { type: "string", description: "HTTP method (GET, POST, etc.)" },
|
|
120
|
-
description: { type: "string", description: "Human-readable description of what the endpoint does" }
|
|
120
|
+
description: { type: "string", description: "Human-readable description of what the endpoint does. MUST be in the preferredLanguage." },
|
|
121
|
+
hash: { type: "string", description: "Optional SHA256 hash of the endpoint definition for efficient diffing." }
|
|
121
122
|
},
|
|
122
123
|
required: ["path", "method", "description"]
|
|
123
124
|
}
|
|
125
|
+
},
|
|
126
|
+
clean: {
|
|
127
|
+
type: "boolean",
|
|
128
|
+
description: "If true, clears all existing endpoints before adding the new ones. Useful for the first batch of a fresh scan."
|
|
129
|
+
},
|
|
130
|
+
globalHash: {
|
|
131
|
+
type: "string",
|
|
132
|
+
description: "Optional SHA256 hash of the entire endpoint set. If provided and matches the backend, the entire sync is skipped for performance."
|
|
124
133
|
}
|
|
125
134
|
},
|
|
126
135
|
required: ["endpoints"]
|
|
127
136
|
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "get_synced_endpoints",
|
|
140
|
+
description: "Retrieves the list of endpoints currently synchronized in the backend for this project. Use this to perform diffing and avoid redundant synchronization calls.",
|
|
141
|
+
inputSchema: {
|
|
142
|
+
type: "object",
|
|
143
|
+
properties: {},
|
|
144
|
+
},
|
|
128
145
|
}
|
|
129
146
|
],
|
|
130
147
|
};
|
|
@@ -196,12 +213,15 @@ function createMcpServer(apiKey) {
|
|
|
196
213
|
componentPath: ann.reference?.componentPath,
|
|
197
214
|
selector: ann.reference?.selector,
|
|
198
215
|
tag: ann.reference?.tag,
|
|
199
|
-
|
|
216
|
+
backendEndpoints: ann.backendEndpoints || [ann.backendEndpoint].filter(Boolean),
|
|
217
|
+
_ia_fix_instruction: `### 🔬 SURGICAL FIX PROTOCOL (Language: ${data.preferredLanguage || 'en'})
|
|
200
218
|
1. **PRIMARY**: Search for \`data-vg-id="${ann.reference?.vgId}"\`.
|
|
201
219
|
2. **SECONDARY**: Check \`${file}\` L${line} (Fiber Source).
|
|
202
220
|
3. **TERTIARY**: Match Tag(\`${ann.reference?.tag}\`) + Role(\`${ann.reference?.fingerprint?.role}\`) + Text("${ann.reference?.text?.slice(0, 30)}").
|
|
203
221
|
4. **VALIDATE**: Confirm parent context matches \`${ann.reference?.parentContext?.slice(0, 50).replace(/`/g, "'")}...\`.
|
|
204
222
|
|
|
223
|
+
IMPORTANT: All your analysis and implementation comments MUST BE IN ${data.preferredLanguage === 'es' ? 'SPANISH' : 'ENGLISH'}.
|
|
224
|
+
|
|
205
225
|
Confidence: [vgId: ${ann.reference?.confidence?.vgId || 0}, Fiber: ${ann.reference?.confidence?.fiber || 0}, Fingerprint: ${ann.reference?.confidence?.fingerprint || 0}]
|
|
206
226
|
Instruction: ${ann.message}`
|
|
207
227
|
};
|
|
@@ -316,14 +336,18 @@ Instruction: ${ann.message}`
|
|
|
316
336
|
'Content-Type': 'application/json',
|
|
317
337
|
'x-api-key': apiKey
|
|
318
338
|
},
|
|
319
|
-
body: JSON.stringify({
|
|
339
|
+
body: JSON.stringify({
|
|
340
|
+
endpoints: args.endpoints,
|
|
341
|
+
clean: args.clean,
|
|
342
|
+
globalHash: args.globalHash
|
|
343
|
+
})
|
|
320
344
|
});
|
|
321
345
|
if (!response.ok) {
|
|
322
346
|
throw new Error(`Backend responded with ${response.status}`);
|
|
323
347
|
}
|
|
324
348
|
const result = (await response.json());
|
|
325
349
|
return {
|
|
326
|
-
content: [{ type: "text", text: `Endpoints synchronized successfully: ${result.count} routes
|
|
350
|
+
content: [{ type: "text", text: `Endpoints synchronized successfully: ${result.count} routes processed. ${result.saved ? 'Changes saved.' : 'No changes detected.'}` }]
|
|
327
351
|
};
|
|
328
352
|
}
|
|
329
353
|
catch (error) {
|
|
@@ -333,6 +357,31 @@ Instruction: ${ann.message}`
|
|
|
333
357
|
};
|
|
334
358
|
}
|
|
335
359
|
}
|
|
360
|
+
case "get_synced_endpoints": {
|
|
361
|
+
try {
|
|
362
|
+
const response = await fetch(`${BACKEND_URL}/api/projects/endpoints`, {
|
|
363
|
+
headers: {
|
|
364
|
+
'x-api-key': apiKey
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
if (!response.ok) {
|
|
368
|
+
throw new Error(`Backend responded with ${response.status}`);
|
|
369
|
+
}
|
|
370
|
+
const data = (await response.json());
|
|
371
|
+
return {
|
|
372
|
+
content: [{
|
|
373
|
+
type: "text",
|
|
374
|
+
text: JSON.stringify(data.endpoints || [], null, 2)
|
|
375
|
+
}]
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
return {
|
|
380
|
+
content: [{ type: "text", text: `Error fetching synced endpoints: ${error.message}` }],
|
|
381
|
+
isError: true
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
}
|
|
336
385
|
default:
|
|
337
386
|
throw new Error("Unknown tool");
|
|
338
387
|
}
|