@sassoftware/sas-score-mcp-serverjs 0.3.12 → 0.3.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassoftware/sas-score-mcp-serverjs",
3
- "version": "0.3.12",
3
+ "version": "0.3.15",
4
4
  "description": "A mcp server for SAS Viya",
5
5
  "author": "Deva Kumar <deva.kumar@sas.com>",
6
6
  "license": "Apache-2.0",
@@ -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
- throw new Error(`No transport found for session ID: ${sessionId}`);
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
@@ -160,17 +162,21 @@ const handleRequest = async (req, res) => {
160
162
  console.error("[Note] Using existing transport for session ID:", sessionId);
161
163
 
162
164
  await transport.handleRequest(req, res, req.body);
165
+ return;
163
166
  }
164
167
 
165
168
  // initialize request
166
169
  else if (!sessionId && isInitializeRequest(req.body)) {
167
170
  // create transport
168
171
  console.error("[Note] Initializing new transport for MCP session...");
172
+ console.error({body: JSON.stringify(req.body)});
169
173
  transport = new StreamableHTTPServerTransport({
170
174
  sessionIdGenerator: () => randomUUID(),
171
175
  enableJsonResponse: true,
176
+ enableDnsRebindingProtection: true,
172
177
  onsessioninitialized: (sessionId) => {
173
178
  // Store the transport by session ID
179
+ console.error("++++++++++++++++++++++++++++++ Transport initialized with ID:", sessionId);
174
180
  transports[sessionId] = transport;
175
181
  },
176
182
  });
@@ -186,9 +192,9 @@ const handleRequest = async (req, res) => {
186
192
  await mcpServer.connect(transport);
187
193
 
188
194
  // Save transport data and app context for use in tools
189
- console.error('connected mcpServe with session ID:', transport.sessionId);
195
+ console.error('connected mcpServer');
190
196
  cache.set("transports", transports);
191
- await transport.handleRequest(req, res, req.body);
197
+ return await transport.handleRequest(req, res, req.body);
192
198
  // cache transport
193
199
 
194
200
  }
@@ -7,7 +7,7 @@ function openAPIJson(version) {
7
7
  "swagger": "2.0",
8
8
  "info": {
9
9
  "title": "sas-score-mcp-serverjs API",
10
- "version": version,
10
+ "version": "1.0.0",
11
11
  "description": "sas-score-mcp-serverjs is a mcp server for SAS Viya"
12
12
  },
13
13
  "host": "localhost:8080",
@@ -17,9 +17,9 @@ function openAPIJson(version) {
17
17
  "produces": ["application/json"],
18
18
  "paths": {
19
19
  "/health": {
20
- "GET": {
20
+ "get": {
21
21
  "summary": "Health check",
22
- "operationId": "GetHealth",
22
+ "operationId": "getHealth",
23
23
  "description": "Returns health and version information.",
24
24
  "responses": {
25
25
  "200": {
@@ -39,7 +39,7 @@ function openAPIJson(version) {
39
39
  }
40
40
  },
41
41
  "/apiMeta": {
42
- "GET": {
42
+ "get": {
43
43
  "summary": "API metadata using apiMeta",
44
44
  "operationId": "GetApiMeta",
45
45
  "responses": {
@@ -50,8 +50,8 @@ function openAPIJson(version) {
50
50
  }
51
51
  }
52
52
  },
53
- "/openapi.json": {
54
- "GET": {
53
+ "/openapi.json": {
54
+ "get": {
55
55
  "summary": "API metadata using openapi.json",
56
56
  "operationId": "GetOpenApiJson",
57
57
  "description": "Returns the OpenAPI specification for this server.",
@@ -64,7 +64,7 @@ function openAPIJson(version) {
64
64
  }
65
65
  },
66
66
  "/mcp": {
67
- "OPTIONS": {
67
+ "options": {
68
68
  "summary": "CORS preflight",
69
69
  "operationId": "OptionsMcp",
70
70
  "description": "CORS preflight endpoint.",
@@ -72,7 +72,7 @@ function openAPIJson(version) {
72
72
  "204": { "description": "No Content" }
73
73
  }
74
74
  },
75
- "POST": {
75
+ "post": {
76
76
  "summary": "MCP request",
77
77
  "operationId": "PostMcp",
78
78
  "parameters": [
@@ -122,8 +122,8 @@ function openAPIJson(version) {
122
122
  }
123
123
  }
124
124
  },
125
- "GET": {
126
- "summary": "Get MCP session",
125
+ "get": {
126
+ "summary": "get MCP session",
127
127
  "operationId": "GetMcp",
128
128
  "description": "Retrieves information for an MCP session.",
129
129
  "parameters": [
@@ -145,7 +145,7 @@ function openAPIJson(version) {
145
145
  }
146
146
  }
147
147
  },
148
- "DELETE": {
148
+ "delete": {
149
149
  "summary": "Delete MCP session",
150
150
  "operationId": "DeleteMcp",
151
151
  "parameters": [
@@ -169,7 +169,7 @@ function openAPIJson(version) {
169
169
  }
170
170
  }
171
171
  }
172
- };
172
+ }
173
173
  spec.info.version = version;
174
174
  return spec;
175
175
  };