@sassoftware/sas-score-mcp-serverjs 0.4.1 → 1.0.1-0

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 (72) hide show
  1. package/.skills/agents/sas-viya-scoring-expert.md +58 -0
  2. package/.skills/copilot-instructions.md +155 -0
  3. package/.skills/skills/sas-find-library-smart/SKILL.md +154 -0
  4. package/.skills/skills/sas-list-tables-smart/SKILL.md +127 -0
  5. package/.skills/skills/sas-read-and-score/SKILL.md +111 -0
  6. package/.skills/skills/sas-read-strategy/SKILL.md +156 -0
  7. package/.skills/skills/sas-request-classifier/SKILL.md +69 -0
  8. package/.skills/skills/sas-score-workflow/SKILL.md +314 -0
  9. package/cli.js +311 -70
  10. package/package.json +7 -7
  11. package/scripts/docs/SCORE_SKILL_REFERENCE.md +142 -0
  12. package/scripts/docs/TOOL_DESCRIPTION_TEMPLATE.md +157 -0
  13. package/scripts/docs/TOOL_UPDATES_SUMMARY.md +208 -0
  14. package/scripts/docs/mcp-localhost-config-guide.md +184 -0
  15. package/scripts/docs/oauth-http-transport.md +96 -0
  16. package/scripts/docs/sas-mcp-tools-reference.md +600 -0
  17. package/scripts/getViyaca.sh +1 -0
  18. package/scripts/optimize_final.py +140 -0
  19. package/scripts/optimize_tools.py +99 -0
  20. package/scripts/setup-skills.js +34 -0
  21. package/scripts/update_descriptions.py +46 -0
  22. package/scripts/viyatls.sh +3 -0
  23. package/src/authpkce.js +219 -0
  24. package/src/createMcpServer.js +16 -5
  25. package/src/expressMcpServer.js +350 -308
  26. package/src/handleGetDelete.js +6 -3
  27. package/src/hapiMcpServer.js +10 -18
  28. package/src/oauthHandlers/authorize.js +46 -0
  29. package/src/oauthHandlers/baseUrl.js +8 -0
  30. package/src/oauthHandlers/callback.js +96 -0
  31. package/src/oauthHandlers/getMetadata.js +27 -0
  32. package/src/oauthHandlers/index.js +7 -0
  33. package/src/oauthHandlers/token.js +37 -0
  34. package/src/processHeaders.js +88 -0
  35. package/src/setupSkills.js +46 -0
  36. package/src/toolHelpers/_jobSubmit.js +2 -0
  37. package/src/toolHelpers/_listLibrary.js +55 -39
  38. package/src/toolHelpers/getLogonPayload.js +7 -1
  39. package/src/toolHelpers/readCerts.js +4 -4
  40. package/src/toolHelpers/refreshToken.js +3 -2
  41. package/src/toolHelpers/refreshTokenOauth.js +3 -3
  42. package/src/toolSet/.claude/settings.local.json +13 -0
  43. package/src/toolSet/devaScore.js +61 -69
  44. package/src/toolSet/findJob.js +38 -71
  45. package/src/toolSet/findJobdef.js +28 -59
  46. package/src/toolSet/findLibrary.js +68 -100
  47. package/src/toolSet/findModel.js +35 -58
  48. package/src/toolSet/findTable.js +31 -60
  49. package/src/toolSet/getEnv.js +30 -45
  50. package/src/toolSet/listJobdefs.js +61 -96
  51. package/src/toolSet/listJobs.js +61 -110
  52. package/src/toolSet/listLibraries.js +78 -90
  53. package/src/toolSet/listModels.js +56 -83
  54. package/src/toolSet/listTables.js +66 -95
  55. package/src/toolSet/makeTools.js +1 -0
  56. package/src/toolSet/modelInfo.js +22 -54
  57. package/src/toolSet/modelScore.js +35 -77
  58. package/src/toolSet/readTable.js +63 -104
  59. package/src/toolSet/runCasProgram.js +32 -52
  60. package/src/toolSet/runJob.js +24 -24
  61. package/src/toolSet/runJobdef.js +26 -29
  62. package/src/toolSet/runMacro.js +82 -82
  63. package/src/toolSet/runProgram.js +32 -84
  64. package/src/toolSet/sasQuery.js +77 -126
  65. package/src/toolSet/sasQueryTemplate.js +4 -5
  66. package/src/toolSet/sasQueryTemplate2.js +4 -5
  67. package/src/toolSet/scrInfo.js +4 -7
  68. package/src/toolSet/scrScore.js +69 -70
  69. package/src/toolSet/searchAssets.js +5 -6
  70. package/src/toolSet/setContext.js +65 -92
  71. package/src/toolSet/superstat.js +61 -60
  72. package/src/toolSet/tableInfo.js +58 -102
@@ -1,60 +1,61 @@
1
- /*
2
- * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import _submitCode from '../toolHelpers/_submitCode.js';
6
- import { z } from 'zod';
7
-
8
- function superstat(_appContext) {
9
- let desc = `
10
- ## superstat: compute superstat for two numbers using SAS programming
11
-
12
- ## Details
13
- This is a tool to demonstrate using SAS programming to score. The SAS program for suprestat is
14
- below. In a real application this would be a more complex program that is
15
- available to the SAS server.
16
-
17
-
18
- ods html style=barrettsblue;
19
- data temp;
20
- superstat = (&a + &b) * 42;
21
- run;
22
- proc print data=temp;
23
- run;
24
- ods html close;
25
- run;
26
-
27
- ## Sample Prompt
28
-
29
- - compute superstat for 1 and 2
30
- - compute superstat for 3,5
31
-
32
- `;
33
- let spec = {
34
- name: 'superstat',
35
- description: desc,
36
- schema: {
37
- a: z.number(),
38
- b: z.number()
39
- },
40
- required: ['a', 'b'],
41
- handler: async (params) => {
42
- let src = `
43
- ods html style=barrettsblue;
44
- data temp;
45
- superstat = (&a + &b) * 42;
46
- run;
47
- proc print data=temp;
48
- run;
49
- ods html close;
50
- run;
51
- `;
52
- params.src = src;
53
- let r = await _submitCode(params);
54
- return r;
55
- }
56
-
57
- };
58
- return spec;
59
- }
60
- export default superstat;
1
+ /*
2
+ * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { type } from 'node:os';
6
+ import _submitCode from '../toolHelpers/_submitCode.js';
7
+ import { z } from 'zod';
8
+
9
+ function superstat(_appContext) {
10
+ let desc = `
11
+ ## superstat: compute superstat for two numbers using SAS programming
12
+
13
+ ## Details
14
+ This is a tool to demonstrate using SAS programming to score. The SAS program for suprestat is
15
+ below. In a real application this would be a more complex program that is
16
+ available to the SAS server.
17
+
18
+
19
+ ods html style=barrettsblue;
20
+ data temp;
21
+ superstat = (&a + &b) * 42;
22
+ run;
23
+ proc print data=temp;
24
+ run;
25
+ ods html close;
26
+ run;
27
+
28
+ ## Sample Prompt
29
+
30
+ - compute superstat for 1 and 2
31
+ - compute superstat for 3,5
32
+
33
+ `;
34
+ let spec = {
35
+ name: 'superstat',
36
+ description: desc,
37
+ inputSchema: z.object({
38
+ a: z.number().optional()
39
+ }),
40
+ required: ['a', 'b']
41
+ },
42
+ handler: async (params) => {
43
+ let src = `
44
+ ods html style=barrettsblue;
45
+ data temp;
46
+ superstat = (&a + &b) * 42;
47
+ run;
48
+ proc print data=temp;
49
+ run;
50
+ ods html close;
51
+ run;
52
+ `;
53
+ params.src = src;
54
+ let r = await _submitCode(params);
55
+ return r;
56
+ }
57
+
58
+ };
59
+ return spec;
60
+ }
61
+ export default superstat;
@@ -1,102 +1,58 @@
1
- /*
2
- * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { z } from 'zod';
6
- import debug from 'debug';
7
-
8
- import _tableInfo from '../toolHelpers/_tableInfo.js';
9
- function tableInfo(_appContext) {
10
-
11
- let describe = `
12
- ## table-info retrieve metadata about a table in a CAS or SAS library
13
-
14
- LLM Invocation Guidance (When to use)
15
- Use THIS tool when:
16
- - User wants table structure/schema: "what columns are in the cars table?"
17
- - User wants column metadata: "describe the structure of customers table"
18
- - User wants to see data types: "show me the schema for sales table in Public"
19
- - User wants table statistics: "how many rows in the orders table?"
20
- - User wants column information: "what are the columns in the iris table?"
21
-
22
- Do NOT use this tool for:
23
- - Reading actual data rows (use read-table)
24
- - Listing tables in a library (use list-tables)
25
- - Checking if a table exists (use find-table)
26
- - Running queries (use sas-query)
27
- - Reading sample data (use read-table)
28
-
29
- Purpose
30
- Return metadata about a table in a specified library (caslib or libref). This includes column names, data types, labels, formats, and table-level statistics such as row count, file size, and timestamps.
31
-
32
- Parameters
33
- - table (string, required): The name of the table to inspect.
34
- - lib (string, required): The caslib or libref containing the table.
35
- - server (string, default 'cas'): Target server, either 'cas' or 'sas'. Defaults to 'cas' when omitted.
36
-
37
- Response Contract
38
- Returns a JSON object containing:
39
- - columns: Array of column objects with:
40
- - name: Column name (string)
41
- - type: Data type (string) - e.g., 'numeric', 'character'
42
- - label: Column label if defined (string)
43
- - format: Display format if defined (string)
44
- - length: Column length for character fields (number)
45
- - tableInfo: Table-level metadata including:
46
- - rowCount: Number of rows (number)
47
- - fileSize: File size if available (number)
48
- - created: Creation timestamp if available (string)
49
- - modified: Last modified timestamp if available (string)
50
- - Empty object if table not found or accessible
51
-
52
- Disambiguation & Clarification
53
- - Missing library: ask "Which library contains the table you want to inspect?"
54
- - Missing table: ask "Which table would you like information about?"
55
- - If user wants data: clarify "Do you want the table structure (use table-info) or actual data rows (use read-table)?"
56
- - Ambiguous lib.table format: parse and use as separate parameters
57
-
58
- Examples (→ mapped params)
59
- - "describe table cars in sashelp" → { table: "cars", lib: "sashelp", server: "sas" }
60
- - "what columns are in orders from Public" → { table: "orders", lib: "Public", server: "cas" }
61
- - "show schema for sales in mylib" → { table: "sales", lib: "mylib", server: "cas" }
62
- - "table info for iris in Samples" → { table: "iris", lib: "Samples", server: "cas" }
63
- - "how many rows in customers on cas" → { table: "customers", lib: <lib>, server: "cas" }
64
-
65
- Negative Examples (should NOT call table-info)
66
- - "read 10 rows from cars" (use read-table instead)
67
- - "list tables in sashelp" (use list-tables instead)
68
- - "does table cars exist in Public?" (use find-table instead)
69
- - "run query on customers table" (use sas-query instead)
70
- - "show me data from the sales table" (use read-table instead)
71
-
72
- Usage Tips
73
- - Use this tool to inspect schema and column types before scoring or reading data.
74
- - After inspecting structure, use read-table to fetch actual data.
75
- - Combine with find-table to verify existence before inspection.
76
-
77
- Related Tools
78
- - find-table → table-info → read-table (typical workflow)
79
- - list-tables — to discover tables before inspecting
80
- - read-table — to fetch actual data after inspecting structure
81
- - find-table — to verify a table exists before inspection
82
- `;
83
-
84
- let specs = {
85
- name: 'table-info',
86
- aliases: ['tableInfo','table info','table_info'],
87
- description: describe,
88
- schema: {
89
- table: z.string(),
90
- lib: z.string(),
91
- server: z.string()
92
- },
93
- required: ['table', 'lib'],
94
- handler: async (params) => {
95
- params.describe = true;
96
- let r = await _tableInfo(params);
97
- return r;
98
- }
99
- }
100
- return specs;
101
- }
102
- export default tableInfo;
1
+ /*
2
+ * Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { z } from 'zod';
6
+ import debug from 'debug';
7
+
8
+ import _tableInfo from '../toolHelpers/_tableInfo.js';
9
+ import { type } from 'node:os';
10
+ function tableInfo(_appContext) {
11
+
12
+ let describe = `
13
+ table-info — retrieve metadata about a table in a CAS or SAS library.
14
+
15
+ USE when: what columns, describe structure, show schema, table statistics, column info
16
+ DO NOT USE for: read data (use read-table), list tables (use list-tables), find table (use find-table), queries (use sas-query)
17
+
18
+ PARAMETERS
19
+ - table: string table name (required)
20
+ - lib: string caslib or libref (required)
21
+ - server: string (default: 'cas') — 'cas' or 'sas'
22
+
23
+ ROUTING RULES
24
+ - "what columns are in cars" { table: "cars", lib: "<lib>", server: "cas" }
25
+ - "describe table sales in Public" → { table: "sales", lib: "Public", server: "cas" }
26
+ - "show schema for mylib.iris on sas" → { table: "iris", lib: "mylib", server: "sas" }
27
+
28
+ EXAMPLES
29
+ - "what columns in cars" → { table: "cars", lib: "<lib>", server: "cas" }
30
+ - "describe structure of customers in Public" { table: "customers", lib: "Public", server: "cas" }
31
+
32
+ NEGATIVE EXAMPLES (do not route here)
33
+ - "read table cars" (use read-table)
34
+ - "list tables in Public" (use list-tables)
35
+ - "does table exist" (use find-table)
36
+ - "query table" (use sas-query)
37
+
38
+ ERRORS
39
+ Returns columns array (name, type, label, format, length) and tableInfo (rowCount, fileSize, created, modified).
40
+ `;
41
+
42
+ let specs = {
43
+ name: 'table-info',
44
+ description: describe,
45
+ inputSchema: z.object({
46
+ table: z.string(),
47
+ lib: z.string().optional(),
48
+ server: z.string().optional()
49
+ }),
50
+ handler: async (params) => {
51
+ params.describe = true;
52
+ let r = await _tableInfo(params);
53
+ return r;
54
+ }
55
+ }
56
+ return specs;
57
+ }
58
+ export default tableInfo;