@sassoftware/sas-score-mcp-serverjs 0.3.19 → 0.3.29-0

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.
@@ -1,176 +1,176 @@
1
- /*
2
- * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- function openAPIJson(version) {
6
- let spec = {
7
- "swagger": "2.0",
8
- "info": {
9
- "title": "sas-score-mcp-serverjs API",
10
- "version": "1.0.0",
11
- "description": "sas-score-mcp-serverjs is a mcp server for SAS Viya"
12
- },
13
- "host": "localhost:8080",
14
- "basePath": "/",
15
- "schemes": ["http", "https"],
16
- "consumes": ["application/json"],
17
- "produces": ["application/json"],
18
- "paths": {
19
- "/health": {
20
- "get": {
21
- "summary": "Health check",
22
- "operationId": "getHealth",
23
- "description": "Returns health and version information.",
24
- "responses": {
25
- "200": {
26
- "description": "Health information",
27
- "schema": {
28
- "type": "object",
29
- "properties": {
30
- "name": { "type": "string" },
31
- "version": { "type": "string" },
32
- "description": { "type": "string" },
33
- "endpoints": { "type": "object" },
34
- "usage": { "type": "string" }
35
- }
36
- }
37
- }
38
- }
39
- }
40
- },
41
- "/apiMeta": {
42
- "get": {
43
- "summary": "API metadata using apiMeta",
44
- "operationId": "GetApiMeta",
45
- "responses": {
46
- "200": {
47
- "description": "OpenAPI document",
48
- "schema": { "type": "object" }
49
- }
50
- }
51
- }
52
- },
53
- "/openapi.json": {
54
- "get": {
55
- "summary": "API metadata using openapi.json",
56
- "operationId": "GetOpenApiJson",
57
- "description": "Returns the OpenAPI specification for this server.",
58
- "responses": {
59
- "200": {
60
- "description": "OpenAPI document",
61
- "schema": { "type": "object" }
62
- }
63
- }
64
- }
65
- },
66
- "/mcp": {
67
- "options": {
68
- "summary": "CORS preflight",
69
- "operationId": "OptionsMcp",
70
- "description": "CORS preflight endpoint.",
71
- "responses": {
72
- "204": { "description": "No Content" }
73
- }
74
- },
75
- "post": {
76
- "summary": "MCP request",
77
- "operationId": "PostMcp",
78
- "parameters": [
79
- {
80
- "name": "body",
81
- "in": "body",
82
- "required": true,
83
- "schema": { "type": "object" }
84
- },
85
- {
86
- "name": "Authorization",
87
- "in": "header",
88
- "required": false,
89
- "type": "string",
90
- "description": "Bearer token for authentication"
91
- },
92
- {
93
- "name": "X-VIYA-SERVER",
94
- "in": "header",
95
- "required": false,
96
- "type": "string",
97
- "description": "Override VIYA server"
98
- },
99
- {
100
- "name": "X-REFRESH-TOKEN",
101
- "in": "header",
102
- "required": false,
103
- "type": "string",
104
- "description": "Refresh token for authentication"
105
- },
106
- {
107
- "name": "mcp-session-id",
108
- "in": "header",
109
- "required": false,
110
- "type": "string",
111
- "description": "Session ID"
112
- }
113
- ],
114
- "responses": {
115
- "200": {
116
- "description": "MCP response",
117
- "schema": { "type": "object" }
118
- },
119
- "500": {
120
- "description": "Server error",
121
- "schema": { "type": "object" }
122
- }
123
- }
124
- },
125
- "get": {
126
- "summary": "get MCP session",
127
- "operationId": "GetMcp",
128
- "description": "Retrieves information for an MCP session.",
129
- "parameters": [
130
- {
131
- "name": "mcp-session-id",
132
- "in": "header",
133
- "required": true,
134
- "type": "string",
135
- "description": "Session ID"
136
- }
137
- ],
138
- "responses": {
139
- "200": {
140
- "description": "Session information",
141
- "schema": { "type": "object" }
142
- },
143
- "400": {
144
- "description": "Invalid or missing session ID"
145
- }
146
- }
147
- },
148
- "delete": {
149
- "summary": "Delete MCP session",
150
- "operationId": "DeleteMcp",
151
- "parameters": [
152
- {
153
- "name": "mcp-session-id",
154
- "in": "header",
155
- "required": true,
156
- "type": "string",
157
- "description": "Session ID"
158
- }
159
- ],
160
- "responses": {
161
- "200": {
162
- "description": "Session deleted",
163
- "schema": { "type": "object" }
164
- },
165
- "400": {
166
- "description": "Invalid or missing session ID"
167
- }
168
- }
169
- }
170
- }
171
- }
172
- }
173
- spec.info.version = version;
174
- return spec;
175
- };
1
+ /*
2
+ * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ function openAPIJson(version) {
6
+ let spec = {
7
+ "swagger": "2.0",
8
+ "info": {
9
+ "title": "sas-score-mcp-serverjs API",
10
+ "version": "1.0.0",
11
+ "description": "sas-score-mcp-serverjs is a mcp server for SAS Viya"
12
+ },
13
+ "host": "localhost:8080",
14
+ "basePath": "/",
15
+ "schemes": ["http", "https"],
16
+ "consumes": ["application/json"],
17
+ "produces": ["application/json"],
18
+ "paths": {
19
+ "/health": {
20
+ "get": {
21
+ "summary": "Health check",
22
+ "operationId": "getHealth",
23
+ "description": "Returns health and version information.",
24
+ "responses": {
25
+ "200": {
26
+ "description": "Health information",
27
+ "schema": {
28
+ "type": "object",
29
+ "properties": {
30
+ "name": { "type": "string" },
31
+ "version": { "type": "string" },
32
+ "description": { "type": "string" },
33
+ "endpoints": { "type": "object" },
34
+ "usage": { "type": "string" }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ },
41
+ "/apiMeta": {
42
+ "get": {
43
+ "summary": "API metadata using apiMeta",
44
+ "operationId": "GetApiMeta",
45
+ "responses": {
46
+ "200": {
47
+ "description": "OpenAPI document",
48
+ "schema": { "type": "object" }
49
+ }
50
+ }
51
+ }
52
+ },
53
+ "/openapi.json": {
54
+ "get": {
55
+ "summary": "API metadata using openapi.json",
56
+ "operationId": "GetOpenApiJson",
57
+ "description": "Returns the OpenAPI specification for this server.",
58
+ "responses": {
59
+ "200": {
60
+ "description": "OpenAPI document",
61
+ "schema": { "type": "object" }
62
+ }
63
+ }
64
+ }
65
+ },
66
+ "/mcp": {
67
+ "options": {
68
+ "summary": "CORS preflight",
69
+ "operationId": "OptionsMcp",
70
+ "description": "CORS preflight endpoint.",
71
+ "responses": {
72
+ "204": { "description": "No Content" }
73
+ }
74
+ },
75
+ "post": {
76
+ "summary": "MCP request",
77
+ "operationId": "PostMcp",
78
+ "parameters": [
79
+ {
80
+ "name": "body",
81
+ "in": "body",
82
+ "required": true,
83
+ "schema": { "type": "object" }
84
+ },
85
+ {
86
+ "name": "Authorization",
87
+ "in": "header",
88
+ "required": false,
89
+ "type": "string",
90
+ "description": "Bearer token for authentication"
91
+ },
92
+ {
93
+ "name": "X-VIYA-SERVER",
94
+ "in": "header",
95
+ "required": false,
96
+ "type": "string",
97
+ "description": "Override VIYA server"
98
+ },
99
+ {
100
+ "name": "X-REFRESH-TOKEN",
101
+ "in": "header",
102
+ "required": false,
103
+ "type": "string",
104
+ "description": "Refresh token for authentication"
105
+ },
106
+ {
107
+ "name": "mcp-session-id",
108
+ "in": "header",
109
+ "required": false,
110
+ "type": "string",
111
+ "description": "Session ID"
112
+ }
113
+ ],
114
+ "responses": {
115
+ "200": {
116
+ "description": "MCP response",
117
+ "schema": { "type": "object" }
118
+ },
119
+ "500": {
120
+ "description": "Server error",
121
+ "schema": { "type": "object" }
122
+ }
123
+ }
124
+ },
125
+ "get": {
126
+ "summary": "get MCP session",
127
+ "operationId": "GetMcp",
128
+ "description": "Retrieves information for an MCP session.",
129
+ "parameters": [
130
+ {
131
+ "name": "mcp-session-id",
132
+ "in": "header",
133
+ "required": true,
134
+ "type": "string",
135
+ "description": "Session ID"
136
+ }
137
+ ],
138
+ "responses": {
139
+ "200": {
140
+ "description": "Session information",
141
+ "schema": { "type": "object" }
142
+ },
143
+ "400": {
144
+ "description": "Invalid or missing session ID"
145
+ }
146
+ }
147
+ },
148
+ "delete": {
149
+ "summary": "Delete MCP session",
150
+ "operationId": "DeleteMcp",
151
+ "parameters": [
152
+ {
153
+ "name": "mcp-session-id",
154
+ "in": "header",
155
+ "required": true,
156
+ "type": "string",
157
+ "description": "Session ID"
158
+ }
159
+ ],
160
+ "responses": {
161
+ "200": {
162
+ "description": "Session deleted",
163
+ "schema": { "type": "object" }
164
+ },
165
+ "400": {
166
+ "description": "Invalid or missing session ID"
167
+ }
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
+ spec.info.version = version;
174
+ return spec;
175
+ };
176
176
  export default openAPIJson;
package/src/openApi.yaml CHANGED
@@ -1,121 +1,121 @@
1
- swagger: "2.0"
2
- info:
3
- title: SAS Viya Sample MCP Server API
4
- version: "1.0.0"
5
- description: API for interacting with the SAS Viya Sample MCP Server.
6
- host: localhost:8080
7
- basePath: /
8
- schemes:
9
- - http
10
- - https
11
- consumes:
12
- - application/json
13
- produces:
14
- - application/json
15
- paths:
16
- /health:
17
- get:
18
- summary: Health check
19
- description: Returns health and version information.
20
- responses:
21
- 200:
22
- description: Health information
23
- schema:
24
- type: object
25
- properties:
26
- name:
27
- type: string
28
- version:
29
- type: string
30
- description:
31
- type: string
32
- endpoints:
33
- type: object
34
- usage:
35
- type: string
36
- /apiMeta:
37
- get:
38
- summary: API metadata
39
- description: Returns the OpenAPI specification for this server.
40
- responses:
41
- 200:
42
- description: OpenAPI document
43
- schema:
44
- type: object
45
- /mcp:
46
- options:
47
- summary: CORS preflight
48
- description: CORS preflight endpoint.
49
- responses:
50
- 204:
51
- description: No Content
52
- post:
53
- summary: MCP request
54
- description: Handles MCP JSON-RPC requests.
55
- parameters:
56
- - name: body
57
- in: body
58
- required: true
59
- schema:
60
- type: object
61
- - name: Authorization
62
- in: header
63
- required: false
64
- type: string
65
- description: Bearer token for authentication
66
- - name: X-VIYA-SERVER
67
- in: header
68
- required: false
69
- type: string
70
- description: Override VIYA server
71
- - name: X-REFRESH-TOKEN
72
- in: header
73
- required: false
74
- type: string
75
- description: Refresh token for authentication
76
- - name: mcp-session-id
77
- in: header
78
- required: false
79
- type: string
80
- description: Session ID
81
- responses:
82
- 200:
83
- description: MCP response
84
- schema:
85
- type: object
86
- 500:
87
- description: Server error
88
- schema:
89
- type: object
90
- get:
91
- summary: Get MCP session
92
- description: Retrieves information for an MCP session.
93
- parameters:
94
- - name: mcp-session-id
95
- in: header
96
- required: true
97
- type: string
98
- description: Session ID
99
- responses:
100
- 200:
101
- description: Session information
102
- schema:
103
- type: object
104
- 400:
105
- description: Invalid or missing session ID
106
- delete:
107
- summary: Delete MCP session
108
- description: Deletes an MCP session.
109
- parameters:
110
- - name: mcp-session-id
111
- in: header
112
- required: true
113
- type: string
114
- description: Session ID
115
- responses:
116
- 200:
117
- description: Session deleted
118
- schema:
119
- type: object
120
- 400:
121
- description: Invalid or missing session ID
1
+ swagger: "2.0"
2
+ info:
3
+ title: SAS Viya Sample MCP Server API
4
+ version: "1.0.0"
5
+ description: API for interacting with the SAS Viya Sample MCP Server.
6
+ host: localhost:8080
7
+ basePath: /
8
+ schemes:
9
+ - http
10
+ - https
11
+ consumes:
12
+ - application/json
13
+ produces:
14
+ - application/json
15
+ paths:
16
+ /health:
17
+ get:
18
+ summary: Health check
19
+ description: Returns health and version information.
20
+ responses:
21
+ 200:
22
+ description: Health information
23
+ schema:
24
+ type: object
25
+ properties:
26
+ name:
27
+ type: string
28
+ version:
29
+ type: string
30
+ description:
31
+ type: string
32
+ endpoints:
33
+ type: object
34
+ usage:
35
+ type: string
36
+ /apiMeta:
37
+ get:
38
+ summary: API metadata
39
+ description: Returns the OpenAPI specification for this server.
40
+ responses:
41
+ 200:
42
+ description: OpenAPI document
43
+ schema:
44
+ type: object
45
+ /mcp:
46
+ options:
47
+ summary: CORS preflight
48
+ description: CORS preflight endpoint.
49
+ responses:
50
+ 204:
51
+ description: No Content
52
+ post:
53
+ summary: MCP request
54
+ description: Handles MCP JSON-RPC requests.
55
+ parameters:
56
+ - name: body
57
+ in: body
58
+ required: true
59
+ schema:
60
+ type: object
61
+ - name: Authorization
62
+ in: header
63
+ required: false
64
+ type: string
65
+ description: Bearer token for authentication
66
+ - name: X-VIYA-SERVER
67
+ in: header
68
+ required: false
69
+ type: string
70
+ description: Override VIYA server
71
+ - name: X-REFRESH-TOKEN
72
+ in: header
73
+ required: false
74
+ type: string
75
+ description: Refresh token for authentication
76
+ - name: mcp-session-id
77
+ in: header
78
+ required: false
79
+ type: string
80
+ description: Session ID
81
+ responses:
82
+ 200:
83
+ description: MCP response
84
+ schema:
85
+ type: object
86
+ 500:
87
+ description: Server error
88
+ schema:
89
+ type: object
90
+ get:
91
+ summary: Get MCP session
92
+ description: Retrieves information for an MCP session.
93
+ parameters:
94
+ - name: mcp-session-id
95
+ in: header
96
+ required: true
97
+ type: string
98
+ description: Session ID
99
+ responses:
100
+ 200:
101
+ description: Session information
102
+ schema:
103
+ type: object
104
+ 400:
105
+ description: Invalid or missing session ID
106
+ delete:
107
+ summary: Delete MCP session
108
+ description: Deletes an MCP session.
109
+ parameters:
110
+ - name: mcp-session-id
111
+ in: header
112
+ required: true
113
+ type: string
114
+ description: Session ID
115
+ responses:
116
+ 200:
117
+ description: Session deleted
118
+ schema:
119
+ type: object
120
+ 400:
121
+ description: Invalid or missing session ID
@@ -13,13 +13,14 @@ async function getLogonPayload(_appContext) {
13
13
  }
14
14
 
15
15
  async function igetLogonPayload(_appContext) {
16
-
16
+ console.error('[Info] Getting logon payload...',_appContext.AUTHFLOW);
17
17
  // Use cached logonPayload if available
18
18
  // This will cause timeouts if the token expires
19
- if (_appContext.contexts.logonPayload != null && _appContext.tokenRefresh !== true) {
19
+ /*if (_appContext.contexts.logonPayload != null && _appContext.tokenRefresh !== true) {
20
20
  console.error("[Note] Using cached logonPayload information");
21
21
  return _appContext.contexts.logonPayload;
22
22
  }
23
+ */
23
24
 
24
25
  if (_appContext.AUTHFLOW === 'code') {
25
26
  let oauthInfo = _appContext.contexts.oauthInfo;
@@ -52,17 +53,18 @@ async function igetLogonPayload(_appContext) {
52
53
  token: _appContext.bearerToken,
53
54
  tokenType: "Bearer",
54
55
  };
56
+ console.error("[Note] Bearer token in logonPayload ", _appContext.bearerToken);
55
57
  return logonPayload;
56
58
  }
57
59
 
58
60
  // Use user supplied refresh token-
59
61
  if (_appContext.AUTHFLOW === "refresh") {
60
- console.error("[Note] Using user supplied refresh token");
61
- let token = await refreshToken(_appContext,{token: _appContext.refreshToken, host: _appContext.VIYA_SERVER});
62
+ console.error("[Note] Using user supplied refresh token", _appContext.REFRESH_TOKEN);
63
+ let token = await refreshToken(_appContext,{token: _appContext.REFRESH_TOKEN, host: _appContext.VIYA_SERVER});
62
64
  let logonPayload = {
63
65
  host: _appContext.VIYA_SERVER,
64
66
  authType: "server",
65
- token: token,
67
+ token: token,
66
68
  tokenType: "Bearer",
67
69
  };
68
70
 
@@ -97,8 +99,8 @@ async function igetLogonPayload(_appContext) {
97
99
  authType: "password",
98
100
  user: _appContext.USERNAME,
99
101
  password: _appContext.PASSWORD,
100
- clientID: _appContext.CLIENTIDPW,
101
- clientSecret: _appContext.CLIENTSECRETPW,
102
+ clientID: _appContext.CLIENTID,
103
+ clientSecret: _appContext.CLIENTSECRET,
102
104
  };
103
105
 
104
106
  return logonPayload;
@@ -2,11 +2,10 @@
2
2
  * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- import getOptsViya from './getOptsViya.js';
6
5
 
7
6
  function getStoreOpts(_appContext) {
8
7
 
9
- let opts = getOptsViya(_appContext);
8
+ let opts = _appContext.contexts.viyaCert;
10
9
  let storeOpts = {
11
10
  casProxy: true,
12
11
  httpOptions: { ...opts, rejectUnauthorized: true }
@@ -15,7 +15,6 @@ async function getToken(_appContext) {
15
15
  let sep = (os.platform() === 'win32') ? '\\' : '/';
16
16
  let credentials = homedir + sep + '.sas' + sep + 'credentials.json';
17
17
  let url = homedir + sep + '.sas' + sep + 'config.json';
18
- console.error('[Note] Using credentials file: ' + credentials);
19
18
  console.error('[Note] Using config file: ' + url);
20
19
  let profile = (_appContext.SAS_CLI_PROFILE == null || _appContext.SAS_CLI_PROFILE.toLowerCase() === 'default')
21
20
  ? 'Default' : _appContext.SAS_CLI_PROFILE;