snow-flow 8.30.25 → 8.30.26
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/package.json +3 -2
- package/scripts/update-mcp-config.js +92 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "8.30.
|
|
3
|
+
"version": "8.30.26",
|
|
4
4
|
"description": "ServiceNow development with SnowCode - 75+ LLM providers (Claude, GPT, Gemini, Llama, Mistral, DeepSeek, Groq, Ollama) • 393 Optimized Tools • 2 MCP Servers • Multi-agent orchestration • Use ANY AI coding assistant (ML tools moved to Enterprise)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"lint": "eslint src/**/*.ts",
|
|
40
40
|
"typecheck": "tsc --noEmit",
|
|
41
41
|
"setup-mcp": "node scripts/setup-mcp.js",
|
|
42
|
+
"update-mcp": "node scripts/update-mcp-config.js",
|
|
42
43
|
"reset-mcp": "node scripts/reset-mcp-servers.js",
|
|
43
44
|
"reset-mcp:restart": "node scripts/reset-mcp-servers.js --restart",
|
|
44
45
|
"cleanup-mcp": "node scripts/cleanup-mcp-servers.js",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"check-binaries": "node scripts/check-binary-updates.js",
|
|
56
57
|
"update-binaries": "node scripts/check-binary-updates.js --auto-update",
|
|
57
58
|
"postbuild-disabled": "npm run setup-mcp",
|
|
58
|
-
"postinstall": "patch-package && node scripts/postinstall.js && node scripts/check-binary-updates.js --silent || true",
|
|
59
|
+
"postinstall": "patch-package && node scripts/postinstall.js && node scripts/check-binary-updates.js --silent && node scripts/update-mcp-config.js || true",
|
|
59
60
|
"version": "node scripts/update-version.js && npm run build && git add src/version.ts",
|
|
60
61
|
"postversion": "git push temp main && git push temp --tags"
|
|
61
62
|
},
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Update .mcp.json with credentials from environment variables
|
|
4
|
+
*
|
|
5
|
+
* This script reads ServiceNow credentials from .env file and updates
|
|
6
|
+
* the .mcp.json configuration to use the actual credentials instead
|
|
7
|
+
* of placeholder values.
|
|
8
|
+
*
|
|
9
|
+
* Usage: node scripts/update-mcp-config.js
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
|
|
15
|
+
// Load .env file if it exists
|
|
16
|
+
const envPath = path.join(process.cwd(), '.env');
|
|
17
|
+
if (fs.existsSync(envPath)) {
|
|
18
|
+
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
19
|
+
envContent.split('\n').forEach(line => {
|
|
20
|
+
const match = line.match(/^([^=]+)=(.*)$/);
|
|
21
|
+
if (match) {
|
|
22
|
+
const key = match[1].trim();
|
|
23
|
+
const value = match[2].trim().replace(/^["']|["']$/g, '');
|
|
24
|
+
if (value && !process.env[key]) {
|
|
25
|
+
process.env[key] = value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Get credentials from environment (support both SNOW_* and SERVICENOW_* prefixes)
|
|
32
|
+
const instanceUrl = process.env.SERVICENOW_INSTANCE_URL ||
|
|
33
|
+
(process.env.SNOW_INSTANCE ? `https://${process.env.SNOW_INSTANCE}` : null);
|
|
34
|
+
const clientId = process.env.SERVICENOW_CLIENT_ID || process.env.SNOW_CLIENT_ID;
|
|
35
|
+
const clientSecret = process.env.SERVICENOW_CLIENT_SECRET || process.env.SNOW_CLIENT_SECRET;
|
|
36
|
+
|
|
37
|
+
// Check if credentials are available
|
|
38
|
+
if (!instanceUrl || !clientId || !clientSecret) {
|
|
39
|
+
console.log('⚠️ Warning: ServiceNow credentials not found in environment');
|
|
40
|
+
console.log(' Please set SNOW_INSTANCE, SNOW_CLIENT_ID, and SNOW_CLIENT_SECRET in .env');
|
|
41
|
+
process.exit(0); // Exit gracefully - not an error
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Read .mcp.json
|
|
45
|
+
const mcpJsonPath = path.join(process.cwd(), '.mcp.json');
|
|
46
|
+
if (!fs.existsSync(mcpJsonPath)) {
|
|
47
|
+
console.log('ℹ️ No .mcp.json found - using global config instead');
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let config;
|
|
52
|
+
try {
|
|
53
|
+
config = JSON.parse(fs.readFileSync(mcpJsonPath, 'utf-8'));
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error('❌ Failed to parse .mcp.json:', error.message);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Update servicenow-unified server configuration
|
|
60
|
+
if (config.mcpServers && config.mcpServers['servicenow-unified']) {
|
|
61
|
+
const server = config.mcpServers['servicenow-unified'];
|
|
62
|
+
|
|
63
|
+
if (!server.env) {
|
|
64
|
+
server.env = {};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Check if values are placeholders
|
|
68
|
+
const hasPlaceholders =
|
|
69
|
+
!server.env.SERVICENOW_INSTANCE_URL ||
|
|
70
|
+
server.env.SERVICENOW_INSTANCE_URL.includes('your-instance') ||
|
|
71
|
+
server.env.SERVICENOW_CLIENT_ID === 'your-client-id' ||
|
|
72
|
+
server.env.SERVICENOW_CLIENT_SECRET === 'your-client-secret';
|
|
73
|
+
|
|
74
|
+
if (hasPlaceholders) {
|
|
75
|
+
console.log('🔧 Updating .mcp.json with credentials from environment...');
|
|
76
|
+
|
|
77
|
+
server.env.SERVICENOW_INSTANCE_URL = instanceUrl;
|
|
78
|
+
server.env.SERVICENOW_CLIENT_ID = clientId;
|
|
79
|
+
server.env.SERVICENOW_CLIENT_SECRET = clientSecret;
|
|
80
|
+
|
|
81
|
+
// Write updated config
|
|
82
|
+
fs.writeFileSync(mcpJsonPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
83
|
+
|
|
84
|
+
console.log('✅ Updated .mcp.json successfully');
|
|
85
|
+
console.log(` Instance: ${instanceUrl}`);
|
|
86
|
+
console.log(` Client ID: ${clientId.substring(0, 8)}...`);
|
|
87
|
+
} else {
|
|
88
|
+
console.log('✅ .mcp.json already has valid credentials');
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
console.log('⚠️ No servicenow-unified server found in .mcp.json');
|
|
92
|
+
}
|