viewgate-mcp 1.0.8 → 1.0.10
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 +51 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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
|
};
|
|
@@ -282,6 +304,35 @@ Instruction: ${ann.message}`
|
|
|
282
304
|
};
|
|
283
305
|
}
|
|
284
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
|
+
}
|
|
285
336
|
default:
|
|
286
337
|
throw new Error("Unknown tool");
|
|
287
338
|
}
|