@juspay/neurolink 4.0.0 → 4.1.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +20 -5
  2. package/README.md +59 -1
  3. package/dist/lib/mcp/dynamic-chain-executor.d.ts +201 -0
  4. package/dist/lib/mcp/dynamic-chain-executor.js +489 -0
  5. package/dist/lib/mcp/dynamic-orchestrator.d.ts +109 -0
  6. package/dist/lib/mcp/dynamic-orchestrator.js +351 -0
  7. package/dist/lib/mcp/error-manager.d.ts +254 -0
  8. package/dist/lib/mcp/error-manager.js +501 -0
  9. package/dist/lib/mcp/error-recovery.d.ts +158 -0
  10. package/dist/lib/mcp/error-recovery.js +405 -0
  11. package/dist/lib/mcp/health-monitor.d.ts +256 -0
  12. package/dist/lib/mcp/health-monitor.js +621 -0
  13. package/dist/lib/mcp/orchestrator.d.ts +136 -5
  14. package/dist/lib/mcp/orchestrator.js +316 -9
  15. package/dist/lib/mcp/registry.d.ts +22 -0
  16. package/dist/lib/mcp/registry.js +24 -0
  17. package/dist/lib/mcp/semaphore-manager.d.ts +137 -0
  18. package/dist/lib/mcp/semaphore-manager.js +329 -0
  19. package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
  20. package/dist/lib/mcp/session-manager.d.ts +186 -0
  21. package/dist/lib/mcp/session-manager.js +400 -0
  22. package/dist/lib/mcp/session-persistence.d.ts +93 -0
  23. package/dist/lib/mcp/session-persistence.js +298 -0
  24. package/dist/lib/mcp/transport-manager.d.ts +153 -0
  25. package/dist/lib/mcp/transport-manager.js +330 -0
  26. package/dist/lib/mcp/unified-registry.d.ts +42 -1
  27. package/dist/lib/mcp/unified-registry.js +122 -2
  28. package/dist/lib/neurolink.d.ts +75 -0
  29. package/dist/lib/neurolink.js +104 -0
  30. package/dist/mcp/dynamic-chain-executor.d.ts +201 -0
  31. package/dist/mcp/dynamic-chain-executor.js +489 -0
  32. package/dist/mcp/dynamic-orchestrator.d.ts +109 -0
  33. package/dist/mcp/dynamic-orchestrator.js +351 -0
  34. package/dist/mcp/error-manager.d.ts +254 -0
  35. package/dist/mcp/error-manager.js +501 -0
  36. package/dist/mcp/error-recovery.d.ts +158 -0
  37. package/dist/mcp/error-recovery.js +405 -0
  38. package/dist/mcp/health-monitor.d.ts +256 -0
  39. package/dist/mcp/health-monitor.js +621 -0
  40. package/dist/mcp/orchestrator.d.ts +136 -5
  41. package/dist/mcp/orchestrator.js +316 -9
  42. package/dist/mcp/registry.d.ts +22 -0
  43. package/dist/mcp/registry.js +24 -0
  44. package/dist/mcp/semaphore-manager.d.ts +137 -0
  45. package/dist/mcp/semaphore-manager.js +329 -0
  46. package/dist/mcp/session-manager.d.ts +186 -0
  47. package/dist/mcp/session-manager.js +400 -0
  48. package/dist/mcp/session-persistence.d.ts +93 -0
  49. package/dist/mcp/session-persistence.js +299 -0
  50. package/dist/mcp/transport-manager.d.ts +153 -0
  51. package/dist/mcp/transport-manager.js +331 -0
  52. package/dist/mcp/unified-registry.d.ts +42 -1
  53. package/dist/mcp/unified-registry.js +122 -2
  54. package/dist/neurolink.d.ts +75 -0
  55. package/dist/neurolink.js +104 -0
  56. package/package.json +2 -1
package/dist/neurolink.js CHANGED
@@ -472,6 +472,94 @@ Note: Tool integration is currently in development. Please provide helpful respo
472
472
  })),
473
473
  };
474
474
  }
475
+ /**
476
+ * Add a new MCP server programmatically
477
+ *
478
+ * Allows dynamic registration of MCP servers at runtime for enhanced
479
+ * tool ecosystem management. Perfect for integrating external services
480
+ * like Bitbucket, Slack, databases, etc.
481
+ *
482
+ * @param serverId - Unique identifier for the server (e.g., 'bitbucket', 'slack-api')
483
+ * @param config - Server configuration with command and execution parameters
484
+ * @returns Promise that resolves when server is successfully added and connected
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * // Add Bitbucket MCP server
489
+ * await neurolink.addMCPServer('bitbucket', {
490
+ * command: 'npx',
491
+ * args: ['-y', '@nexus2520/bitbucket-mcp-server'],
492
+ * env: {
493
+ * BITBUCKET_USERNAME: 'your-username',
494
+ * BITBUCKET_APP_PASSWORD: 'your-app-password'
495
+ * }
496
+ * });
497
+ *
498
+ * // Add custom database connector
499
+ * await neurolink.addMCPServer('database', {
500
+ * command: 'node',
501
+ * args: ['./custom-db-mcp-server.js'],
502
+ * env: { DB_CONNECTION_STRING: 'postgresql://...' }
503
+ * });
504
+ * ```
505
+ */
506
+ async addMCPServer(serverId, config) {
507
+ const functionTag = "NeuroLink.addMCPServer";
508
+ mcpLogger.info(`[${functionTag}] Adding MCP server: ${serverId}`, {
509
+ command: config.command,
510
+ argsCount: config.args?.length || 0,
511
+ hasEnv: Object.keys(config.env || {}).length > 0,
512
+ });
513
+ try {
514
+ // Ensure MCP is initialized
515
+ await this.initializeMCP();
516
+ // Add server to unified registry with configurable transport type
517
+ const transportType = config.type || "stdio";
518
+ // Validate URL requirement for non-stdio transports
519
+ if ((transportType === "sse" || transportType === "http") &&
520
+ !config.url) {
521
+ throw new Error(`URL is required for ${transportType} transport. Please provide config.url for server '${serverId}'.`);
522
+ }
523
+ const transportConfig = {
524
+ type: transportType,
525
+ ...(transportType === "stdio" && {
526
+ command: config.command,
527
+ args: config.args || [],
528
+ env: config.env || {},
529
+ cwd: config.cwd,
530
+ }),
531
+ ...(transportType === "sse" && {
532
+ url: config.url,
533
+ headers: config.headers,
534
+ timeout: config.timeout,
535
+ }),
536
+ ...(transportType === "http" && {
537
+ url: config.url,
538
+ headers: config.headers,
539
+ timeout: config.timeout,
540
+ }),
541
+ };
542
+ await unifiedRegistry.addExternalServer(serverId, transportConfig);
543
+ // Check if server is actually connected vs just registered
544
+ const isConnected = unifiedRegistry.isConnected(serverId);
545
+ if (isConnected) {
546
+ mcpLogger.info(`[${functionTag}] Successfully connected to MCP server: ${serverId}`);
547
+ }
548
+ else {
549
+ mcpLogger.info(`[${functionTag}] MCP server registered: ${serverId} (connection failed, but server available for retry)`);
550
+ }
551
+ }
552
+ catch (error) {
553
+ mcpLogger.error(`[${functionTag}] Failed to add MCP server: ${serverId}`, {
554
+ error: error instanceof Error ? error.message : String(error),
555
+ });
556
+ const newError = new Error(`Failed to add MCP server '${serverId}': ${error instanceof Error ? error.message : String(error)}`);
557
+ if (error instanceof Error && error.stack) {
558
+ newError.stack = `${newError.stack}\nCaused by: ${error.stack}`;
559
+ }
560
+ throw newError;
561
+ }
562
+ }
475
563
  /**
476
564
  * Alias for generateText() - CLI-SDK consistency
477
565
  * @param options - Text generation options
@@ -488,4 +576,20 @@ Note: Tool integration is currently in development. Please provide helpful respo
488
576
  async gen(options) {
489
577
  return this.generateText(options);
490
578
  }
579
+ /**
580
+ * Get the connection client for a specific MCP server
581
+ * @param serverId - The ID of the server to get connection for
582
+ * @returns Client connection object or undefined if not connected
583
+ */
584
+ getConnection(serverId) {
585
+ return unifiedRegistry.getConnection(serverId);
586
+ }
587
+ /**
588
+ * Check if a specific MCP server is currently connected
589
+ * @param serverId - The ID of the server to check
590
+ * @returns True if server is connected, false otherwise
591
+ */
592
+ isConnected(serverId) {
593
+ return unifiedRegistry.isConnected(serverId);
594
+ }
491
595
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "4.0.0",
3
+ "version": "4.1.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 9 major providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
5
5
  "author": {
6
6
  "name": "Juspay Technologies",
@@ -155,6 +155,7 @@
155
155
  "inquirer": "^9.2.15",
156
156
  "ora": "^7.0.1",
157
157
  "playwright": "^1.52.0",
158
+ "reconnecting-eventsource": "^1.6.4",
158
159
  "undici": "^6.6.2",
159
160
  "uuid": "^11.1.0",
160
161
  "ws": "^8.18.3",