@sassoftware/sas-score-mcp-serverjs 1.0.1-9 → 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.
- package/.skills/.claude-plugin/plugin.json +59 -0
- package/.skills/agents/sas-score-mcp-serverjs-agent.md +26 -0
- package/.skills/copilot-instructions.md +62 -0
- package/.skills/skills/README.md +204 -0
- package/.skills/skills/detail-strategy/SKILL.md +316 -0
- package/.skills/skills/find-library-server/SKILL.md +62 -0
- package/.skills/skills/find-resources/SKILL.md +66 -0
- package/.skills/skills/list-library/SKILL.md +30 -0
- package/.skills/skills/list-mas-job-jobdef/SKILL.md +31 -0
- package/.skills/skills/list-tables/SKILL.md +30 -0
- package/.skills/skills/read-strategy/SKILL.md +87 -0
- package/.skills/skills/request-routing/SKILL.md +112 -0
- package/.skills/skills/score-cas/SKILL.md +95 -0
- package/.skills/skills/score-job-jobdef/SKILL.md +58 -0
- package/.skills/skills/score-mas-scr/SKILL.md +58 -0
- package/.skills/skills/score-program/SKILL.md +59 -0
- package/.skills/skills/score-strategy/SKILL.md +39 -0
- package/README.md +96 -54
- package/cli.js +11 -13
- package/openApi.yaml +121 -121
- package/package.json +16 -14
- package/scripts/docs/SCORE_SKILL_REFERENCE.md +17 -16
- package/scripts/docs/TOOL_DESCRIPTION_TEMPLATE.md +3 -3
- package/scripts/docs/TOOL_UPDATES_SUMMARY.md +65 -63
- package/scripts/docs/oauth-http-transport.md +2 -2
- package/scripts/docs/sas-mcp-tools-reference.md +43 -32
- package/scripts/plot_msrp_usa.py +49 -0
- package/scripts/refreshtoken.js +58 -0
- package/scripts/runListScr.mjs +16 -0
- package/src/createMcpServer.js +4 -1
- package/src/expressMcpServer.js +47 -49
- package/src/oauthHandlers/authorize.js +4 -1
- package/src/oauthHandlers/baseUrl.js +4 -0
- package/src/oauthHandlers/callback.js +4 -0
- package/src/oauthHandlers/getMetadata.js +4 -0
- package/src/oauthHandlers/index.js +4 -0
- package/src/oauthHandlers/token.js +4 -0
- package/src/openApi.yaml +121 -121
- package/src/processHeaders.js +10 -7
- package/src/setupSkills.js +1 -18
- package/src/toolHelpers/_casScore.js +32 -0
- package/src/toolHelpers/_desc.js +14 -0
- package/src/toolHelpers/_findJob.js +12 -0
- package/src/toolHelpers/_findJobdef.js +10 -0
- package/src/toolHelpers/_findLibrary.js +11 -0
- package/src/toolHelpers/_findMas.js +13 -0
- package/src/toolHelpers/_findScr.js +36 -0
- package/src/toolHelpers/_findTable.js +11 -0
- package/src/toolHelpers/_listJobdefs.js +12 -2
- package/src/toolHelpers/_listJobs.js +19 -8
- package/src/toolHelpers/{_listModels.js → _listMas.js} +4 -4
- package/src/toolHelpers/_listScr.js +13 -0
- package/src/toolHelpers/{_scrInfo.js → _scrDescribe.js} +4 -4
- package/src/toolHelpers/_scrScore.js +2 -2
- package/src/toolHelpers/_submitCasl.js +19 -17
- package/src/toolHelpers/{_tableInfo.js → _tableDescribe.js} +2 -2
- package/src/toolHelpers/getLogonPayload.js +2 -2
- package/src/toolSet/casModelScore.js +93 -0
- package/src/toolSet/casProgramScore.js +105 -0
- package/src/toolSet/devaScore.js +11 -6
- package/src/toolSet/findJob.js +74 -59
- package/src/toolSet/findJobdef.js +67 -64
- package/src/toolSet/findLibrary.js +28 -23
- package/src/toolSet/findMas.js +72 -0
- package/src/toolSet/findScr.js +69 -0
- package/src/toolSet/findTable.js +34 -27
- package/src/toolSet/getEnv.js +57 -57
- package/src/toolSet/jobDescribe.js +65 -0
- package/src/toolSet/jobScore.js +90 -0
- package/src/toolSet/jobdefDescribe.js +67 -0
- package/src/toolSet/jobdefScore.js +85 -0
- package/src/toolSet/listJobdefs.js +17 -8
- package/src/toolSet/listJobs.js +15 -8
- package/src/toolSet/listLibraries.js +16 -10
- package/src/toolSet/listMas.js +71 -0
- package/src/toolSet/listScr.js +62 -0
- package/src/toolSet/listTables.js +78 -66
- package/src/toolSet/{runMacro.js → macroScore.js} +86 -82
- package/src/toolSet/makeTools.js +39 -25
- package/src/toolSet/masDescribe.js +67 -0
- package/src/toolSet/masScore.js +95 -0
- package/src/toolSet/{runProgram.js → programScore.js} +96 -93
- package/src/toolSet/readTable.js +43 -26
- package/src/toolSet/sasQuery.js +24 -18
- package/src/toolSet/scrDescribe.js +55 -0
- package/src/toolSet/scrScore.js +63 -70
- package/src/toolSet/searchAssets.js +1 -1
- package/src/toolSet/setContext.js +8 -3
- package/src/toolSet/superstat.js +61 -61
- package/src/toolSet/tableDescribe.js +65 -0
- package/.agents/sas-score-mcp-serverjs-agent.md +0 -58
- package/.instructions/copilot-instructions.md +0 -201
- package/.instructions/enforce-find-resource-strategy.md +0 -35
- package/.skills/sas-find-library-smart/SKILL.md +0 -155
- package/.skills/sas-find-resource-strategy/SKILL.md +0 -105
- package/.skills/sas-list-resource-strategy/SKILL.md +0 -124
- package/.skills/sas-list-tables-smart/SKILL.md +0 -128
- package/.skills/sas-read-and-score-strategy/SKILL.md +0 -113
- package/.skills/sas-read-strategy/SKILL.md +0 -154
- package/.skills/sas-request-classifier/SKILL.md +0 -74
- package/.skills/sas-score-workflow-strategy/SKILL.md +0 -314
- package/scripts/optimize_final.py +0 -140
- package/scripts/optimize_tools.py +0 -99
- package/scripts/setup-skills.js +0 -34
- package/scripts/update_descriptions.py +0 -46
- package/src/authpkce.js +0 -219
- package/src/handleGetDelete.js +0 -34
- package/src/handleRequest.js +0 -112
- package/src/hapiMcpServer.js +0 -241
- package/src/toolSet/findModel.js +0 -60
- package/src/toolSet/listModels.js +0 -56
- package/src/toolSet/modelInfo.js +0 -55
- package/src/toolSet/modelScore.js +0 -89
- package/src/toolSet/runCasProgram.js +0 -98
- package/src/toolSet/runJob.js +0 -81
- package/src/toolSet/runJobdef.js +0 -82
- package/src/toolSet/scrInfo.js +0 -52
- 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
|
|
48
|
-
|
|
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
|
-
|
|
80
|
+
### Options with defaults
|
|
52
81
|
|
|
53
|
-
|
|
82
|
+
These can be customized
|
|
54
83
|
|
|
55
|
-
|
|
84
|
+
1. AUTHFLOW=**oauth**|oauthclient|bearer|sascli|token|password
|
|
85
|
+
- Authentication method. Default is oauth
|
|
56
86
|
|
|
57
|
-
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
|
-
|
|
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
|
-
|
|
63
|
-
-
|
|
97
|
+
5. PROFILE=**~/.sas**
|
|
98
|
+
- profile name used by sas-cli to store the tokens
|
|
64
99
|
|
|
65
|
-
|
|
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
|
-
|
|
106
|
+
8. COMPUTECONTEXT=**"SAS Job Execution compute context"**
|
|
107
|
+
- Use one that is appropriate
|
|
69
108
|
|
|
70
|
-
|
|
71
|
-
PROFILE=<profile name used by sas-cli to store the tokens in ~/.sas>
|
|
72
|
-
```
|
|
109
|
+
### Clientid specifications
|
|
73
110
|
|
|
74
|
-
|
|
111
|
+
If using remote mcp server, change the url in redirect to the remote url
|
|
75
112
|
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
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
|
-
|
|
132
|
+
## Agent and skills
|
|
89
133
|
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
137
|
+
To download the skills to your environment issue this command:
|
|
96
138
|
|
|
97
|
-
```
|
|
98
|
-
|
|
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
|
|
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
|
|
161
|
+
For bearer authflow.
|
|
117
162
|
```json
|
|
118
163
|
"sasmcp": {
|
|
119
164
|
"type": "http",
|
|
120
|
-
"url": "
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
|
|
165
|
+
"url": "http://localhost:8080/mcp`,
|
|
166
|
+
"headers" {
|
|
167
|
+
"Authorization": "bearer <tokenstring>"
|
|
168
|
+
}
|
|
124
169
|
}
|
|
125
170
|
```
|
|
126
171
|
|
|
127
|
-
For
|
|
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
|
|
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,8 +9,6 @@
|
|
|
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';
|
|
@@ -25,7 +23,8 @@ import setupSkills from './src/setupSkills.js';
|
|
|
25
23
|
import { parseArgs } from "node:util";
|
|
26
24
|
|
|
27
25
|
import NodeCache from 'node-cache';
|
|
28
|
-
import { be } from 'zod/locales';
|
|
26
|
+
//import { be } from 'zod/locales';
|
|
27
|
+
//import { auth } from '@modelcontextprotocol/sdk/client/auth';
|
|
29
28
|
//import getOpts from './src/toolHelpers/getOpts.js';
|
|
30
29
|
|
|
31
30
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -140,6 +139,7 @@ Options:
|
|
|
140
139
|
MCP server options:
|
|
141
140
|
-t, --mcptype <type> MCP server type: http or stdio (default: http)
|
|
142
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
|
|
143
143
|
|
|
144
144
|
Authentication options:
|
|
145
145
|
-c, --clientid <id> Client ID for oauth authentication(pkce preferred. default: vscodemcp)
|
|
@@ -205,7 +205,7 @@ process.env.AUTHFLOW = args.values.authflow || process.env.AUTHFLOW || 'oauth';
|
|
|
205
205
|
process.env.MCPCLIENT = args.values.client || process.env.MCPCLIENT || 'github';
|
|
206
206
|
process.env.VIYA_SERVER = args.values.viya || process.env.VIYA_SERVER;
|
|
207
207
|
process.env.CLIENTID = args.values.clientid || process.env.CLIENTID || 'vscodemcp';
|
|
208
|
-
process.env.CLIENTSECRET = null;
|
|
208
|
+
process.env.CLIENTSECRET = args.values.clientid || process.env.CLIENTID || null;
|
|
209
209
|
process.env.SAS_CLI_PROFILE = args.values.profile || process.env.SAS_CLI_PROFILE || 'Default';
|
|
210
210
|
process.env.SAS_CLI_CONFIG = args.values.config || process.env.SAS_CLI_CONFIG || os.homedir(); // default to user home directory
|
|
211
211
|
process.env.CASSERVER = args.values.casserver || process.env.CASSERVER || 'cas-shared-default';
|
|
@@ -268,12 +268,15 @@ let mcpHost = process.env.MCPHOST;
|
|
|
268
268
|
if (authFlow === 'oauth' || authFlow === 'oauthclient') {
|
|
269
269
|
authFlow = 'bearer';
|
|
270
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
|
|
271
273
|
}
|
|
272
|
-
let autoLogon = process.env.AUTOLOGON != null ? process.env.AUTOLOGON.toUpperCase() : "FALSE";
|
|
274
|
+
let autoLogon = process.env.AUTOLOGON != null ? process.env.AUTOLOGON.toUpperCase() : "FALSE";
|
|
273
275
|
const appEnvBase = {
|
|
274
276
|
version: version,
|
|
275
277
|
mcpType: mcpType,
|
|
276
278
|
mcpClient: process.env.MCPCLIENT || 'github',
|
|
279
|
+
agent: (process.env.AGENT === 'TRUE') ? true : false,
|
|
277
280
|
mcpHost: (process.env.MCPHOST == null) ? 'http://localhost:8080' : process.env.MCPHOST,
|
|
278
281
|
brand: (process.env.BRAND == null) ? BRAND : process.env.BRAND,
|
|
279
282
|
HTTPS: https,
|
|
@@ -437,6 +440,7 @@ Options:
|
|
|
437
440
|
PORT ${appEnvBase.PORT}
|
|
438
441
|
HTTPS ${appEnvBase.contexts.HTTPS}
|
|
439
442
|
CLIENT ${appEnvBase.mcpClient}
|
|
443
|
+
AGENT ${appEnvBase.agent}
|
|
440
444
|
|
|
441
445
|
Authentication options:
|
|
442
446
|
AUTHFLOW ${process.env.AUTHFLOW}
|
|
@@ -468,14 +472,8 @@ if (mcpType === 'stdio') {
|
|
|
468
472
|
|
|
469
473
|
} else {
|
|
470
474
|
console.error('[Note] Starting HTTP MCP server...');
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
await hapiMcpServer(mcpServer, sessionCache, appEnvBase);
|
|
474
|
-
console.error('[Note] Using HAPI HTTP server...')
|
|
475
|
-
} else {
|
|
476
|
-
await expressMcpServer(mcpServer, sessionCache, appEnvBase);
|
|
477
|
-
console.error('[Note] MCP HTTP express server started on port ' + appEnvBase.PORT);
|
|
478
|
-
}
|
|
475
|
+
await expressMcpServer(mcpServer, sessionCache, appEnvBase);
|
|
476
|
+
console.error('[Note] MCP HTTP express server started on port ' + appEnvBase.PORT);
|
|
479
477
|
}
|
|
480
478
|
|
|
481
479
|
// custom reader for .env file to avoid dotenv logging to console
|
package/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
|