viewgate-mcp 1.0.25 → 1.0.26

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 CHANGED
@@ -48,7 +48,7 @@ function createMcpServer(apiKey, personalKey) {
48
48
  tools: [
49
49
  {
50
50
  name: "get_annotations",
51
- description: "Retrieves all feedback annotations. Use 'status' to filter (e.g. 'pending,bug_fixing'). WORKFLOW: 1. Read these annotations, 2. Open the source files and apply SURGICAL fixes. 3. Call 'mark_annotation_ready' for EACH ticket. IMPORTANT: Uses 'id' for marking, but 'key' for readability.",
51
+ description: "Retrieves all feedback annotations. Use 'status' to filter (e.g. 'pending,bug_fixing'). WORKFLOW: 1. Read these annotations, 2. Open the source files and apply SURGICAL fixes. 3. Call 'mark_annotation_ready' for EACH ticket. IMPORTANT: Tickets already resolved by the AI in the current sprint are automatically filtered out to prevent redundant work.",
52
52
  inputSchema: {
53
53
  type: "object",
54
54
  properties: {
@@ -61,7 +61,7 @@ function createMcpServer(apiKey, personalKey) {
61
61
  },
62
62
  {
63
63
  name: "mark_annotation_ready",
64
- description: "CRITICAL: Call this tool AFTER applying code fixes. REQUIREMENT: Use the internal database ID (e.g. 675ba...), NOT the human key (VG-XXXX).",
64
+ description: "CRITICAL: Call this tool AFTER applying code fixes. This also registers the tickets as resolved by the AI for the current sprint to avoid re-fetching them. REQUIREMENT: Use the internal database ID (e.g. 675ba...), NOT the human key (VG-XXXX).",
65
65
  inputSchema: {
66
66
  type: "object",
67
67
  properties: {
@@ -152,6 +152,11 @@ function createMcpServer(apiKey, personalKey) {
152
152
  },
153
153
  required: ["id"]
154
154
  },
155
+ },
156
+ {
157
+ name: "get_ai_resolved_tickets",
158
+ description: "Retrieves the list of ticket IDs that have already been resolved by the AI in the current sprint.",
159
+ inputSchema: { type: "object", properties: {} },
155
160
  }
156
161
  ],
157
162
  };
@@ -227,16 +232,16 @@ function createMcpServer(apiKey, personalKey) {
227
232
  line: ann.line || (line ? parseInt(line) : undefined),
228
233
  vgId: ann.reference?.vgId,
229
234
  outerHtml: ann.reference?.outerHtml,
230
- _ia_fix_instruction: `### 🎯 DESIGN CONTEXT (Figma)
231
- ${ann.figmaReference ? `A design reference is available: ${ann.figmaReference}` : 'No explicit design linked.'}
232
-
233
- ${pendingCorrection ? `### ⚠️ PENDING CORRECTION\nUser feedback: "${pendingCorrection.text}"` : ''}
234
-
235
- ### 🔬 FIX PROTOCOL
236
- 1. **Target**: \`data-vg-id="${ann.reference?.vgId}"\` in \`${file}\`.
237
- 2. **Context**: \`${ann.reference?.parentContext?.slice(0, 50)}...\`
238
-
239
- IMPORTANT: Respond in ${rawData.preferredLanguage === 'es' ? 'SPANISH' : 'ENGLISH'}.
235
+ _ia_fix_instruction: `### 🎯 DESIGN CONTEXT (Figma)
236
+ ${ann.figmaReference ? `A design reference is available: ${ann.figmaReference}` : 'No explicit design linked.'}
237
+
238
+ ${pendingCorrection ? `### ⚠️ PENDING CORRECTION\nUser feedback: "${pendingCorrection.text}"` : ''}
239
+
240
+ ### 🔬 FIX PROTOCOL
241
+ 1. **Target**: \`data-vg-id="${ann.reference?.vgId}"\` in \`${file}\`.
242
+ 2. **Context**: \`${ann.reference?.parentContext?.slice(0, 50)}...\`
243
+
244
+ IMPORTANT: Respond in ${rawData.preferredLanguage === 'es' ? 'SPANISH' : 'ENGLISH'}.
240
245
  Instruction: ${ann.message}`
241
246
  };
242
247
  });
@@ -307,9 +312,16 @@ Instruction: ${ann.message}`
307
312
  method: 'PATCH',
308
313
  headers: { 'x-api-key': apiKey, ...(personalKey ? { 'x-personal-key': personalKey } : {}) }
309
314
  });
315
+ return { content: [{ type: "text", text: "Optimization marked as applied." }] };
316
+ }
317
+ case "get_ai_resolved_tickets": {
318
+ const response = await fetch(`${BACKEND_URL}/api/mcp/resolved-tickets`, {
319
+ headers: { 'x-api-key': apiKey, ...(personalKey ? { 'x-personal-key': personalKey } : {}) }
320
+ });
310
321
  if (!response.ok)
311
322
  throw new Error(`Backend responded with ${response.status}`);
312
- return { content: [{ type: "text", text: "Optimization marked as applied." }] };
323
+ const data = await response.json();
324
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
313
325
  }
314
326
  default:
315
327
  throw new Error("Unknown tool");
@@ -0,0 +1,59 @@
1
+ import fetch from "node-fetch";
2
+ async function test() {
3
+ console.log("1. Connecting to http://localhost:3333/sse...");
4
+ const response = await fetch("http://localhost:3333/sse?apiKey=2af5628c9442f10b93cfe6970897d4de26578d958ba43a4e3bcb684fe0f92668");
5
+ if (!response.ok) {
6
+ console.error("Failed to connect to SSE:", response.status, await response.text());
7
+ return;
8
+ }
9
+ console.log("SSE connected. Reading stream for sessionId...");
10
+ const body = response.body;
11
+ let sessionId = null;
12
+ body.on("data", async (chunk) => {
13
+ const text = chunk.toString();
14
+ console.log("SSE Data:", text);
15
+ // Example event:
16
+ // event: endpoint
17
+ // data: /message?sessionId=...
18
+ const match = text.match(/sessionId=([a-f0-9-]+)/);
19
+ if (match && !sessionId) {
20
+ sessionId = match[1];
21
+ console.log("FOUND SESSION ID:", sessionId);
22
+ // 2. Test POST to /message
23
+ console.log(`2. Testing POST to /message?sessionId=${sessionId}...`);
24
+ const postResponse = await fetch(`http://localhost:3333/message?sessionId=${sessionId}`, {
25
+ method: 'POST',
26
+ headers: {
27
+ 'Content-Type': 'application/json'
28
+ },
29
+ body: JSON.stringify({
30
+ jsonrpc: "2.0",
31
+ id: 1,
32
+ method: "initialize",
33
+ params: {
34
+ clientInfo: { name: "test-client", version: "1.0.0" },
35
+ protocolVersion: "2024-11-05",
36
+ capabilities: {}
37
+ }
38
+ })
39
+ });
40
+ console.log("POST Response Status:", postResponse.status);
41
+ const responseText = await postResponse.text();
42
+ console.log("POST Response Body:", responseText);
43
+ if (postResponse.status === 200 || postResponse.status === 202) {
44
+ console.log("SUCCESS: Stream was readable and message was accepted.");
45
+ }
46
+ else {
47
+ console.error("FAILURE: Server returned error status.");
48
+ }
49
+ process.exit(0);
50
+ }
51
+ });
52
+ setTimeout(() => {
53
+ if (!sessionId) {
54
+ console.error("TIMEOUT: Did not receive sessionId from SSE.");
55
+ process.exit(1);
56
+ }
57
+ }, 10000);
58
+ }
59
+ test();
@@ -0,0 +1,23 @@
1
+ import fetch from "node-fetch";
2
+ async function test() {
3
+ console.log("Connecting to http://localhost:3333/sse...");
4
+ const response = await fetch("http://localhost:3333/sse?apiKey=test-key");
5
+ if (!response.ok) {
6
+ console.error("Failed to connect:", response.status, await response.text());
7
+ return;
8
+ }
9
+ console.log("Headers:", response.headers.raw());
10
+ const body = response.body;
11
+ body.on("data", (chunk) => {
12
+ console.log("Chunk received:", chunk.toString());
13
+ if (chunk.toString().includes("event: endpoint")) {
14
+ console.log("FOUND ENDPOINT EVENT!");
15
+ }
16
+ });
17
+ body.on("end", () => console.log("Connection closed"));
18
+ setTimeout(() => {
19
+ console.log("Closing test...");
20
+ process.exit(0);
21
+ }, 5000);
22
+ }
23
+ test();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-mcp",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "viewgate-mcp": "./dist/index.js"