snow-flow 2.0.2 → 2.0.3
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/{.claude/mcp-config.json → .mcp.json} +13 -12
- package/.releaserc.json +47 -0
- package/README.md +6 -0
- package/package.json +1 -1
- package/.claude/claude-settings.json +0 -15
- package/.claude/commands/analysis/README.md +0 -9
- package/.claude/commands/automation/README.md +0 -9
- package/.claude/commands/github/README.md +0 -11
- package/.claude/commands/helpers/standard-checkpoint-hooks.sh +0 -179
- package/.claude/commands/hooks/README.md +0 -11
- package/.claude/commands/monitoring/README.md +0 -9
- package/.claude/commands/optimization/README.md +0 -9
- package/.claude/commands/training/README.md +0 -9
- package/.claude/commands/workflows/README.md +0 -9
- package/.claude/config.json +0 -36
- package/.claude/helpers/github-setup.sh +0 -28
- package/.claude/helpers/quick-start.sh +0 -19
- package/.claude/helpers/setup-mcp.sh +0 -18
- package/.claude/settings.json +0 -114
- package/.claude/settings.local.json +0 -33
- package/.claude-flow/metrics/agent-metrics.json +0 -1
- package/.claude-flow/metrics/performance.json +0 -9
- package/.claude-flow/metrics/system-metrics.json +0 -15986
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/.roo/README.md +0 -402
- package/.roo/mcp-list.txt +0 -257
- package/.roo/mcp.json +0 -32
- package/.roo/workflows/basic-tdd.json +0 -32
- package/.roomodes +0 -201
- package/CLAUDE.md +0 -393
- package/bin/snow-flow.js +0 -3
- package/dist/cli.js.bak +0 -2052
- package/dist/config/snow-flow-config.d.ts +0 -1492
- package/dist/config/snow-flow-config.js +0 -938
- package/scripts/create-env.js +0 -91
- package/scripts/postinstall.js +0 -30
- package/scripts/register-mcp-servers.js +0 -210
- package/scripts/reset-mcp-servers.js +0 -246
- package/scripts/setup-mcp.js +0 -106
- package/scripts/update-version.js +0 -31
- package/src/agents/README.md +0 -192
- package/src/agents/base-agent.ts +0 -251
- package/src/agents/coordinator.ts +0 -971
- package/src/agents/index.ts +0 -18
- package/src/agents/queen-403-handler.ts +0 -230
- package/src/agents/queen-agent.ts +0 -1399
- package/src/agents/script-writer-agent.ts +0 -769
- package/src/agents/security-agent.ts +0 -726
- package/src/agents/widget-creator-agent.ts +0 -568
- package/src/api/error-handling.ts +0 -1758
- package/src/api/natural-language-mapper.ts +0 -630
- package/src/api/performance-optimizer.ts +0 -891
- package/src/api/transaction-manager.ts +0 -754
- package/src/cli/deploy-artifact.ts +0 -304
- package/src/cli/snow-flow-cli-integration.ts +0 -434
- package/src/cli.ts +0 -4455
- package/src/cli.ts.bak +0 -5616
- package/src/compliance/advanced-compliance-system.ts +0 -1268
- package/src/compliance/index.ts +0 -19
- package/src/config/snow-flow-config.ts +0 -1019
- package/src/documentation/index.ts +0 -16
- package/src/documentation/self-documenting-system.ts +0 -1421
- package/src/dynamic-version.ts +0 -44
- package/src/healing/index.ts +0 -20
- package/src/healing/self-healing-system.ts +0 -1435
- package/src/health/README.md +0 -161
- package/src/health/system-health.ts +0 -995
- package/src/index.ts +0 -60
- package/src/intelligence/acl-analyzer.ts +0 -377
- package/src/intelligence/auto-resolution-engine.ts +0 -643
- package/src/intelligence/gap-analysis-engine.ts +0 -488
- package/src/intelligence/manual-instructions-generator.ts +0 -744
- package/src/intelligence/mcp-coverage-analyzer.ts +0 -708
- package/src/intelligence/multi-pass-requirements-analyzer.ts +0 -603
- package/src/intelligence/performance-recommendations-engine.ts +0 -1223
- package/src/intelligence/requirements-analyzer.ts +0 -1148
- package/src/intelligence/task-analyzer.ts +0 -628
- package/src/managers/scope-manager.ts +0 -555
- package/src/mcp/advanced/servicenow-advanced-features-mcp.ts +0 -16110
- package/src/mcp/base-mcp-server.ts +0 -660
- package/src/mcp/http-transport-wrapper.ts +0 -426
- package/src/mcp/service-discovery-client.ts +0 -312
- package/src/mcp/servicenow-automation-mcp-refactored.ts +0 -678
- package/src/mcp/servicenow-automation-mcp.ts +0 -838
- package/src/mcp/servicenow-deployment-mcp-refactored.ts +0 -1292
- package/src/mcp/servicenow-deployment-mcp.ts +0 -7244
- package/src/mcp/servicenow-graph-memory-mcp-refactored.ts +0 -721
- package/src/mcp/servicenow-graph-memory-mcp.ts +0 -832
- package/src/mcp/servicenow-integration-mcp-refactored.ts +0 -655
- package/src/mcp/servicenow-integration-mcp.ts +0 -819
- package/src/mcp/servicenow-intelligent-mcp-refactored.ts +0 -977
- package/src/mcp/servicenow-intelligent-mcp.ts +0 -4638
- package/src/mcp/servicenow-mcp-server.ts +0 -728
- package/src/mcp/servicenow-memory-mcp.ts +0 -474
- package/src/mcp/servicenow-operations-mcp-refactored.ts +0 -1995
- package/src/mcp/servicenow-operations-mcp.ts +0 -3384
- package/src/mcp/servicenow-platform-development-mcp-refactored.ts +0 -611
- package/src/mcp/servicenow-platform-development-mcp.ts +0 -970
- package/src/mcp/servicenow-progressive-indexer.ts +0 -370
- package/src/mcp/servicenow-reporting-analytics-mcp-refactored.ts +0 -695
- package/src/mcp/servicenow-reporting-analytics-mcp.ts +0 -1123
- package/src/mcp/servicenow-security-compliance-mcp-refactored.ts +0 -642
- package/src/mcp/servicenow-security-compliance-mcp.ts +0 -1157
- package/src/mcp/servicenow-update-set-mcp-refactored.ts +0 -751
- package/src/mcp/servicenow-update-set-mcp.ts +0 -811
- package/src/mcp/shared/agent-context-provider.ts +0 -365
- package/src/mcp/shared/base-mcp-server.ts +0 -2463
- package/src/mcp/shared/mcp-memory-manager.ts +0 -540
- package/src/mcp/shared/mcp-resource-manager.ts +0 -367
- package/src/mcp/snow-flow-mcp.ts +0 -911
- package/src/mcp/start-all-mcp-servers.ts +0 -102
- package/src/mcp/start-servicenow-mcp.ts +0 -67
- package/src/monitoring/enhanced-monitoring-system.ts +0 -1345
- package/src/monitoring/performance-tracker.ts +0 -777
- package/src/optimization/cost-optimization-engine.ts +0 -1125
- package/src/optimization/index.ts +0 -10
- package/src/queen/README.md +0 -403
- package/src/queen/agent-factory.ts +0 -574
- package/src/queen/index.ts +0 -94
- package/src/queen/mcp-execution-bridge.ts +0 -681
- package/src/queen/neural-learning.ts +0 -319
- package/src/queen/parallel-agent-engine.ts +0 -848
- package/src/queen/queen-memory-system.ts +0 -490
- package/src/queen/queen-memory.ts +0 -456
- package/src/queen/servicenow-queen.ts +0 -1029
- package/src/queen/types.ts +0 -87
- package/src/rollback/smart-rollback-system.ts +0 -866
- package/src/schemas/deployment.schema.json +0 -58
- package/src/schemas/flow.schema.json +0 -79
- package/src/schemas/widget.schema.json +0 -72
- package/src/snow-flow-system.ts +0 -541
- package/src/sparc/sparc-help.ts +0 -49
- package/src/sparc/team-sparc.ts +0 -88
- package/src/strategies/global-scope-strategy.ts +0 -736
- package/src/templates/base/application.template.json +0 -45
- package/src/templates/base/business_rule.template.json +0 -33
- package/src/templates/base/script_include.template.json +0 -18
- package/src/templates/base/table.template.json +0 -64
- package/src/templates/base/widget.template.json +0 -25
- package/src/templates/patterns/composite.incident-management.template.json +0 -140
- package/src/templates/patterns/widget.dashboard.template.json +0 -238
- package/src/templates/patterns/widget.datatable.template.json +0 -292
- package/src/testing/integration-test-suite.ts +0 -1276
- package/src/types/index.ts +0 -183
- package/src/types/neo4j-driver.d.ts +0 -23
- package/src/types/servicenow.types.ts +0 -307
- package/src/types/snow-flow.types.ts +0 -186
- package/src/types/todo.types.ts +0 -70
- package/src/utils/action-type-cache.ts +0 -286
- package/src/utils/agent-detector.ts +0 -573
- package/src/utils/artifact-tracker.ts +0 -379
- package/src/utils/dependency-detector.ts +0 -233
- package/src/utils/deployment-metadata-handler.ts +0 -518
- package/src/utils/error-recovery.ts +0 -680
- package/src/utils/logger.ts +0 -60
- package/src/utils/mcp-auth-middleware.ts +0 -262
- package/src/utils/mcp-config-manager.ts +0 -270
- package/src/utils/mcp-server-manager.ts +0 -446
- package/src/utils/mcp-tool-registry.ts +0 -298
- package/src/utils/migrate-snow-flow.ts +0 -98
- package/src/utils/oauth-html-templates.ts +0 -188
- package/src/utils/scope-utils.ts +0 -443
- package/src/utils/servicenow-client.ts +0 -3321
- package/src/utils/servicenow-id-generator.ts +0 -181
- package/src/utils/snow-memory-manager.ts +0 -605
- package/src/utils/snow-oauth.ts +0 -797
- package/src/utils/template-engine.ts +0 -463
- package/src/utils/theme-manager.ts +0 -295
- package/src/utils/unified-auth-store.ts +0 -222
- package/src/utils/update-set-importer.ts +0 -422
- package/src/utils/update-set-xml-packager.ts +0 -371
- package/src/utils/widget-template-generator.ts +0 -1744
- package/src/version.ts +0 -1950
package/scripts/create-env.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
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 (recommended)
|
|
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
|
-
# Basic Auth Configuration (deprecated - use OAuth instead)
|
|
49
|
-
# Uncomment these lines ONLY if you need to use basic auth:
|
|
50
|
-
# SNOW_USERNAME=your_username
|
|
51
|
-
# SNOW_PASSWORD=your_password
|
|
52
|
-
|
|
53
|
-
# Neo4j Configuration (optional - for Graph Memory MCP)
|
|
54
|
-
NEO4J_URI=${neo4jUri}
|
|
55
|
-
NEO4J_USER=${neo4jUser}
|
|
56
|
-
NEO4J_PASSWORD=${neo4jPassword}
|
|
57
|
-
|
|
58
|
-
# Environment
|
|
59
|
-
NODE_ENV=production
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
|
-
// Determine where to save .env
|
|
63
|
-
const isGlobalInstall = __dirname.includes('node_modules/snow-flow') ||
|
|
64
|
-
__dirname.includes('.nvm/versions/node');
|
|
65
|
-
|
|
66
|
-
const envPath = isGlobalInstall
|
|
67
|
-
? path.join(__dirname, '..', '.env')
|
|
68
|
-
: path.join(process.cwd(), '.env');
|
|
69
|
-
|
|
70
|
-
// Write .env file
|
|
71
|
-
fs.writeFileSync(envPath, envContent);
|
|
72
|
-
|
|
73
|
-
console.log(`\n✅ Created .env file at: ${envPath}`);
|
|
74
|
-
console.log('🎉 Your ServiceNow credentials are now configured!');
|
|
75
|
-
console.log('\n💡 Next steps:');
|
|
76
|
-
console.log(' 1. Run: snow-flow init');
|
|
77
|
-
console.log(' 2. Run: snow-flow auth login');
|
|
78
|
-
console.log(' 3. Use /mcp in Claude Code to access ServiceNow tools');
|
|
79
|
-
|
|
80
|
-
rl.close();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Run if called directly
|
|
84
|
-
if (require.main === module) {
|
|
85
|
-
createEnvFile().catch(error => {
|
|
86
|
-
console.error('❌ Error creating .env file:', error.message);
|
|
87
|
-
process.exit(1);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
module.exports = { createEnvFile };
|
package/scripts/postinstall.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
|
|
7
|
-
console.log('🚀 Setting up Snow-Flow...');
|
|
8
|
-
|
|
9
|
-
// Check if we're in a global install
|
|
10
|
-
const isGlobalInstall = process.env.npm_config_global === 'true' ||
|
|
11
|
-
process.env.npm_config_global === true;
|
|
12
|
-
|
|
13
|
-
if (isGlobalInstall) {
|
|
14
|
-
console.log('✅ Snow-Flow installed globally');
|
|
15
|
-
console.log('📁 Run "snow-flow init" in your project directory to initialize');
|
|
16
|
-
|
|
17
|
-
// Create global config directory
|
|
18
|
-
const globalConfigDir = path.join(os.homedir(), '.snow-flow');
|
|
19
|
-
if (!fs.existsSync(globalConfigDir)) {
|
|
20
|
-
fs.mkdirSync(globalConfigDir, { recursive: true });
|
|
21
|
-
console.log(`✅ Created global config directory at ${globalConfigDir}`);
|
|
22
|
-
}
|
|
23
|
-
} else {
|
|
24
|
-
// Local installation - don't create directories automatically
|
|
25
|
-
console.log('✅ Snow-Flow installed locally');
|
|
26
|
-
console.log('🔧 Run "snow-flow init" to initialize your project');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
console.log('\n📚 Documentation: https://github.com/groeimetai/snow-flow#readme');
|
|
30
|
-
console.log('🆘 Get help: snow-flow --help');
|
|
@@ -1,210 +0,0 @@
|
|
|
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
|
-
"servicenow-deployment": {
|
|
21
|
-
"command": "node",
|
|
22
|
-
"args": [
|
|
23
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-deployment-mcp.js"
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
"servicenow-update-set": {
|
|
27
|
-
"command": "node",
|
|
28
|
-
"args": [
|
|
29
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-update-set-mcp.js"
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
"servicenow-intelligent": {
|
|
33
|
-
"command": "node",
|
|
34
|
-
"args": [
|
|
35
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-intelligent-mcp.js"
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
"servicenow-memory": {
|
|
39
|
-
"command": "node",
|
|
40
|
-
"args": [
|
|
41
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-memory-mcp.js"
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
"servicenow-graph-memory": {
|
|
45
|
-
"command": "node",
|
|
46
|
-
"args": [
|
|
47
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-graph-memory-mcp.js"
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
|
-
"servicenow-operations": {
|
|
51
|
-
"command": "node",
|
|
52
|
-
"args": [
|
|
53
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-operations-mcp.js"
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
"servicenow-platform-development": {
|
|
57
|
-
"command": "node",
|
|
58
|
-
"args": [
|
|
59
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-platform-development-mcp.js"
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
"servicenow-integration": {
|
|
63
|
-
"command": "node",
|
|
64
|
-
"args": [
|
|
65
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-integration-mcp.js"
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
"servicenow-automation": {
|
|
69
|
-
"command": "node",
|
|
70
|
-
"args": [
|
|
71
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-automation-mcp.js"
|
|
72
|
-
]
|
|
73
|
-
},
|
|
74
|
-
"servicenow-security-compliance": {
|
|
75
|
-
"command": "node",
|
|
76
|
-
"args": [
|
|
77
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-security-compliance-mcp.js"
|
|
78
|
-
]
|
|
79
|
-
},
|
|
80
|
-
"servicenow-reporting-analytics": {
|
|
81
|
-
"command": "node",
|
|
82
|
-
"args": [
|
|
83
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-reporting-analytics-mcp.js"
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
"servicenow-flow-composer": {
|
|
87
|
-
"command": "node",
|
|
88
|
-
"args": [
|
|
89
|
-
"${SNOW_FLOW_PATH}/dist/mcp/servicenow-flow-composer-mcp.js"
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
"snow-flow": {
|
|
93
|
-
"command": "node",
|
|
94
|
-
"args": [
|
|
95
|
-
"${SNOW_FLOW_PATH}/dist/mcp/snow-flow-mcp.js"
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
async function registerMCPServers() {
|
|
101
|
-
try {
|
|
102
|
-
// Determine Snow-Flow installation path
|
|
103
|
-
const isGlobalInstall = __dirname.includes('node_modules/snow-flow') ||
|
|
104
|
-
__dirname.includes('.nvm/versions/node');
|
|
105
|
-
|
|
106
|
-
const snowFlowPath = process.env.SNOW_FLOW_PATH ||
|
|
107
|
-
(isGlobalInstall ? path.resolve(__dirname, '..') : process.cwd());
|
|
108
|
-
|
|
109
|
-
// Replace ${SNOW_FLOW_PATH} with actual path
|
|
110
|
-
const servers = JSON.parse(JSON.stringify(SNOW_FLOW_SERVERS));
|
|
111
|
-
Object.keys(servers).forEach(key => {
|
|
112
|
-
// Replace path placeholder
|
|
113
|
-
if (servers[key].args && servers[key].args[0]) {
|
|
114
|
-
servers[key].args[0] = servers[key].args[0].replace('${SNOW_FLOW_PATH}', snowFlowPath);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Add environment variables from .env if it exists
|
|
118
|
-
const envPath = path.join(snowFlowPath, '.env');
|
|
119
|
-
if (fs.existsSync(envPath)) {
|
|
120
|
-
try {
|
|
121
|
-
const envContent = fs.readFileSync(envPath, 'utf8');
|
|
122
|
-
const envVars = {};
|
|
123
|
-
|
|
124
|
-
envContent.split('\n').forEach(line => {
|
|
125
|
-
// Skip comments and empty lines
|
|
126
|
-
if (line.trim() && !line.trim().startsWith('#')) {
|
|
127
|
-
const [key, ...valueParts] = line.split('=');
|
|
128
|
-
if (key && valueParts.length > 0) {
|
|
129
|
-
const value = valueParts.join('=').trim().replace(/^["']|["']$/g, '');
|
|
130
|
-
envVars[key.trim()] = value;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// Add env vars to server config
|
|
136
|
-
if (Object.keys(envVars).length > 0) {
|
|
137
|
-
servers[key].env = envVars;
|
|
138
|
-
}
|
|
139
|
-
} catch (err) {
|
|
140
|
-
console.warn('⚠️ Could not read .env file:', err.message);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// Check if Claude config exists
|
|
146
|
-
if (!fs.existsSync(CLAUDE_CONFIG_PATH)) {
|
|
147
|
-
console.log('⚠️ Claude Code configuration not found.');
|
|
148
|
-
console.log('📍 Creating new configuration at:', CLAUDE_CONFIG_PATH);
|
|
149
|
-
|
|
150
|
-
// Ensure directory exists
|
|
151
|
-
const configDir = path.dirname(CLAUDE_CONFIG_PATH);
|
|
152
|
-
if (!fs.existsSync(configDir)) {
|
|
153
|
-
fs.mkdirSync(configDir, { recursive: true });
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// Create new config with "servers" (Claude Code expects this)
|
|
157
|
-
const newConfig = {
|
|
158
|
-
servers: servers
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
fs.writeFileSync(CLAUDE_CONFIG_PATH, JSON.stringify(newConfig, null, 2));
|
|
162
|
-
console.log('✅ Created new Claude Code configuration with Snow-Flow MCP servers');
|
|
163
|
-
} else {
|
|
164
|
-
// Read existing config
|
|
165
|
-
let config = JSON.parse(fs.readFileSync(CLAUDE_CONFIG_PATH, 'utf8'));
|
|
166
|
-
|
|
167
|
-
// Initialize servers if not exists (Claude Code uses "servers")
|
|
168
|
-
if (!config.servers) {
|
|
169
|
-
config.servers = {};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Add Snow-Flow servers
|
|
173
|
-
let addedCount = 0;
|
|
174
|
-
Object.keys(servers).forEach(key => {
|
|
175
|
-
if (!config.servers[key]) {
|
|
176
|
-
config.servers[key] = servers[key];
|
|
177
|
-
addedCount++;
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
// Write updated config
|
|
182
|
-
fs.writeFileSync(CLAUDE_CONFIG_PATH, JSON.stringify(config, null, 2));
|
|
183
|
-
|
|
184
|
-
if (addedCount > 0) {
|
|
185
|
-
console.log(`✅ Added ${addedCount} Snow-Flow MCP servers to Claude Code configuration`);
|
|
186
|
-
} else {
|
|
187
|
-
console.log('✅ All Snow-Flow MCP servers already registered');
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
console.log('\n📋 Registered MCP servers:');
|
|
192
|
-
Object.keys(servers).forEach(key => {
|
|
193
|
-
console.log(` - ${key}`);
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
console.log('\n🔄 MCP servers are now available in Claude Code');
|
|
197
|
-
console.log('💡 Use /mcp in Claude Code to verify the servers are available');
|
|
198
|
-
|
|
199
|
-
} catch (error) {
|
|
200
|
-
console.error('❌ Error registering MCP servers:', error.message);
|
|
201
|
-
process.exit(1);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Run if called directly
|
|
206
|
-
if (require.main === module) {
|
|
207
|
-
registerMCPServers();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
module.exports = { registerMCPServers };
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Reset MCP Servers Script
|
|
5
|
-
* Kills all running MCP processes and optionally restarts them
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const { exec, spawn } = require('child_process');
|
|
9
|
-
const os = require('os');
|
|
10
|
-
const path = require('path');
|
|
11
|
-
const fs = require('fs');
|
|
12
|
-
|
|
13
|
-
// Colors for console output
|
|
14
|
-
const colors = {
|
|
15
|
-
reset: '\x1b[0m',
|
|
16
|
-
red: '\x1b[31m',
|
|
17
|
-
green: '\x1b[32m',
|
|
18
|
-
yellow: '\x1b[33m',
|
|
19
|
-
blue: '\x1b[34m',
|
|
20
|
-
magenta: '\x1b[35m',
|
|
21
|
-
cyan: '\x1b[36m'
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
function log(message, color = 'reset') {
|
|
25
|
-
console.log(`${colors[color]}${message}${colors.reset}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function logStep(step, message) {
|
|
29
|
-
console.log(`${colors.cyan}[${step}]${colors.reset} ${message}`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Get platform-specific commands
|
|
33
|
-
function getKillCommand() {
|
|
34
|
-
const platform = os.platform();
|
|
35
|
-
if (platform === 'win32') {
|
|
36
|
-
return {
|
|
37
|
-
list: 'wmic process where "commandline like \'%servicenow-%mcp%\'" get processid,commandline',
|
|
38
|
-
kill: (pid) => `taskkill /F /PID ${pid}`
|
|
39
|
-
};
|
|
40
|
-
} else {
|
|
41
|
-
return {
|
|
42
|
-
list: "ps aux | grep -E 'servicenow-.*-mcp' | grep -v grep",
|
|
43
|
-
kill: (pid) => `kill -9 ${pid}`
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Kill all MCP processes
|
|
49
|
-
async function killMCPProcesses() {
|
|
50
|
-
return new Promise((resolve) => {
|
|
51
|
-
logStep('1/4', 'Finding running MCP processes...');
|
|
52
|
-
|
|
53
|
-
const commands = getKillCommand();
|
|
54
|
-
|
|
55
|
-
exec(commands.list, (error, stdout, stderr) => {
|
|
56
|
-
if (error && !stderr) {
|
|
57
|
-
log('No MCP processes found running.', 'green');
|
|
58
|
-
resolve(0);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const lines = stdout.split('\n').filter(line => line.trim());
|
|
63
|
-
let killed = 0;
|
|
64
|
-
|
|
65
|
-
if (os.platform() === 'win32') {
|
|
66
|
-
// Windows: Extract PIDs from wmic output
|
|
67
|
-
lines.forEach(line => {
|
|
68
|
-
const match = line.match(/(\d+)\s*$/);
|
|
69
|
-
if (match) {
|
|
70
|
-
const pid = match[1];
|
|
71
|
-
exec(commands.kill(pid), (err) => {
|
|
72
|
-
if (!err) {
|
|
73
|
-
log(` ✓ Killed process ${pid}`, 'yellow');
|
|
74
|
-
killed++;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
} else {
|
|
80
|
-
// Unix-like: Extract PIDs from ps output
|
|
81
|
-
lines.forEach(line => {
|
|
82
|
-
const parts = line.trim().split(/\s+/);
|
|
83
|
-
if (parts.length > 1) {
|
|
84
|
-
const pid = parts[1];
|
|
85
|
-
exec(commands.kill(pid), (err) => {
|
|
86
|
-
if (!err) {
|
|
87
|
-
log(` ✓ Killed process ${pid}`, 'yellow');
|
|
88
|
-
killed++;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
setTimeout(() => {
|
|
96
|
-
if (killed > 0) {
|
|
97
|
-
log(`Killed ${killed} MCP processes.`, 'green');
|
|
98
|
-
}
|
|
99
|
-
resolve(killed);
|
|
100
|
-
}, 1000);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Clear temporary files and cache
|
|
106
|
-
async function clearCache() {
|
|
107
|
-
logStep('2/4', 'Clearing MCP cache and temporary files...');
|
|
108
|
-
|
|
109
|
-
const cacheLocations = [
|
|
110
|
-
path.join(os.homedir(), '.snow-flow', 'mcp-cache'),
|
|
111
|
-
path.join(os.homedir(), '.snow-flow', 'memory', '*.lock'),
|
|
112
|
-
path.join(process.cwd(), '.mcp-temp'),
|
|
113
|
-
path.join(process.cwd(), 'dist', 'mcp', '*.lock')
|
|
114
|
-
];
|
|
115
|
-
|
|
116
|
-
let cleared = 0;
|
|
117
|
-
|
|
118
|
-
cacheLocations.forEach(location => {
|
|
119
|
-
try {
|
|
120
|
-
if (location.includes('*')) {
|
|
121
|
-
// Handle glob patterns
|
|
122
|
-
const dir = path.dirname(location);
|
|
123
|
-
const pattern = path.basename(location);
|
|
124
|
-
if (fs.existsSync(dir)) {
|
|
125
|
-
const files = fs.readdirSync(dir);
|
|
126
|
-
files.forEach(file => {
|
|
127
|
-
if (file.match(pattern.replace('*', '.*'))) {
|
|
128
|
-
fs.unlinkSync(path.join(dir, file));
|
|
129
|
-
cleared++;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
} else if (fs.existsSync(location)) {
|
|
134
|
-
// Handle directories
|
|
135
|
-
fs.rmSync(location, { recursive: true, force: true });
|
|
136
|
-
cleared++;
|
|
137
|
-
}
|
|
138
|
-
} catch (error) {
|
|
139
|
-
// Ignore errors for non-existent files
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
if (cleared > 0) {
|
|
144
|
-
log(` ✓ Cleared ${cleared} cache locations`, 'green');
|
|
145
|
-
} else {
|
|
146
|
-
log(' ✓ No cache files found to clear', 'green');
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Verify no processes are running
|
|
151
|
-
async function verifyClean() {
|
|
152
|
-
return new Promise((resolve) => {
|
|
153
|
-
logStep('3/4', 'Verifying all MCP processes are stopped...');
|
|
154
|
-
|
|
155
|
-
const commands = getKillCommand();
|
|
156
|
-
|
|
157
|
-
exec(commands.list, (error, stdout) => {
|
|
158
|
-
if (error || !stdout.trim()) {
|
|
159
|
-
log(' ✓ All MCP processes successfully stopped', 'green');
|
|
160
|
-
resolve(true);
|
|
161
|
-
} else {
|
|
162
|
-
log(' ⚠ Some MCP processes may still be running', 'yellow');
|
|
163
|
-
resolve(false);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Restart MCP servers if requested
|
|
170
|
-
async function restartServers() {
|
|
171
|
-
logStep('4/4', 'Restarting MCP servers...');
|
|
172
|
-
|
|
173
|
-
const serverPath = path.join(__dirname, '..', 'dist', 'mcp', 'start-all-mcp-servers.js');
|
|
174
|
-
|
|
175
|
-
if (!fs.existsSync(serverPath)) {
|
|
176
|
-
log(' ⚠ MCP server starter not found. Run "npm run build" first.', 'yellow');
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
log(' Starting MCP servers in background...', 'cyan');
|
|
181
|
-
|
|
182
|
-
const child = spawn('node', [serverPath], {
|
|
183
|
-
detached: true,
|
|
184
|
-
stdio: 'ignore'
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
child.unref();
|
|
188
|
-
|
|
189
|
-
log(' ✓ MCP servers starting...', 'green');
|
|
190
|
-
log('\n To view logs, check ~/.snow-flow/logs/', 'cyan');
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Main execution
|
|
194
|
-
async function main() {
|
|
195
|
-
console.log('\n' + colors.magenta + '🔄 Snow-Flow MCP Server Reset' + colors.reset + '\n');
|
|
196
|
-
|
|
197
|
-
const args = process.argv.slice(2);
|
|
198
|
-
const shouldRestart = args.includes('--restart') || args.includes('-r');
|
|
199
|
-
|
|
200
|
-
try {
|
|
201
|
-
// Kill processes
|
|
202
|
-
await killMCPProcesses();
|
|
203
|
-
|
|
204
|
-
// Clear cache
|
|
205
|
-
await clearCache();
|
|
206
|
-
|
|
207
|
-
// Verify clean
|
|
208
|
-
await verifyClean();
|
|
209
|
-
|
|
210
|
-
// Restart if requested
|
|
211
|
-
if (shouldRestart) {
|
|
212
|
-
await restartServers();
|
|
213
|
-
} else {
|
|
214
|
-
log('\n✅ MCP servers reset complete!', 'green');
|
|
215
|
-
log('To restart servers, run: npm run reset-mcp -- --restart', 'cyan');
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
} catch (error) {
|
|
219
|
-
log(`\n❌ Error resetting MCP servers: ${error.message}`, 'red');
|
|
220
|
-
process.exit(1);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Help text
|
|
225
|
-
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
226
|
-
console.log(`
|
|
227
|
-
${colors.cyan}Snow-Flow MCP Server Reset${colors.reset}
|
|
228
|
-
|
|
229
|
-
Usage: node reset-mcp-servers.js [options]
|
|
230
|
-
|
|
231
|
-
Options:
|
|
232
|
-
-r, --restart Restart MCP servers after reset
|
|
233
|
-
-h, --help Show this help message
|
|
234
|
-
|
|
235
|
-
Examples:
|
|
236
|
-
node reset-mcp-servers.js # Reset only
|
|
237
|
-
node reset-mcp-servers.js --restart # Reset and restart
|
|
238
|
-
`);
|
|
239
|
-
process.exit(0);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// Run the script
|
|
243
|
-
main().catch(error => {
|
|
244
|
-
log(`Fatal error: ${error.message}`, 'red');
|
|
245
|
-
process.exit(1);
|
|
246
|
-
});
|
package/scripts/setup-mcp.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Dynamic MCP Configuration Generator
|
|
4
|
-
* Generates .mcp.json from template with absolute paths and actual environment variables
|
|
5
|
-
* This ensures compatibility with Claude Code while keeping the project portable
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
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 packageRoot = isGlobalInstall
|
|
23
|
-
? path.resolve(__dirname, '..') // Go up from scripts/ to package root
|
|
24
|
-
: process.cwd();
|
|
25
|
-
|
|
26
|
-
// The actual project root where we're running the command
|
|
27
|
-
const projectRoot = process.cwd();
|
|
28
|
-
|
|
29
|
-
const templatePath = path.join(packageRoot, '.mcp.json.template');
|
|
30
|
-
const mcpFilePath = path.join(projectRoot, '.mcp.json');
|
|
31
|
-
|
|
32
|
-
// Check if template exists
|
|
33
|
-
if (!fs.existsSync(templatePath)) {
|
|
34
|
-
console.error('❌ Error: .mcp.json.template not found!');
|
|
35
|
-
console.error(' This file should be in the project root.');
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Check if required environment variables are set
|
|
40
|
-
const requiredEnvVars = ['SNOW_INSTANCE', 'SNOW_CLIENT_ID', 'SNOW_CLIENT_SECRET'];
|
|
41
|
-
const missingVars = requiredEnvVars.filter(varName => !process.env[varName]);
|
|
42
|
-
|
|
43
|
-
if (missingVars.length > 0) {
|
|
44
|
-
console.warn('⚠️ Warning: Missing environment variables:', missingVars.join(', '));
|
|
45
|
-
console.warn(' MCP servers may not work without proper ServiceNow credentials.');
|
|
46
|
-
console.warn(' Copy .env.example to .env and configure your ServiceNow credentials.');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Read template
|
|
50
|
-
const template = fs.readFileSync(templatePath, 'utf8');
|
|
51
|
-
|
|
52
|
-
// Replace placeholders
|
|
53
|
-
const replacements = {
|
|
54
|
-
'{{PROJECT_ROOT}}': packageRoot, // Use packageRoot for MCP server paths
|
|
55
|
-
'{{SNOW_INSTANCE}}': process.env.SNOW_INSTANCE || 'your-instance.service-now.com',
|
|
56
|
-
'{{SNOW_CLIENT_ID}}': process.env.SNOW_CLIENT_ID || 'your-oauth-client-id',
|
|
57
|
-
'{{SNOW_CLIENT_SECRET}}': process.env.SNOW_CLIENT_SECRET || 'your-oauth-client-secret',
|
|
58
|
-
'{{NEO4J_URI}}': process.env.NEO4J_URI || 'bolt://localhost:7687',
|
|
59
|
-
'{{NEO4J_USER}}': process.env.NEO4J_USER || 'neo4j',
|
|
60
|
-
'{{NEO4J_PASSWORD}}': process.env.NEO4J_PASSWORD || 'password'
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
let mcpConfig = template;
|
|
64
|
-
for (const [placeholder, value] of Object.entries(replacements)) {
|
|
65
|
-
mcpConfig = mcpConfig.replace(new RegExp(placeholder, 'g'), value);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Write the configuration file
|
|
69
|
-
fs.writeFileSync(mcpFilePath, mcpConfig);
|
|
70
|
-
|
|
71
|
-
// Make all MCP server files executable
|
|
72
|
-
const mcpServerFiles = [
|
|
73
|
-
'servicenow-deployment-mcp.js',
|
|
74
|
-
'servicenow-update-set-mcp.js',
|
|
75
|
-
'servicenow-intelligent-mcp.js',
|
|
76
|
-
'servicenow-graph-memory-mcp.js',
|
|
77
|
-
'servicenow-operations-mcp.js',
|
|
78
|
-
'servicenow-platform-development-mcp.js',
|
|
79
|
-
'servicenow-integration-mcp.js',
|
|
80
|
-
'servicenow-automation-mcp.js',
|
|
81
|
-
'servicenow-security-compliance-mcp.js',
|
|
82
|
-
'servicenow-reporting-analytics-mcp.js',
|
|
83
|
-
'servicenow-memory-mcp.js'
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
mcpServerFiles.forEach(file => {
|
|
87
|
-
const filePath = path.join(packageRoot, 'dist/mcp', file);
|
|
88
|
-
if (fs.existsSync(filePath)) {
|
|
89
|
-
fs.chmodSync(filePath, '755');
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
console.log('✅ Generated .mcp.json with dynamic configuration');
|
|
94
|
-
console.log('📁 Project directory:', projectRoot);
|
|
95
|
-
console.log('📦 Package directory:', packageRoot);
|
|
96
|
-
console.log('🔧 Environment variables:', requiredEnvVars.filter(v => process.env[v]).length + '/' + requiredEnvVars.length + ' configured');
|
|
97
|
-
console.log('🔐 Made MCP server files executable');
|
|
98
|
-
console.log('📝 Using node + args format for Claude Code compatibility');
|
|
99
|
-
|
|
100
|
-
if (missingVars.length === 0) {
|
|
101
|
-
console.log('🎉 All ServiceNow environment variables are configured!');
|
|
102
|
-
console.log('💡 MCP servers should now work properly in Claude Code');
|
|
103
|
-
} else {
|
|
104
|
-
console.log('⚠️ Configure missing environment variables in .env file');
|
|
105
|
-
console.log('📖 See .env.example for setup instructions');
|
|
106
|
-
}
|