@sassoftware/sas-score-mcp-serverjs 1.0.1-8 → 1.1.1

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.
Files changed (121) hide show
  1. package/.skills/.claude-plugin/plugin.json +59 -0
  2. package/.skills/agents/sas-score-mcp-serverjs-agent.md +26 -0
  3. package/.skills/copilot-instructions.md +62 -0
  4. package/.skills/skills/README.md +204 -0
  5. package/.skills/skills/detail-strategy/SKILL.md +316 -0
  6. package/.skills/skills/find-library-server/SKILL.md +62 -0
  7. package/.skills/skills/find-resources/SKILL.md +66 -0
  8. package/.skills/skills/list-library/SKILL.md +30 -0
  9. package/.skills/skills/list-mas-job-jobdef/SKILL.md +31 -0
  10. package/.skills/skills/list-tables/SKILL.md +30 -0
  11. package/.skills/skills/read-strategy/SKILL.md +87 -0
  12. package/.skills/skills/request-routing/SKILL.md +112 -0
  13. package/.skills/skills/score-cas/SKILL.md +95 -0
  14. package/.skills/skills/score-job-jobdef/SKILL.md +58 -0
  15. package/.skills/skills/score-mas-scr/SKILL.md +58 -0
  16. package/.skills/skills/score-program/SKILL.md +59 -0
  17. package/.skills/skills/score-strategy/SKILL.md +39 -0
  18. package/README.md +96 -54
  19. package/cli.js +29 -38
  20. package/openApi.yaml +121 -121
  21. package/package.json +15 -13
  22. package/scripts/docs/SCORE_SKILL_REFERENCE.md +17 -16
  23. package/scripts/docs/TOOL_DESCRIPTION_TEMPLATE.md +3 -3
  24. package/scripts/docs/TOOL_UPDATES_SUMMARY.md +65 -63
  25. package/scripts/docs/oauth-http-transport.md +2 -2
  26. package/scripts/docs/sas-mcp-tools-reference.md +43 -32
  27. package/scripts/plot_msrp_usa.py +49 -0
  28. package/scripts/refreshtoken.js +58 -0
  29. package/scripts/runListScr.mjs +16 -0
  30. package/src/createMcpServer.js +4 -1
  31. package/src/expressMcpServer.js +47 -49
  32. package/src/oauthHandlers/authorize.js +4 -1
  33. package/src/oauthHandlers/baseUrl.js +4 -0
  34. package/src/oauthHandlers/callback.js +4 -0
  35. package/src/oauthHandlers/getMetadata.js +4 -0
  36. package/src/oauthHandlers/index.js +4 -0
  37. package/src/oauthHandlers/token.js +4 -0
  38. package/src/openApi.yaml +121 -121
  39. package/src/processHeaders.js +10 -7
  40. package/src/setupSkills.js +6 -9
  41. package/src/toolHelpers/_casScore.js +32 -0
  42. package/src/toolHelpers/_desc.js +14 -0
  43. package/src/toolHelpers/_findJob.js +12 -0
  44. package/src/toolHelpers/_findJobdef.js +10 -0
  45. package/src/toolHelpers/_findLibrary.js +11 -0
  46. package/src/toolHelpers/_findMas.js +13 -0
  47. package/src/toolHelpers/_findScr.js +36 -0
  48. package/src/toolHelpers/_findTable.js +11 -0
  49. package/src/toolHelpers/_listJobdefs.js +12 -2
  50. package/src/toolHelpers/_listJobs.js +19 -8
  51. package/src/toolHelpers/{_listModels.js → _listMas.js} +4 -4
  52. package/src/toolHelpers/_listScr.js +13 -0
  53. package/src/toolHelpers/{_scrInfo.js → _scrDescribe.js} +4 -4
  54. package/src/toolHelpers/_scrScore.js +2 -2
  55. package/src/toolHelpers/_submitCasl.js +19 -17
  56. package/src/toolHelpers/{_tableInfo.js → _tableDescribe.js} +2 -2
  57. package/src/toolHelpers/getLogonPayload.js +2 -2
  58. package/src/toolSet/casModelScore.js +93 -0
  59. package/src/toolSet/casProgramScore.js +105 -0
  60. package/src/toolSet/devaScore.js +11 -6
  61. package/src/toolSet/findJob.js +74 -59
  62. package/src/toolSet/findJobdef.js +67 -64
  63. package/src/toolSet/findLibrary.js +28 -23
  64. package/src/toolSet/findMas.js +72 -0
  65. package/src/toolSet/findScr.js +69 -0
  66. package/src/toolSet/findTable.js +34 -27
  67. package/src/toolSet/getEnv.js +57 -57
  68. package/src/toolSet/jobDescribe.js +65 -0
  69. package/src/toolSet/jobScore.js +90 -0
  70. package/src/toolSet/jobdefDescribe.js +67 -0
  71. package/src/toolSet/jobdefScore.js +85 -0
  72. package/src/toolSet/listJobdefs.js +17 -8
  73. package/src/toolSet/listJobs.js +15 -8
  74. package/src/toolSet/listLibraries.js +16 -10
  75. package/src/toolSet/listMas.js +71 -0
  76. package/src/toolSet/listScr.js +62 -0
  77. package/src/toolSet/listTables.js +78 -66
  78. package/src/toolSet/{runMacro.js → macroScore.js} +86 -82
  79. package/src/toolSet/makeTools.js +39 -25
  80. package/src/toolSet/masDescribe.js +67 -0
  81. package/src/toolSet/masScore.js +95 -0
  82. package/src/toolSet/{runProgram.js → programScore.js} +96 -93
  83. package/src/toolSet/readTable.js +43 -26
  84. package/src/toolSet/sasQuery.js +24 -18
  85. package/src/toolSet/scrDescribe.js +55 -0
  86. package/src/toolSet/scrScore.js +63 -70
  87. package/src/toolSet/searchAssets.js +1 -1
  88. package/src/toolSet/setContext.js +8 -3
  89. package/src/toolSet/superstat.js +61 -61
  90. package/src/toolSet/tableDescribe.js +65 -0
  91. package/.skills/sas-find-library-smart/SKILL.md +0 -155
  92. package/.skills/sas-find-resource-strategy/SKILL.md +0 -105
  93. package/.skills/sas-list-resource-strategy/SKILL.md +0 -124
  94. package/.skills/sas-list-tables-smart/SKILL.md +0 -128
  95. package/.skills/sas-read-and-score-strategy/SKILL.md +0 -113
  96. package/.skills/sas-read-strategy/SKILL.md +0 -154
  97. package/.skills/sas-request-classifier/SKILL.md +0 -74
  98. package/.skills/sas-score-workflow-strategy/SKILL.md +0 -314
  99. package/.skills_claude/CLAUDE.md +0 -201
  100. package/.skills_claude/agents/sas-score-mcp-serverjs-agent.md +0 -58
  101. package/.skills_claude/enforce-find-resource-strategy.md +0 -35
  102. package/.skills_github/agents/sas-score-mcp-serverjs-agent.md +0 -58
  103. package/.skills_github/copilot-instructions.md +0 -201
  104. package/.skills_github/enforce-find-resource-strategy.md +0 -35
  105. package/scripts/optimize_final.py +0 -140
  106. package/scripts/optimize_tools.py +0 -99
  107. package/scripts/setup-skills.js +0 -34
  108. package/scripts/update_descriptions.py +0 -46
  109. package/src/authpkce.js +0 -219
  110. package/src/handleGetDelete.js +0 -34
  111. package/src/handleRequest.js +0 -112
  112. package/src/hapiMcpServer.js +0 -241
  113. package/src/toolSet/findModel.js +0 -60
  114. package/src/toolSet/listModels.js +0 -56
  115. package/src/toolSet/modelInfo.js +0 -55
  116. package/src/toolSet/modelScore.js +0 -89
  117. package/src/toolSet/runCasProgram.js +0 -98
  118. package/src/toolSet/runJob.js +0 -81
  119. package/src/toolSet/runJobdef.js +0 -82
  120. package/src/toolSet/scrInfo.js +0 -52
  121. package/src/toolSet/tableInfo.js +0 -58
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: score-program
3
+ description: >
4
+ Scoring workflow for SAS Program and Macro model types.
5
+ Use when the user wants to score with a SAS program , or when the user references a SAS macro by name.
6
+ For CAS programs (casl) or CAS model tables, use score-cas instead.
7
+ No pre-verification step — programs are scored directly.
8
+ Handles both inline scenario scoring and table row scoring.
9
+ ---
10
+
11
+ # Score SAS Program / Macro
12
+
13
+ ## When to use this skill
14
+ - When the user wants to score a SAS program (`.sas`),
15
+ - User references a SAS macro by name (Macro)
16
+
17
+ > For CAS programs (`.casl`) or CAS model tables, use the **score-cas** skill instead.
18
+
19
+ ## Tools
20
+
21
+ | Type | Verify | Score |
22
+ |---|---|---|
23
+ | Program | *(no pre-check)* | `sas-score-program-score` |
24
+ | Macro | *(no pre-check)* | `sas-score-macro-score` |
25
+
26
+ ## Inline Scenario Scoring
27
+
28
+ **Program (`.sas`):**
29
+ - Score directly: `sas-score-program-score({ src, scenario, folder, output, limit })`
30
+
31
+ **Macro:**
32
+ - Score directly: `sas-score-macro-score({ macro, scenario })`
33
+
34
+ > No verification step for any program type — they are executed directly.
35
+
36
+ ## Table Row Scoring
37
+
38
+ **Parsing row count:**
39
+
40
+ | User says | start | limit |
41
+ |---|---|---|
42
+ | "score the first N rows from lib.table" | 1 | N |
43
+ | "score N rows from lib.table" | 1 | N |
44
+ | (count not specified) | 1 | 10 |
45
+
46
+ **Flow:**
47
+ 1. Read table → use read-strategy skill
48
+ 2. Score each row — tools accept a single row; loop over rows calling the tool for each
49
+ 3. Return rows with predictions appended
50
+ 4. Cap batch at 10 rows by default; ask user before proceeding with larger batches
51
+
52
+ ## Error Handling
53
+
54
+ | Error | Action |
55
+ |---|---|
56
+ | Program source not found | Confirm `src` path or folder with user |
57
+ | Table not found | Confirm table name and library |
58
+ | Empty table | Ask user to adjust filter or confirm criteria |
59
+ | Scoring failure | Return tool error verbatim |
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: score-strategy
3
+ description: >
4
+ Scoring router — classifies model type and delegates to the appropriate scoring skill.
5
+ Use this as the entry point for any scoring request.
6
+ ---
7
+
8
+ # Score Strategy (Router)
9
+
10
+ ## Step 1 — Identify model type
11
+
12
+ Use the `a.b` notation rule from request-routing:
13
+
14
+ | Suffix `b` | Model type | Skill to use |
15
+ |---|---|---|
16
+ | `.mas` or *(no suffix — default)* | MAS | **score-mas-scr** |
17
+ | `.scr` | SCR | **score-mas-scr** |
18
+ | `.job` | Job | **score-job-jobdef** |
19
+ | `.jobdef` | JobDef | **score-job-jobdef** |
20
+ | `.sas` | SAS Program | **score-program** |
21
+ | `.casl` | CAS Program (inline src) | **score-cas** |
22
+ | CAS model table (`lib.table` form, no recognized suffix) + user says "cas model" | CAS Model | **score-cas** |
23
+ | Macro name (no `.` suffix) | Macro | **score-program** |
24
+
25
+ ## Step 2 — Delegate
26
+
27
+ Load the appropriate skill and follow its workflow:
28
+
29
+ - **MAS / SCR** → `score-mas-scr` skill
30
+ - **Job / JobDef** → `score-job-jobdef` skill
31
+ - **SAS Program / Macro** → `score-program` skill
32
+ - **CAS Program / CAS Model** → `score-cas` skill
33
+
34
+ ## Model Type from `a.b` Notation
35
+
36
+ Short form: if `b ∈ {mas, job, jobdef, scr, sas, casl}` → model type suffix; anything else → table reference.
37
+ Default (no suffix) → MAS.
38
+
39
+ > **CAS disambiguation:** if the user explicitly says "cas model" or "casmodel" with a `lib.table` reference (no `.casl` suffix), route to **score-cas** with `casmodel` param instead of the MAS default.
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # sas-score-mcp-serverjs
2
- A Model Context Protocol (MCP) Server for Scoring with SAS Viya
2
+ A Model Context Protocol (MCP) Server for Scoring with SAS Viya.
3
+ See [wiki](https://github.com/sassoftware/sas-score-mcp-serverjs/wiki) for the capabilities of the server.
3
4
 
4
5
  ## Major changes in release 1.0.0
5
6
 
@@ -8,6 +9,8 @@ A Model Context Protocol (MCP) Server for Scoring with SAS Viya
8
9
 
9
10
  - Agent - can be deployed as an agent
10
11
 
12
+ - Docker image: ghcr.io/sassoftware/sas-score-mcp-serverjs
13
+
11
14
 
12
15
  ## Overview
13
16
  This MCP server is designed for scoring with SAS Viya.
@@ -22,6 +25,33 @@ Some examples are:
22
25
  - job Definitions
23
26
  - jobs using SAS Studio or other interfaces
24
27
 
28
+ ## Start the mcp server
29
+
30
+ If using stdio transport, most of the mcp clients will start the server automatically.
31
+ But for http transport, the mcp server must be started.
32
+
33
+ If running locally
34
+ ```sh
35
+ npx @sassoftware/sas-score-mcp-serverjs@latest
36
+ ```
37
+
38
+ The mcp is also available as a docker image. Add or remove the env variables as needed.
39
+
40
+ ```sh
41
+ docker run -p 8080:8080 --name sasscore -e VIYA_SERVER=<yourviyaserver> -e AUTHFLOW=oauth ghcr.io/sassoftware/sas-score-mcp-serverjs:latest
42
+ ```
43
+
44
+ ## Capabilities
45
+
46
+ The tools can be grouped into these categories
47
+
48
+ - Scoring with MAS models, job, jobdef and scr
49
+ - Viewing and querying tables
50
+
51
+ Supporting tools can be grouped into these categories
52
+ - Listing of MAS models, job, jobdef , tables
53
+ - Describing MAS models, job, jobdef, scr and tables
54
+
25
55
  ## Target Audience
26
56
  This MCP server was developed for two types of SAS users.
27
57
 
@@ -44,88 +74,102 @@ Typically these are set either in the .env file or as environment variables or a
44
74
 
45
75
  ### Required Options
46
76
 
47
- VIYA_SERVER=<url for Viya server>
48
- MCPTYPE=http|stdio
49
- MCPHOST=<url for the mcp server = http://localhost:8080 or some remote mcp server>
77
+ 1. VIYA_SERVER=
78
+ <url for Viya server>.
50
79
 
51
- >Recommended authflow is oauth - the most secure of all the options since all oauth flow occurs in the server and the actual token is never sent to the client. Bearer authflow is useful when the mcp server is remote with its own authentication process
80
+ ### Options with defaults
52
81
 
53
- AUTHFLOW=oauth|oauthclient|bearer|sascli|token|password
82
+ These can be customized
54
83
 
55
- > Options for oauth. The clientid must have a redirect of http://localhost:8080/callback,https://localhost:8080/callback
84
+ 1. AUTHFLOW=**oauth**|oauthclient|bearer|sascli|token|password
85
+ - Authentication method. Default is oauth
56
86
 
57
- CLIENTID=<pkce clientid>
87
+ 2. CLIENTID=**vscodemcp**
88
+ - Clientid for oauth and oauthclient AUTHFlOW. Must be PKCE clientid.
89
+
58
90
 
91
+ 3. MCPTYPE=**http**|stdio
92
+ - The transport protocol for the mcp server.
59
93
 
60
- > OauthClient Flow. Clientid with redirect appropriate for the client. Some examples are shown below. Note that the explicit port used by github copilot is not guaranteed.
94
+ 4. MCPHOST=**http://localhost:8080**
95
+ - URL of the mcp server. If using remote mcp server, set this to remote MCP server
61
96
 
62
- - github copilot: http://127.0.0.1:33418/
63
- - claude: https://claude.ai/api/mcp/auth_callback,https://claude.ai/api/auth/callback
97
+ 5. PROFILE=**~/.sas**
98
+ - profile name used by sas-cli to store the tokens
64
99
 
65
- > bearer - Use this when the remote mcp server sends the token in the header.
100
+ 6. PORT=**8080**
101
+ - set it to what fits your environment.
66
102
 
103
+ 7. CASSERVER=**cas-shared-default**
104
+ - Set to a valid cas server
67
105
 
68
- > sascli - Use sas-viya cli to create the token information. It is stored in ~/.sas folder by default
106
+ 8. COMPUTECONTEXT=**"SAS Job Execution compute context"**
107
+ - Use one that is appropriate
69
108
 
70
- ```env
71
- PROFILE=<profile name used by sas-cli to store the tokens in ~/.sas>
72
- ```
109
+ ### Clientid specifications
73
110
 
74
- ### Other options
111
+ If using remote mcp server, change the url in redirect to the remote url
75
112
 
76
- ```env
77
- PORT=<default is 8080>
78
- HTTPS=FALSE
79
- CASSERVER=CAS server name (default: cas-shared-default)
80
- COMPUTECONTEXT=Compute session name or context (default: SAS Job Execution compute context)
113
+ ```js
114
+ {
115
+ client_id: 'vscodemcp',
116
+ scope: [ 'openid' ],
117
+ resource_ids: [ 'none' ],
118
+ autoapprove: true,
119
+ authorized_grant_types: [ 'authorization_code' ],
120
+ access_token_validity: 86400,
121
+ allowpublic: true,
122
+ redirect_uri: [ 'http://localhost:8080/callback' ]
123
+ }
81
124
  ```
82
125
 
83
- ## Agent
126
+ > OauthClient Flow. Clientid with redirect appropriate for the client. Some examples are shown below. Note that the explicit port used by github copilot is not guaranteed.
127
+
128
+ - github copilot: http://127.0.0.1:33418/
129
+ - claude: https://claude.ai/api/mcp/auth_callback,https://claude.ai/api/auth/callback
84
130
 
85
- > The mcp server can be deployed as an agent in github copilot
86
- > The configuration files for claude can be installed locally. You have to move the files to the appriopiate place.
87
131
 
88
- Specify the following configuration values to enable agent mode
132
+ ## Agent and skills
89
133
 
90
- ```env
91
- AGENT=TRUE
92
- MCPCLIENT=github|claude
93
- ```
134
+ > The mcp server can be deployed as an agent in github copilot
135
+ > The configuration files for claude can be installed locally. You have to move the files to the appriopiate place.
94
136
 
95
- By default the agent information is installed in the user's home directory as .github or .claude} To install it where the mcp server is running do the following:
137
+ To download the skills to your environment issue this command:
96
138
 
97
- ```env
98
- MCPCLIENT=.github|.claude
139
+ ```sh
140
+ npx @sassoftware/sas-score-mcp-serverjs --skills github|claude
99
141
  ```
142
+ The skills and related files will be written to .github or .claude
100
143
 
101
144
 
102
145
  ## Configure the mcp client for localhost
103
146
 
104
- The mcp configuration is show below
147
+ The mcp configuration for oauth flow. For remote mcp, change the url to the
148
+ remote url
105
149
 
106
150
  ```json
107
151
  "sasmcp": {
108
152
  "type": "http",
109
- "url": "http://localhost:8080/mcp"``
153
+ "url": "http://localhost:8080/mcp"
110
154
  "oauth: {
111
- "type": "oauth2"
155
+ "type": "oauth2",
156
+ "clientId: "vscodemcp"
112
157
  }
113
158
  }
114
159
  ```
115
160
 
116
- For remote mcp servers:
161
+ For bearer authflow.
117
162
  ```json
118
163
  "sasmcp": {
119
164
  "type": "http",
120
- "url": "your remote mcp server`,
121
- "oauth": {
122
- "type": 'oauth2
123
- }
165
+ "url": "http://localhost:8080/mcp`,
166
+ "headers" {
167
+ "Authorization": "bearer <tokenstring>"
168
+ }
124
169
  }
125
170
  ```
126
171
 
127
- For transport protocol stdio. For claude drop the type
128
-
172
+ For stdio scenario
129
173
  ```json
130
174
  "sas-mcp-server": {
131
175
  "type: "stdio"
@@ -141,17 +185,7 @@ For transport protocol stdio. For claude drop the type
141
185
  }
142
186
  ```
143
187
 
144
- #### Step 2: Start the mcp server
145
188
 
146
- If using stdio transport, most of the mcp clients will start the server automatically.
147
- But this step is necessary of using http transport.
148
-
149
-
150
- ```sh
151
- npx @sassoftware/sas-score-mcp-serverjs@latest
152
- ```
153
-
154
- Make sure that the .env file is in the current working directory or specify the options in the command line
155
189
 
156
190
 
157
191
  ## Notes
@@ -196,7 +230,15 @@ NODE_EXTRA_CA_CERTS=c:\Users\<your_username>\AppData\Local\mkcert\rootCA.pem
196
230
  ```
197
231
 
198
232
  ## License
199
- This project is licensed under the [Apache 2.0 license](LICENSE).
233
+ This project is licensed under the Apache License 2.0. See [LICENSE](LICENSE).
234
+
235
+ The container image published from this repository also includes third-party software, each component under its own license:
236
+
237
+ - The npm dependencies that ship with this project, along with their respective licenses, are listed in [LICENSES.json](LICENSES.json).
238
+ - The container is built from the 25-alpine base image; license texts for its included software ship inside the image itself. License information for each Alpine package is available at [pkgs.alpinelinux.org](https://pkgs.alpinelinux.org/packages).
239
+
240
+ As with any container image, direct and indirect dependencies are governed by their own licenses.
241
+ Users of the published container image are responsible for ensuring that their use complies with all applicable licenses.
200
242
 
201
243
  ## Additional Resources
202
244
 
package/cli.js CHANGED
@@ -9,15 +9,11 @@
9
9
 
10
10
  import coreSSE from './src/coreSSE.js';
11
11
  import expressMcpServer from './src/expressMcpServer.js';
12
- import hapiMcpServer from './src/hapiMcpServer.js';
13
-
14
12
  import createMcpServer from './src/createMcpServer.js';
15
13
  // import dotenvExpand from 'dotenv-expand';
16
14
  import fs from 'fs';
17
15
  import { randomUUID } from 'node:crypto';
18
16
 
19
- //import refreshToken from './src/toolHelpers/refreshToken.js';
20
- //import getOptsViya from './src/toolHelpers/getOptsViya.js';
21
17
  import readCerts from './src/toolHelpers/readCerts.js';
22
18
 
23
19
  import { fileURLToPath } from 'url';
@@ -27,7 +23,8 @@ import setupSkills from './src/setupSkills.js';
27
23
  import { parseArgs } from "node:util";
28
24
 
29
25
  import NodeCache from 'node-cache';
30
- import { be } from 'zod/locales';
26
+ //import { be } from 'zod/locales';
27
+ //import { auth } from '@modelcontextprotocol/sdk/client/auth';
31
28
  //import getOpts from './src/toolHelpers/getOpts.js';
32
29
 
33
30
  const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -72,11 +69,6 @@ const args = parseArgs({
72
69
  short: 'c',
73
70
  description: 'Client ID for authentication'
74
71
  },
75
- clientsecret: {
76
- type: 'string',
77
- short: 's',
78
- description: 'Client Secret for authentication'
79
- },
80
72
  profile: {
81
73
  type: 'string',
82
74
  description: 'SAS CLI profile name'
@@ -107,14 +99,15 @@ const args = parseArgs({
107
99
  alias: 'mcpclient',
108
100
  description: 'MCP client name (github, claude...). Defaults to \'github\''
109
101
  },
110
- agentfolder: {
102
+ folder: {
111
103
  type: 'string',
112
104
  short: 'f',
113
105
  description: 'Subfolder under the client folder to copy the skills to, used to have different set of skills for different agents under the same client'
114
106
 
115
107
  },
116
108
  skills: {
117
- type: 'boolean',
109
+ type: 'string',
110
+ short: 's',
118
111
  description: 'Copies the skills for .github and .claude to the user home directory under .clientname (e.g. .github) or current directory if client name starts with dot (e.g. ./.github), used to have different set of skills for different clients'
119
112
  },
120
113
  help: {
@@ -135,30 +128,29 @@ const args = parseArgs({
135
128
  // Handle help flag
136
129
  if (args.values.help) {
137
130
  console.error(`
138
- SAS Viya Scoring Expert Agent - Version: ${JSON.parse(pkg).version}
131
+ sas-score-mcp-serverjs - Version: ${JSON.parse(pkg).version}
139
132
 
140
133
  Usage: npx @sassoftware/sas-score-mcp-serverjs@dev [options]
141
134
 
142
135
  Options:
143
136
  Minimal options:
144
137
  -v, --viya <url> Viya server URL
145
- -c, --clientid <id> Client ID for oauth authentication(pkce preferred. default: vscodemcp)
146
138
 
147
139
  MCP server options:
148
140
  -t, --mcptype <type> MCP server type: http or stdio (default: http)
149
141
  -m, --mcphost <host> MCP server host - can be remote URL - (default: http://localhost:8080)
142
+ --agent Enable agent mode (default: false) with a pre-configured set of skills based on the client specified
150
143
 
151
- Agent options:
152
- --skills Copies the skills for .github and .claude
153
- --agent Enable agent mode with a pre-configured set of skills based on the client specified (default: false)
154
- --client <name> MCP client name (github, claude...). Defaults to 'github'.Use to install skills
155
- --agentfolder <folder> Subfolder under the client folder to copy the skills to, used to have different set of skills for different agents under the same client
156
144
  Authentication options:
145
+ -c, --clientid <id> Client ID for oauth authentication(pkce preferred. default: vscodemcp)
157
146
  -a, --authflow <flow> Authentication flow: oauth, oauthclient, sascli, code, token(default oauth)
158
- -s, --clientsecret <secret> Client Secret for oauth authentication (not needed for pkce)
159
147
  --profile <name> SAS CLI profile name for sascli flow (default: Default)
160
148
  --config <path> SAS CLI config directory for sascli flow (default: user home directory)
161
149
 
150
+ Agent/skills options:
151
+ -s, --skills <name> Copies the skills for .github and .claude
152
+ -f, --folder <folder> Subfolder to copy the skills to. ex: ./github/<folder>, used to have different set of skills for different agents under the same client.
153
+
162
154
  Other options:
163
155
  -p, --port <port> Port to run the server on (default: 8080)
164
156
  --https Use HTTPS for the server (default: false)
@@ -177,6 +169,13 @@ Environment Variables:
177
169
  `);
178
170
  process.exit(0);
179
171
  }
172
+ if (args.values.skills) {
173
+ console.error(`[Note] Settings up skills for ${args.values.skills }`);
174
+ setupSkills(args.values.skills, args.values.folder);;
175
+ console.error(`[Note] Skills setup completed. `);
176
+ process.exit(0);
177
+ }
178
+
180
179
  console.error('Parsed command line arguments:', args.values);
181
180
  // read env file and then override with command line arguments
182
181
  if (args.values.env) {
@@ -206,7 +205,7 @@ process.env.AUTHFLOW = args.values.authflow || process.env.AUTHFLOW || 'oauth';
206
205
  process.env.MCPCLIENT = args.values.client || process.env.MCPCLIENT || 'github';
207
206
  process.env.VIYA_SERVER = args.values.viya || process.env.VIYA_SERVER;
208
207
  process.env.CLIENTID = args.values.clientid || process.env.CLIENTID || 'vscodemcp';
209
- process.env.CLIENTSECRET = args.values.clientsecret || process.env.CLIENTSECRET || null;
208
+ process.env.CLIENTSECRET = args.values.clientid || process.env.CLIENTID || null;
210
209
  process.env.SAS_CLI_PROFILE = args.values.profile || process.env.SAS_CLI_PROFILE || 'Default';
211
210
  process.env.SAS_CLI_CONFIG = args.values.config || process.env.SAS_CLI_CONFIG || os.homedir(); // default to user home directory
212
211
  process.env.CASSERVER = args.values.casserver || process.env.CASSERVER || 'cas-shared-default';
@@ -269,12 +268,15 @@ let mcpHost = process.env.MCPHOST;
269
268
  if (authFlow === 'oauth' || authFlow === 'oauthclient') {
270
269
  authFlow = 'bearer';
271
270
  authExternal = (authFlow === 'oauthclient') ? true : false;
271
+ } else if (authFlow === 'bearer') {
272
+ authExternal = true; // in bearer token flow we assume the token is generated externally and passed in via env variable or token file, so we set authExternal to true to indicate that
272
273
  }
273
- let autoLogon = process.env.AUTOLOGON != null ? process.env.AUTOLOGON.toUpperCase() : "FALSE";
274
+ let autoLogon = process.env.AUTOLOGON != null ? process.env.AUTOLOGON.toUpperCase() : "FALSE";
274
275
  const appEnvBase = {
275
276
  version: version,
276
277
  mcpType: mcpType,
277
278
  mcpClient: process.env.MCPCLIENT || 'github',
279
+ agent: (process.env.AGENT === 'TRUE') ? true : false,
278
280
  mcpHost: (process.env.MCPHOST == null) ? 'http://localhost:8080' : process.env.MCPHOST,
279
281
  brand: (process.env.BRAND == null) ? BRAND : process.env.BRAND,
280
282
  HTTPS: https,
@@ -387,18 +389,12 @@ if (appEnvBase.TOKENFILE != null) {
387
389
  // setup skills based on client before mcp initialization
388
390
  //
389
391
 
390
- if (args.values.skills) {
391
- console.error(`[Note] Downloading skills`); ;
392
- setupSkills('github', args.values.agentfolder);
393
- setupSkills('claude', args.values.agentfolder);
394
- console.error(`[Note] Skills setup completed. `);
395
- process.exit(0);
396
- }
392
+
397
393
 
398
394
  if (process.env.AGENT === 'TRUE') {
399
395
  if (process.env.CLIENT !== 'none') {
400
396
  console.error(`[Note] Setting up skills for client: ${process.env.CLIENT}...`);
401
- setupSkills(process.env.CLIENT, args.values.agentfolder);
397
+ setupSkills(process.env.CLIENT, args.values.folder);
402
398
  }
403
399
  } else {
404
400
  console.error(`[Note] Agent mode not enabled`);
@@ -444,6 +440,7 @@ Options:
444
440
  PORT ${appEnvBase.PORT}
445
441
  HTTPS ${appEnvBase.contexts.HTTPS}
446
442
  CLIENT ${appEnvBase.mcpClient}
443
+ AGENT ${appEnvBase.agent}
447
444
 
448
445
  Authentication options:
449
446
  AUTHFLOW ${process.env.AUTHFLOW}
@@ -475,14 +472,8 @@ if (mcpType === 'stdio') {
475
472
 
476
473
  } else {
477
474
  console.error('[Note] Starting HTTP MCP server...');
478
- if (useHapi === true) {
479
- process.env.AUTHTYPE = null;
480
- await hapiMcpServer(mcpServer, sessionCache, appEnvBase);
481
- console.error('[Note] Using HAPI HTTP server...')
482
- } else {
483
- await expressMcpServer(mcpServer, sessionCache, appEnvBase);
484
- console.error('[Note] MCP HTTP express server started on port ' + appEnvBase.PORT);
485
- }
475
+ await expressMcpServer(mcpServer, sessionCache, appEnvBase);
476
+ console.error('[Note] MCP HTTP express server started on port ' + appEnvBase.PORT);
486
477
  }
487
478
 
488
479
  // custom reader for .env file to avoid dotenv logging to console