@sassoftware/sas-score-mcp-serverjs 0.3.14 → 0.3.16
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 +1 -1
- package/src/expressMcpServer.js +16 -1
package/package.json
CHANGED
package/src/expressMcpServer.js
CHANGED
|
@@ -140,7 +140,9 @@ const handleRequest = async (req, res) => {
|
|
|
140
140
|
transport = transports[sessionId];
|
|
141
141
|
console.error("Found transport:", transport != null);
|
|
142
142
|
if (transport == null) {
|
|
143
|
-
|
|
143
|
+
console.error("[Error] No transport found for session ID:", sessionId, "Returning a 400 error with instructions for the user");
|
|
144
|
+
res.status(400).send(`Invalid or missing session ID ${sessionId}. Please ensure your MCP client is configured to use the correct session ID returned in the 'mcp-session-id' header of the response from the /mcp endpoint.`);
|
|
145
|
+
return;
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
// post the curren session - used to pass _appContext to tools
|
|
@@ -167,6 +169,7 @@ const handleRequest = async (req, res) => {
|
|
|
167
169
|
else if (!sessionId && isInitializeRequest(req.body)) {
|
|
168
170
|
// create transport
|
|
169
171
|
console.error("[Note] Initializing new transport for MCP session...");
|
|
172
|
+
console.error({body: JSON.stringify(req.body)});
|
|
170
173
|
transport = new StreamableHTTPServerTransport({
|
|
171
174
|
sessionIdGenerator: () => randomUUID(),
|
|
172
175
|
enableJsonResponse: true,
|
|
@@ -233,6 +236,18 @@ app.options("/mcp", (_, res) => res.sendStatus(204));
|
|
|
233
236
|
app.post("/mcp", requireBearer, handleRequest);
|
|
234
237
|
app.get("/mcp", handleGetDelete);
|
|
235
238
|
app.delete("/mcp", handleGetDelete);
|
|
239
|
+
app.get("/startup", (_req, res) => {
|
|
240
|
+
if (appServer == null) {
|
|
241
|
+
return res.status(500).json({ status: "starting" });
|
|
242
|
+
}
|
|
243
|
+
return res.status(200).json({ status: "started" });
|
|
244
|
+
});
|
|
245
|
+
app.get("/ready", (_req, res) => {
|
|
246
|
+
if (appServer == null) {
|
|
247
|
+
return res.status(500).json({ status: "not ready" });
|
|
248
|
+
}
|
|
249
|
+
return res.status(200).json({ status: "ready" });
|
|
250
|
+
});
|
|
236
251
|
|
|
237
252
|
// Start the server
|
|
238
253
|
let appEnvBase = cache.get("appEnvBase");
|