snow-flow 4.5.54 → 4.6.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.
- package/.mcp.json +220 -0
- package/dist/cli.js +59 -0
- package/dist/utils/claude-desktop-exporter.d.ts +31 -0
- package/dist/utils/claude-desktop-exporter.js +202 -0
- package/memory/agents/README.md +3 -0
- package/package.json +1 -1
- package/servicenow/README.md +3 -0
package/.mcp.json
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"servicenow-deployment": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": [
|
|
6
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-deployment-mcp.js"
|
|
7
|
+
],
|
|
8
|
+
"description": "Widget and artifact deployment with COHERENCE VALIDATION - ensures HTML template, client script, server script work together perfectly. Tools: snow_deploy, snow_update, snow_validate_deployment, snow_rollback_deployment, snow_deployment_status, snow_export_artifact, snow_import_artifact, snow_preview_widget, snow_widget_test, snow_create_solution_package",
|
|
9
|
+
"env": {
|
|
10
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
11
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
12
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}",
|
|
13
|
+
"SNOW_DEPLOYMENT_TIMEOUT": "${SNOW_DEPLOYMENT_TIMEOUT}",
|
|
14
|
+
"MCP_DEPLOYMENT_TIMEOUT": "${MCP_DEPLOYMENT_TIMEOUT}"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"servicenow-operations": {
|
|
18
|
+
"command": "node",
|
|
19
|
+
"args": [
|
|
20
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-operations-mcp.js"
|
|
21
|
+
],
|
|
22
|
+
"description": "Core ServiceNow operations - universal table query (snow_query_table), CRUD operations, incident/request/problem management, CMDB search, user/group management, catalog items, knowledge search, field discovery (snow_discover_table_fields), get by sys_id",
|
|
23
|
+
"env": {
|
|
24
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
25
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
26
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"servicenow-automation": {
|
|
30
|
+
"command": "node",
|
|
31
|
+
"args": [
|
|
32
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-automation-mcp.js"
|
|
33
|
+
],
|
|
34
|
+
"description": "Script execution with output capture (snow_execute_script_with_output), scheduled jobs, event rules, notifications, SLA definitions, workflow activities, script history, REST testing, system logs (snow_get_logs), execution tracing, background scripts with autoConfirm option",
|
|
35
|
+
"env": {
|
|
36
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
37
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
38
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"servicenow-platform-development": {
|
|
42
|
+
"command": "node",
|
|
43
|
+
"args": [
|
|
44
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-platform-development-mcp.js"
|
|
45
|
+
],
|
|
46
|
+
"description": "Platform development - create UI pages, script includes, business rules, client scripts, UI policies/actions, ACLs, dictionary entries, catalog items, workflows, transform maps",
|
|
47
|
+
"env": {
|
|
48
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
49
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
50
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"servicenow-integration": {
|
|
54
|
+
"command": "node",
|
|
55
|
+
"args": [
|
|
56
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-integration-mcp.js"
|
|
57
|
+
],
|
|
58
|
+
"description": "Integration management - REST messages, SOAP messages, transform maps, import sets, web services, email configuration, OAuth providers, endpoint discovery, integration testing",
|
|
59
|
+
"env": {
|
|
60
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
61
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
62
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"servicenow-system-properties": {
|
|
66
|
+
"command": "node",
|
|
67
|
+
"args": [
|
|
68
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-system-properties-mcp.js"
|
|
69
|
+
],
|
|
70
|
+
"description": "System property management - get/set/list/delete properties (snow_property_get, snow_property_set), bulk operations, import/export JSON, validate values, search by pattern, categories, audit history",
|
|
71
|
+
"env": {
|
|
72
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
73
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
74
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"servicenow-update-set": {
|
|
78
|
+
"command": "node",
|
|
79
|
+
"args": [
|
|
80
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-update-set-mcp.js"
|
|
81
|
+
],
|
|
82
|
+
"description": "Update set management - create/switch/complete update sets, preview changes, export/import XML, ensure active update set, add artifacts to sets, batch operations",
|
|
83
|
+
"env": {
|
|
84
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
85
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
86
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"servicenow-development-assistant": {
|
|
90
|
+
"command": "node",
|
|
91
|
+
"args": [
|
|
92
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-development-assistant-mcp.js"
|
|
93
|
+
],
|
|
94
|
+
"description": "Development assistance - code generation, best practices, pattern recommendations, code review, performance optimization, ES5 conversion, documentation generation, requirement analysis (snow_find_artifact, snow_edit_artifact, snow_analyze_artifact)",
|
|
95
|
+
"env": {
|
|
96
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
97
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
98
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"servicenow-security-compliance": {
|
|
102
|
+
"command": "node",
|
|
103
|
+
"args": [
|
|
104
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-security-compliance-mcp.js"
|
|
105
|
+
],
|
|
106
|
+
"description": "Security and compliance - security policies, compliance rules (SOX/GDPR/HIPAA), audit trails, access control review, vulnerability scanning, risk assessment, encryption settings",
|
|
107
|
+
"env": {
|
|
108
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
109
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
110
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"servicenow-reporting-analytics": {
|
|
114
|
+
"command": "node",
|
|
115
|
+
"args": [
|
|
116
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-reporting-analytics-mcp.js"
|
|
117
|
+
],
|
|
118
|
+
"description": "Reporting and analytics - create reports/dashboards/KPIs, data visualization, performance analytics, scheduled reports, data quality analysis, metrics collection, trend analysis",
|
|
119
|
+
"env": {
|
|
120
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
121
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
122
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"servicenow-machine-learning": {
|
|
126
|
+
"command": "node",
|
|
127
|
+
"args": [
|
|
128
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-machine-learning-mcp.js"
|
|
129
|
+
],
|
|
130
|
+
"description": "Machine learning - train/classify incidents (snow_train_classifier), change risk prediction, anomaly detection, forecast incidents, sentiment analysis, process optimization, hybrid recommendations with TensorFlow.js",
|
|
131
|
+
"env": {
|
|
132
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
133
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
134
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"servicenow-knowledge-catalog": {
|
|
138
|
+
"command": "node",
|
|
139
|
+
"args": [
|
|
140
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-knowledge-catalog-mcp.js"
|
|
141
|
+
],
|
|
142
|
+
"description": "Knowledge and catalog management - CORRECTED v3.6.10 with proper catalog UI policy creation (2-table system: policy with embedded conditions string, separate actions table). Create/search/update knowledge articles, catalog items, variables, UI policies with conditions as query string and actions array",
|
|
143
|
+
"env": {
|
|
144
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
145
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
146
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"servicenow-change-virtualagent-pa": {
|
|
150
|
+
"command": "node",
|
|
151
|
+
"args": [
|
|
152
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-change-virtualagent-pa-mcp.js"
|
|
153
|
+
],
|
|
154
|
+
"description": "Change management, Virtual Agent, and Performance Analytics - create/manage change requests, CAB meetings, VA topics/blocks, conversations, PA indicators/widgets/breakdowns, thresholds, data collection",
|
|
155
|
+
"env": {
|
|
156
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
157
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
158
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"servicenow-flow-workspace-mobile": {
|
|
162
|
+
"command": "node",
|
|
163
|
+
"args": [
|
|
164
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-flow-workspace-mobile-mcp.js"
|
|
165
|
+
],
|
|
166
|
+
"description": "Flow Designer, Workspace, and Mobile - create flows/actions/subflows/triggers, test flows, workspaces/tabs/lists, contextual panels, mobile app config, layouts, push notifications, offline sync",
|
|
167
|
+
"env": {
|
|
168
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
169
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
170
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"servicenow-cmdb-event-hr-csm-devops": {
|
|
174
|
+
"command": "node",
|
|
175
|
+
"args": [
|
|
176
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-cmdb-event-hr-csm-devops-mcp.js"
|
|
177
|
+
],
|
|
178
|
+
"description": "CMDB, Event Management, HR, CSM, and DevOps - create CIs/relationships, discovery, impact analysis, events/alerts, HR cases/onboarding, customer cases/accounts, DevOps pipelines/deployments",
|
|
179
|
+
"env": {
|
|
180
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
181
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
182
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"servicenow-advanced-features": {
|
|
186
|
+
"command": "node",
|
|
187
|
+
"args": [
|
|
188
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/advanced/servicenow-advanced-features-mcp.js"
|
|
189
|
+
],
|
|
190
|
+
"description": "Advanced features - batch API operations (80% reduction), table relationships analysis, query optimization, field usage analysis, code pattern detection, process discovery, workflow analysis, documentation generation",
|
|
191
|
+
"env": {
|
|
192
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
193
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
194
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"servicenow-local-development": {
|
|
198
|
+
"command": "node",
|
|
199
|
+
"args": [
|
|
200
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/servicenow-local-development-mcp.js"
|
|
201
|
+
],
|
|
202
|
+
"description": "UNIVERSAL ARTIFACT DETECTION v3.6.6 - finds ANY ServiceNow record by sys_id using sys_metadata! Pull any artifact (even custom tables) to local files with Claude Code native tools. Supports all tables, generic artifact creation for unknown types, smart chunking, ES5 validation, coherence checking. Tools: snow_pull_artifact, snow_push_artifact, snow_validate_artifact_coherence",
|
|
203
|
+
"env": {
|
|
204
|
+
"SNOW_INSTANCE": "${SNOW_INSTANCE}",
|
|
205
|
+
"SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
|
|
206
|
+
"SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"snow-flow": {
|
|
210
|
+
"command": "node",
|
|
211
|
+
"args": [
|
|
212
|
+
"/Users/nielsvanderwerf/.nvm/versions/node/v20.15.0/lib/node_modules/snow-flow/dist/mcp/snow-flow-mcp.js"
|
|
213
|
+
],
|
|
214
|
+
"description": "Snow-Flow orchestration - swarm init/status, agent spawn/discover, task orchestrate/categorize, neural train/patterns (TensorFlow.js), memory store/search (timeout-protected), performance reports, token usage tracking",
|
|
215
|
+
"env": {
|
|
216
|
+
"SNOW_FLOW_ENV": "${SNOW_FLOW_ENV}"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -1727,6 +1727,7 @@ program
|
|
|
1727
1727
|
📋 Available Commands:
|
|
1728
1728
|
swarm <objective> Execute multi-agent orchestration
|
|
1729
1729
|
spawn <type> Spawn specific agent types
|
|
1730
|
+
export Export MCP configuration to Claude Desktop
|
|
1730
1731
|
status Show system status
|
|
1731
1732
|
monitor Real-time monitoring dashboard
|
|
1732
1733
|
memory <action> Memory operations
|
|
@@ -3327,6 +3328,64 @@ program
|
|
|
3327
3328
|
}
|
|
3328
3329
|
});
|
|
3329
3330
|
// ===================================================
|
|
3331
|
+
// 📤 CLAUDE DESKTOP EXPORT COMMAND
|
|
3332
|
+
// ===================================================
|
|
3333
|
+
program
|
|
3334
|
+
.command('export')
|
|
3335
|
+
.description('📤 Export Snow-Flow MCP configuration to Claude Desktop with automatic credential injection')
|
|
3336
|
+
.option('--output <path>', 'Custom output path for Claude Desktop config')
|
|
3337
|
+
.option('--backup', 'Backup existing Claude Desktop config before overwriting', true)
|
|
3338
|
+
.option('--merge', 'Merge with existing Claude Desktop config instead of overwriting')
|
|
3339
|
+
.option('--dry-run', 'Preview the export without writing files')
|
|
3340
|
+
.action(async (options) => {
|
|
3341
|
+
console.log(`\n📤 Snow-Flow Claude Desktop Export v${version_js_1.VERSION}`);
|
|
3342
|
+
console.log('🎯 Exporting all 22 MCP servers with 245+ tools to Claude Desktop...\n');
|
|
3343
|
+
try {
|
|
3344
|
+
const { exportToClaudeDesktop } = await Promise.resolve().then(() => __importStar(require('./utils/claude-desktop-exporter.js')));
|
|
3345
|
+
const result = await exportToClaudeDesktop({
|
|
3346
|
+
outputPath: options.output,
|
|
3347
|
+
backup: options.backup,
|
|
3348
|
+
merge: options.merge,
|
|
3349
|
+
dryRun: options.dryRun
|
|
3350
|
+
});
|
|
3351
|
+
if (result.success) {
|
|
3352
|
+
console.log('✅ Claude Desktop export completed successfully!\n');
|
|
3353
|
+
if (result.configPath) {
|
|
3354
|
+
console.log(`📝 Configuration written to: ${result.configPath}`);
|
|
3355
|
+
}
|
|
3356
|
+
if (result.backupPath) {
|
|
3357
|
+
console.log(`💾 Backup created at: ${result.backupPath}`);
|
|
3358
|
+
}
|
|
3359
|
+
if (result.merged) {
|
|
3360
|
+
console.log(`🔗 Merged with existing configuration (${result.existingServers} existing servers preserved)`);
|
|
3361
|
+
}
|
|
3362
|
+
console.log(`🔑 Credentials automatically injected from .env file`);
|
|
3363
|
+
console.log(`🌍 Instance: ${result.credentials.instance}`);
|
|
3364
|
+
console.log(`🔐 Authentication: OAuth configured`);
|
|
3365
|
+
console.log('\n🚀 Next steps:');
|
|
3366
|
+
console.log('1. Restart Claude Desktop to load the new MCP servers');
|
|
3367
|
+
console.log('2. Open Claude Desktop chat');
|
|
3368
|
+
console.log('3. Try: "Create UX workspace for IT support using snow_create_complete_workspace"');
|
|
3369
|
+
console.log('\n💡 All 245+ Snow-Flow tools are now available in Claude Desktop!');
|
|
3370
|
+
}
|
|
3371
|
+
else {
|
|
3372
|
+
console.error('\n❌ Export failed:', result.error);
|
|
3373
|
+
if (result.missingCredentials) {
|
|
3374
|
+
console.error('\n🔑 Missing credentials in .env file:');
|
|
3375
|
+
result.missingCredentials.forEach(cred => {
|
|
3376
|
+
console.error(` • ${cred}`);
|
|
3377
|
+
});
|
|
3378
|
+
console.error('\nRun: snow-flow auth login');
|
|
3379
|
+
}
|
|
3380
|
+
process.exit(1);
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
catch (error) {
|
|
3384
|
+
console.error('\n💥 Export error:', error.message);
|
|
3385
|
+
process.exit(1);
|
|
3386
|
+
}
|
|
3387
|
+
});
|
|
3388
|
+
// ===================================================
|
|
3330
3389
|
// 🔄 BACKWARD COMPATIBILITY ENHANCEMENTS
|
|
3331
3390
|
// ===================================================
|
|
3332
3391
|
/**
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Claude Desktop Exporter - Export Snow-Flow MCP configuration to Claude Desktop
|
|
4
|
+
* Handles automatic credential injection, backup, and merge operations
|
|
5
|
+
*/
|
|
6
|
+
interface ExportOptions {
|
|
7
|
+
outputPath?: string;
|
|
8
|
+
backup?: boolean;
|
|
9
|
+
merge?: boolean;
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ExportResult {
|
|
13
|
+
success: boolean;
|
|
14
|
+
error?: string;
|
|
15
|
+
configPath?: string;
|
|
16
|
+
backupPath?: string;
|
|
17
|
+
merged?: boolean;
|
|
18
|
+
existingServers?: number;
|
|
19
|
+
credentials?: {
|
|
20
|
+
instance: string;
|
|
21
|
+
clientId: string;
|
|
22
|
+
clientSecret: string;
|
|
23
|
+
};
|
|
24
|
+
missingCredentials?: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Export Snow-Flow MCP configuration to Claude Desktop
|
|
28
|
+
*/
|
|
29
|
+
export declare function exportToClaudeDesktop(options: ExportOptions): Promise<ExportResult>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=claude-desktop-exporter.d.ts.map
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Claude Desktop Exporter - Export Snow-Flow MCP configuration to Claude Desktop
|
|
5
|
+
* Handles automatic credential injection, backup, and merge operations
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.exportToClaudeDesktop = exportToClaudeDesktop;
|
|
12
|
+
const fs_1 = __importDefault(require("fs"));
|
|
13
|
+
const path_1 = __importDefault(require("path"));
|
|
14
|
+
const os_1 = __importDefault(require("os"));
|
|
15
|
+
/**
|
|
16
|
+
* Export Snow-Flow MCP configuration to Claude Desktop
|
|
17
|
+
*/
|
|
18
|
+
async function exportToClaudeDesktop(options) {
|
|
19
|
+
try {
|
|
20
|
+
console.log('🔍 Detecting Claude Desktop configuration location...');
|
|
21
|
+
// Step 1: Detect Claude Desktop config location
|
|
22
|
+
const claudeConfigPath = await detectClaudeDesktopConfigPath();
|
|
23
|
+
const outputPath = options.outputPath || claudeConfigPath;
|
|
24
|
+
if (!outputPath) {
|
|
25
|
+
return {
|
|
26
|
+
success: false,
|
|
27
|
+
error: 'Could not detect Claude Desktop configuration location. Specify --output <path> manually.'
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
console.log(`📂 Claude Desktop config: ${outputPath}`);
|
|
31
|
+
// Step 2: Load .env credentials
|
|
32
|
+
console.log('🔐 Loading credentials from .env file...');
|
|
33
|
+
const credentials = await loadCredentialsFromEnv();
|
|
34
|
+
if (credentials.missingCredentials && credentials.missingCredentials.length > 0) {
|
|
35
|
+
return {
|
|
36
|
+
success: false,
|
|
37
|
+
error: 'Missing required credentials in .env file',
|
|
38
|
+
missingCredentials: credentials.missingCredentials
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
console.log(`✅ Credentials loaded for instance: ${credentials.instance}`);
|
|
42
|
+
// Step 3: Load Snow-Flow MCP template
|
|
43
|
+
console.log('📋 Loading Snow-Flow MCP template...');
|
|
44
|
+
const mcpTemplate = await loadSnowFlowMCPTemplate();
|
|
45
|
+
// Step 4: Inject credentials into template
|
|
46
|
+
console.log('💉 Injecting credentials into MCP configuration...');
|
|
47
|
+
const mcpConfig = injectCredentials(mcpTemplate, credentials);
|
|
48
|
+
// Step 5: Handle existing config (backup/merge)
|
|
49
|
+
let existingConfig = null;
|
|
50
|
+
let backupPath = null;
|
|
51
|
+
if (fs_1.default.existsSync(outputPath)) {
|
|
52
|
+
console.log('📁 Existing Claude Desktop config found');
|
|
53
|
+
if (options.backup) {
|
|
54
|
+
backupPath = await createBackup(outputPath);
|
|
55
|
+
console.log(`🗃️ Backup created: ${backupPath}`);
|
|
56
|
+
}
|
|
57
|
+
if (options.merge) {
|
|
58
|
+
console.log('🔗 Merging configurations...');
|
|
59
|
+
existingConfig = JSON.parse(fs_1.default.readFileSync(outputPath, 'utf8'));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Step 6: Generate final config
|
|
63
|
+
const finalConfig = options.merge && existingConfig ?
|
|
64
|
+
mergeConfigurations(existingConfig, mcpConfig) : mcpConfig;
|
|
65
|
+
// Step 7: Write config (or dry run)
|
|
66
|
+
if (options.dryRun) {
|
|
67
|
+
console.log('🔬 DRY RUN - Preview of configuration:');
|
|
68
|
+
console.log(JSON.stringify(finalConfig, null, 2));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// Ensure directory exists
|
|
72
|
+
const configDir = path_1.default.dirname(outputPath);
|
|
73
|
+
if (!fs_1.default.existsSync(configDir)) {
|
|
74
|
+
fs_1.default.mkdirSync(configDir, { recursive: true });
|
|
75
|
+
console.log(`📁 Created directory: ${configDir}`);
|
|
76
|
+
}
|
|
77
|
+
fs_1.default.writeFileSync(outputPath, JSON.stringify(finalConfig, null, 2));
|
|
78
|
+
console.log(`✅ Configuration written to: ${outputPath}`);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
success: true,
|
|
82
|
+
configPath: outputPath,
|
|
83
|
+
backupPath: backupPath,
|
|
84
|
+
merged: !!options.merge,
|
|
85
|
+
existingServers: existingConfig ? Object.keys(existingConfig.mcpServers || {}).length : 0,
|
|
86
|
+
credentials: {
|
|
87
|
+
instance: credentials.instance,
|
|
88
|
+
clientId: credentials.clientId ? '[CONFIGURED]' : '[MISSING]',
|
|
89
|
+
clientSecret: credentials.clientSecret ? '[CONFIGURED]' : '[MISSING]'
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
return {
|
|
95
|
+
success: false,
|
|
96
|
+
error: `Export failed: ${error}`
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Detect Claude Desktop configuration path for different platforms
|
|
102
|
+
*/
|
|
103
|
+
async function detectClaudeDesktopConfigPath() {
|
|
104
|
+
const platform = os_1.default.platform();
|
|
105
|
+
switch (platform) {
|
|
106
|
+
case 'darwin': // macOS
|
|
107
|
+
return path_1.default.join(os_1.default.homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
108
|
+
case 'win32': // Windows
|
|
109
|
+
return path_1.default.join(os_1.default.homedir(), 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
|
|
110
|
+
case 'linux': // Linux
|
|
111
|
+
return path_1.default.join(os_1.default.homedir(), '.config', 'Claude', 'claude_desktop_config.json');
|
|
112
|
+
default:
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Load credentials from .env file
|
|
118
|
+
*/
|
|
119
|
+
async function loadCredentialsFromEnv() {
|
|
120
|
+
const envPath = path_1.default.join(process.cwd(), '.env');
|
|
121
|
+
const missingCredentials = [];
|
|
122
|
+
if (!fs_1.default.existsSync(envPath)) {
|
|
123
|
+
return {
|
|
124
|
+
missingCredentials: ['SNOW_INSTANCE', 'SNOW_CLIENT_ID', 'SNOW_CLIENT_SECRET']
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const envContent = fs_1.default.readFileSync(envPath, 'utf8');
|
|
128
|
+
const envVars = {};
|
|
129
|
+
// Parse .env file
|
|
130
|
+
envContent.split('\n').forEach(line => {
|
|
131
|
+
const [key, ...valueParts] = line.split('=');
|
|
132
|
+
if (key && valueParts.length > 0) {
|
|
133
|
+
envVars[key.trim()] = valueParts.join('=').trim().replace(/^["']|["']$/g, '');
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
// Check required credentials
|
|
137
|
+
const requiredCreds = ['SNOW_INSTANCE', 'SNOW_CLIENT_ID', 'SNOW_CLIENT_SECRET'];
|
|
138
|
+
requiredCreds.forEach(cred => {
|
|
139
|
+
if (!envVars[cred]) {
|
|
140
|
+
missingCredentials.push(cred);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
return {
|
|
144
|
+
instance: envVars.SNOW_INSTANCE,
|
|
145
|
+
clientId: envVars.SNOW_CLIENT_ID,
|
|
146
|
+
clientSecret: envVars.SNOW_CLIENT_SECRET,
|
|
147
|
+
missingCredentials: missingCredentials.length > 0 ? missingCredentials : null
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Load Snow-Flow MCP template
|
|
152
|
+
*/
|
|
153
|
+
async function loadSnowFlowMCPTemplate() {
|
|
154
|
+
// Try to load from current project
|
|
155
|
+
let templatePath = path_1.default.join(process.cwd(), '.mcp.json.template');
|
|
156
|
+
if (!fs_1.default.existsSync(templatePath)) {
|
|
157
|
+
// Try to load from Snow-Flow installation (global npm package)
|
|
158
|
+
const globalSnowFlowPath = path_1.default.join(os_1.default.homedir(), '.nvm', 'versions', 'node', process.version, 'lib', 'node_modules', 'snow-flow');
|
|
159
|
+
templatePath = path_1.default.join(globalSnowFlowPath, '.mcp.json.template');
|
|
160
|
+
}
|
|
161
|
+
if (!fs_1.default.existsSync(templatePath)) {
|
|
162
|
+
throw new Error('Snow-Flow MCP template not found. Run "snow-flow init" first.');
|
|
163
|
+
}
|
|
164
|
+
const templateContent = fs_1.default.readFileSync(templatePath, 'utf8');
|
|
165
|
+
return JSON.parse(templateContent);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Inject credentials into MCP configuration
|
|
169
|
+
*/
|
|
170
|
+
function injectCredentials(mcpTemplate, credentials) {
|
|
171
|
+
const configJson = JSON.stringify(mcpTemplate, null, 2)
|
|
172
|
+
.replace(/\{\{SNOW_INSTANCE\}\}/g, credentials.instance)
|
|
173
|
+
.replace(/\{\{SNOW_CLIENT_ID\}\}/g, credentials.clientId)
|
|
174
|
+
.replace(/\{\{SNOW_CLIENT_SECRET\}\}/g, credentials.clientSecret)
|
|
175
|
+
.replace(/\{\{PROJECT_ROOT\}\}/g, path_1.default.join(os_1.default.homedir(), '.nvm', 'versions', 'node', process.version, 'lib', 'node_modules', 'snow-flow'))
|
|
176
|
+
.replace(/\{\{SNOW_DEPLOYMENT_TIMEOUT\}\}/g, '300000')
|
|
177
|
+
.replace(/\{\{MCP_DEPLOYMENT_TIMEOUT\}\}/g, '30000');
|
|
178
|
+
return JSON.parse(configJson);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Create backup of existing Claude Desktop config
|
|
182
|
+
*/
|
|
183
|
+
async function createBackup(configPath) {
|
|
184
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
185
|
+
const backupPath = configPath.replace('.json', `_backup_${timestamp}.json`);
|
|
186
|
+
fs_1.default.copyFileSync(configPath, backupPath);
|
|
187
|
+
return backupPath;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Merge Snow-Flow config with existing Claude Desktop config
|
|
191
|
+
*/
|
|
192
|
+
function mergeConfigurations(existing, snowFlow) {
|
|
193
|
+
const merged = {
|
|
194
|
+
...existing,
|
|
195
|
+
mcpServers: {
|
|
196
|
+
...existing.mcpServers,
|
|
197
|
+
...snowFlow.servers // Snow-Flow uses 'servers' key, Claude Desktop uses 'mcpServers'
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
return merged;
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=claude-desktop-exporter.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "Conversational ServiceNow development platform using Claude Code. Multi-agent orchestration with 20+ MCP servers providing 245+ ServiceNow tools including complete UX + Agent Workspace creation with official APIs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|