snow-flow 3.4.28 ā 3.4.30
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/dist/cli.js +67 -74
- package/dist/mcp/advanced/servicenow-advanced-features-mcp.d.ts +4 -0
- package/dist/mcp/advanced/servicenow-advanced-features-mcp.js +11 -1
- package/dist/mcp/service-discovery-client.js +2 -2
- package/dist/mcp/servicenow-deployment-mcp.js +12 -3
- package/dist/mcp/servicenow-development-assistant-mcp.js +46 -2
- package/dist/mcp/servicenow-mcp-server.js +1 -1
- package/dist/mcp/servicenow-system-properties-mcp.d.ts +1 -1
- package/dist/mcp/servicenow-system-properties-mcp.js +4 -3
- package/dist/mcp/servicenow-update-set-mcp.js +4 -4
- package/dist/mcp/start-all-mcp-servers.js +1 -1
- package/dist/mcp/start-servicenow-mcp.js +18 -18
- package/fix-console-logs.sh +32 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -123,9 +123,60 @@ program
|
|
|
123
123
|
.option('--auto-confirm', 'Auto-confirm background script executions (bypasses human-in-the-loop)')
|
|
124
124
|
.option('--no-auto-confirm', 'Force confirmation for all background scripts (default behavior)')
|
|
125
125
|
.option('--verbose', 'Show detailed execution information')
|
|
126
|
+
.option('--debug', 'Enable debug mode (sets LOG_LEVEL=debug)')
|
|
127
|
+
.option('--trace', 'Enable trace mode (MAXIMUM debug output - sets LOG_LEVEL=trace)')
|
|
128
|
+
.option('--debug-mcp', 'Enable MCP server debug output')
|
|
129
|
+
.option('--debug-http', 'Enable HTTP request/response debugging')
|
|
130
|
+
.option('--debug-memory', 'Enable memory operation debugging')
|
|
131
|
+
.option('--debug-servicenow', 'Enable ServiceNow API debugging')
|
|
132
|
+
.option('--debug-all', 'Enable ALL debug output (WARNING: Very verbose!)')
|
|
126
133
|
.action(async (objective, options) => {
|
|
127
134
|
// Check for flow deprecation first
|
|
128
135
|
checkFlowDeprecation('swarm', objective);
|
|
136
|
+
// Set debug levels based on options
|
|
137
|
+
if (options.debugAll) {
|
|
138
|
+
process.env.DEBUG = '*';
|
|
139
|
+
process.env.LOG_LEVEL = 'trace';
|
|
140
|
+
process.env.SNOW_FLOW_DEBUG = 'true';
|
|
141
|
+
process.env.MCP_DEBUG = 'true';
|
|
142
|
+
process.env.MCP_LOG_LEVEL = 'trace';
|
|
143
|
+
process.env.HTTP_TRACE = 'true';
|
|
144
|
+
process.env.VERBOSE = 'true';
|
|
145
|
+
cliLogger.info('š DEBUG MODE: ALL (Maximum verbosity enabled!)');
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
if (options.trace) {
|
|
149
|
+
process.env.LOG_LEVEL = 'trace';
|
|
150
|
+
process.env.SNOW_FLOW_TRACE = 'true';
|
|
151
|
+
cliLogger.info('š TRACE MODE: Enabled (Maximum detail level)');
|
|
152
|
+
}
|
|
153
|
+
else if (options.debug) {
|
|
154
|
+
process.env.LOG_LEVEL = 'debug';
|
|
155
|
+
process.env.SNOW_FLOW_DEBUG = 'true';
|
|
156
|
+
cliLogger.info('š DEBUG MODE: Enabled');
|
|
157
|
+
}
|
|
158
|
+
if (options.debugMcp) {
|
|
159
|
+
process.env.MCP_DEBUG = 'true';
|
|
160
|
+
process.env.MCP_LOG_LEVEL = 'trace';
|
|
161
|
+
cliLogger.info('š MCP DEBUG: Enabled');
|
|
162
|
+
}
|
|
163
|
+
if (options.debugHttp) {
|
|
164
|
+
process.env.HTTP_TRACE = 'true';
|
|
165
|
+
cliLogger.info('š HTTP DEBUG: Enabled (Request/Response tracing)');
|
|
166
|
+
}
|
|
167
|
+
if (options.debugMemory) {
|
|
168
|
+
process.env.DEBUG = process.env.DEBUG ? `${process.env.DEBUG},memory:*` : 'memory:*';
|
|
169
|
+
cliLogger.info('š MEMORY DEBUG: Enabled');
|
|
170
|
+
}
|
|
171
|
+
if (options.debugServicenow) {
|
|
172
|
+
process.env.DEBUG = process.env.DEBUG ? `${process.env.DEBUG},servicenow:*` : 'servicenow:*';
|
|
173
|
+
cliLogger.info('š SERVICENOW DEBUG: Enabled');
|
|
174
|
+
}
|
|
175
|
+
if (options.verbose) {
|
|
176
|
+
process.env.VERBOSE = 'true';
|
|
177
|
+
cliLogger.info('š VERBOSE MODE: Enabled');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
129
180
|
// Always show essential info
|
|
130
181
|
cliLogger.info(`\nš Snow-Flow v${version_js_1.VERSION}`);
|
|
131
182
|
cliLogger.info(`š Objective: ${objective}`);
|
|
@@ -464,9 +515,25 @@ async function executeClaudeCode(prompt) {
|
|
|
464
515
|
const claudeArgs = hasMcpConfig
|
|
465
516
|
? ['--mcp-config', '.mcp.json', '--dangerously-skip-permissions']
|
|
466
517
|
: ['--dangerously-skip-permissions'];
|
|
518
|
+
// Add debug args if debug is enabled
|
|
519
|
+
if (process.env.SNOW_FLOW_DEBUG === 'true' || process.env.LOG_LEVEL === 'debug' || process.env.LOG_LEVEL === 'trace') {
|
|
520
|
+
claudeArgs.push('--verbose');
|
|
521
|
+
if (process.env.LOG_LEVEL === 'trace') {
|
|
522
|
+
claudeArgs.push('--trace');
|
|
523
|
+
}
|
|
524
|
+
}
|
|
467
525
|
cliLogger.info('š Launching Claude Code automatically...');
|
|
468
526
|
if (hasMcpConfig) {
|
|
469
527
|
cliLogger.info('š§ Starting Claude Code with ServiceNow MCP servers...');
|
|
528
|
+
if (process.env.MCP_DEBUG === 'true') {
|
|
529
|
+
cliLogger.info('š MCP Debug Mode Active - Expect detailed connection logs');
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
// Debug output if enabled
|
|
533
|
+
if (process.env.SNOW_FLOW_DEBUG === 'true' || process.env.VERBOSE === 'true') {
|
|
534
|
+
cliLogger.info(`š Claude Command: claude ${claudeArgs.join(' ')}`);
|
|
535
|
+
cliLogger.info(`š Working Directory: ${process.cwd()}`);
|
|
536
|
+
cliLogger.info(`š MCP Config: ${mcpConfigPath}`);
|
|
470
537
|
}
|
|
471
538
|
// Start Claude Code process in interactive mode with stdin piping
|
|
472
539
|
const claudeProcess = (0, child_process_1.spawn)('claude', claudeArgs, {
|
|
@@ -546,80 +613,6 @@ function startMonitoringDashboard(claudeProcess) {
|
|
|
546
613
|
}, 5000); // Check every 5 seconds silently
|
|
547
614
|
return monitoringInterval;
|
|
548
615
|
}
|
|
549
|
-
async function executeWithClaude(claudeCommand, prompt, resolve) {
|
|
550
|
-
cliLogger.info('š Starting Claude Code execution...');
|
|
551
|
-
// Write prompt to temporary file for large prompts
|
|
552
|
-
const tempFile = (0, path_1.join)(process.cwd(), '.snow-flow-prompt.tmp');
|
|
553
|
-
await fs_1.promises.writeFile(tempFile, prompt);
|
|
554
|
-
// Check if .mcp.json exists in current directory
|
|
555
|
-
const mcpConfigPath = (0, path_1.join)(process.cwd(), '.mcp.json');
|
|
556
|
-
let hasMcpConfig = false;
|
|
557
|
-
try {
|
|
558
|
-
await fs_1.promises.access(mcpConfigPath);
|
|
559
|
-
hasMcpConfig = true;
|
|
560
|
-
cliLogger.info('ā
Found MCP configuration in current directory');
|
|
561
|
-
}
|
|
562
|
-
catch {
|
|
563
|
-
cliLogger.warn('ā ļø No MCP configuration found. Run "snow-flow init" to set up MCP servers');
|
|
564
|
-
}
|
|
565
|
-
const claudeArgs = hasMcpConfig
|
|
566
|
-
? ['--mcp-config', '.mcp.json', '--dangerously-skip-permissions']
|
|
567
|
-
: ['--dangerously-skip-permissions'];
|
|
568
|
-
if (hasMcpConfig) {
|
|
569
|
-
cliLogger.info('š§ Starting Claude Code with ServiceNow MCP servers...');
|
|
570
|
-
}
|
|
571
|
-
// Start Claude Code process in interactive mode
|
|
572
|
-
const claudeProcess = (0, child_process_1.spawn)(claudeCommand, claudeArgs, {
|
|
573
|
-
stdio: ['pipe', 'inherit', 'inherit'], // inherit stdout/stderr for interactive mode
|
|
574
|
-
cwd: process.cwd()
|
|
575
|
-
});
|
|
576
|
-
// Send the prompt via stdin
|
|
577
|
-
cliLogger.info('š Sending orchestration prompt to Claude Code...');
|
|
578
|
-
cliLogger.info('š Claude Code interactive interface opening...\n');
|
|
579
|
-
claudeProcess.stdin.write(prompt);
|
|
580
|
-
claudeProcess.stdin.end();
|
|
581
|
-
// Start silent monitoring dashboard (doesn't interfere with Claude Code UI)
|
|
582
|
-
const monitoringInterval = startMonitoringDashboard(claudeProcess);
|
|
583
|
-
claudeProcess.on('close', (code) => {
|
|
584
|
-
clearInterval(monitoringInterval);
|
|
585
|
-
if (code === 0) {
|
|
586
|
-
cliLogger.info('\nā
Claude Code session completed successfully!');
|
|
587
|
-
resolve(true);
|
|
588
|
-
}
|
|
589
|
-
else {
|
|
590
|
-
cliLogger.warn(`\nā Claude Code session ended with code: ${code}`);
|
|
591
|
-
resolve(false);
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
claudeProcess.on('error', (error) => {
|
|
595
|
-
clearInterval(monitoringInterval);
|
|
596
|
-
cliLogger.error(`ā Failed to start Claude Code: ${error.message}`);
|
|
597
|
-
resolve(false);
|
|
598
|
-
});
|
|
599
|
-
// Set timeout for Claude Code execution (configurable via environment variable)
|
|
600
|
-
const timeoutMinutes = process.env.SNOW_FLOW_TIMEOUT_MINUTES ? parseInt(process.env.SNOW_FLOW_TIMEOUT_MINUTES) : 60;
|
|
601
|
-
const timeoutMs = timeoutMinutes * 60 * 1000;
|
|
602
|
-
cliLogger.info(`ā±ļø Claude Code timeout set to ${timeoutMinutes} minutes (configure with SNOW_FLOW_TIMEOUT_MINUTES=0 for no timeout)`);
|
|
603
|
-
let timeout = null;
|
|
604
|
-
// Only set timeout if not disabled (0 = no timeout)
|
|
605
|
-
if (timeoutMinutes > 0) {
|
|
606
|
-
timeout = setTimeout(() => {
|
|
607
|
-
clearInterval(monitoringInterval);
|
|
608
|
-
cliLogger.warn(`ā±ļø Claude Code session timeout (${timeoutMinutes} minutes), terminating...`);
|
|
609
|
-
claudeProcess.kill('SIGTERM');
|
|
610
|
-
// Force kill if it doesn't respond
|
|
611
|
-
setTimeout(() => {
|
|
612
|
-
claudeProcess.kill('SIGKILL');
|
|
613
|
-
}, 2000);
|
|
614
|
-
resolve(false);
|
|
615
|
-
}, timeoutMs);
|
|
616
|
-
}
|
|
617
|
-
claudeProcess.on('close', () => {
|
|
618
|
-
if (timeout) {
|
|
619
|
-
clearTimeout(timeout);
|
|
620
|
-
}
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
616
|
// Helper function to build Queen Agent orchestration prompt
|
|
624
617
|
// Helper function to build Queen Agent orchestration prompt - CLEANED UP VERSION
|
|
625
618
|
function buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated = false, sessionId, isFlowDesignerTask = false) {
|
|
@@ -920,6 +920,10 @@ export declare class ServiceNowAdvancedFeaturesMCP extends BaseMCPServer {
|
|
|
920
920
|
private generateMonitoringHtmlReport;
|
|
921
921
|
private generateMetricsExport;
|
|
922
922
|
private generateAlertSummary;
|
|
923
|
+
/**
|
|
924
|
+
* Run the MCP server
|
|
925
|
+
*/
|
|
926
|
+
run(): Promise<void>;
|
|
923
927
|
}
|
|
924
928
|
export default ServiceNowAdvancedFeaturesMCP;
|
|
925
929
|
//# sourceMappingURL=servicenow-advanced-features-mcp.d.ts.map
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.ServiceNowAdvancedFeaturesMCP = void 0;
|
|
11
11
|
const base_mcp_server_js_1 = require("../base-mcp-server.js");
|
|
12
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
12
13
|
const snow_memory_manager_js_1 = require("../../utils/snow-memory-manager.js");
|
|
13
14
|
class ServiceNowAdvancedFeaturesMCP extends base_mcp_server_js_1.BaseMCPServer {
|
|
14
15
|
constructor() {
|
|
@@ -14148,12 +14149,21 @@ function getIncidentsByUser(userSysId) {
|
|
|
14148
14149
|
size: JSON.stringify(alertSummary).length
|
|
14149
14150
|
};
|
|
14150
14151
|
}
|
|
14152
|
+
/**
|
|
14153
|
+
* Run the MCP server
|
|
14154
|
+
*/
|
|
14155
|
+
async run() {
|
|
14156
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
14157
|
+
await this.server.connect(transport);
|
|
14158
|
+
// Use stderr for logs to keep stdout clean for JSON-RPC
|
|
14159
|
+
console.error('ServiceNow Advanced Features MCP server running on stdio');
|
|
14160
|
+
}
|
|
14151
14161
|
}
|
|
14152
14162
|
exports.ServiceNowAdvancedFeaturesMCP = ServiceNowAdvancedFeaturesMCP;
|
|
14153
14163
|
// CLI entry point
|
|
14154
14164
|
if (require.main === module) {
|
|
14155
14165
|
const server = new ServiceNowAdvancedFeaturesMCP();
|
|
14156
|
-
server.
|
|
14166
|
+
server.run().catch(console.error);
|
|
14157
14167
|
}
|
|
14158
14168
|
exports.default = ServiceNowAdvancedFeaturesMCP;
|
|
14159
14169
|
//# sourceMappingURL=servicenow-advanced-features-mcp.js.map
|
|
@@ -210,13 +210,13 @@ class ServiceDiscoveryClient {
|
|
|
210
210
|
* COMPATIBILITY FIX: makeRequest method for phantom calls
|
|
211
211
|
*/
|
|
212
212
|
async makeRequest(config) {
|
|
213
|
-
console.
|
|
213
|
+
console.error('š§ ServiceDiscoveryClient.makeRequest called with config:', config);
|
|
214
214
|
try {
|
|
215
215
|
// Route the request to the appropriate HTTP method
|
|
216
216
|
const method = (config.method || 'GET').toLowerCase();
|
|
217
217
|
const url = config.url || config.endpoint;
|
|
218
218
|
const data = config.data || config.body;
|
|
219
|
-
console.
|
|
219
|
+
console.error(`š§ ServiceDiscovery routing ${method.toUpperCase()} request to: ${url}`);
|
|
220
220
|
switch (method) {
|
|
221
221
|
case 'get':
|
|
222
222
|
return await this.client.get(url, { params: config.params });
|
|
@@ -548,7 +548,7 @@ class ServiceNowDeploymentMCP {
|
|
|
548
548
|
// Create the sys_update_xml record to track the artifact
|
|
549
549
|
const trackingResult = await this.client.createRecord('sys_update_xml', updateXmlData);
|
|
550
550
|
if (trackingResult.success) {
|
|
551
|
-
console.
|
|
551
|
+
console.error(`ā
Artifact tracked in Update Set: ${artifact.name} (${artifact.sys_id})`);
|
|
552
552
|
}
|
|
553
553
|
else {
|
|
554
554
|
console.warn(`ā ļø Failed to track artifact in Update Set: ${trackingResult.error}`);
|
|
@@ -8593,7 +8593,7 @@ Use \`snow_deploy\` to create a new ${args.type} instead.`
|
|
|
8593
8593
|
- "Change the title to 'New Widget Title'"
|
|
8594
8594
|
- "Update the description to 'Updated description'"
|
|
8595
8595
|
- "Add this CSS: .my-class { color: blue; }"
|
|
8596
|
-
- "Change the script to: function() { console.
|
|
8596
|
+
- "Change the script to: function() { console.error('updated'); }"
|
|
8597
8597
|
- "Set active to false"
|
|
8598
8598
|
|
|
8599
8599
|
š” **Or use the config parameter directly:**
|
|
@@ -9077,10 +9077,19 @@ c.$onInit = function() {
|
|
|
9077
9077
|
.replace(/"/g, '"')
|
|
9078
9078
|
.replace(/'/g, ''');
|
|
9079
9079
|
}
|
|
9080
|
+
/**
|
|
9081
|
+
* Run the MCP server
|
|
9082
|
+
*/
|
|
9083
|
+
async run() {
|
|
9084
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
9085
|
+
await this.server.connect(transport);
|
|
9086
|
+
// Use stderr for logs to keep stdout clean for JSON-RPC
|
|
9087
|
+
console.error('ServiceNow Deployment MCP server running on stdio');
|
|
9088
|
+
}
|
|
9080
9089
|
}
|
|
9081
9090
|
// Start the server
|
|
9082
9091
|
const server = new ServiceNowDeploymentMCP();
|
|
9083
|
-
server.
|
|
9092
|
+
server.run().catch((error) => {
|
|
9084
9093
|
console.error('Failed to start ServiceNow Deployment MCP:', error);
|
|
9085
9094
|
process.exit(1);
|
|
9086
9095
|
});
|
|
@@ -89,7 +89,7 @@ class ServiceNowDevelopmentAssistantMCP {
|
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
name: 'snow_get_by_sysid',
|
|
92
|
-
description: 'Retrieves artifacts by sys_id for precise, fast lookups. More reliable than text-based searches when sys_id is known.',
|
|
92
|
+
description: 'Retrieves artifacts by sys_id for precise, fast lookups. Auto-detects large responses and suggests efficient field-specific queries using snow_query_table when needed. More reliable than text-based searches when sys_id is known.',
|
|
93
93
|
inputSchema: {
|
|
94
94
|
type: 'object',
|
|
95
95
|
properties: {
|
|
@@ -2128,6 +2128,50 @@ class ServiceNowDevelopmentAssistantMCP {
|
|
|
2128
2128
|
table: args.table,
|
|
2129
2129
|
...artifact
|
|
2130
2130
|
};
|
|
2131
|
+
// Estimate token count (rough estimate: 1 token ā 4 characters)
|
|
2132
|
+
const jsonString = JSON.stringify(formattedArtifact, null, 2);
|
|
2133
|
+
const estimatedTokens = Math.ceil(jsonString.length / 4);
|
|
2134
|
+
const maxTokens = 25000; // MCP response limit
|
|
2135
|
+
let responseText;
|
|
2136
|
+
if (estimatedTokens > maxTokens) {
|
|
2137
|
+
// Response too large - return essential fields only and suggest specific field access
|
|
2138
|
+
const essentialFields = {
|
|
2139
|
+
sys_id: artifact.sys_id,
|
|
2140
|
+
name: artifact.name || artifact.title || 'Unknown',
|
|
2141
|
+
table: args.table,
|
|
2142
|
+
sys_updated_on: artifact.sys_updated_on,
|
|
2143
|
+
sys_created_on: artifact.sys_created_on,
|
|
2144
|
+
sys_updated_by: artifact.sys_updated_by,
|
|
2145
|
+
active: artifact.active,
|
|
2146
|
+
// Table-specific key fields
|
|
2147
|
+
...(args.table === 'sp_widget' && {
|
|
2148
|
+
id: artifact.id,
|
|
2149
|
+
title: artifact.title,
|
|
2150
|
+
template: artifact.template ? `${artifact.template.substring(0, 200)}...` : null,
|
|
2151
|
+
script: artifact.script ? `${artifact.script.substring(0, 200)}...` : null,
|
|
2152
|
+
client_script: artifact.client_script ? `${artifact.client_script.substring(0, 200)}...` : null,
|
|
2153
|
+
css: artifact.css ? `${artifact.css.substring(0, 200)}...` : null
|
|
2154
|
+
}),
|
|
2155
|
+
...(args.table === 'wf_workflow' && {
|
|
2156
|
+
title: artifact.title,
|
|
2157
|
+
workflow_version: artifact.workflow_version,
|
|
2158
|
+
stage: artifact.stage
|
|
2159
|
+
}),
|
|
2160
|
+
...(args.table === 'sys_script_include' && {
|
|
2161
|
+
api_name: artifact.api_name,
|
|
2162
|
+
client_callable: artifact.client_callable,
|
|
2163
|
+
script: artifact.script ? `${artifact.script.substring(0, 200)}...` : null
|
|
2164
|
+
})
|
|
2165
|
+
};
|
|
2166
|
+
const availableFields = Object.keys(artifact).filter(key => !essentialFields.hasOwnProperty(key));
|
|
2167
|
+
responseText = `ā
Found artifact by sys_id!\n\nšÆ **${formattedArtifact.name}**\nš sys_id: ${args.sys_id}\nš Table: ${args.table}\n\nā ļø **Response size limited (${estimatedTokens} tokens > ${maxTokens} limit)**\n\n**Essential Fields:**\n${JSON.stringify(essentialFields, null, 2)}\n\nšÆ **RECOMMENDATION: Get specific fields instead**\n\nUse snow_query_table with specific fields for better performance:\n\`\`\`\nsnow_query_table({\n table: "${args.table}",\n query: "sys_id=${args.sys_id}",\n fields: ["field1", "field2", "field3"], // Only fields you need\n limit: 1\n})\n\`\`\`\n\n**Available fields to choose from:**\n${availableFields.slice(0, 20).join(', ')}${availableFields.length > 20 ? `, and ${availableFields.length - 20} more...` : ''}\n\nš” **Example for ${args.table}:**\n${args.table === 'sp_widget' ? `snow_query_table({ table: "sp_widget", query: "sys_id=${args.sys_id}", fields: ["name", "title", "template", "client_script", "script"], limit: 1 })` :
|
|
2168
|
+
args.table === 'wf_workflow' ? `snow_query_table({ table: "wf_workflow", query: "sys_id=${args.sys_id}", fields: ["name", "title", "workflow_version", "stage"], limit: 1 })` :
|
|
2169
|
+
`snow_query_table({ table: "${args.table}", query: "sys_id=${args.sys_id}", fields: ["name", "sys_updated_on"], limit: 1 })`}`;
|
|
2170
|
+
}
|
|
2171
|
+
else {
|
|
2172
|
+
// Response size is acceptable
|
|
2173
|
+
responseText = `ā
Found artifact by sys_id!\n\nšÆ **${formattedArtifact.name}**\nš sys_id: ${args.sys_id}\nš Table: ${args.table}\n\n**All Fields:**\n${jsonString}`;
|
|
2174
|
+
}
|
|
2131
2175
|
// Skip memory indexing for now - it might be causing timeouts
|
|
2132
2176
|
// TODO: Investigate why memory indexing causes timeouts
|
|
2133
2177
|
/*
|
|
@@ -2143,7 +2187,7 @@ class ServiceNowDevelopmentAssistantMCP {
|
|
|
2143
2187
|
content: [
|
|
2144
2188
|
{
|
|
2145
2189
|
type: 'text',
|
|
2146
|
-
text:
|
|
2190
|
+
text: responseText,
|
|
2147
2191
|
},
|
|
2148
2192
|
],
|
|
2149
2193
|
};
|
|
@@ -626,7 +626,7 @@ class ServiceNowMCPServer {
|
|
|
626
626
|
// Keep the server running
|
|
627
627
|
await new Promise((resolve) => {
|
|
628
628
|
process.on('SIGINT', () => {
|
|
629
|
-
console.
|
|
629
|
+
console.error('\nServiceNow MCP Server shutting down...');
|
|
630
630
|
resolve();
|
|
631
631
|
});
|
|
632
632
|
});
|
|
@@ -1156,16 +1156,17 @@ Note: Audit history requires sys_audit to be enabled for sys_properties table.`
|
|
|
1156
1156
|
};
|
|
1157
1157
|
}
|
|
1158
1158
|
}
|
|
1159
|
-
async
|
|
1159
|
+
async run() {
|
|
1160
1160
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
1161
1161
|
await this.server.connect(transport);
|
|
1162
|
-
|
|
1162
|
+
// Use stderr for logs to keep stdout clean for JSON-RPC
|
|
1163
|
+
console.error('ServiceNow System Properties MCP Server running on stdio');
|
|
1163
1164
|
}
|
|
1164
1165
|
}
|
|
1165
1166
|
exports.ServiceNowSystemPropertiesMCP = ServiceNowSystemPropertiesMCP;
|
|
1166
1167
|
// Start the server
|
|
1167
1168
|
const server = new ServiceNowSystemPropertiesMCP();
|
|
1168
|
-
server.
|
|
1169
|
+
server.run().catch((error) => {
|
|
1169
1170
|
console.error('Failed to start ServiceNow System Properties MCP:', error);
|
|
1170
1171
|
process.exit(1);
|
|
1171
1172
|
});
|
|
@@ -37,16 +37,16 @@ class ServiceNowUpdateSetMCP {
|
|
|
37
37
|
* Test credentials on startup
|
|
38
38
|
*/
|
|
39
39
|
async testCredentials() {
|
|
40
|
-
console.
|
|
40
|
+
console.error('š [UPDATE-SET MCP] Testing credentials...');
|
|
41
41
|
try {
|
|
42
42
|
const credentials = await this.oauth.loadCredentials();
|
|
43
43
|
if (credentials) {
|
|
44
|
-
console.
|
|
44
|
+
console.error('ā
[UPDATE-SET MCP] Credentials loaded successfully');
|
|
45
45
|
const isAuth = await this.oauth.isAuthenticated();
|
|
46
|
-
console.
|
|
46
|
+
console.error(`š [UPDATE-SET MCP] Authentication status: ${isAuth ? 'ā
Valid' : 'ā Expired'}`);
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
|
-
console.
|
|
49
|
+
console.error('ā [UPDATE-SET MCP] No credentials found');
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
catch (error) {
|
|
@@ -48,7 +48,7 @@ async function startAllServers() {
|
|
|
48
48
|
logger.warn('ā ļø DEPRECATED: This start-all-mcp-servers.ts script is deprecated!');
|
|
49
49
|
logger.warn(' Please use MCPServerManager or scripts/start-mcp-proper.js instead');
|
|
50
50
|
logger.warn(' This provides proper process management and singleton protection');
|
|
51
|
-
console.
|
|
51
|
+
console.error('\nš Redirecting to proper MCPServerManager...\n');
|
|
52
52
|
try {
|
|
53
53
|
// Redirect to proper approach
|
|
54
54
|
const { MCPServerManager } = await Promise.resolve().then(() => __importStar(require('../utils/mcp-server-manager.js')));
|
|
@@ -14,19 +14,19 @@ const dotenv_1 = __importDefault(require("dotenv"));
|
|
|
14
14
|
// Load environment variables
|
|
15
15
|
dotenv_1.default.config();
|
|
16
16
|
async function startServiceNowMCPServer() {
|
|
17
|
-
console.
|
|
17
|
+
console.error('š Starting ServiceNow MCP Server...');
|
|
18
18
|
// Check if OAuth is configured
|
|
19
19
|
const oauth = new snow_oauth_js_1.ServiceNowOAuth();
|
|
20
20
|
const isAuthenticated = await oauth.isAuthenticated();
|
|
21
21
|
if (isAuthenticated) {
|
|
22
|
-
console.
|
|
22
|
+
console.error('ā
ServiceNow OAuth authentication detected');
|
|
23
23
|
const credentials = await oauth.loadCredentials();
|
|
24
|
-
console.
|
|
24
|
+
console.error(`š¢ Instance: ${credentials?.instance}`);
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
console.
|
|
28
|
-
console.
|
|
29
|
-
console.
|
|
27
|
+
console.error('ā ļø ServiceNow OAuth not configured');
|
|
28
|
+
console.error('š” Some tools will be unavailable until authentication is complete');
|
|
29
|
+
console.error('š Run "snow-flow auth login" to authenticate');
|
|
30
30
|
}
|
|
31
31
|
const config = {
|
|
32
32
|
name: "servicenow-mcp-server",
|
|
@@ -37,19 +37,19 @@ async function startServiceNowMCPServer() {
|
|
|
37
37
|
clientSecret: process.env.SNOW_CLIENT_SECRET || ''
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
console.
|
|
41
|
-
console.
|
|
42
|
-
console.
|
|
43
|
-
console.
|
|
44
|
-
console.
|
|
45
|
-
console.
|
|
46
|
-
console.
|
|
40
|
+
console.error('š§ MCP Server Configuration:');
|
|
41
|
+
console.error(` š Name: ${config.name}`);
|
|
42
|
+
console.error(` š·ļø Version: ${config.version}`);
|
|
43
|
+
console.error(` š¢ Instance: ${config.oauth.instance || 'Not configured'}`);
|
|
44
|
+
console.error(` š Client ID: ${config.oauth.clientId ? 'ā
Set' : 'ā Not set'}`);
|
|
45
|
+
console.error(` š Client Secret: ${config.oauth.clientSecret ? 'ā
Set' : 'ā Not set'}`);
|
|
46
|
+
console.error('');
|
|
47
47
|
const server = new servicenow_mcp_server_js_1.ServiceNowMCPServer(config);
|
|
48
|
-
console.
|
|
49
|
-
console.
|
|
50
|
-
console.
|
|
51
|
-
console.
|
|
52
|
-
console.
|
|
48
|
+
console.error('š ServiceNow MCP Server is running...');
|
|
49
|
+
console.error('š” This server provides Claude Code with direct access to ServiceNow APIs');
|
|
50
|
+
console.error('š§ Available tools depend on authentication status');
|
|
51
|
+
console.error('š Press Ctrl+C to stop the server');
|
|
52
|
+
console.error('');
|
|
53
53
|
try {
|
|
54
54
|
await server.run();
|
|
55
55
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Fix console.log statements in MCP servers to use console.error instead
|
|
4
|
+
# This prevents stdout pollution which breaks JSON-RPC protocol
|
|
5
|
+
|
|
6
|
+
echo "š§ Fixing console.log statements in MCP servers..."
|
|
7
|
+
|
|
8
|
+
# List of files to fix
|
|
9
|
+
files=(
|
|
10
|
+
"src/mcp/service-discovery-client.ts"
|
|
11
|
+
"src/mcp/servicenow-deployment-mcp.ts"
|
|
12
|
+
"src/mcp/servicenow-mcp-server.ts"
|
|
13
|
+
"src/mcp/servicenow-update-set-mcp.ts"
|
|
14
|
+
"src/mcp/start-all-mcp-servers.ts"
|
|
15
|
+
"src/mcp/start-servicenow-mcp.ts"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
for file in "${files[@]}"; do
|
|
19
|
+
if [ -f "$file" ]; then
|
|
20
|
+
echo " Fixing $file..."
|
|
21
|
+
# Replace console.log with console.error
|
|
22
|
+
sed -i.bak 's/console\.log(/console.error(/g' "$file"
|
|
23
|
+
# Remove backup file
|
|
24
|
+
rm -f "${file}.bak"
|
|
25
|
+
else
|
|
26
|
+
echo " ā ļø File not found: $file"
|
|
27
|
+
fi
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
echo "ā
Console.log statements fixed!"
|
|
31
|
+
echo ""
|
|
32
|
+
echo "Note: console.error is used for logging in MCP servers to keep stdout clean for JSON-RPC protocol."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.30",
|
|
4
4
|
"description": "ServiceNow development framework with MCP server integration. Executes background scripts using ES5 JavaScript only (ServiceNow Rhino engine requirement). Provides 17 MCP servers for complete ServiceNow operations including widget deployment with coherence validation, table operations, script execution, machine learning, advanced features, and comprehensive platform management.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|