snow-flow 1.1.4 → 1.1.14

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.
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Manual MCP Registration Script for Snow-Flow
5
+ * Run this to register Snow-Flow MCP servers with Claude Desktop
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const os = require('os');
11
+
12
+ // Claude Desktop config path on macOS
13
+ const CLAUDE_CONFIG_PATH = path.join(
14
+ os.homedir(),
15
+ 'Library',
16
+ 'Application Support',
17
+ 'Claude',
18
+ 'claude_desktop_config.json'
19
+ );
20
+
21
+ // Determine Snow-Flow installation path
22
+ const SNOW_FLOW_PATH = '/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow';
23
+
24
+ // Snow-Flow MCP servers configuration
25
+ const SNOW_FLOW_SERVERS = {
26
+ "snow-flow-operations": {
27
+ "command": "node",
28
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-operations-mcp.js`]
29
+ },
30
+ "snow-flow-automation": {
31
+ "command": "node",
32
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-automation-mcp.js`]
33
+ },
34
+ "snow-flow-integration": {
35
+ "command": "node",
36
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-integration-mcp.js`]
37
+ },
38
+ "snow-flow-deployment": {
39
+ "command": "node",
40
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-deployment-mcp.js`]
41
+ },
42
+ "snow-flow-platform-development": {
43
+ "command": "node",
44
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-platform-development-mcp.js`]
45
+ },
46
+ "snow-flow-reporting-analytics": {
47
+ "command": "node",
48
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-reporting-analytics-mcp.js`]
49
+ },
50
+ "snow-flow-security-compliance": {
51
+ "command": "node",
52
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-security-compliance-mcp.js`]
53
+ },
54
+ "snow-flow-flow-composer": {
55
+ "command": "node",
56
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-flow-composer-mcp.js`]
57
+ },
58
+ "snow-flow-update-set": {
59
+ "command": "node",
60
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-update-set-mcp.js`]
61
+ },
62
+ "snow-flow-intelligent": {
63
+ "command": "node",
64
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-intelligent-mcp.js`]
65
+ },
66
+ "snow-flow-graph-memory": {
67
+ "command": "node",
68
+ "args": [`${SNOW_FLOW_PATH}/dist/mcp/servicenow-graph-memory-mcp.js`]
69
+ }
70
+ };
71
+
72
+ // Add environment variables if .env exists
73
+ const envPath = path.join(SNOW_FLOW_PATH, '.env');
74
+ if (fs.existsSync(envPath)) {
75
+ const envContent = fs.readFileSync(envPath, 'utf8');
76
+ const envVars = {};
77
+
78
+ envContent.split('\n').forEach(line => {
79
+ const [key, value] = line.split('=');
80
+ if (key && value) {
81
+ envVars[key.trim()] = value.trim().replace(/^["']|["']$/g, '');
82
+ }
83
+ });
84
+
85
+ // Add env vars to each server
86
+ Object.keys(SNOW_FLOW_SERVERS).forEach(serverKey => {
87
+ SNOW_FLOW_SERVERS[serverKey].env = envVars;
88
+ });
89
+ }
90
+
91
+ console.log('šŸ“‹ Registering Snow-Flow MCP servers with Claude Desktop...\n');
92
+
93
+ try {
94
+ // Read existing config
95
+ let config = { mcpServers: {} };
96
+ if (fs.existsSync(CLAUDE_CONFIG_PATH)) {
97
+ config = JSON.parse(fs.readFileSync(CLAUDE_CONFIG_PATH, 'utf8'));
98
+ if (!config.mcpServers) {
99
+ config.mcpServers = {};
100
+ }
101
+ }
102
+
103
+ // Add Snow-Flow servers
104
+ let addedCount = 0;
105
+ Object.keys(SNOW_FLOW_SERVERS).forEach(key => {
106
+ if (!config.mcpServers[key]) {
107
+ config.mcpServers[key] = SNOW_FLOW_SERVERS[key];
108
+ addedCount++;
109
+ console.log(`āœ… Added ${key}`);
110
+ } else {
111
+ console.log(`ā­ļø ${key} already exists`);
112
+ }
113
+ });
114
+
115
+ // Write updated config
116
+ fs.writeFileSync(CLAUDE_CONFIG_PATH, JSON.stringify(config, null, 2));
117
+
118
+ console.log(`\nšŸ“ Updated Claude Desktop configuration`);
119
+ console.log(` Added ${addedCount} new servers`);
120
+ console.log(` Path: ${CLAUDE_CONFIG_PATH}`);
121
+
122
+ console.log('\nšŸ”„ Please restart Claude Desktop to load the MCP servers');
123
+ console.log('šŸ’” Use /mcp in Claude to verify the servers are available');
124
+
125
+ // Also create a proper .env file in Snow-Flow directory if needed
126
+ if (!fs.existsSync(envPath)) {
127
+ console.log('\nāš ļø No .env file found in Snow-Flow installation');
128
+ console.log(' Create one at: ' + envPath);
129
+ console.log(' With your ServiceNow credentials:');
130
+ console.log(' SNOW_INSTANCE=your-instance.service-now.com');
131
+ console.log(' SNOW_CLIENT_ID=your-client-id');
132
+ console.log(' SNOW_CLIENT_SECRET=your-client-secret');
133
+ }
134
+
135
+ } catch (error) {
136
+ console.error('āŒ Error registering MCP servers:', error.message);
137
+ process.exit(1);
138
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "1.1.4",
3
+ "version": "1.1.14",
4
4
  "description": "Multi-Agent ServiceNow Development Platform - Create, manage, and deploy ServiceNow artifacts using natural language and AI agents",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Create .env file for Snow-Flow
5
+ * This helps users set up their ServiceNow credentials
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const readline = require('readline');
11
+
12
+ const rl = readline.createInterface({
13
+ input: process.stdin,
14
+ output: process.stdout
15
+ });
16
+
17
+ function question(query) {
18
+ return new Promise(resolve => rl.question(query, resolve));
19
+ }
20
+
21
+ async function createEnvFile() {
22
+ console.log('šŸ”§ Snow-Flow Environment Setup\n');
23
+ console.log('This will create a .env file with your ServiceNow credentials.\n');
24
+
25
+ // Get ServiceNow instance
26
+ const instance = await question('ServiceNow instance (e.g., dev12345.service-now.com): ');
27
+
28
+ // Get OAuth credentials
29
+ const clientId = await question('OAuth Client ID: ');
30
+ const clientSecret = await question('OAuth Client Secret: ');
31
+
32
+ // Optional Neo4j settings
33
+ console.log('\nšŸ“Š Neo4j Configuration (optional - press Enter to skip)');
34
+ const neo4jUri = await question('Neo4j URI (default: bolt://localhost:7687): ') || 'bolt://localhost:7687';
35
+ const neo4jUser = await question('Neo4j username (default: neo4j): ') || 'neo4j';
36
+ const neo4jPassword = await question('Neo4j password (default: password): ') || 'password';
37
+
38
+ // Create .env content
39
+ const envContent = `# ServiceNow OAuth Configuration
40
+ SNOW_INSTANCE=${instance}
41
+ SNOW_CLIENT_ID=${clientId}
42
+ SNOW_CLIENT_SECRET=${clientSecret}
43
+
44
+ # OAuth URLs (these are automatically generated)
45
+ OAUTH_TOKEN_URL=https://${instance}/oauth_token.do
46
+ OAUTH_REDIRECT_URI=http://localhost:3000/callback
47
+
48
+ # Neo4j Configuration (optional - for Graph Memory MCP)
49
+ NEO4J_URI=${neo4jUri}
50
+ NEO4J_USER=${neo4jUser}
51
+ NEO4J_PASSWORD=${neo4jPassword}
52
+
53
+ # Environment
54
+ NODE_ENV=production
55
+ `;
56
+
57
+ // Determine where to save .env
58
+ const isGlobalInstall = __dirname.includes('node_modules/snow-flow') ||
59
+ __dirname.includes('.nvm/versions/node');
60
+
61
+ const envPath = isGlobalInstall
62
+ ? path.join(__dirname, '..', '.env')
63
+ : path.join(process.cwd(), '.env');
64
+
65
+ // Write .env file
66
+ fs.writeFileSync(envPath, envContent);
67
+
68
+ console.log(`\nāœ… Created .env file at: ${envPath}`);
69
+ console.log('šŸŽ‰ Your ServiceNow credentials are now configured!');
70
+ console.log('\nšŸ’” Next steps:');
71
+ console.log(' 1. Run: snow-flow init');
72
+ console.log(' 2. Run: snow-flow auth login');
73
+ console.log(' 3. Use /mcp in Claude Code to access ServiceNow tools');
74
+
75
+ rl.close();
76
+ }
77
+
78
+ // Run if called directly
79
+ if (require.main === module) {
80
+ createEnvFile().catch(error => {
81
+ console.error('āŒ Error creating .env file:', error.message);
82
+ process.exit(1);
83
+ });
84
+ }
85
+
86
+ module.exports = { createEnvFile };
@@ -0,0 +1,176 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Register Snow-Flow MCP servers with Claude Desktop
5
+ */
6
+
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const os = require('os');
10
+
11
+ // Claude Code config path
12
+ const CLAUDE_CONFIG_PATH = path.join(
13
+ os.homedir(),
14
+ '.claude',
15
+ 'mcp_config.json'
16
+ );
17
+
18
+ // Snow-Flow MCP servers configuration
19
+ const SNOW_FLOW_SERVERS = {
20
+ "snow-flow-operations": {
21
+ "command": "node",
22
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-operations-mcp.js"]
23
+ },
24
+ "snow-flow-automation": {
25
+ "command": "node",
26
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-automation-mcp.js"]
27
+ },
28
+ "snow-flow-integration": {
29
+ "command": "node",
30
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-integration-mcp.js"]
31
+ },
32
+ "snow-flow-deployment": {
33
+ "command": "node",
34
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-deployment-mcp.js"]
35
+ },
36
+ "snow-flow-platform-development": {
37
+ "command": "node",
38
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-platform-development-mcp.js"]
39
+ },
40
+ "snow-flow-reporting-analytics": {
41
+ "command": "node",
42
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-reporting-analytics-mcp.js"]
43
+ },
44
+ "snow-flow-security-compliance": {
45
+ "command": "node",
46
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-security-compliance-mcp.js"]
47
+ },
48
+ "snow-flow-flow-composer": {
49
+ "command": "node",
50
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-flow-composer-mcp.js"]
51
+ },
52
+ "snow-flow-update-set": {
53
+ "command": "node",
54
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-update-set-mcp.js"]
55
+ },
56
+ "snow-flow-intelligent": {
57
+ "command": "node",
58
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-intelligent-mcp.js"]
59
+ },
60
+ "snow-flow-graph-memory": {
61
+ "command": "node",
62
+ "args": ["${SNOW_FLOW_PATH}/dist/mcp/servicenow-graph-memory-mcp.js"]
63
+ }
64
+ };
65
+
66
+ async function registerMCPServers() {
67
+ try {
68
+ // Determine Snow-Flow installation path
69
+ const isGlobalInstall = __dirname.includes('node_modules/snow-flow') ||
70
+ __dirname.includes('.nvm/versions/node');
71
+
72
+ const snowFlowPath = process.env.SNOW_FLOW_PATH ||
73
+ (isGlobalInstall ? path.resolve(__dirname, '..') : process.cwd());
74
+
75
+ // Replace ${SNOW_FLOW_PATH} with actual path
76
+ const servers = JSON.parse(JSON.stringify(SNOW_FLOW_SERVERS));
77
+ Object.keys(servers).forEach(key => {
78
+ // Replace path placeholder
79
+ if (servers[key].args && servers[key].args[0]) {
80
+ servers[key].args[0] = servers[key].args[0].replace('${SNOW_FLOW_PATH}', snowFlowPath);
81
+ }
82
+
83
+ // Add environment variables from .env if it exists
84
+ const envPath = path.join(snowFlowPath, '.env');
85
+ if (fs.existsSync(envPath)) {
86
+ try {
87
+ const envContent = fs.readFileSync(envPath, 'utf8');
88
+ const envVars = {};
89
+
90
+ envContent.split('\n').forEach(line => {
91
+ // Skip comments and empty lines
92
+ if (line.trim() && !line.trim().startsWith('#')) {
93
+ const [key, ...valueParts] = line.split('=');
94
+ if (key && valueParts.length > 0) {
95
+ const value = valueParts.join('=').trim().replace(/^["']|["']$/g, '');
96
+ envVars[key.trim()] = value;
97
+ }
98
+ }
99
+ });
100
+
101
+ // Add env vars to server config
102
+ if (Object.keys(envVars).length > 0) {
103
+ servers[key].env = envVars;
104
+ }
105
+ } catch (err) {
106
+ console.warn('āš ļø Could not read .env file:', err.message);
107
+ }
108
+ }
109
+ });
110
+
111
+ // Check if Claude config exists
112
+ if (!fs.existsSync(CLAUDE_CONFIG_PATH)) {
113
+ console.log('āš ļø Claude Code configuration not found.');
114
+ console.log('šŸ“ Creating new configuration at:', CLAUDE_CONFIG_PATH);
115
+
116
+ // Ensure directory exists
117
+ const configDir = path.dirname(CLAUDE_CONFIG_PATH);
118
+ if (!fs.existsSync(configDir)) {
119
+ fs.mkdirSync(configDir, { recursive: true });
120
+ }
121
+
122
+ // Create new config with "servers" (not "mcpServers")
123
+ const newConfig = {
124
+ servers: servers
125
+ };
126
+
127
+ fs.writeFileSync(CLAUDE_CONFIG_PATH, JSON.stringify(newConfig, null, 2));
128
+ console.log('āœ… Created new Claude Code configuration with Snow-Flow MCP servers');
129
+ } else {
130
+ // Read existing config
131
+ let config = JSON.parse(fs.readFileSync(CLAUDE_CONFIG_PATH, 'utf8'));
132
+
133
+ // Initialize servers if not exists (Claude Code uses "servers" not "mcpServers")
134
+ if (!config.servers) {
135
+ config.servers = {};
136
+ }
137
+
138
+ // Add Snow-Flow servers
139
+ let addedCount = 0;
140
+ Object.keys(servers).forEach(key => {
141
+ if (!config.servers[key]) {
142
+ config.servers[key] = servers[key];
143
+ addedCount++;
144
+ }
145
+ });
146
+
147
+ // Write updated config
148
+ fs.writeFileSync(CLAUDE_CONFIG_PATH, JSON.stringify(config, null, 2));
149
+
150
+ if (addedCount > 0) {
151
+ console.log(`āœ… Added ${addedCount} Snow-Flow MCP servers to Claude Code configuration`);
152
+ } else {
153
+ console.log('āœ… All Snow-Flow MCP servers already registered');
154
+ }
155
+ }
156
+
157
+ console.log('\nšŸ“‹ Registered MCP servers:');
158
+ Object.keys(servers).forEach(key => {
159
+ console.log(` - ${key}`);
160
+ });
161
+
162
+ console.log('\nšŸ”„ MCP servers are now available in Claude Code');
163
+ console.log('šŸ’” Use /mcp in Claude Code to verify the servers are available');
164
+
165
+ } catch (error) {
166
+ console.error('āŒ Error registering MCP servers:', error.message);
167
+ process.exit(1);
168
+ }
169
+ }
170
+
171
+ // Run if called directly
172
+ if (require.main === module) {
173
+ registerMCPServers();
174
+ }
175
+
176
+ module.exports = { registerMCPServers };
@@ -7,9 +7,22 @@
7
7
 
8
8
  const fs = require('fs');
9
9
  const path = require('path');
10
- require('dotenv').config();
10
+ // Try to load .env file if it exists, but don't fail if it doesn't
11
+ try {
12
+ require('dotenv').config();
13
+ } catch (err) {
14
+ // .env file not found, that's OK
15
+ }
16
+
17
+ // Determine if we're in a global npm installation
18
+ const isGlobalInstall = __dirname.includes('node_modules/snow-flow') ||
19
+ __dirname.includes('.nvm/versions/node');
20
+
21
+ // For global installs, use the package directory, not cwd
22
+ const projectRoot = isGlobalInstall
23
+ ? path.resolve(__dirname, '..') // Go up from scripts/ to package root
24
+ : process.cwd();
11
25
 
12
- const projectRoot = process.cwd();
13
26
  const templatePath = path.join(projectRoot, '.mcp.json.template');
14
27
  const mcpFilePath = path.join(projectRoot, '.mcp.json');
15
28