@sassoftware/sas-score-mcp-serverjs 1.0.1-30 → 1.0.1-32

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 (50) hide show
  1. package/.skills/agents/sas-score-mcp-serverjs-agent.md +1 -1
  2. package/.skills/copilot-instructions.md +57 -26
  3. package/.skills/skills/detail-strategy/SKILL.md +95 -49
  4. package/.skills/skills/find-resources/SKILL.md +38 -31
  5. package/.skills/skills/list-resource/SKILL.md +93 -33
  6. package/.skills/skills/request-routing/SKILL.md +9 -4
  7. package/.skills/skills/score-strategy/SKILL.md +21 -3
  8. package/README.md +62 -43
  9. package/openApi.yaml +121 -121
  10. package/package.json +7 -5
  11. package/scripts/docs/oauth-http-transport.md +2 -2
  12. package/scripts/plot_msrp_usa.py +49 -0
  13. package/scripts/refreshtoken.js +57 -57
  14. package/src/createMcpServer.js +0 -1
  15. package/src/openApi.yaml +121 -121
  16. package/src/toolHelpers/_findJob.js +12 -0
  17. package/src/toolHelpers/_findJobdef.js +10 -0
  18. package/src/toolHelpers/_findLibrary.js +10 -0
  19. package/src/toolHelpers/_findMas.js +12 -0
  20. package/src/toolHelpers/_findTable.js +10 -0
  21. package/src/toolHelpers/_listJobs.js +2 -2
  22. package/src/toolHelpers/{_listModels.js → _listMas.js} +4 -4
  23. package/src/toolSet/devaScore.js +61 -61
  24. package/src/toolSet/findJob.js +2 -1
  25. package/src/toolSet/findJobdef.js +2 -2
  26. package/src/toolSet/findLibrary.js +68 -68
  27. package/src/toolSet/findMas.js +59 -0
  28. package/src/toolSet/findTable.js +2 -2
  29. package/src/toolSet/jobInfo.js +59 -0
  30. package/src/toolSet/jobdefInfo.js +59 -0
  31. package/src/toolSet/listJobdefs.js +61 -61
  32. package/src/toolSet/listJobs.js +61 -61
  33. package/src/toolSet/listLibraries.js +78 -78
  34. package/src/toolSet/{listModels.js → listMas.js} +61 -56
  35. package/src/toolSet/listTables.js +66 -66
  36. package/src/toolSet/makeTools.js +21 -12
  37. package/src/toolSet/{modelInfo.js → masInfo.js} +12 -12
  38. package/src/toolSet/{modelScore.js → masScore.js} +3 -3
  39. package/src/toolSet/readTable.js +63 -63
  40. package/src/toolSet/runMacro.js +82 -82
  41. package/src/toolSet/sasQuery.js +77 -77
  42. package/src/toolSet/setContext.js +65 -65
  43. package/src/toolSet/superstat.js +61 -61
  44. package/src/toolSet/tableInfo.js +58 -58
  45. package/scripts/optimize_final.py +0 -140
  46. package/scripts/optimize_tools.py +0 -99
  47. package/scripts/setup-skills.js +0 -34
  48. package/scripts/token.txt +0 -1
  49. package/scripts/update_descriptions.py +0 -46
  50. package/src/toolSet/findModel.js +0 -60
@@ -1,24 +1,27 @@
1
1
  ---
2
2
  name: list-resource
3
3
  description: >
4
- Unified resource listing strategy. Use appropriate list tools for discovery and browsing.
5
- Determines pagination parameters. Use list tools for discovery only; use find tools for verification.
4
+ Unified resource listing strategy. Use appropriate list tools for listing and browsing.
5
+ Determines pagination parameters. Use list tools for listing only; use find tools for verification of existence or discovery.
6
6
  ---
7
7
 
8
8
  # Unified Resource Listing Strategy
9
9
 
10
10
 
11
- Use this strategy to discover and browse available resources (libraries, tables, models, jobs, jobdefs).
11
+ Use this strategy to list available resources (libraries, tables, models, jobs, jobdefs).
12
12
 
13
13
  ## Resource Type to Tool Mapping
14
14
 
15
- | Resource Type | List Tool |
16
- |--------------|-----------|
17
- | Libraries | sas-score-list-libraries |
18
- | Tables | sas-score-list-tables |
19
- | Models | sas-score-list-models |
20
- | Jobs | sas-score-list-jobs |
21
- | JobDefs | sas-score-list-jobdefs |
15
+ | Resource Type | Aliases / Adjective Form | List Tool |
16
+ |----------------------|----------------------------------------|----------------------------|
17
+ | Libraries | library | sas-score-list-libraries |
18
+ | Tables | table | sas-score-list-tables |
19
+ | MAS Models | mas model, model (default) | sas-score-list-mas |
20
+ | Job Models | job model, models of type job | sas-score-list-jobs |
21
+ | JobDef Models | jobdef model, models of type jobdef | sas-score-list-jobdefs |
22
+ | SCR Models | scr model, models of type scr | *(no list tool available)* |
23
+
24
+ When the user says "model" as an adjective (e.g. "mas model", "job model", "jobdef model", "scr model"), route to the corresponding list tool. When the model type is unspecified, default to MAS.
22
25
 
23
26
  Use this table to select the correct tool for each resource type. Then follow the logic for parameters and pagination below.
24
27
 
@@ -97,14 +100,28 @@ sas-score-list-tables({ lib: "Public", server: "cas", start: 11, limit: 10 })
97
100
 
98
101
  ---
99
102
 
100
- ### 3. List Models
103
+ ### 3. List Scoring Models
104
+
105
+ **Trigger**: "list models", "show all models", "what models are available",
106
+ "list mas models", "list job models", "list jobdef models", "list scr models",
107
+ "list models of type mas", "list models of type job", "list models of type jobdef",
108
+ "list models of type scr", "show all scoring models"
109
+
110
+ **Routing logic** — use the model type to pick the right tool:
101
111
 
102
- **Trigger**: "list models", "show all models", "browse models", "what models are available"
112
+ | User phrase | Model type | Tool |
113
+ |------------------------------------------|------------|------------------------|
114
+ | "list models" (no type) | MAS (default) | `sas-score-list-mas` |
115
+ | "list mas models" / "models of type mas" | MAS | `sas-score-list-mas` |
116
+ | "list job models" / "models of type job" | Job | `sas-score-list-jobs` |
117
+ | "list jobdef models" / "models of type jobdef" | JobDef | `sas-score-list-jobdefs` |
118
+ | "list scr models" / "models of type scr" | SCR | *(no list tool — inform user)* |
103
119
 
104
- **Tool**: `sas-score-list-models`
120
+ #### 3a. MAS Models
105
121
 
106
- **Logic**: Lists all models published to the Model Administration Service (MAS).
107
- - No server selection required (MAS is centralized)
122
+ **Tool**: `sas-score-list-mas`
123
+
124
+ **Logic**: Lists all models published to the Model Administration Service (MAS). No server selection required.
108
125
 
109
126
  **Parameters**:
110
127
  ```
@@ -114,21 +131,68 @@ limit: <size> # items per page (default 10)
114
131
 
115
132
  **Examples**:
116
133
  ```
117
- # List first 10 models
118
- sas-score-list-models({ start: 1, limit: 10 })
134
+ # List first 10 MAS models
135
+ sas-score-list-mas({ start: 1, limit: 10 })
136
+
137
+ # Pagination: show next page
138
+ sas-score-list-mas({ start: 11, limit: 10 })
139
+ ```
140
+
141
+ #### 3b. Job Models
142
+
143
+ **Tool**: `sas-score-list-jobs`
144
+
145
+ **Logic**: Lists all SAS Viya job assets that can be used as scoring models.
146
+
147
+ **Parameters**:
148
+ ```
149
+ start: <offset> # 1-based page number (default 1)
150
+ limit: <page size> # items per page (default 10)
151
+ where: "<filter expression>" # optional filter
152
+ ```
119
153
 
120
- # List 25 models
121
- sas-score-list-models({ start: 1, limit: 25 })
154
+ **Examples**:
155
+ ```
156
+ # List first 10 job models
157
+ sas-score-list-jobs({ start: 1, limit: 10 })
122
158
 
123
159
  # Pagination: show next page
124
- sas-score-list-models({ start: 11, limit: 10 })
160
+ sas-score-list-jobs({ start: 11, limit: 10 })
125
161
  ```
126
162
 
163
+ #### 3c. JobDef Models
164
+
165
+ **Tool**: `sas-score-list-jobdefs`
166
+
167
+ **Logic**: Lists all SAS Viya job definition assets that can be used as scoring models.
168
+
169
+ **Parameters**:
170
+ ```
171
+ start: <offset> # 1-based page number (default 1)
172
+ limit: <page size> # items per page (default 10)
173
+ where: "<filter expression>" # optional filter
174
+ ```
175
+
176
+ **Examples**:
177
+ ```
178
+ # List first 10 jobdef models
179
+ sas-score-list-jobdefs({ start: 1, limit: 10 })
180
+
181
+ # Pagination: show next page
182
+ sas-score-list-jobdefs({ start: 11, limit: 10 })
183
+ ```
184
+
185
+ #### 3d. SCR Models
186
+
187
+ No list tool is available for SCR models. Inform the user and ask for a specific SCR endpoint URL if they want to work with an SCR model.
188
+
127
189
  ---
128
190
 
129
- ### 4. List Jobs
191
+ ### 4. List Jobs (non-model)
192
+
193
+ **Trigger**: "list jobs", "show all jobs", "what jobs are available"
130
194
 
131
- **Trigger**: "list jobs", "show all jobs", "browse jobs", "what jobs are available"
195
+ > **Note**: "list job models" also routes here jobs and job models use the same list tool.
132
196
 
133
197
  **Tool**: `sas-score-list-jobs`
134
198
 
@@ -146,18 +210,17 @@ where: "<filter expression>" # optional filter
146
210
  # List first 10 jobs
147
211
  sas-score-list-jobs({ start: 1, limit: 10 })
148
212
 
149
- # List 25 jobs
150
- sas-score-list-jobs({ start: 1, limit: 25 })
151
-
152
213
  # Pagination: show next page
153
214
  sas-score-list-jobs({ start: 11, limit: 10 })
154
215
  ```
155
216
 
156
217
  ---
157
218
 
158
- ### 5. List JobDefs
219
+ ### 5. List JobDefs (non-model)
159
220
 
160
- **Trigger**: "list jobdefs", "show all jobdefs", "browse jobdefs", "what jobdefs are available"
221
+ **Trigger**: "list jobdefs", "show all jobdefs", "what jobdefs are available"
222
+
223
+ > **Note**: "list jobdef models" also routes here — jobdefs and jobdef models use the same list tool.
161
224
 
162
225
  **Tool**: `sas-score-list-jobdefs`
163
226
 
@@ -175,9 +238,6 @@ where: "<filter expression>" # optional filter
175
238
  # List first 10 jobdefs
176
239
  sas-score-list-jobdefs({ start: 1, limit: 10 })
177
240
 
178
- # List 25 jobdefs
179
- sas-score-list-jobdefs({ start: 1, limit: 25 })
180
-
181
241
  # Pagination: show next page
182
242
  sas-score-list-jobdefs({ start: 11, limit: 10 })
183
243
  ```
@@ -219,7 +279,7 @@ User requests to list/browse resources
219
279
  What resource type?
220
280
  ├─ Libraries? → Use sas-score-list-libraries
221
281
  ├─ Tables in library X? → Use sas-score-list-tables
222
- ├─ Models? → Use sas-score-list-models
282
+ ├─ Models? → Use sas-score-list-mas
223
283
  ├─ Jobs? → Use sas-score-list-jobs
224
284
  └─ JobDefs? → Use sas-score-list-jobdefs
225
285
  ```
@@ -252,7 +312,7 @@ What resource type?
252
312
 
253
313
  | Aspect | Find | List |
254
314
  |---|---|---|
255
- | Purpose | Verify existence | Browse/discover |
315
+ | Purpose | Verify/discover existence | List available resources |
256
316
  | Returns | Single resource or not found | Multiple resources with pagination |
257
- | Use case | Before execution | Exploration/discovery |
317
+ | Use case | Before execution | Listing of resources |
258
318
  | Tool suffix | `find-*` | `list-*` |
@@ -33,10 +33,15 @@ Once resources are verified to exist, select the appropriate execution tool:
33
33
  |---|---|---|
34
34
  | Read table rows | `sas-score-read-table` | lib, table, server (from Step 1) |
35
35
  | Query table (aggregation) | `sas-score-sas-query` | lib.table, SQL query |
36
- | Score with MAS model | `sas-score-mas-score` | model name, scenario data |
37
- | Run Job | `sas-score-run-jobdef` | job name, scenario parameters |
38
- | Run JobDef | `sas-score-run-jobdef` | jobdef name, scenario parameters |
39
- | Score with SCR model | `sas-score-scr-score` | SCR URL, scenario data |
36
+ | Score with MAS model / `mas model X` | `sas-score-mas-score` | model name, scenario data |
37
+ | Score with Job model / `job model X` | `sas-score-run-job` | job name, scenario parameters |
38
+ | Score with JobDef model / `jobdef model X` | `sas-score-run-jobdef` | jobdef name, scenario parameters |
39
+ | Score with SCR model / `scr model X` | `sas-score-scr-score` | SCR URL, scenario data |
40
+ | Describe MAS model / `mas model X` | `sas-score-mas-info` | model name |
41
+ | Describe Job model / `job model X` | `sas-score-job-info` | job name |
42
+ | Describe JobDef model / `jobdef model X` | `sas-score-jobdef-info` | jobdef name |
43
+ | Describe SCR model / `scr model X` | `sas-score-scr-info` | SCR URL |
44
+ | Describe table | `sas-score-table-info` | lib, table, server |
40
45
 
41
46
  ---
42
47
 
@@ -26,12 +26,28 @@ Identify the scoring target (model type) and input source:
26
26
 
27
27
  ### Identify Model Type
28
28
 
29
+ Model type can be expressed as a **dot-suffix** (`X.mas`) or as an **adjective form** (`mas model X`). Both are equivalent:
30
+
29
31
  ```
32
+ # Dot-suffix form
30
33
  score with model X.mas → MAS model
31
34
  score with model X.job → Job
32
35
  score with model X.jobdef → JobDef
33
36
  score with model X.scr → SCR model
34
37
  score with model X (default to MAS if type is not specified) → MAS model
38
+
39
+ # Adjective form (equivalent)
40
+ score with mas model X → MAS model
41
+ score with job model X → Job
42
+ score with jobdef model X → JobDef
43
+ score with scr model X → SCR model
44
+
45
+ # Short form (no "model" keyword)
46
+ score with X.mas → MAS model
47
+ score with X.job → Job
48
+ score with X.jobdef → JobDef
49
+ score with X.scr → SCR model
50
+ score with X (default to MAS if type is not specified) → MAS model
35
51
  ```
36
52
 
37
53
  ### Visual Flowchart
@@ -83,9 +99,11 @@ score results of query... → Query results
83
99
  ```
84
100
  sas-score-mas-score({
85
101
  model: "<model name>",
86
- scenario: { a: 1, b: 2 }
102
+ scenario: { a: 1, b: 2 }
103
+ })
87
104
  ```
88
- **Parameters** (job): ):
105
+
106
+ **Parameters** (job):
89
107
  ```
90
108
  sas-score-run-job({
91
109
  name: "<job name>",
@@ -216,7 +234,7 @@ If table columns don't match model input variable names:
216
234
 
217
235
  ### Example 3: Score table rows
218
236
  **Request**: "score all active customers with model risk_model and table Public.customers"
219
- 1. Find model risk_model.mad using find-resources strategy
237
+ 1. Find model risk_model.mas using find-resources strategy
220
238
  2. Find table Public.customers using find-resources strategy
221
239
  3. Read: `sas-score-read-table({ lib: "Public", table: "customers", server: "cas", where: "status='active'" })`
222
240
  4. Score each row with risk_model
package/README.md CHANGED
@@ -9,6 +9,8 @@ See [wiki](https://github.com/sassoftware/sas-score-mcp-serverjs/wiki) for the c
9
9
 
10
10
  - Agent - can be deployed as an agent
11
11
 
12
+ - Docker image: ghcr.io/sassoftware/sas-score-mcp-serverjs
13
+
12
14
 
13
15
  ## Overview
14
16
  This MCP server is designed for scoring with SAS Viya.
@@ -23,6 +25,22 @@ Some examples are:
23
25
  - job Definitions
24
26
  - jobs using SAS Studio or other interfaces
25
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
+
26
44
  ## Capabilities
27
45
 
28
46
  The tools can be grouped into these categories
@@ -56,43 +74,60 @@ Typically these are set either in the .env file or as environment variables or a
56
74
 
57
75
  ### Required Options
58
76
 
59
- VIYA_SERVER=<url for Viya server>
77
+ 1. VIYA_SERVER=
78
+ <url for Viya server>.
60
79
 
61
- MCPTYPE=http|stdio
80
+ ### Options with defaults
62
81
 
63
- MCPHOST=<url for the mcp server = http://localhost:8080 or some remote mcp server>
82
+ These can be customized
64
83
 
65
- >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
84
+ 1. AUTHFLOW=**oauth**|oauthclient|bearer|sascli|token|password
85
+ - Authentication method. Default is oauth
66
86
 
67
- AUTHFLOW=oauth|oauthclient|bearer|sascli|token|password
87
+ 2. CLIENTID=**vscodemcp**
88
+ - Clientid for oauth and oauthclient AUTHFlOW. Must be PKCE clientid.
89
+
68
90
 
69
- > Options for oauth. The clientid must have a redirect of http://localhost:8080/callback,https://localhost:8080/callback
91
+ 3. MCPTYPE=**http**|stdio
92
+ - The transport protocol for the mcp server.
70
93
 
71
- CLIENTID=<pkce clientid>
94
+ 4. MCPHOST=**http://localhost:8080**
95
+ - URL of the mcp server. If using remote mcp server, set this to remote MCP server
72
96
 
97
+ 5. PROFILE=**~/.sas**
98
+ - profile name used by sas-cli to store the tokens
73
99
 
74
- > 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.
100
+ 6. PORT=**8080**
101
+ - set it to what fits your environment.
75
102
 
76
- - github copilot: http://127.0.0.1:33418/
77
- - claude: https://claude.ai/api/mcp/auth_callback,https://claude.ai/api/auth/callback
103
+ 7. CASSERVER=**cas-shared-default**
104
+ - Set to a valid cas server
78
105
 
79
- > bearer - Use this when the remote mcp server sends the token in the header.
106
+ 8. COMPUTECONTEXT=**"SAS Job Execution compute context"**
107
+ - Use one that is appropriate
80
108
 
109
+ ### Clientid specifications
81
110
 
82
- > sascli - Use sas-viya cli to create the token information. It is stored in ~/.sas folder by default
111
+ If using remote mcp server, change the url in redirect to the remote url
83
112
 
84
- ```env
85
- PROFILE=<profile name used by sas-cli to store the tokens in ~/.sas>
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
+ }
86
124
  ```
87
125
 
88
- ### Other options
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
89
130
 
90
- ```env
91
- PORT=<default is 8080>
92
- HTTPS=FALSE
93
- CASSERVER=CAS server name (default: cas-shared-default)
94
- COMPUTECONTEXT=Compute session name or context (default: SAS Job Execution compute context)
95
- ```
96
131
 
97
132
  ## Agent and skills
98
133
 
@@ -110,14 +145,15 @@ The skills and related files will be written to .github or .claude
110
145
  ## Configure the mcp client for localhost
111
146
 
112
147
  The mcp configuration for oauth flow. For remote mcp, change the url to the
113
- appropriate url.
148
+ remote url
114
149
 
115
150
  ```json
116
151
  "sasmcp": {
117
152
  "type": "http",
118
- "url": "http://localhost:8080/mcp"``
153
+ "url": "http://localhost:8080/mcp"
119
154
  "oauth: {
120
- "type": "oauth2"
155
+ "type": "oauth2",
156
+ "clientId: "vscodemcp"
121
157
  }
122
158
  }
123
159
  ```
@@ -126,13 +162,14 @@ For bearer authflow.
126
162
  ```json
127
163
  "sasmcp": {
128
164
  "type": "http",
129
- "url": "your remote mcp server`,
165
+ "url": "http://localhost:8080/mcp`,
130
166
  "headers" {
131
167
  "Authorization": "bearer <tokenstring>"
132
168
  }
133
169
  }
134
170
  ```
135
171
 
172
+ For stdio scenario
136
173
  ```json
137
174
  "sas-mcp-server": {
138
175
  "type: "stdio"
@@ -148,25 +185,7 @@ For bearer authflow.
148
185
  }
149
186
  ```
150
187
 
151
- #### Step 2: Start the mcp server
152
-
153
- If using stdio transport, most of the mcp clients will start the server automatically.
154
- But for http transport, the mcp server must be started.
155
-
156
- If running locally
157
- ```sh
158
- npx @sassoftware/sas-score-mcp-serverjs@latest
159
- ```
160
-
161
- The mcp is also available as a docker image. Add or remove the env variables as needed.
162
-
163
- ```sh
164
- docker run -p 8080:8080 --name sasscore -e VIYA_SERVER=<yourviayserver> -e AUTHFLOW=oauth ghcr.io/sassoftware/sas-score-mcp-serverjs:latest
165
- ```
166
-
167
- If you want to run it in docker then use docker run:
168
188
 
169
- Make sure that the .env file is in the current working directory or specify the options in the command line
170
189
 
171
190
 
172
191
  ## Notes