viewgate-mcp 1.0.7 → 1.0.9

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 +63 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -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.",
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.",
60
60
  inputSchema: {
61
61
  type: "object",
62
62
  properties: {
@@ -103,6 +103,28 @@ function createMcpServer(apiKey) {
103
103
  }
104
104
  }
105
105
  }
106
+ },
107
+ {
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.).",
110
+ inputSchema: {
111
+ type: "object",
112
+ properties: {
113
+ endpoints: {
114
+ type: "array",
115
+ items: {
116
+ type: "object",
117
+ properties: {
118
+ path: { type: "string", description: "The relative path of the endpoint" },
119
+ method: { type: "string", description: "HTTP method (GET, POST, etc.)" },
120
+ description: { type: "string", description: "Human-readable description of what the endpoint does" }
121
+ },
122
+ required: ["path", "method", "description"]
123
+ }
124
+ }
125
+ },
126
+ required: ["endpoints"]
127
+ }
106
128
  }
107
129
  ],
108
130
  };
@@ -166,14 +188,22 @@ function createMcpServer(apiKey) {
166
188
  source: source,
167
189
  filePath: ann.filePath || file,
168
190
  line: ann.line || (line ? parseInt(line) : undefined),
191
+ vgId: ann.reference?.vgId,
192
+ confidence: ann.reference?.confidence,
193
+ fingerprint: ann.reference?.fingerprint,
169
194
  outerHtml: ann.reference?.outerHtml,
170
195
  parentContext: ann.reference?.parentContext,
171
196
  componentPath: ann.reference?.componentPath,
172
197
  selector: ann.reference?.selector,
173
198
  tag: ann.reference?.tag,
174
- _ia_fix_instruction: hasSource
175
- ? `FAST SURGICAL FIX: Open \`${file}\` at line ${line}. Focus on the block inside \`${ann.reference?.parentContext?.slice(0, 50)}...\`. Exact element: \`${ann.reference?.outerHtml?.slice(0, 100)}...\`. Instruction: ${ann.message}`
176
- : `MANUAL FIND: Search for the element using selector \`${ann.reference?.selector}\`. Reference HTML: \`${ann.reference?.outerHtml?.slice(0, 100)}...\`. Instruction: ${ann.message}`
199
+ _ia_fix_instruction: `### 🔬 SURGICAL FIX PROTOCOL
200
+ 1. **PRIMARY**: Search for \`data-vg-id="${ann.reference?.vgId}"\`.
201
+ 2. **SECONDARY**: Check \`${file}\` L${line} (Fiber Source).
202
+ 3. **TERTIARY**: Match Tag(\`${ann.reference?.tag}\`) + Role(\`${ann.reference?.fingerprint?.role}\`) + Text("${ann.reference?.text?.slice(0, 30)}").
203
+ 4. **VALIDATE**: Confirm parent context matches \`${ann.reference?.parentContext?.slice(0, 50).replace(/`/g, "'")}...\`.
204
+
205
+ Confidence: [vgId: ${ann.reference?.confidence?.vgId || 0}, Fiber: ${ann.reference?.confidence?.fiber || 0}, Fingerprint: ${ann.reference?.confidence?.fingerprint || 0}]
206
+ Instruction: ${ann.message}`
177
207
  };
178
208
  });
179
209
  return {
@@ -274,6 +304,35 @@ function createMcpServer(apiKey) {
274
304
  };
275
305
  }
276
306
  }
307
+ case "sync_endpoints": {
308
+ try {
309
+ const args = request.params.arguments;
310
+ if (!args.endpoints || !Array.isArray(args.endpoints)) {
311
+ throw new Error("Invalid endpoints format. Expected an array.");
312
+ }
313
+ const response = await fetch(`${BACKEND_URL}/api/mcp/sync-endpoints`, {
314
+ method: 'POST',
315
+ headers: {
316
+ 'Content-Type': 'application/json',
317
+ 'x-api-key': apiKey
318
+ },
319
+ body: JSON.stringify({ endpoints: args.endpoints })
320
+ });
321
+ if (!response.ok) {
322
+ throw new Error(`Backend responded with ${response.status}`);
323
+ }
324
+ const result = (await response.json());
325
+ return {
326
+ content: [{ type: "text", text: `Endpoints synchronized successfully: ${result.count} routes mapped.` }]
327
+ };
328
+ }
329
+ catch (error) {
330
+ return {
331
+ content: [{ type: "text", text: `Error synchronizing endpoints: ${error.message}` }],
332
+ isError: true
333
+ };
334
+ }
335
+ }
277
336
  default:
278
337
  throw new Error("Unknown tool");
279
338
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-mcp",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "viewgate-mcp": "./dist/index.js"