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

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 (44) hide show
  1. package/.skills/copilot-instructions.md +11 -4
  2. package/.skills/skills/detail-strategy/SKILL.md +71 -43
  3. package/.skills/skills/list-resource/SKILL.md +5 -5
  4. package/.skills/skills/request-routing/SKILL.md +4 -0
  5. package/.skills/skills/score-strategy/SKILL.md +4 -2
  6. package/README.md +62 -43
  7. package/openApi.yaml +121 -121
  8. package/package.json +7 -5
  9. package/scripts/docs/oauth-http-transport.md +2 -2
  10. package/scripts/refreshtoken.js +57 -57
  11. package/src/createMcpServer.js +0 -1
  12. package/src/openApi.yaml +121 -121
  13. package/src/toolHelpers/_findJob.js +12 -0
  14. package/src/toolHelpers/_findJobdef.js +10 -0
  15. package/src/toolHelpers/_findLibrary.js +10 -0
  16. package/src/toolHelpers/_findModel.js +12 -0
  17. package/src/toolHelpers/_findTable.js +10 -0
  18. package/src/toolHelpers/_listJobs.js +2 -2
  19. package/src/toolSet/devaScore.js +61 -61
  20. package/src/toolSet/findJob.js +2 -1
  21. package/src/toolSet/findJobdef.js +2 -2
  22. package/src/toolSet/findLibrary.js +68 -68
  23. package/src/toolSet/findModel.js +2 -2
  24. package/src/toolSet/findTable.js +2 -2
  25. package/src/toolSet/jobInfo.js +59 -0
  26. package/src/toolSet/jobdefInfo.js +59 -0
  27. package/src/toolSet/listJobdefs.js +61 -61
  28. package/src/toolSet/listJobs.js +61 -61
  29. package/src/toolSet/listLibraries.js +78 -78
  30. package/src/toolSet/listModels.js +56 -56
  31. package/src/toolSet/listTables.js +66 -66
  32. package/src/toolSet/makeTools.js +3 -0
  33. package/src/toolSet/modelInfo.js +1 -1
  34. package/src/toolSet/readTable.js +63 -63
  35. package/src/toolSet/runMacro.js +82 -82
  36. package/src/toolSet/sasQuery.js +77 -77
  37. package/src/toolSet/setContext.js +65 -65
  38. package/src/toolSet/superstat.js +61 -61
  39. package/src/toolSet/tableInfo.js +58 -58
  40. package/scripts/optimize_final.py +0 -140
  41. package/scripts/optimize_tools.py +0 -99
  42. package/scripts/setup-skills.js +0 -34
  43. package/scripts/token.txt +0 -1
  44. package/scripts/update_descriptions.py +0 -46
@@ -32,6 +32,7 @@ When you receive a SAS request, classify it using request-routing skill:
32
32
  | Read | "read", "show", "fetch", "query", "how many", "count by" | read-strategy | sas-score-read-table, sas-score-sas-query |
33
33
  | Score | "score", "predict", "run model" | score-strategy | sas-score-mas-score, sas-score-run-jobdef, sas-score-scr-score |
34
34
  | List | "list", "show all", "browse" | — | sas-score-list-libraries, sas-score-list-tables, sas-score-list-models, etc. |
35
+ | Describe | "describe", "what inputs", "show schema", "metadata", "information" | detail-strategy | sas-score-model-info, sas-score-job-info, sas-score-scr-info, sas-score-table-info |
35
36
 
36
37
  ---
37
38
 
@@ -78,9 +79,8 @@ These terms are overloaded in SAS and must be clarified:
78
79
 
79
80
  - **model**: MAS, Job, JobDef, or SCR?
80
81
  - **score/scoring**: Running a model on data (not code coverage)
81
- - **job**: SAS Job or SAS JobDef?
82
82
  - **table**: CAS table or SAS dataset? Which library?
83
- - **resource**: Library, table, model, job, or jobdef?
83
+ - **resource**: Library, table, model, job,jobdef, scr?
84
84
  - **read/query**: Raw row read or aggregation?
85
85
 
86
86
  When ambiguous, ask one focused clarifying question.
@@ -95,12 +95,15 @@ See the strategies folder:
95
95
  - **find-resources** — How to verify resources exist
96
96
  - **read-strategy** — How to read/query tables
97
97
  - **score-strategy** — How to score/predict
98
+ - **list-resource** — How to list resources
99
+ - **detail-strategy** — How to retrieve details about a resource
98
100
  - **sas-score-mcp-serverjs-agent** — Main orchestration agent
99
101
 
100
102
  ---
101
103
 
102
104
  ## Response Format
103
105
 
106
+ Whenever possible format the response as a markdown table or structured JSON for easy readability.
104
107
  After completing a SAS Viya request, append a brief **Strategy Summary**:
105
108
 
106
109
  ```
@@ -157,7 +160,7 @@ Example:
157
160
  4. Result: Aggregated data by make
158
161
 
159
162
  ### Example 3: Read Rows
160
- **User**: "read first 20 customers from Public"
163
+ **User**: "read first 20 customers from Public.customers"
161
164
 
162
165
  **Process**:
163
166
  1. Classify: Read request, raw row read
@@ -166,7 +169,7 @@ Example:
166
169
  4. Result: 20 customer rows
167
170
 
168
171
  ### Example 4: Score Table Rows
169
- **User**: "score all active customers with model risk_model"
172
+ **User**: "score all active customers in Public.customers with model risk_model"
170
173
 
171
174
  **Process**:
172
175
  1. Classify: Score request, table rows
@@ -197,6 +200,10 @@ Example:
197
200
  | | sas-score-list-models | Browse MAS models |
198
201
  | | sas-score-list-jobs | Browse jobs |
199
202
  | | sas-score-list-jobdefs | Browse jobdefs |
203
+ | **Detail** | sas-score-model-info | Get MAS model details |
204
+ | | sas-score-job-info | Get Job model details |
205
+ | | sas-score-scr-info | Get SCR model details |
206
+ | | sas-score-table-info | Get table details |
200
207
 
201
208
  ---
202
209
 
@@ -1,68 +1,64 @@
1
1
  ---
2
2
  name: detail-strategy
3
3
  description: >
4
- Unified detail/information retrieval strategy. Handles MAS models, SCR models, and tables.
5
- Always verify resources exist using find-resources skill before retrieving details, except for SCR models (which do not require pre-verification).
4
+ Unified detail/information/describe retrieval strategy. Handles MAS models, Job models, JobDef models, SCR models, and tables. Verify resources exist using find-resources skill before retrieving details (except SCR models, which can be queried directly).
6
5
  ---
7
6
 
8
7
  # Detail Strategy
9
8
 
9
+ Use this strategy when the user requests information about a resource.
10
10
 
11
- Use this strategy when the user requests information about a resource: model details, schema, metadata, inputs/outputs, or any descriptive information.
11
+ **Supported resource types**: MAS model, Job model, JobDef model, SCR model, or table.
12
12
 
13
- If the resource type is ambiguous or cannot be determined, ask the user for clarification.
14
- If the resource type is not MAS, SCR, or table, respond with: "Unsupported resource type. Please specify MAS model, SCR model, or table."
13
+ If the specified resource is ambiguous, ask the user for clarification (e.g. "Are you asking about a MAS model, a Job model, a JobDef model, a SCR model or a table?").
15
14
 
15
+ Verification vs Retrieval (simplified)
16
16
 
17
- ## Simplified Steps
17
+ - We separate the workflow into two clear, sequential phases to reduce branching and cognitive load:
18
+ 1. Verification phase — confirm the resource exists and determine its exact type and server. Use the appropriate "find" tool for all resource types except SCR models.
19
+ 2. Retrieval phase — after successful verification, call the detail/read tool appropriate for the identified resource type to fetch metadata or content.
18
20
 
19
- 1. Determine resource type (MAS model, SCR model, or table)
20
- 2. If MAS model or table, verify resource exists using find-resources skill
21
- - If SCR model, skip verification and proceed to retrieval
22
- 3. Retrieve details using the appropriate tool
21
+ - Exception for SCR models: document the exception inline — SCR models may be queried directly with `sas-score-scr-info` when the user provides a specific SCR endpoint. Even when skipping verification, still validate the endpoint/URL format before calling the tool.
23
22
 
24
- ---
23
+ Apply this separation consistently across MAS models, Job models, JobDef models, SCR models, and tables.
25
24
 
25
+ ---
26
26
 
27
- ## Step 1: Identify Resource Type
27
+ ## Classification & Verification Process
28
28
 
29
- Classify the resource based on naming convention or context:
29
+ ### Phase 1: Classify the Resource Type
30
30
 
31
- | Pattern | Resource Type |
32
- |--------------------------------|--------------|
33
- | model X.mas or "model X" | MAS model |
34
- | model X.scr | SCR model |
35
- | table X in library Y | Table |
31
+ Determine resource type from context/naming conventions:
36
32
 
37
- If resource type cannot be determined, ask the user for clarification.
33
+ | Pattern | Resource Type |
34
+ |--------------------------|---------------|
35
+ | model X (or X.mas) | MAS model |
36
+ | model X.scr | SCR model |
37
+ | model X.job | Job model |
38
+ | model X.jobdef | JobDef model |
39
+ | table X in library Y | Table |
38
40
 
39
- ---
41
+ If resource is ambiguous, ask user for clarification.
40
42
 
41
- ## Step 2: Verify Resource Exists (if required)
43
+ ### Phase 2: Verify Resource Exists (Skip for SCR Models)
42
44
 
43
- | Resource Type | Verification Required? | How to Verify |
44
- |---------------|-----------------------|---------------|
45
- | MAS model | Yes | find-model |
46
- | SCR model | No | — |
47
- | Table | Yes | find-table |
45
+ For each resource type, use the appropriate verification tool:
48
46
 
49
- If resource type is not supported, respond with: "Unsupported resource type. Please specify MAS model, SCR model, or table."
47
+ | Resource Type | Tool |
48
+ |---------------|-------------------|
49
+ | MAS model | sas-score-find-model |
50
+ | Job model | sas-score-find-job |
51
+ | JobDef model | sas-score-find-jobdef |
52
+ | Table | sas-score-find-table |
53
+ | SCR model | *(no verification needed)* |
50
54
 
51
- ### Find SCR Model
52
- ```
53
- find-resources skill → find-scr
54
- Tool: sas-score-find-scr({ url: "<scr-endpoint>" })
55
- ```
56
-
57
- ### Find Table
58
- ```
59
- find-resources skill → find-table
60
- Tool: sas-score-find-table({ lib: "<library>", name: "<table>", server: "<cas|sas>" })
61
- ```
55
+ If verification fails, inform the user and ask for additional details or corrections.
62
56
 
63
57
  ---
64
58
 
65
- ## Step 3: Get Details
59
+ ## Detail Retrieval Process
60
+
61
+ ### Phase 3: Get Details
66
62
 
67
63
  ### Option A: MAS Model Details
68
64
 
@@ -153,20 +149,52 @@ User: "What columns are in the customers table in Public?"
153
149
  ```
154
150
 
155
151
  ---
152
+ ### Option D: Job Model Details
153
+
154
+ **Trigger phrases**: "what inputs does job model X need", "describe job model X", "show variables for job model X", "job model X metadata", "job model X information"
155
+
156
+ **Tool**: `sas-score-job-info`
157
+
158
+ **Parameters**:
159
+ ```
160
+ sas-score-job-info({
161
+ model: "<model name>"
162
+ })
163
+ ```
164
+
165
+ **Returns**:
166
+ - Input variables (name, type, role)
167
+
168
+ **Example**:
169
+ ```
170
+ User: "What inputs does job model churnRisk need?"
171
+
172
+ 1. Find: sas-score-find-job({ name: "churnRisk" })
173
+ 2. Get info: sas-score-job-info({ model: "churnRisk" })
174
+ 3. Return: { inputs: [...] }
175
+ ```
156
176
 
157
177
  ## Decision Tree
158
178
 
159
179
  ```
160
180
  User requests information/details
161
181
  ├─ About a MAS model?
162
- │ → Find model (find-resources)
182
+ │ → Verify: sas-score-find-model
163
183
  │ → Call: sas-score-model-info
164
184
 
165
185
  ├─ About a SCR model?
166
- │ → Call: sas-score-scr-info (can skip verification)
186
+ │ → Call: sas-score-scr-info (skip verification; validate URL first)
187
+
188
+ ├─ About a Job model?
189
+ │ → Verify: sas-score-find-job
190
+ │ → Call: sas-score-job-info
191
+
192
+ ├─ About a JobDef model?
193
+ │ → Verify: sas-score-find-jobdef
194
+ │ → Call: sas-score-job-info
167
195
 
168
196
  └─ About a table?
169
- Find table (find-resources, determine server)
197
+ Verify: sas-score-find-table (determine CAS or SAS server)
170
198
  → Call: sas-score-table-info
171
199
  ```
172
200
 
@@ -176,7 +204,7 @@ User requests information/details
176
204
 
177
205
  For each detail/information request:
178
206
 
179
- - [ ] **Classify** resource type (MAS/SCR/table)
207
+ - [ ] **Classify** resource type (MAS / Job / JobDef / SCR / table)
180
208
  - [ ] **Verify** resource exists (use find-resources skill, except SCR)
181
209
  - [ ] **Determine** server for tables (CAS or SAS)
182
210
  - [ ] **Execute** appropriate detail tool
@@ -1,14 +1,14 @@
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
 
@@ -252,7 +252,7 @@ What resource type?
252
252
 
253
253
  | Aspect | Find | List |
254
254
  |---|---|---|
255
- | Purpose | Verify existence | Browse/discover |
255
+ | Purpose | Verify/discover existence | List available resources |
256
256
  | Returns | Single resource or not found | Multiple resources with pagination |
257
- | Use case | Before execution | Exploration/discovery |
257
+ | Use case | Before execution | Listing of resources |
258
258
  | Tool suffix | `find-*` | `list-*` |
@@ -37,6 +37,10 @@ Once resources are verified to exist, select the appropriate execution tool:
37
37
  | Run Job | `sas-score-run-jobdef` | job name, scenario parameters |
38
38
  | Run JobDef | `sas-score-run-jobdef` | jobdef name, scenario parameters |
39
39
  | Score with SCR model | `sas-score-scr-score` | SCR URL, scenario data |
40
+ | Describe MAS model | `sas-score-model-info` | model name |
41
+ | Describe Job/JobDef | `sas-score-job-info` | job or jobdef name |
42
+ | Describe SCR model | `sas-score-scr-info` | SCR URL |
43
+ | Describe table | `sas-score-table-info` | lib, table, server |
40
44
 
41
45
  ---
42
46
 
@@ -83,9 +83,11 @@ score results of query... → Query results
83
83
  ```
84
84
  sas-score-mas-score({
85
85
  model: "<model name>",
86
- scenario: { a: 1, b: 2 }
86
+ scenario: { a: 1, b: 2 }
87
+ })
87
88
  ```
88
- **Parameters** (job): ):
89
+
90
+ **Parameters** (job):
89
91
  ```
90
92
  sas-score-run-job({
91
93
  name: "<job name>",
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