@sassoftware/sas-score-mcp-serverjs 0.3.15 → 0.3.17
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/package.json +2 -2
- package/src/expressMcpServer.js +31 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sassoftware/sas-score-mcp-serverjs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.17",
|
|
4
4
|
"description": "A mcp server for SAS Viya",
|
|
5
5
|
"author": "Deva Kumar <deva.kumar@sas.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"debug": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node --inspect-brk cli.js",
|
|
17
17
|
"getViyatls": "bash ./scripts/getViyaca.sh",
|
|
18
18
|
"deploy": "bash ./deploy.sh",
|
|
19
|
-
"push2acr": "bash ./push2acr.sh",
|
|
19
|
+
"push2acr": "cd docker && bash ./push2acr.sh",
|
|
20
20
|
"bump": "npm version prerelease",
|
|
21
21
|
"pub": "npm publish --tag dev --access public"
|
|
22
22
|
},
|
package/src/expressMcpServer.js
CHANGED
|
@@ -26,6 +26,7 @@ async function expressMcpServer(mcpServer, cache, baseAppEnvContext) {
|
|
|
26
26
|
cache.set("headerCache", {});
|
|
27
27
|
|
|
28
28
|
const app = express();
|
|
29
|
+
let appStatus = false;
|
|
29
30
|
|
|
30
31
|
app.use(express.json({ limit: "50mb" }));
|
|
31
32
|
app.use(
|
|
@@ -49,6 +50,9 @@ async function expressMcpServer(mcpServer, cache, baseAppEnvContext) {
|
|
|
49
50
|
// setup routes
|
|
50
51
|
app.get("/health", (req, res) => {
|
|
51
52
|
console.error("Received request for health endpoint");
|
|
53
|
+
if (appStatus === false) {
|
|
54
|
+
return res.status(500).json({ status: "not healthy" });
|
|
55
|
+
}
|
|
52
56
|
let health = {
|
|
53
57
|
name: "@sassoftware/mcp-server",
|
|
54
58
|
version: baseAppEnvContext.version,
|
|
@@ -236,7 +240,29 @@ app.options("/mcp", (_, res) => res.sendStatus(204));
|
|
|
236
240
|
app.post("/mcp", requireBearer, handleRequest);
|
|
237
241
|
app.get("/mcp", handleGetDelete);
|
|
238
242
|
app.delete("/mcp", handleGetDelete);
|
|
243
|
+
app.get("/startup", (_req, res) => {
|
|
244
|
+
console.error("Received request for startup endpoint");
|
|
245
|
+
if (appStatus === false) {
|
|
246
|
+
return res.status(500).json({ status: "starting" });
|
|
247
|
+
}
|
|
248
|
+
return res.status(200).json({ status: "started" });
|
|
249
|
+
});
|
|
239
250
|
|
|
251
|
+
app.get("/status", (_req, res) => {
|
|
252
|
+
console.error("Received request for status endpoint. Current app status:", appStatus);
|
|
253
|
+
if (appStatus === false) {
|
|
254
|
+
return res.status(500).json({ status: "not ready" });
|
|
255
|
+
}
|
|
256
|
+
return res.status(200).json({ status: "ready" });
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
app.get("/ready", (_req, res) => {
|
|
260
|
+
console.error("Received request for ready endpoint. Current app status:", appStatus);
|
|
261
|
+
if (appStatus === false) {
|
|
262
|
+
return res.status(500).json({ status: "not ready" });
|
|
263
|
+
}
|
|
264
|
+
return res.status(200).json({ status: "ready" });
|
|
265
|
+
});
|
|
240
266
|
// Start the server
|
|
241
267
|
let appEnvBase = cache.get("appEnvBase");
|
|
242
268
|
|
|
@@ -267,7 +293,10 @@ if (appEnvBase.HTTPS === 'TRUE') {
|
|
|
267
293
|
console.error("[Note] Press Ctrl+C to stop the server");
|
|
268
294
|
|
|
269
295
|
appServer = https.createServer(appEnvBase.tlsOpts, app);
|
|
270
|
-
appServer.listen(PORT, "0.0.0.0", () => {
|
|
296
|
+
appServer.listen(PORT, "0.0.0.0", () => {
|
|
297
|
+
console.error( `[Note] Express server successfully bound to 0.0.0.0:${PORT}` );
|
|
298
|
+
appStatus= true;
|
|
299
|
+
});
|
|
271
300
|
} else {
|
|
272
301
|
console.error(`[Note] MCP Server listening on port ${PORT}`);
|
|
273
302
|
console.error("[Note] Visit http://localhost:8080/health for health check");
|
|
@@ -277,6 +306,7 @@ if (appEnvBase.HTTPS === 'TRUE') {
|
|
|
277
306
|
console.error("[Note] Press Ctrl+C to stop the server");
|
|
278
307
|
try {
|
|
279
308
|
appServer = app.listen(PORT, "0.0.0.0", () => {
|
|
309
|
+
appStatus = true;
|
|
280
310
|
console.error(
|
|
281
311
|
`[Note] Express server successfully bound to 0.0.0.0:${PORT}`
|
|
282
312
|
);
|