@sassoftware/sas-score-mcp-serverjs 1.0.0 → 1.0.1-10

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.
@@ -75,7 +75,7 @@ async function callback(req, res, pkceStore, codeStore, appContext) {
75
75
  // which was part of the payload from the client to /oauth/authorize
76
76
  // we trust since it was associated with the valid PKCE state
77
77
  console.error("[Note] OAuth callback complete, redirecting to MCP client");
78
- console.log(pending.clientRedirectUri.toString())
78
+ console.error(pending.clientRedirectUri.toString())
79
79
  return res.redirect(`${pending.clientRedirectUri}?${redirectParams}`);
80
80
  } catch (err) {
81
81
  console.error("[Error] OAuth callback handler error:", err);
@@ -34,7 +34,7 @@ function processHeaders(req, res, next, cache, appContext) {
34
34
  let token = (hdr != null) ? hdr.slice(7) : null;
35
35
  //console.error("[Note] Authorization token", token);
36
36
  debugger;
37
- console.log('>>>',appContext.AUTHFLOW);
37
+ console.error('>>>',appContext.AUTHFLOW);
38
38
  if (appContext.AUTHFLOW === 'bearer') {
39
39
  debugger;
40
40
  let startAuth = false;
@@ -4,32 +4,74 @@ import path from 'path';
4
4
  import os from 'os';
5
5
  import { fileURLToPath } from 'url';
6
6
 
7
- function setupSkills(clientName) {
7
+ function setupSkills(clientName,agentFolder) {
8
8
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
9
  // Paths
10
- let client = (clientName == null) ? '.github' : `.${clientName.toLowerCase()}`;
11
- const source = path.join(__dirname, `../.skills`);
12
- const destination = path.join(os.homedir(), client);
13
- console.error(`📁 Copying ${source} to ${destination}...`);
10
+ let destination;
11
+ if (clientName.startsWith('.')) {
12
+ console.error('-----------------------',process.cwd());
13
+ destination = path.join(process.cwd(), clientName);
14
+ clientName = clientName.slice(1);
15
+ } else {
16
+ destination = path.join(os.homedir(), '.' + clientName );
17
+ }
18
+
19
+ if (agentFolder) {
20
+ destination = path.join(destination, agentFolder);
21
+ }
22
+ const source = path.join(__dirname, `../.skills` + '_' + clientName.toLowerCase());
23
+ console.error("==================================================================");
24
+ console.error(` Copying ${source} to ${destination}...`);
25
+
26
+
27
+
28
+ // Copy agents folder if it exists
29
+ let agentsFromPath = path.join(__dirname, `../.agents`);
30
+ let agentsToPath = path.join(destination, 'agents');
31
+ copyFolderSync(agentsFromPath, agentsToPath);
32
+
33
+ // now copy the skills folder to the destination
34
+ let toPath = path.join(destination, '.skills');
35
+ let fromPath = path.join(__dirname, `../.skills`);
36
+ copyFolderSync(fromPath, toPath);
37
+
38
+ // Now copy instructions
39
+ let instructionsFromPath = path.join(__dirname, `../.instructions`);
40
+ let instructionsToPath = destination;
41
+ copyFolderSync(instructionsFromPath, instructionsToPath);
42
+
14
43
  function copyFolderSync(from, to) {
15
- if (!fs.existsSync(from)) return;
16
- if (!fs.existsSync(to)) fs.mkdirSync(to, { recursive: true });
17
- console.error(`📁 Copying folder: ${from} to ${to}`);
44
+ if (!fs.existsSync(from)) return [];
45
+ if (!fs.existsSync(to)) fs.mkdirSync(to, { recursive: true });;
18
46
  fs.readdirSync(from).forEach(element => {
19
- console.error(`📁 Processing: ${element}`);
20
47
  const fromPath = path.join(from, element);
21
- const toPath = path.join(to, element);
48
+ let toPath = path.join(to, element);
49
+ if (clientName === 'claude' && element === 'copilot-instructions.md') {
50
+ toPath = path.join(to, 'CLAUDE.md');
51
+ }
22
52
  if (fs.lstatSync(fromPath).isFile()) {
53
+ console.error(` 📄 Copying file: ${element}`);
23
54
  fs.copyFileSync(fromPath, toPath);
24
55
  } else if (fs.lstatSync(fromPath).isDirectory()) {
56
+ console.error(`📂 Copying folder: ${element}`);
25
57
  copyFolderSync(fromPath, toPath);
26
58
  }
27
59
  });
28
60
  }
61
+ function listExpandedFolder(dir, indent = "") {
62
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
63
+
64
+ for (const entry of entries) {
65
+ console.error(indent + entry.name);
29
66
 
67
+ if (entry.isDirectory()) {
68
+ listExpandedFolder(path.join(dir, entry.name), indent + " ");
69
+ }
70
+ }
71
+ }
30
72
  try {
31
73
  copyFolderSync(source, destination);
32
- console.error(`✅ Success: ${destination} folder is now in your project root.`);
74
+ //listExpandedFolder(destination);
33
75
  } catch (err) {
34
76
  console.error('❌ Error copying files:', err.message);
35
77
  }
@@ -54,7 +54,7 @@ async function _listLibrary(params) {
54
54
  if (appControl != null) {
55
55
  await deleteSession(appControl);
56
56
  }
57
- return { isError: true, content: [{ type: 'text', text: JSON.stringify(err) }] };
57
+ return { isError: true, content: [{ type: 'text', text: (typeof err === 'string') ? err : JSON.stringify(err) }] };
58
58
  }
59
59
  }
60
60
 
@@ -44,7 +44,7 @@ async function _listTables(params) {
44
44
  structuredContent: response};
45
45
  } catch (err) {
46
46
  console.error(JSON.stringify(err));
47
- return {isError: true, content: [{ type: 'text', text: JSON.stringify(err) }] }
47
+ return {isError: true, content: [{ type: 'text', text: (typeof err === 'string') ? err : JSON.stringify(err) }] }
48
48
  }
49
49
 
50
50
  };
@@ -1,13 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "mcp__sasmcp__sas-score-deva-score",
5
- "mcp__sasmcp__sas-score-find-model",
6
- "mcp__sasmcp__sas-score-model-info",
7
- "Bash(cp \"C:/dev/github/7-skill-integration/.claude/skills/sas-read-and-score/SKILL.md\" \"C:/dev/github/7-skill-integration/skills/sas-read-and-score/SKILL.md\")",
8
- "Bash(cp \"C:/dev/github/7-skill-integration/.claude/skills/sas-read-strategy/SKILL.md\" \"C:/dev/github/7-skill-integration/skills/sas-read-strategy/SKILL.md\")",
9
- "Bash(cp \"C:/dev/github/7-skill-integration/.claude/skills/sas-score-workflow/SKILL.md\" \"C:/dev/github/7-skill-integration/skills/sas-score-workflow/SKILL.md\")",
10
- "WebSearch"
11
- ]
12
- }
13
- }