@sassoftware/sas-score-mcp-serverjs 0.0.2

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 (96) hide show
  1. package/.babelrc +6 -0
  2. package/.env +13 -0
  3. package/.env.http +29 -0
  4. package/CHANGES.md +2 -0
  5. package/CONTRIBUTING.md +14 -0
  6. package/ContributorAgreement.txt +56 -0
  7. package/LICENSE +205 -0
  8. package/LICENSES.json +105 -0
  9. package/QUICK_REFERENCE.md +378 -0
  10. package/README.md +267 -0
  11. package/SECURITY.md +31 -0
  12. package/SUPPORT.md +3 -0
  13. package/TOOL_DESCRIPTION_TEMPLATE.md +157 -0
  14. package/TOOL_UPDATES_SUMMARY.md +208 -0
  15. package/cli.js +214 -0
  16. package/labs/.subclass.json +13 -0
  17. package/labs/README.md +4 -0
  18. package/mcpConfigurations/README.md +3 -0
  19. package/mcpConfigurations/http.json +8 -0
  20. package/mcpConfigurations/stdio.json +20 -0
  21. package/mcpConfigurations/stdiodev.json +20 -0
  22. package/mcpserver.png +0 -0
  23. package/openApi.json +106 -0
  24. package/openApi.yaml +84 -0
  25. package/package.json +72 -0
  26. package/sas-mcp-tools-reference.md +600 -0
  27. package/sasCode/sas-sql-query.sas +33 -0
  28. package/sasCode/sas_sql_tool.json +237 -0
  29. package/scripts/getViyaca.sh +8 -0
  30. package/src/core.js +19 -0
  31. package/src/coreSSE.js +14 -0
  32. package/src/corehttp.js +335 -0
  33. package/src/createHttpTransport.js +26 -0
  34. package/src/createMcpServer.js +76 -0
  35. package/src/db/scrModels.js +23 -0
  36. package/src/toolSet/devaScore.js +69 -0
  37. package/src/toolSet/findJob.js +90 -0
  38. package/src/toolSet/findJobdef.js +95 -0
  39. package/src/toolSet/findLibrary.js +100 -0
  40. package/src/toolSet/findModel.js +83 -0
  41. package/src/toolSet/findTable.js +94 -0
  42. package/src/toolSet/getEnv.js +72 -0
  43. package/src/toolSet/listJobdefs.js +96 -0
  44. package/src/toolSet/listJobs.js +110 -0
  45. package/src/toolSet/listLibraries.js +90 -0
  46. package/src/toolSet/listModels.js +83 -0
  47. package/src/toolSet/listTables.js +95 -0
  48. package/src/toolSet/makeTools.js +75 -0
  49. package/src/toolSet/mcp server .png +0 -0
  50. package/src/toolSet/modelInfo.js +87 -0
  51. package/src/toolSet/modelScore.js +131 -0
  52. package/src/toolSet/readTable.js +104 -0
  53. package/src/toolSet/runCasProgram.js +118 -0
  54. package/src/toolSet/runJob.js +81 -0
  55. package/src/toolSet/runJobdef.js +85 -0
  56. package/src/toolSet/runMacro.js +82 -0
  57. package/src/toolSet/runProgram.js +145 -0
  58. package/src/toolSet/sasQuery.js +126 -0
  59. package/src/toolSet/sasQueryTemplate.js +148 -0
  60. package/src/toolSet/sasQueryTemplate2.js +140 -0
  61. package/src/toolSet/scrInfo.js +55 -0
  62. package/src/toolSet/scrScore.js +71 -0
  63. package/src/toolSet/searchAssets.js +52 -0
  64. package/src/toolSet/setContext.js +98 -0
  65. package/src/toolSet/superstat.js +60 -0
  66. package/src/toolSet/tableInfo.js +102 -0
  67. package/src/toolhelpers/_catalogSearch.js +87 -0
  68. package/src/toolhelpers/_getEnv.js +10 -0
  69. package/src/toolhelpers/_itemsData.js +28 -0
  70. package/src/toolhelpers/_jobSubmit.js +78 -0
  71. package/src/toolhelpers/_listJobdefs.js +59 -0
  72. package/src/toolhelpers/_listJobs.js +63 -0
  73. package/src/toolhelpers/_listLibrary.js +56 -0
  74. package/src/toolhelpers/_listModels.js +41 -0
  75. package/src/toolhelpers/_listTables.js +52 -0
  76. package/src/toolhelpers/_masDescribe.js +27 -0
  77. package/src/toolhelpers/_masScoring.js +64 -0
  78. package/src/toolhelpers/_readTable.js +69 -0
  79. package/src/toolhelpers/_scrInfo.js +32 -0
  80. package/src/toolhelpers/_scrScore.js +49 -0
  81. package/src/toolhelpers/_submitCasl.js +34 -0
  82. package/src/toolhelpers/_submitCode.js +96 -0
  83. package/src/toolhelpers/_submitMacro.js +24 -0
  84. package/src/toolhelpers/_tableColumns.js +61 -0
  85. package/src/toolhelpers/_tableInfo.js +72 -0
  86. package/src/toolhelpers/deleteSession.js +13 -0
  87. package/src/toolhelpers/getLogonPayload.js +100 -0
  88. package/src/toolhelpers/getOpts.js +43 -0
  89. package/src/toolhelpers/getOptsViya.js +38 -0
  90. package/src/toolhelpers/getStoreOpts.js +18 -0
  91. package/src/toolhelpers/getToken.js +40 -0
  92. package/src/toolhelpers/refreshToken.js +48 -0
  93. package/test/README.md +63 -0
  94. package/test/listLibraries.test.js +245 -0
  95. package/tool-developer-guide.md +80 -0
  96. package/types.js +25 -0
@@ -0,0 +1,378 @@
1
+ # Tool Description Template - Quick Reference
2
+
3
+ ## The 9 Essential Sections
4
+
5
+ Every tool description should follow this exact structure:
6
+
7
+ ### 1️⃣ **Title Line**
8
+ ```markdown
9
+ ## toolName — brief one-liner description
10
+ ```
11
+ - Clear, action-oriented
12
+ - Include purpose/benefit
13
+ - Use em dash (—) not colon
14
+
15
+ ### 2️⃣ **LLM Invocation Guidance (When to use)**
16
+ ```markdown
17
+ Use THIS tool when:
18
+ - "example user request 1"
19
+ - "example user request 2"
20
+ - "example user request 3"
21
+ ```
22
+ - Explicit: "Use THIS tool when..."
23
+ - Real user phrases with quotes
24
+ - 3-5 examples
25
+ - Show actual language patterns
26
+
27
+ ### 3️⃣ **Do NOT use this tool for:**
28
+ ```markdown
29
+ - What NOT to do (use toolX instead)
30
+ - Another misuse case (use toolY instead)
31
+ - Common misconception (use toolZ instead)
32
+ ```
33
+ - List what NOT to do
34
+ - Always specify alternative tool
35
+ - Prevent tool misuse
36
+
37
+ ### 4️⃣ **Purpose**
38
+ ```markdown
39
+ Clear explanation of what this tool does.
40
+ 1-3 sentences maximum.
41
+ Explain the business value, not just mechanics.
42
+ ```
43
+ - Concise (1-3 sentences)
44
+ - Focus on "why" not just "what"
45
+ - Explain when/why someone uses it
46
+
47
+ ### 5️⃣ **Parameters**
48
+ ```markdown
49
+ - paramName (type, default): Description of what this parameter does.
50
+ - anotherParam (type, required): Description explaining constraints.
51
+ ```
52
+ - Every parameter documented
53
+ - Format: `name (type, default): description`
54
+ - Include constraints: `(1-100)`, `(required)`, `(optional)`
55
+ - Add examples of valid values
56
+
57
+ ### 6️⃣ **Response Contract**
58
+ ```markdown
59
+ Returns a JSON object containing:
60
+ - fieldName: Description of what this field contains
61
+ - otherField: Type and description
62
+ - Empty array if no results
63
+ - Error cases and how they're represented
64
+ ```
65
+ - Describe JSON structure
66
+ - List key fields and types
67
+ - Cover edge cases (empty, null, errors)
68
+ - Example response helpful
69
+
70
+ ### 7️⃣ **Disambiguation & Clarification**
71
+ ```markdown
72
+ - If user says "X" without specifying Y: ask "Did you mean Z?"
73
+ - If parameter is missing: ask "Which [param] would you like?"
74
+ - Handle multiple requests: clarify which one
75
+ ```
76
+ - Format: `- If user says "X" → ask "[question]"`
77
+ - Exact questions to ask (in quotes)
78
+ - Edge cases and confusion points
79
+
80
+ ### 8️⃣ **Examples (→ mapped params)**
81
+ ```markdown
82
+ - "user phrase example 1" → { param: "value", limit: 10 }
83
+ - "another user request" → { param: "value" }
84
+ - "with different params" → { param1: "x", param2: "y" }
85
+ ```
86
+ - Real user phrases (with quotes)
87
+ - Arrow notation: `→`
88
+ - Show parameter mappings
89
+ - 3-5 examples covering different scenarios
90
+
91
+ ### 9️⃣ **Negative Examples (should NOT call toolName)**
92
+ ```markdown
93
+ - "incorrect user request" (use toolX instead)
94
+ - "another common mistake" (use toolY instead)
95
+ ```
96
+ - Show what NOT to do
97
+ - Always specify correct tool
98
+ - 2-3 examples of common mistakes
99
+
100
+ ### 🔟 **Related Tools** (optional but recommended)
101
+ ```markdown
102
+ - listThing → findThing → infoThing → actionThing (typical workflow)
103
+ - otherTool — description of how it relates
104
+ ```
105
+ - Show workflow chains
106
+ - Show prerequisites
107
+ - Show follow-up tools
108
+
109
+ ---
110
+
111
+ ## Formatting Checklist
112
+
113
+ - [ ] Use `## title` for main header
114
+ - [ ] Use `###` or bold for section headers
115
+ - [ ] Use `- ` for bullet points
116
+ - [ ] Use `` `code` `` for parameter/field names
117
+ - [ ] Use quotes `"..."` for example user phrases
118
+ - [ ] Use em dash `→` in examples (not arrow)
119
+ - [ ] Use em dash `—` in title (not colon or dash)
120
+ - [ ] Consistent indentation
121
+ - [ ] No typos (spell-check parameter names)
122
+
123
+ ---
124
+
125
+ ## Parameter Documentation Format
126
+
127
+ **Minimal:**
128
+ ```
129
+ - name (string): Description.
130
+ ```
131
+
132
+ **With defaults:**
133
+ ```
134
+ - name (string, default 'value'): Description.
135
+ ```
136
+
137
+ **With constraints:**
138
+ ```
139
+ - name (number, 1-100, default 10): Description.
140
+ ```
141
+
142
+ **Optional parameter:**
143
+ ```
144
+ - name (string, optional): Description.
145
+ ```
146
+
147
+ **Required parameter:**
148
+ ```
149
+ - name (string, required): Description.
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Example Parameter Variations
155
+
156
+ ```markdown
157
+ Parameters
158
+ - model (string, required): The name of the model to analyze.
159
+ - limit (number, default 10): Maximum results (1-1000).
160
+ - where (string, optional): SQL-style filter clause.
161
+ - server (string, default 'cas'): Target server: 'cas' or 'sas'.
162
+ - format (boolean, default true): Return formatted values when true.
163
+ ```
164
+
165
+ ---
166
+
167
+ ## Response Contract Examples
168
+
169
+ ### Simple (scalar return)
170
+ ```markdown
171
+ Response Contract
172
+ Returns a JSON object with:
173
+ - result: The computed numeric value (number)
174
+ ```
175
+
176
+ ### Array return
177
+ ```markdown
178
+ Response Contract
179
+ Returns an array of objects:
180
+ - Each object contains { name: string, value: any }
181
+ - Empty array if no results found
182
+ ```
183
+
184
+ ### Complex structure
185
+ ```markdown
186
+ Response Contract
187
+ Returns a JSON object with:
188
+ - models: Array of model objects containing:
189
+ - name: Model name (string)
190
+ - type: Model type (string)
191
+ - metadata: Optional model metadata (object)
192
+ - count: Total number of models (number)
193
+ - pageInfo: Pagination information if applicable
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Example vs Negative Example Format
199
+
200
+ **Examples format:**
201
+ ```
202
+ - "read 10 rows from customers" → { table: "customers", limit: 10 }
203
+ - "get all columns from orders" → { table: "orders" }
204
+ ```
205
+
206
+ **Negative Examples format:**
207
+ ```
208
+ - "execute this SQL query" (use sasQuery instead)
209
+ - "run this SAS program" (use program instead)
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Common Mistakes to Avoid
215
+
216
+ ❌ **Bad: Vague description**
217
+ ```
218
+ ## listThings
219
+
220
+ Provides a list of things.
221
+ ```
222
+
223
+ ✅ **Good: Clear description**
224
+ ```
225
+ ## listThings — enumerate available items with pagination support
226
+ ```
227
+
228
+ ---
229
+
230
+ ❌ **Bad: No usage guidance**
231
+ ```
232
+ Parameters
233
+ - name (string): The name
234
+ ```
235
+
236
+ ✅ **Good: Clear guidance**
237
+ ```
238
+ Parameters
239
+ - name (string, required): The exact name of the item to retrieve.
240
+ Names are case-sensitive. Examples: 'myItem', 'item_123'
241
+ ```
242
+
243
+ ---
244
+
245
+ ❌ **Bad: Abstract examples**
246
+ ```
247
+ Examples
248
+ - basic usage
249
+ - advanced usage with parameters
250
+ ```
251
+
252
+ ✅ **Good: Real examples**
253
+ ```
254
+ Examples (→ mapped params)
255
+ - "list all models" → { start: 1, limit: 10 }
256
+ - "show me 25 models" → { start: 1, limit: 25 }
257
+ ```
258
+
259
+ ---
260
+
261
+ ❌ **Bad: Missing related tools**
262
+ ```
263
+ [Description ends]
264
+ ```
265
+
266
+ ✅ **Good: Context**
267
+ ```
268
+ Related Tools
269
+ - listModels → findModel → modelInfo → modelScore (typical workflow)
270
+ - findModel — to check if a specific model exists
271
+ - modelScore — to score using this model
272
+ ```
273
+
274
+ ---
275
+
276
+ ## Section Order (IMPORTANT)
277
+
278
+ Always use this exact order:
279
+ 1. Title
280
+ 2. LLM Invocation Guidance (When to use)
281
+ 3. Do NOT use this tool for
282
+ 4. Purpose
283
+ 5. Parameters
284
+ 6. Response Contract
285
+ 7. Disambiguation & Clarification
286
+ 8. Examples (→ mapped params)
287
+ 9. Negative Examples
288
+ 10. Related Tools (optional)
289
+
290
+ ---
291
+
292
+ ## Line Length Guidelines
293
+
294
+ - Keep lines under 100 characters for readability
295
+ - Parameter descriptions can wrap across 2-3 lines
296
+ - Real-world example lines can be longer if needed
297
+
298
+ ---
299
+
300
+ ## Testing Your Description
301
+
302
+ Before submitting, verify:
303
+
304
+ 1. **Can an LLM understand when to use this?**
305
+ - Read the "LLM Invocation Guidance" section
306
+ - Does it have real user phrase examples?
307
+
308
+ 2. **Can an LLM understand what NOT to do?**
309
+ - Read the "Do NOT use" section
310
+ - Does it specify which tool to use instead?
311
+
312
+ 3. **Can an LLM invoke this correctly?**
313
+ - Look at the "Examples" section
314
+ - Are parameter mappings clear and realistic?
315
+
316
+ 4. **Does it match the template format?**
317
+ - Use the 9-section checklist above
318
+ - All required sections present?
319
+ - Proper markdown formatting?
320
+
321
+ 5. **Is it consistent with other tools?**
322
+ - Same structure as similar tools?
323
+ - Same tone and style?
324
+ - Same level of detail?
325
+
326
+ ---
327
+
328
+ ## Quick Copy-Paste Template
329
+
330
+ ```markdown
331
+ ## toolName — brief one-liner
332
+
333
+ LLM Invocation Guidance (When to use)
334
+ Use THIS tool when:
335
+ - "example 1"
336
+ - "example 2"
337
+ - "example 3"
338
+
339
+ Do NOT use this tool for:
340
+ - Wrong use case (use toolX instead)
341
+ - Another wrong case (use toolY instead)
342
+
343
+ Purpose
344
+ [1-3 sentences explaining what this tool does]
345
+
346
+ Parameters
347
+ - param1 (type, default): Description
348
+ - param2 (type, required): Description
349
+
350
+ Response Contract
351
+ [Describe JSON response structure]
352
+
353
+ Disambiguation & Clarification
354
+ - If user says "X" → ask "question?"
355
+ - If missing param → ask "which param?"
356
+
357
+ Examples (→ mapped params)
358
+ - "user request 1" → { param1: "value" }
359
+ - "user request 2" → { param1: "value", param2: 10 }
360
+
361
+ Negative Examples (should NOT call toolName)
362
+ - "wrong request" (use toolX instead)
363
+ - "another mistake" (use toolY instead)
364
+
365
+ Related Tools
366
+ - toolX — description
367
+ - toolY — description
368
+ ```
369
+
370
+ ---
371
+
372
+ ## Questions?
373
+
374
+ Refer to:
375
+ - `TOOL_DESCRIPTION_TEMPLATE.md` - Detailed specification
376
+ - `EXAMPLE_IMPROVEMENTS.md` - Before/after comparisons
377
+ - `TOOL_UPDATES_SUMMARY.md` - What was updated
378
+ - Updated tool files in `src/toolSet/` - Real examples
package/README.md ADDED
@@ -0,0 +1,267 @@
1
+ # sas-score-mcp-serverjs
2
+ A Model Context Protocol (MCP) Server for Scoring with SAS Viya
3
+
4
+ ## Overview
5
+ This MCP server is designed for scoring with SAS Viya.
6
+
7
+ > Note: **scoring** refers to executing any code that takes some input and returns results.
8
+
9
+ Some examples are:
10
+
11
+ - models created with SAS solutions like Model Studio, Intelligent Decisioning etc...
12
+ - user written SAS program
13
+ - SAS Studio Flow
14
+ - job Definitions
15
+ - jobs using SAS Studio or other interfaces
16
+
17
+ ## Target Audience
18
+ This MCP server was developed for two types of SAS users.
19
+
20
+ ### SAS users
21
+ SAS users who want to use natural language("chat") to execute prebuilt SAS code and models.
22
+ See this [quick reference](../sas-mcp-tools-reference.md) for details.
23
+
24
+ ### MCP tool developers
25
+ SAS developers who want to extend the capabilities of the server with their own tools. See the [guide](../tool-developer-guide.md) for details.
26
+
27
+ ## Configuration Variables
28
+ Typically these are set either in the .env file or as environment variables (or both). This is full list of the configuration variables used the mcp server.
29
+
30
+ ```env
31
+
32
+ # Indicate what type of transport(stdio|http)
33
+ # http is useful for remote mcp servers
34
+ # If running locally, recommend stdio
35
+
36
+ MCPTYPE=http
37
+
38
+ # Port for http transport(default is 8080)
39
+
40
+ PORT=8080
41
+
42
+ # If transport is http, optionally specify if the server
43
+ # is using http or https
44
+
45
+ HTTPS=FALSE
46
+
47
+
48
+ # Viya Authentication
49
+ # The mcp server support different ways to authenticate(see section on Authentication)
50
+
51
+ # * sascli * will look for tokens created with sas-viya cli
52
+ # * token * a custom token
53
+ # * password * userid/password
54
+
55
+ AUTHFLOW=sascli
56
+ SAS_CLI_CONFIG=your-home-directory
57
+ SAS_CLI_PROFILE=your-sas-cli-profile
58
+
59
+ # VIYA_SERVER URL for AUTHFLOW of token and password
60
+
61
+ VIYA_SERVER= your Viya server url
62
+
63
+ # if AUTHFLOW=token, specify the file with the token
64
+ TOKENFILE=
65
+
66
+ # if password flow specify these
67
+ CLIENTIDPW=
68
+ CLIENTSECRET=
69
+ PASSWORD=
70
+
71
+ # When HTTPS is TRUE, specify the folder with SSL certificates for the mcp server
72
+ # All files in that folder will be loaded and used in the TLS connection
73
+ # If not set and HTTPS is true, the server will create a self-signed certificate
74
+
75
+ SSLCERT=<some folder>
76
+
77
+
78
+ # This certificate isused in the http calls to SAS Viya from MCP server
79
+ # Used in restaf (ultimately axios and fetch)
80
+ # All files in the folder will be loaded and used in the TLS connection
81
+ # if not set, no ssl certificates will be used
82
+ # See the script in scripts/getViyaca.sh to get this certificate from the SAS Viya server
83
+
84
+ VIYACERT=<some folder>
85
+
86
+ # SAS Contexts
87
+ # These are for the CAS and SAS sessions
88
+ # Defaults are:
89
+ COMPUTECONTEXT=SAS Job Execution compute context
90
+ CASSERVER=cas-shared-default
91
+
92
+ ```
93
+
94
+ ## Authentication
95
+ The server supports multiple ways to authenticate.
96
+
97
+ ### sas-viya cli
98
+
99
+ > Note: To use this, set `AUTHFLOW=sascli`
100
+
101
+ This MCP server CLI works similar to SAS supplied sas-viya CLI commands.
102
+ Use the following command to create the necessary token and refresh token.
103
+
104
+ `create a default auth Profile`.
105
+ Issue this command and follow instruction: `sas-viya profile init`
106
+
107
+ `create token`
108
+ Issue this command and follow the instructions: `sas-viya auth loginCode`
109
+
110
+ You need to do this once every 90 days or whenever the refresh token expires.
111
+
112
+ At this point the tools can make authenticated calls to SAS Viya.
113
+
114
+ ### Password
115
+
116
+ > Note: To use this, set `AUTHTYPE=password`
117
+
118
+ Ths requires additional setup:
119
+
120
+ - Create a clientid and client password for Oauth password flow.
121
+ - Set these in the .env file or the mcp configuration file
122
+
123
+ ### Custom token
124
+
125
+ > Note: To use this, set `AUTHTYPE=token`
126
+
127
+ Set the env TOKENFILE to a file containing the token.
128
+
129
+ There seems to be a pattern of using a long-lived token.
130
+ If this is your use case, set the TOKENFILE to a file containing this token.
131
+
132
+ ### Oauth
133
+ This is under development.
134
+
135
+ ## Transport Methods
136
+ This server supports both stdio and http transport methods.
137
+
138
+ ### stdio transport
139
+ This is ideal for running mcp servers locally.
140
+ Most clients will autostart the mcp server for you.
141
+
142
+ > Note: You must set the MCPTYPE in the environment variable.
143
+
144
+ ```json
145
+ "sasmcp": {
146
+ "type": "stdio",
147
+ "command": "npx",
148
+ "args": [
149
+ "@sassoftware/sas-app-mcp-serverjs@latest",
150
+ ],
151
+ "env": {
152
+ "MCPTYPE": "stdio",
153
+ "AUTHFLOW": "sascli", // sascli|password|token
154
+ "SAS_CLI_PROFILE": "cli profile name or Default",
155
+ "SAS_CLI_CONFIG":"where sas-cli stores authentication information",
156
+ "SSLCERT": "where you have stored the tls information(see below)",
157
+ "VIYACERT": "where you have stored the viya server ssl certificates for calls to Viya server",
158
+ "VIYA_SERVER": "viya server if AUTHFLOW=password|token|refresh",
159
+ "PASSWORD": "password if AUTHFLOW is password",
160
+ "USERNAME": "username if AUTHFLOW is password",
161
+ "CLIENTIDPW": "client password if AUTHFLOW is password",
162
+ "CLIENTSECRETPW": "client id if AUTHFLOW is password",
163
+ "TOKENFILE": "file if AUTHFLOW is token",
164
+ "COMPUTECONTEXT": "SAS Job Execution compute context",
165
+ "CASSERVER": "cas-shared-default",
166
+ }
167
+ }
168
+
169
+ ```
170
+
171
+ ### http transport
172
+
173
+ This is an alternate to using stdio.
174
+ This requires the .env file, which has the necessary configuration values described earlier in this document.
175
+ It also requires the MCP server to be running (see step 2).
176
+
177
+ > Remote MCP servers: This is under development
178
+
179
+ #### Step 1: Configure the mcp client for localhost
180
+
181
+ The mcp configuration is show below
182
+
183
+ ```json
184
+ "sasmcp": {
185
+ "type": "http",
186
+ "url": "http(s)//localhost:8080/mcp"``
187
+ }
188
+ ```
189
+
190
+ Here is a typical .env file for http transport
191
+
192
+ ```env
193
+
194
+ PORT=8080
195
+ HTTPS=FALSE
196
+ MCPTYPE=http
197
+ VIYA_SERVER=https://myviya.com
198
+ AUTHFLOW=sascli
199
+ SAS_CLI_PROFILE=00m
200
+ SAS_CLI_CONFIG=c:\Users\<yourusername>
201
+ SSLCERT=c:\Users\yourusername\.tls
202
+ VIYACERT=c:\Users\yourusername\viyaCert
203
+ CAS_SERVER=cas-shared-default
204
+ COMPUTECONTEXT=SAS Job Execution compute context
205
+
206
+ ```
207
+ Use https if the environment variables HTTPS=TRUE
208
+
209
+
210
+ #### Step 2: Start the mcp server
211
+
212
+ If using stdio transport, most of the mcp clients will start the server automatically.
213
+ But this step is necessary of using http transport.
214
+
215
+
216
+ ```sh
217
+ npx dotenv-cli -e .env -- npx @sassoftware/sas-app-mcp-serverjs@latest
218
+ ```
219
+
220
+ An alternative to using dotenv-cli is to preset the environment variables.
221
+ Make sure that the .env file is in the current working directory
222
+
223
+
224
+ ## Notes
225
+
226
+ The mcp server caches information for each mcp session id(user).
227
+
228
+ However, cas and compute sessions are not cached in this release(TBD).
229
+ The implication of this design choice is felt most when the tool needs is creating compute session * the requests will take longer than when the compute session is cached.
230
+
231
+ ## Other Useful Tips
232
+
233
+ ### mkcert
234
+ To create a self-signed certificate for localhost:
235
+
236
+ ```sh
237
+ mkcert -install
238
+ ```
239
+
240
+ The install also stores local root Certificate Authority (CA) on the system.
241
+ For windows the location is `AppData/Local\mkcert`.
242
+
243
+ Now go to the location where you want to store the certificates.
244
+ Then create the certificates:
245
+
246
+ ```sh
247
+ mkcert -key-file key.pem -cert-file crt.pem localhost 127:0.0.1 ::1
248
+ ```
249
+
250
+ One last step for windows nodejs users.
251
+ Add this to the environment variable `NODE_EXTRA_CA_CERTS`:
252
+
253
+ ```text
254
+ NODE_EXTRA_CA_CERTS=c:\Users\<your_username>\AppData\Local\mkcert\rootCA.pem
255
+ ```
256
+
257
+ ## License
258
+ This project is licensed under the [Apache 2.0 license](LICENSE).
259
+
260
+ ## Additional Resources
261
+
262
+ * [Documentation on modelcontextprotocol(mcp)](https://modelcontextprotocol.io/introduction)
263
+ * [mcp sdk](https://www.npmjs.com/package/@modelcontextprotocol/sdk)
264
+ * [restaf](https://sassoftware.github.io/restaf/)
265
+ * [mkcert](https://www.npmjs.com/package/mkcert)
266
+ * [SAS tokens](https://communities.sas.com/t5/SAS-Communities-Library/SAS-Viya-CLI-Token-Expiry/ta-p/848183)
267
+ * Also see <https://communities.sas.com> for articles on using mcp servers with SAS Viya
package/SECURITY.md ADDED
@@ -0,0 +1,31 @@
1
+ <!--
2
+ A SECURITY.md outlines your project's security policy. It includes instructions on how to report a security vulnerability in your project.
3
+ If your project contains this file, link to it from the project's README.
4
+ -->
5
+
6
+ # PROJECT_NAME Security Policy
7
+ <!-- Replace PROJECT_NAME with the official name of your SAS-sanctioned open source project. -->
8
+ Project maintainers and community contributors take security issues seriously.
9
+ Efforts to disclose potential issues responsibly are appreciated, and viable contributions will be acknowledged.
10
+ To aid investigation of any reported vulnerabilities, please follow the [reporting guidelines](#reporting-guidelines) when submitting your findings.
11
+
12
+ ## Reporting Guidelines
13
+ <!-- Project maintainers: Activate GitHub's built-in private reporting:
14
+
15
+ https://docs.github.com/en/code-security/security-advisories/working-with-repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository
16
+ -->
17
+
18
+ To report a suspected security issue, use private vulnerability reporting.
19
+
20
+ 1. Click the `Security` tab
21
+ 1. Click the `Report a vulnerability` button
22
+
23
+ Then provide the following information with suspected security issues:
24
+
25
+ * Your name and affiliation
26
+ * Version/build-date of project
27
+ * Issue description
28
+ * Steps to reproduce the issue
29
+ * Current public knowledge of this vulnerability (for example, related CVE, security advisory, and so on), if known
30
+
31
+ The project release notes contain acknowledgments for contributors who provide security-related insights in their commits.
package/SUPPORT.md ADDED
@@ -0,0 +1,3 @@
1
+ ## Support
2
+ Project maintainers use GitHub for tracking bugs and feature requests.
3
+ Please submit a GitHub issue or pull request for support.