@sassoftware/sas-score-mcp-serverjs 0.3.16 → 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 +22 -4
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,
|
|
@@ -237,18 +241,28 @@ app.post("/mcp", requireBearer, handleRequest);
|
|
|
237
241
|
app.get("/mcp", handleGetDelete);
|
|
238
242
|
app.delete("/mcp", handleGetDelete);
|
|
239
243
|
app.get("/startup", (_req, res) => {
|
|
240
|
-
|
|
244
|
+
console.error("Received request for startup endpoint");
|
|
245
|
+
if (appStatus === false) {
|
|
241
246
|
return res.status(500).json({ status: "starting" });
|
|
242
247
|
}
|
|
243
248
|
return res.status(200).json({ status: "started" });
|
|
244
249
|
});
|
|
245
|
-
|
|
246
|
-
|
|
250
|
+
|
|
251
|
+
app.get("/status", (_req, res) => {
|
|
252
|
+
console.error("Received request for status endpoint. Current app status:", appStatus);
|
|
253
|
+
if (appStatus === false) {
|
|
247
254
|
return res.status(500).json({ status: "not ready" });
|
|
248
255
|
}
|
|
249
256
|
return res.status(200).json({ status: "ready" });
|
|
250
257
|
});
|
|
251
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
|
+
});
|
|
252
266
|
// Start the server
|
|
253
267
|
let appEnvBase = cache.get("appEnvBase");
|
|
254
268
|
|
|
@@ -279,7 +293,10 @@ if (appEnvBase.HTTPS === 'TRUE') {
|
|
|
279
293
|
console.error("[Note] Press Ctrl+C to stop the server");
|
|
280
294
|
|
|
281
295
|
appServer = https.createServer(appEnvBase.tlsOpts, app);
|
|
282
|
-
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
|
+
});
|
|
283
300
|
} else {
|
|
284
301
|
console.error(`[Note] MCP Server listening on port ${PORT}`);
|
|
285
302
|
console.error("[Note] Visit http://localhost:8080/health for health check");
|
|
@@ -289,6 +306,7 @@ if (appEnvBase.HTTPS === 'TRUE') {
|
|
|
289
306
|
console.error("[Note] Press Ctrl+C to stop the server");
|
|
290
307
|
try {
|
|
291
308
|
appServer = app.listen(PORT, "0.0.0.0", () => {
|
|
309
|
+
appStatus = true;
|
|
292
310
|
console.error(
|
|
293
311
|
`[Note] Express server successfully bound to 0.0.0.0:${PORT}`
|
|
294
312
|
);
|