snow-flow 4.5.53 → 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 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
  /**
@@ -140,10 +140,10 @@ class ServiceNowFlowWorkspaceMobileMCP {
140
140
  }
141
141
  },
142
142
  // 🏗️ COMPLETE UX WORKSPACE CREATION (6-Step Workflow)
143
- // STEP 1: Experience Record (sys_ux_experience)
143
+ // STEP 1: Experience Record (sys_ux_experience) - REQUIRES NOW EXPERIENCE FRAMEWORK
144
144
  {
145
145
  name: 'snow_create_ux_experience',
146
- description: 'STEP 1: Create UX Experience Record (sys_ux_experience) - The top-level container for the workspace. This is the first step in the 6-step workspace creation process.',
146
+ description: 'STEP 1: Create UX Experience Record (sys_ux_experience) - The top-level container for the workspace. ⚠️ REQUIRES: Now Experience Framework (UXF) enabled. ALTERNATIVE: Use traditional form/list configurations if UXF unavailable.',
147
147
  inputSchema: {
148
148
  type: 'object',
149
149
  properties: {
@@ -357,10 +357,10 @@ class ServiceNowFlowWorkspaceMobileMCP {
357
357
  // UI BUILDER TOOLS - COMPLETE NOW EXPERIENCE FRAMEWORK INTEGRATION
358
358
  // Official ServiceNow sys_ux_* APIs for conversational UI Builder development
359
359
  // ==========================================
360
- // UI Builder Page Management (sys_ux_page)
360
+ // UI Builder Page Management (sys_ux_page) - REQUIRES UI BUILDER PLUGIN
361
361
  {
362
362
  name: 'snow_create_uib_page',
363
- description: 'Creates a new UI Builder page in the Now Experience Framework using official ServiceNow sys_ux_page API. Enables conversational page creation with full UXF integration.',
363
+ description: 'Creates a new UI Builder page in the Now Experience Framework using official ServiceNow sys_ux_page API. ⚠️ REQUIRES: UI Builder plugin + ui_builder_admin role. ALTERNATIVE: Use Service Portal pages if plugin unavailable.',
364
364
  inputSchema: {
365
365
  type: 'object',
366
366
  properties: {
@@ -815,33 +815,33 @@ class ServiceNowFlowWorkspaceMobileMCP {
815
815
  case 'snow_import_flow_from_xml':
816
816
  result = await this.importFlowFromXml(args);
817
817
  break;
818
- // 🏗️ UX WORKSPACE CREATION (6-Step Workflow)
818
+ // 🏗️ UX WORKSPACE CREATION (SAFE EXECUTION)
819
819
  case 'snow_create_ux_experience':
820
- result = await this.snow_create_ux_experience(args);
820
+ result = await this.safeToolExecution('snow_create_ux_experience', () => this.snow_create_ux_experience(args), 'now_experience_framework');
821
821
  break;
822
822
  case 'snow_create_ux_app_config':
823
- result = await this.snow_create_ux_app_config(args);
823
+ result = await this.safeToolExecution('snow_create_ux_app_config', () => this.snow_create_ux_app_config(args), 'now_experience_framework');
824
824
  break;
825
825
  case 'snow_create_ux_page_macroponent':
826
- result = await this.snow_create_ux_page_macroponent(args);
826
+ result = await this.safeToolExecution('snow_create_ux_page_macroponent', () => this.snow_create_ux_page_macroponent(args), 'now_experience_framework');
827
827
  break;
828
828
  case 'snow_create_ux_page_registry':
829
- result = await this.snow_create_ux_page_registry(args);
829
+ result = await this.safeToolExecution('snow_create_ux_page_registry', () => this.snow_create_ux_page_registry(args), 'now_experience_framework');
830
830
  break;
831
831
  case 'snow_create_ux_app_route':
832
- result = await this.snow_create_ux_app_route(args);
832
+ result = await this.safeToolExecution('snow_create_ux_app_route', () => this.snow_create_ux_app_route(args), 'now_experience_framework');
833
833
  break;
834
834
  case 'snow_update_ux_app_config_landing_page':
835
- result = await this.snow_update_ux_app_config_landing_page(args);
835
+ result = await this.safeToolExecution('snow_update_ux_app_config_landing_page', () => this.snow_update_ux_app_config_landing_page(args), 'now_experience_framework');
836
836
  break;
837
837
  case 'snow_create_complete_workspace':
838
- result = await this.snow_create_complete_workspace(args);
838
+ result = await this.safeToolExecution('snow_create_complete_workspace', () => this.snow_create_complete_workspace(args), 'now_experience_framework');
839
839
  break;
840
840
  case 'snow_create_configurable_agent_workspace':
841
- result = await this.snow_create_configurable_agent_workspace(args);
841
+ result = await this.safeToolExecution('snow_create_configurable_agent_workspace', () => this.snow_create_configurable_agent_workspace(args), 'agent_workspace');
842
842
  break;
843
843
  case 'snow_discover_all_workspaces':
844
- result = await this.discoverAllWorkspaces(args);
844
+ result = await this.safeToolExecution('snow_discover_all_workspaces', () => this.discoverAllWorkspaces(args), 'now_experience_framework');
845
845
  break;
846
846
  case 'snow_validate_workspace_configuration':
847
847
  result = await this.validateWorkspaceConfiguration(args);
@@ -859,31 +859,31 @@ class ServiceNowFlowWorkspaceMobileMCP {
859
859
  case 'snow_configure_offline_sync':
860
860
  result = await this.configureOfflineSync(args);
861
861
  break;
862
- // UI Builder Page Management
862
+ // UI Builder Page Management (SAFE EXECUTION)
863
863
  case 'snow_create_uib_page':
864
- result = await this.createUIBPage(args);
864
+ result = await this.safeToolExecution('snow_create_uib_page', () => this.createUIBPage(args), 'ui_builder');
865
865
  break;
866
866
  case 'snow_update_uib_page':
867
- result = await this.updateUIBPage(args);
867
+ result = await this.safeToolExecution('snow_update_uib_page', () => this.updateUIBPage(args), 'ui_builder');
868
868
  break;
869
869
  case 'snow_delete_uib_page':
870
- result = await this.deleteUIBPage(args);
870
+ result = await this.safeToolExecution('snow_delete_uib_page', () => this.deleteUIBPage(args), 'ui_builder');
871
871
  break;
872
872
  case 'snow_discover_uib_pages':
873
- result = await this.discoverUIBPages(args);
873
+ result = await this.safeToolExecution('snow_discover_uib_pages', () => this.discoverUIBPages(args), 'ui_builder');
874
874
  break;
875
- // UI Builder Component Management
875
+ // UI Builder Component Management (SAFE EXECUTION)
876
876
  case 'snow_create_uib_component':
877
- result = await this.createUIBComponent(args);
877
+ result = await this.safeToolExecution('snow_create_uib_component', () => this.createUIBComponent(args), 'ui_builder');
878
878
  break;
879
879
  case 'snow_update_uib_component':
880
- result = await this.updateUIBComponent(args);
880
+ result = await this.safeToolExecution('snow_update_uib_component', () => this.updateUIBComponent(args), 'ui_builder');
881
881
  break;
882
882
  case 'snow_discover_uib_components':
883
- result = await this.discoverUIBComponents(args);
883
+ result = await this.safeToolExecution('snow_discover_uib_components', () => this.discoverUIBComponents(args), 'ui_builder');
884
884
  break;
885
885
  case 'snow_clone_uib_component':
886
- result = await this.cloneUIBComponent(args);
886
+ result = await this.safeToolExecution('snow_clone_uib_component', () => this.cloneUIBComponent(args), 'ui_builder');
887
887
  break;
888
888
  // UI Builder Data Broker Management
889
889
  case 'snow_create_uib_data_broker':
@@ -1809,10 +1809,12 @@ ${configList}${layoutsText}${offlineText}
1809
1809
  }
1810
1810
  }
1811
1811
  /**
1812
- * Discover UI Builder Pages
1812
+ * Discover UI Builder Pages - ENHANCED with mandatory feedback
1813
1813
  */
1814
1814
  async discoverUIBPages(args) {
1815
1815
  try {
1816
+ // MANDATORY: Always log start of operation
1817
+ this.logger.info(`🔍 Starting UI Builder pages discovery...`);
1816
1818
  this.logger.info('🔍 Discovering UI Builder pages...');
1817
1819
  const conditions = [];
1818
1820
  if (args.active_only)
@@ -1853,7 +1855,19 @@ ${configList}${layoutsText}${offlineText}
1853
1855
  }
1854
1856
  catch (error) {
1855
1857
  this.logger.error('Failed to discover UI Builder pages:', error);
1856
- throw error;
1858
+ // NEVER throw - always return error object for MCP
1859
+ return {
1860
+ success: false,
1861
+ error: `UI Builder pages discovery failed: ${error}`,
1862
+ suggestion: 'UI Builder plugin not installed or insufficient permissions (need ui_builder_admin role)',
1863
+ plugin_required: 'UI Builder',
1864
+ table_attempted: 'sys_ux_page',
1865
+ operation_type: 'DISCOVERY',
1866
+ debug_info: {
1867
+ error_type: error instanceof Error ? error.constructor.name : 'Unknown',
1868
+ error_message: String(error)
1869
+ }
1870
+ };
1857
1871
  }
1858
1872
  }
1859
1873
  /**
@@ -1869,9 +1883,27 @@ ${configList}${layoutsText}${offlineText}
1869
1883
  version: args.version || '1.0.0',
1870
1884
  active: true
1871
1885
  };
1886
+ // PRE-CHECK: Verify UI Builder is available
1887
+ const uiBuilderCheck = await this.client.searchRecords('sys_ux_lib_source_script', '', 1);
1888
+ if (!uiBuilderCheck.success) {
1889
+ return {
1890
+ success: false,
1891
+ error: 'UI Builder plugin not available - sys_ux_lib_source_script table not accessible',
1892
+ suggestion: 'Install UI Builder plugin from ServiceNow Store. Requires ui_builder_admin role.',
1893
+ plugin_required: 'UI Builder',
1894
+ table_tested: 'sys_ux_lib_source_script',
1895
+ alternative: 'Use Service Portal widgets instead of UI Builder components'
1896
+ };
1897
+ }
1872
1898
  const sourceResponse = await this.client.createRecord('sys_ux_lib_source_script', sourceData);
1873
1899
  if (!sourceResponse.success) {
1874
- throw new Error(`Failed to create component source: ${sourceResponse.error}`);
1900
+ return {
1901
+ success: false,
1902
+ error: `Failed to create component source: ${sourceResponse.error}`,
1903
+ suggestion: 'Check UI Builder permissions and source script syntax',
1904
+ operation_attempted: 'CREATE sys_ux_lib_source_script',
1905
+ source_data_attempted: sourceData
1906
+ };
1875
1907
  }
1876
1908
  // Then create the component definition
1877
1909
  const componentData = {
@@ -1891,8 +1923,18 @@ ${configList}${layoutsText}${offlineText}
1891
1923
  const componentResponse = await this.client.createRecord('sys_ux_lib_component', componentData);
1892
1924
  if (!componentResponse.success) {
1893
1925
  // Cleanup source script on failure
1894
- await this.client.deleteRecord('sys_ux_lib_source_script', sourceResponse.data.sys_id);
1895
- throw new Error(`Failed to create component: ${componentResponse.error}`);
1926
+ const sourceId = sourceResponse.data?.sys_id || sourceResponse.data?.result?.sys_id;
1927
+ if (sourceId) {
1928
+ await this.client.deleteRecord('sys_ux_lib_source_script', sourceId);
1929
+ }
1930
+ return {
1931
+ success: false,
1932
+ error: `Failed to create UI Builder component: ${componentResponse.error}`,
1933
+ suggestion: 'Check UI Builder permissions, component definition syntax, and plugin availability',
1934
+ operation_attempted: 'CREATE sys_ux_lib_component',
1935
+ component_data_attempted: componentData,
1936
+ cleanup_performed: !!sourceId
1937
+ };
1896
1938
  }
1897
1939
  this.logger.info('✅ UI Builder component created successfully');
1898
1940
  return {
@@ -1957,10 +1999,12 @@ ${configList}${layoutsText}${offlineText}
1957
1999
  }
1958
2000
  }
1959
2001
  /**
1960
- * Discover UI Builder Components
2002
+ * Discover UI Builder Components - ENHANCED with mandatory feedback
1961
2003
  */
1962
2004
  async discoverUIBComponents(args) {
1963
2005
  try {
2006
+ // MANDATORY: Always log start of operation
2007
+ this.logger.info(`🔍 Starting UI Builder components discovery...`);
1964
2008
  this.logger.info('🔍 Discovering UI Builder components...');
1965
2009
  const conditions = [];
1966
2010
  if (args.category)
@@ -2004,7 +2048,19 @@ ${configList}${layoutsText}${offlineText}
2004
2048
  }
2005
2049
  catch (error) {
2006
2050
  this.logger.error('Failed to discover UI Builder components:', error);
2007
- throw error;
2051
+ // NEVER throw - always return error object for MCP
2052
+ return {
2053
+ success: false,
2054
+ error: `UI Builder components discovery failed: ${error}`,
2055
+ suggestion: 'UI Builder plugin not installed or insufficient permissions (need ui_builder_admin role)',
2056
+ plugin_required: 'UI Builder',
2057
+ table_attempted: 'sys_ux_lib_component',
2058
+ operation_type: 'DISCOVERY',
2059
+ debug_info: {
2060
+ error_type: error instanceof Error ? error.constructor.name : 'Unknown',
2061
+ error_message: String(error)
2062
+ }
2063
+ };
2008
2064
  }
2009
2065
  }
2010
2066
  /**
@@ -3425,6 +3481,113 @@ ${configList}${layoutsText}${offlineText}
3425
3481
  /**
3426
3482
  * Validate workspace configuration (fix from user feedback)
3427
3483
  */
3484
+ /**
3485
+ * COMPREHENSIVE PLUGIN DETECTION SYSTEM
3486
+ * Checks all required plugins before tool execution
3487
+ */
3488
+ async checkPluginAvailabilityForTool(toolType) {
3489
+ try {
3490
+ switch (toolType) {
3491
+ case 'ui_builder':
3492
+ const uiBuilderCheck = await this.client.searchRecords('sys_ux_page', '', 1);
3493
+ if (!uiBuilderCheck.success) {
3494
+ return {
3495
+ available: false,
3496
+ error: 'UI Builder plugin not installed or not accessible',
3497
+ suggestion: 'Install UI Builder plugin from ServiceNow Store. Requires ui_builder_admin + ui_builder_user roles.',
3498
+ alternative: 'Use Service Portal widgets for custom UI development instead'
3499
+ };
3500
+ }
3501
+ break;
3502
+ case 'now_experience_framework':
3503
+ const uxfCheck = await this.client.searchRecords('sys_ux_experience', '', 1);
3504
+ if (!uxfCheck.success) {
3505
+ return {
3506
+ available: false,
3507
+ error: 'Now Experience Framework (UXF) not available',
3508
+ suggestion: 'Enable Now Experience Framework in ServiceNow instance. May require additional licensing.',
3509
+ alternative: 'Use traditional ServiceNow interface development instead'
3510
+ };
3511
+ }
3512
+ break;
3513
+ case 'agent_workspace':
3514
+ const agentWorkspaceCheck = await this.client.searchRecords('sys_ux_screen_type', '', 1);
3515
+ if (!agentWorkspaceCheck.success) {
3516
+ return {
3517
+ available: false,
3518
+ error: 'Agent Workspace plugin not installed',
3519
+ suggestion: 'Install Agent Workspace plugin from ServiceNow Store. Requires workspace_admin role.',
3520
+ alternative: 'Use traditional forms and lists for agent interfaces'
3521
+ };
3522
+ }
3523
+ break;
3524
+ case 'mobile_publishing':
3525
+ const mobileCheck = await this.client.searchRecords('sys_push_notif_msg', '', 1);
3526
+ if (!mobileCheck.success) {
3527
+ return {
3528
+ available: false,
3529
+ error: 'Mobile Publishing plugin not available',
3530
+ suggestion: 'Install Mobile Publishing plugin from ServiceNow Store. Requires additional licensing and mobile_admin role.',
3531
+ alternative: 'Use responsive Service Portal pages for mobile interfaces'
3532
+ };
3533
+ }
3534
+ break;
3535
+ }
3536
+ return { available: true };
3537
+ }
3538
+ catch (error) {
3539
+ return {
3540
+ available: false,
3541
+ error: `Plugin check failed: ${error}`,
3542
+ suggestion: 'Check ServiceNow connectivity and basic table access permissions'
3543
+ };
3544
+ }
3545
+ }
3546
+ /**
3547
+ * SAFE TOOL EXECUTION WRAPPER
3548
+ * Ensures all tools return proper feedback instead of throwing
3549
+ */
3550
+ async safeToolExecution(toolName, operation, pluginType) {
3551
+ try {
3552
+ this.logger.info(`🛠️ Executing tool: ${toolName}`);
3553
+ // Step 1: Check plugin availability
3554
+ const pluginCheck = await this.checkPluginAvailabilityForTool(pluginType);
3555
+ if (!pluginCheck.available) {
3556
+ this.logger.warn(`⚠️ Plugin check failed for ${toolName}`);
3557
+ return {
3558
+ success: false,
3559
+ tool_name: toolName,
3560
+ plugin_type: pluginType,
3561
+ ...pluginCheck
3562
+ };
3563
+ }
3564
+ // Step 2: Execute operation
3565
+ const result = await operation();
3566
+ this.logger.info(`✅ Tool ${toolName} executed successfully`);
3567
+ return {
3568
+ ...result,
3569
+ tool_name: toolName,
3570
+ plugin_verified: true,
3571
+ execution_timestamp: new Date().toISOString()
3572
+ };
3573
+ }
3574
+ catch (error) {
3575
+ this.logger.error(`❌ Tool ${toolName} failed with exception:`, error);
3576
+ // NEVER throw - always return error object
3577
+ return {
3578
+ success: false,
3579
+ tool_name: toolName,
3580
+ error: `Tool execution failed: ${error}`,
3581
+ suggestion: 'Check ServiceNow connectivity, permissions, and plugin installation',
3582
+ execution_type: 'EXCEPTION_CAUGHT',
3583
+ debug_info: {
3584
+ error_type: error instanceof Error ? error.constructor.name : 'Unknown',
3585
+ error_message: String(error),
3586
+ stack_trace: error instanceof Error ? error.stack : undefined
3587
+ }
3588
+ };
3589
+ }
3590
+ }
3428
3591
  validateWorkspaceConfig(config) {
3429
3592
  const errors = [];
3430
3593
  // Check required fields
@@ -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
@@ -0,0 +1,3 @@
1
+ # Agent Memory
2
+
3
+ This directory contains persistent memory for ServiceNow agents.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "4.5.53",
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",
@@ -0,0 +1,3 @@
1
+ # ServiceNow Artifacts
2
+
3
+ This directory contains generated ServiceNow development artifacts.