viewgate-mcp 1.0.3 → 1.0.5
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 +21 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20,9 +20,15 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
|
|
|
20
20
|
import fetch from "node-fetch";
|
|
21
21
|
import cors from "cors";
|
|
22
22
|
import dotenv from "dotenv";
|
|
23
|
-
|
|
23
|
+
import path from "path";
|
|
24
|
+
import { fileURLToPath } from "url";
|
|
25
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
26
|
+
const __dirname = path.dirname(__filename);
|
|
27
|
+
dotenv.config({ path: path.join(__dirname, "..", ".env") });
|
|
24
28
|
const port = process.env.PORT || 3000;
|
|
25
29
|
const BACKEND_URL = process.env.BACKEND_URL || "https://view-gate.vercel.app";
|
|
30
|
+
console.error(`[MCP Config] BACKEND_URL: ${BACKEND_URL}`);
|
|
31
|
+
console.error(`[MCP Config] API_KEY Prefix: ${process.env.API_KEY?.substring(0, 5)}...`);
|
|
26
32
|
// Store active sessions for SSE: sessionId -> { server, transport }
|
|
27
33
|
const sessions = new Map();
|
|
28
34
|
/**
|
|
@@ -42,7 +48,7 @@ function createMcpServer(apiKey) {
|
|
|
42
48
|
tools: [
|
|
43
49
|
{
|
|
44
50
|
name: "get_annotations",
|
|
45
|
-
description: "Retrieves all feedback annotations. For each annotation, follow the '_ia_fix_instruction' to perform a FAST, SURGICAL fix. Use 'outerHtml' and 'source' (file:line) to locate the exact code block without manual searching.",
|
|
51
|
+
description: "Retrieves all feedback annotations. For each annotation, follow the '_ia_fix_instruction' to perform a FAST, SURGICAL fix. 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.",
|
|
46
52
|
inputSchema: {
|
|
47
53
|
type: "object",
|
|
48
54
|
properties: {},
|
|
@@ -72,7 +78,7 @@ function createMcpServer(apiKey) {
|
|
|
72
78
|
},
|
|
73
79
|
{
|
|
74
80
|
name: "planning",
|
|
75
|
-
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).",
|
|
81
|
+
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.",
|
|
76
82
|
inputSchema: {
|
|
77
83
|
type: "object",
|
|
78
84
|
properties: {
|
|
@@ -116,7 +122,7 @@ function createMcpServer(apiKey) {
|
|
|
116
122
|
throw new Error(`Backend responded with ${response.status}`);
|
|
117
123
|
}
|
|
118
124
|
const data = (await response.json());
|
|
119
|
-
const rawAnnotations = Array.isArray(data) ? data : (data?.data || []);
|
|
125
|
+
const rawAnnotations = Array.isArray(data) ? data : (data?.data || data?.annotations || []);
|
|
120
126
|
if (!Array.isArray(rawAnnotations)) {
|
|
121
127
|
return {
|
|
122
128
|
content: [{ type: "text", text: "Error: Invalid format" }],
|
|
@@ -175,7 +181,10 @@ function createMcpServer(apiKey) {
|
|
|
175
181
|
content: [
|
|
176
182
|
{
|
|
177
183
|
type: "text",
|
|
178
|
-
text: JSON.stringify(
|
|
184
|
+
text: JSON.stringify({
|
|
185
|
+
preferredLanguage: data.preferredLanguage || 'en',
|
|
186
|
+
annotations: annotationsWithTips
|
|
187
|
+
}, null, 2),
|
|
179
188
|
},
|
|
180
189
|
],
|
|
181
190
|
};
|
|
@@ -230,7 +239,13 @@ function createMcpServer(apiKey) {
|
|
|
230
239
|
}
|
|
231
240
|
const data = (await response.json());
|
|
232
241
|
return {
|
|
233
|
-
content: [{
|
|
242
|
+
content: [{
|
|
243
|
+
type: "text",
|
|
244
|
+
text: JSON.stringify({
|
|
245
|
+
preferredLanguage: data.preferredLanguage || 'en',
|
|
246
|
+
backlog: data.data || []
|
|
247
|
+
}, null, 2)
|
|
248
|
+
}]
|
|
234
249
|
};
|
|
235
250
|
}
|
|
236
251
|
else {
|