@juspay/neurolink 8.41.0 → 8.41.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [8.41.1](https://github.com/juspay/neurolink/compare/v8.41.0...v8.41.1) (2026-01-31)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **(ci):** add fork detection to docs PR validation workflow ([6d1f9eb](https://github.com/juspay/neurolink/commit/6d1f9eb720dea1a5997e53cbcff8d6a5c86282cd))
6
+
1
7
  ## [8.41.0](https://github.com/juspay/neurolink/compare/v8.40.1...v8.41.0) (2026-01-29)
2
8
 
3
9
  ### Features
@@ -128,9 +128,15 @@ export declare class ExternalServerManager extends EventEmitter {
128
128
  */
129
129
  getServerStatuses(): ExternalMCPServerHealth[];
130
130
  /**
131
- * Shutdown all servers
131
+ * Shutdown all servers and clean up resources
132
+ * This method should be called during application shutdown to prevent memory leaks
132
133
  */
133
134
  shutdown(): Promise<void>;
135
+ /**
136
+ * Destroy the manager and all associated resources
137
+ * Alias for shutdown() to match the pattern used by other components
138
+ */
139
+ destroy(): Promise<void>;
134
140
  /**
135
141
  * Get manager statistics
136
142
  */
@@ -1084,7 +1084,8 @@ export class ExternalServerManager extends EventEmitter {
1084
1084
  return statuses;
1085
1085
  }
1086
1086
  /**
1087
- * Shutdown all servers
1087
+ * Shutdown all servers and clean up resources
1088
+ * This method should be called during application shutdown to prevent memory leaks
1088
1089
  */
1089
1090
  async shutdown() {
1090
1091
  if (this.isShuttingDown) {
@@ -1097,7 +1098,19 @@ export class ExternalServerManager extends EventEmitter {
1097
1098
  }));
1098
1099
  await Promise.all(shutdownPromises);
1099
1100
  this.servers.clear();
1100
- mcpLogger.info("[ExternalServerManager] All servers shut down");
1101
+ // Clean up the tool discovery service to prevent memory leaks
1102
+ // from accumulated event listeners
1103
+ this.toolDiscovery.destroy();
1104
+ // Remove all event listeners from this manager
1105
+ this.removeAllListeners();
1106
+ mcpLogger.info("[ExternalServerManager] All servers shut down and resources cleaned up");
1107
+ }
1108
+ /**
1109
+ * Destroy the manager and all associated resources
1110
+ * Alias for shutdown() to match the pattern used by other components
1111
+ */
1112
+ async destroy() {
1113
+ return this.shutdown();
1101
1114
  }
1102
1115
  /**
1103
1116
  * Get manager statistics
@@ -98,6 +98,30 @@ export declare class ToolDiscoveryService extends EventEmitter {
98
98
  * Create timeout promise
99
99
  */
100
100
  private createTimeoutPromise;
101
+ /**
102
+ * Destroy the tool discovery service and clean up all resources
103
+ * This method should be called when the service is no longer needed
104
+ * to prevent memory leaks from accumulated event listeners
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const service = new ToolDiscoveryService();
109
+ * // ... use the service ...
110
+ * service.destroy(); // Clean up when done
111
+ * ```
112
+ */
113
+ destroy(): void;
114
+ /**
115
+ * Reset statistics for all tools
116
+ * This clears execution counts, timing data, and other statistics
117
+ * while preserving the tool registrations themselves
118
+ */
119
+ resetStatistics(): void;
120
+ /**
121
+ * Get the count of active event listeners
122
+ * Useful for monitoring potential memory leaks
123
+ */
124
+ getListenerCount(): number;
101
125
  /**
102
126
  * Get discovery statistics
103
127
  */
@@ -630,6 +630,64 @@ export class ToolDiscoveryService extends EventEmitter {
630
630
  }, timeout);
631
631
  });
632
632
  }
633
+ /**
634
+ * Destroy the tool discovery service and clean up all resources
635
+ * This method should be called when the service is no longer needed
636
+ * to prevent memory leaks from accumulated event listeners
637
+ *
638
+ * @example
639
+ * ```typescript
640
+ * const service = new ToolDiscoveryService();
641
+ * // ... use the service ...
642
+ * service.destroy(); // Clean up when done
643
+ * ```
644
+ */
645
+ destroy() {
646
+ mcpLogger.debug("[ToolDiscoveryService] Starting cleanup...");
647
+ // Clear all event listeners to prevent memory leaks
648
+ this.removeAllListeners();
649
+ // Clear all internal data structures
650
+ this.serverToolStorage.clear();
651
+ this.toolRegistry.clear();
652
+ this.serverTools.clear();
653
+ this.discoveryInProgress.clear();
654
+ mcpLogger.debug("[ToolDiscoveryService] Destroyed and cleaned up");
655
+ }
656
+ /**
657
+ * Reset statistics for all tools
658
+ * This clears execution counts, timing data, and other statistics
659
+ * while preserving the tool registrations themselves
660
+ */
661
+ resetStatistics() {
662
+ for (const toolInfo of this.toolRegistry.values()) {
663
+ toolInfo.stats = {
664
+ totalCalls: 0,
665
+ successfulCalls: 0,
666
+ failedCalls: 0,
667
+ averageExecutionTime: 0,
668
+ lastExecutionTime: 0,
669
+ };
670
+ toolInfo.lastCalled = undefined;
671
+ }
672
+ mcpLogger.debug("[ToolDiscoveryService] Statistics reset for all tools");
673
+ }
674
+ /**
675
+ * Get the count of active event listeners
676
+ * Useful for monitoring potential memory leaks
677
+ */
678
+ getListenerCount() {
679
+ const events = [
680
+ "discoveryCompleted",
681
+ "discoveryFailed",
682
+ "toolRegistered",
683
+ "toolUnregistered",
684
+ ];
685
+ let total = 0;
686
+ for (const event of events) {
687
+ total += this.listenerCount(event);
688
+ }
689
+ return total;
690
+ }
633
691
  /**
634
692
  * Get discovery statistics
635
693
  */
@@ -128,9 +128,15 @@ export declare class ExternalServerManager extends EventEmitter {
128
128
  */
129
129
  getServerStatuses(): ExternalMCPServerHealth[];
130
130
  /**
131
- * Shutdown all servers
131
+ * Shutdown all servers and clean up resources
132
+ * This method should be called during application shutdown to prevent memory leaks
132
133
  */
133
134
  shutdown(): Promise<void>;
135
+ /**
136
+ * Destroy the manager and all associated resources
137
+ * Alias for shutdown() to match the pattern used by other components
138
+ */
139
+ destroy(): Promise<void>;
134
140
  /**
135
141
  * Get manager statistics
136
142
  */
@@ -1084,7 +1084,8 @@ export class ExternalServerManager extends EventEmitter {
1084
1084
  return statuses;
1085
1085
  }
1086
1086
  /**
1087
- * Shutdown all servers
1087
+ * Shutdown all servers and clean up resources
1088
+ * This method should be called during application shutdown to prevent memory leaks
1088
1089
  */
1089
1090
  async shutdown() {
1090
1091
  if (this.isShuttingDown) {
@@ -1097,7 +1098,19 @@ export class ExternalServerManager extends EventEmitter {
1097
1098
  }));
1098
1099
  await Promise.all(shutdownPromises);
1099
1100
  this.servers.clear();
1100
- mcpLogger.info("[ExternalServerManager] All servers shut down");
1101
+ // Clean up the tool discovery service to prevent memory leaks
1102
+ // from accumulated event listeners
1103
+ this.toolDiscovery.destroy();
1104
+ // Remove all event listeners from this manager
1105
+ this.removeAllListeners();
1106
+ mcpLogger.info("[ExternalServerManager] All servers shut down and resources cleaned up");
1107
+ }
1108
+ /**
1109
+ * Destroy the manager and all associated resources
1110
+ * Alias for shutdown() to match the pattern used by other components
1111
+ */
1112
+ async destroy() {
1113
+ return this.shutdown();
1101
1114
  }
1102
1115
  /**
1103
1116
  * Get manager statistics
@@ -98,6 +98,30 @@ export declare class ToolDiscoveryService extends EventEmitter {
98
98
  * Create timeout promise
99
99
  */
100
100
  private createTimeoutPromise;
101
+ /**
102
+ * Destroy the tool discovery service and clean up all resources
103
+ * This method should be called when the service is no longer needed
104
+ * to prevent memory leaks from accumulated event listeners
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const service = new ToolDiscoveryService();
109
+ * // ... use the service ...
110
+ * service.destroy(); // Clean up when done
111
+ * ```
112
+ */
113
+ destroy(): void;
114
+ /**
115
+ * Reset statistics for all tools
116
+ * This clears execution counts, timing data, and other statistics
117
+ * while preserving the tool registrations themselves
118
+ */
119
+ resetStatistics(): void;
120
+ /**
121
+ * Get the count of active event listeners
122
+ * Useful for monitoring potential memory leaks
123
+ */
124
+ getListenerCount(): number;
101
125
  /**
102
126
  * Get discovery statistics
103
127
  */
@@ -630,6 +630,64 @@ export class ToolDiscoveryService extends EventEmitter {
630
630
  }, timeout);
631
631
  });
632
632
  }
633
+ /**
634
+ * Destroy the tool discovery service and clean up all resources
635
+ * This method should be called when the service is no longer needed
636
+ * to prevent memory leaks from accumulated event listeners
637
+ *
638
+ * @example
639
+ * ```typescript
640
+ * const service = new ToolDiscoveryService();
641
+ * // ... use the service ...
642
+ * service.destroy(); // Clean up when done
643
+ * ```
644
+ */
645
+ destroy() {
646
+ mcpLogger.debug("[ToolDiscoveryService] Starting cleanup...");
647
+ // Clear all event listeners to prevent memory leaks
648
+ this.removeAllListeners();
649
+ // Clear all internal data structures
650
+ this.serverToolStorage.clear();
651
+ this.toolRegistry.clear();
652
+ this.serverTools.clear();
653
+ this.discoveryInProgress.clear();
654
+ mcpLogger.debug("[ToolDiscoveryService] Destroyed and cleaned up");
655
+ }
656
+ /**
657
+ * Reset statistics for all tools
658
+ * This clears execution counts, timing data, and other statistics
659
+ * while preserving the tool registrations themselves
660
+ */
661
+ resetStatistics() {
662
+ for (const toolInfo of this.toolRegistry.values()) {
663
+ toolInfo.stats = {
664
+ totalCalls: 0,
665
+ successfulCalls: 0,
666
+ failedCalls: 0,
667
+ averageExecutionTime: 0,
668
+ lastExecutionTime: 0,
669
+ };
670
+ toolInfo.lastCalled = undefined;
671
+ }
672
+ mcpLogger.debug("[ToolDiscoveryService] Statistics reset for all tools");
673
+ }
674
+ /**
675
+ * Get the count of active event listeners
676
+ * Useful for monitoring potential memory leaks
677
+ */
678
+ getListenerCount() {
679
+ const events = [
680
+ "discoveryCompleted",
681
+ "discoveryFailed",
682
+ "toolRegistered",
683
+ "toolUnregistered",
684
+ ];
685
+ let total = 0;
686
+ for (const event of events) {
687
+ total += this.listenerCount(event);
688
+ }
689
+ return total;
690
+ }
633
691
  /**
634
692
  * Get discovery statistics
635
693
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "8.41.0",
3
+ "version": "8.41.1",
4
4
  "description": "Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 13 providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
5
5
  "author": {
6
6
  "name": "Juspay Technologies",