snow-flow 1.4.46 → 1.4.48

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.
@@ -16,8 +16,7 @@ export declare class ServiceNowIntelligentMCP {
16
16
  private memorySystem;
17
17
  private memoryIndex;
18
18
  constructor();
19
- private initializeSystemsInBackground;
20
- private ensureSystemsInitialized;
19
+ private initializeSystems;
21
20
  private setupHandlers;
22
21
  private findArtifact;
23
22
  private editArtifact;
@@ -139,6 +138,6 @@ export declare class ServiceNowIntelligentMCP {
139
138
  private getDocumentationSuggestions;
140
139
  private startContinuousDocumentation;
141
140
  private verifyArtifactSearchable;
142
- start(): Promise<void>;
141
+ run(): Promise<void>;
143
142
  }
144
143
  //# sourceMappingURL=servicenow-intelligent-mcp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"servicenow-intelligent-mcp.d.ts","sourceRoot":"","sources":["../../src/mcp/servicenow-intelligent-mcp.ts"],"names":[],"mappings":";AACA;;;GAGG;AA8CH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAA+C;IAC7D,OAAO,CAAC,mBAAmB,CAAwB;IACnD,OAAO,CAAC,sBAAsB,CAAyB;IACvD,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,WAAW,CAA+B;;YA0BpC,6BAA6B;YAuB7B,wBAAwB;IAatC,OAAO,CAAC,aAAa;YA0ZP,YAAY;YAsEZ,YAAY;YAkDZ,eAAe;YAuCf,YAAY;YAsBZ,mBAAmB;YA6InB,WAAW;IAmIzB,OAAO,CAAC,iBAAiB;YAoDX,eAAe;IAW7B;;;;OAIG;YACW,yBAAyB;IAiDvC;;OAEG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YASb,mBAAmB;YAiJnB,mBAAmB;YA8HnB,cAAc;YA6Fd,sBAAsB;YA+MtB,mBAAmB;IAyIjC,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,wBAAwB;YAclB,6BAA6B;YAQ7B,wBAAwB;YAOxB,yBAAyB;YAoJzB,qBAAqB;IA4LnC,OAAO,CAAC,0BAA0B;YAiBpB,oBAAoB;YAQpB,kBAAkB;YAOlB,gBAAgB;YAOhB,mBAAmB;YAOnB,mBAAmB;YAOnB,qBAAqB;YASrB,2BAA2B;IAsDzC,OAAO,CAAC,2BAA2B;YAarB,qBAAqB;IA2DnC;;;OAGG;YACW,qBAAqB;YAgDrB,2BAA2B;YAsD3B,4BAA4B;YA6C5B,wBAAwB;IAgHhC,GAAG;CAcV"}
@@ -36,19 +36,18 @@ class ServiceNowIntelligentMCP {
36
36
  this.logger = new logger_js_1.Logger('ServiceNowIntelligentMCP');
37
37
  this.config = mcp_config_manager_js_1.mcpConfig.getMemoryConfig();
38
38
  this.memoryPath = this.config.path || (0, path_1.join)(process.cwd(), 'memory', 'servicenow_artifacts');
39
- // Initialize autonomous systems in background - don't block server startup
40
- this.initializeSystemsInBackground();
41
39
  this.setupHandlers();
42
40
  }
43
- async initializeSystemsInBackground() {
41
+ async initializeSystems() {
44
42
  try {
45
- // Initialize autonomous systems in background
43
+ // Initialize systems synchronously during server startup
46
44
  this.memorySystem = new memory_system_js_1.MemorySystem({
47
45
  dbPath: './intelligent-mcp.db',
48
46
  cache: { enabled: true, maxSize: 100, ttl: 3600 },
49
47
  ttl: { default: 3600, session: 7200, artifact: 86400, metric: 604800 }
50
48
  });
51
49
  await this.memorySystem.initialize();
50
+ this.logger.info('Memory system initialized');
52
51
  this.documentationSystem = new self_documenting_system_js_1.SelfDocumentingSystem(this.client, this.memorySystem);
53
52
  this.costOptimizationEngine = new cost_optimization_engine_js_1.CostOptimizationEngine(this.client, this.memorySystem);
54
53
  this.complianceSystem = new advanced_compliance_system_js_1.AdvancedComplianceSystem(this.client, this.memorySystem);
@@ -57,18 +56,9 @@ class ServiceNowIntelligentMCP {
57
56
  }
58
57
  catch (error) {
59
58
  this.logger.error('Failed to initialize systems:', error);
60
- // Continue without these systems - don't crash the server
61
- }
62
- }
63
- async ensureSystemsInitialized() {
64
- // Wait for background initialization to complete
65
- let retries = 0;
66
- while (!this.memorySystem && retries < 50) {
67
- await new Promise(resolve => setTimeout(resolve, 100));
68
- retries++;
69
- }
70
- if (!this.memorySystem) {
71
- this.logger.warn('Systems not initialized after 5 seconds, some features may be limited');
59
+ // Initialize minimal fallback systems
60
+ this.memorySystem = new memory_system_js_1.MemorySystem({ dbPath: './intelligent-mcp.db' });
61
+ await this.memorySystem.initialize();
72
62
  }
73
63
  }
74
64
  setupHandlers() {
@@ -296,8 +286,11 @@ class ServiceNowIntelligentMCP {
296
286
  this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
297
287
  const { name, arguments: args } = request.params;
298
288
  try {
299
- // Ensure systems are initialized before handling any tool
300
- await this.ensureSystemsInitialized();
289
+ // Authenticate if needed
290
+ const authResult = await mcp_auth_middleware_js_1.mcpAuth.ensureAuthenticated();
291
+ if (!authResult.success) {
292
+ throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, authResult.error || 'Authentication required');
293
+ }
301
294
  switch (name) {
302
295
  case 'snow_find_artifact':
303
296
  return await this.findArtifact(args);
@@ -4142,17 +4135,22 @@ Please check your ServiceNow connection and try again.`,
4142
4135
  };
4143
4136
  }
4144
4137
  }
4145
- async start() {
4146
- const transport = new stdio_js_1.StdioServerTransport();
4147
- await this.server.connect(transport);
4148
- this.logger.info('ServiceNow Intelligent MCP Server started');
4138
+ async run() {
4139
+ try {
4140
+ // Initialize systems first
4141
+ await this.initializeSystems();
4142
+ // Connect transport
4143
+ const transport = new stdio_js_1.StdioServerTransport();
4144
+ await this.server.connect(transport);
4145
+ this.logger.info('ServiceNow Intelligent MCP Server running on stdio');
4146
+ }
4147
+ catch (error) {
4148
+ this.logger.error('Failed to start ServiceNow Intelligent MCP:', error);
4149
+ process.exit(1);
4150
+ }
4149
4151
  }
4150
4152
  }
4151
4153
  exports.ServiceNowIntelligentMCP = ServiceNowIntelligentMCP;
4152
- // Start the server
4153
4154
  const server = new ServiceNowIntelligentMCP();
4154
- server.start().catch((error) => {
4155
- console.error('Failed to start ServiceNow Intelligent MCP:', error);
4156
- process.exit(1);
4157
- });
4155
+ server.run().catch(console.error);
4158
4156
  //# sourceMappingURL=servicenow-intelligent-mcp.js.map