@juspay/neurolink 7.13.0 → 7.14.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/CHANGELOG.md +6 -0
- package/README.md +89 -25
- package/dist/config/conversationMemoryConfig.js +2 -1
- package/dist/context/ContextManager.js +15 -4
- package/dist/context/config.js +5 -1
- package/dist/context/utils.js +1 -1
- package/dist/core/baseProvider.d.ts +16 -1
- package/dist/core/baseProvider.js +208 -9
- package/dist/core/conversationMemoryManager.js +3 -2
- package/dist/core/factory.js +13 -2
- package/dist/factories/providerFactory.js +5 -11
- package/dist/factories/providerRegistry.js +2 -2
- package/dist/lib/config/conversationMemoryConfig.js +2 -1
- package/dist/lib/context/ContextManager.js +15 -4
- package/dist/lib/context/config.js +5 -1
- package/dist/lib/context/utils.js +1 -1
- package/dist/lib/core/baseProvider.d.ts +16 -1
- package/dist/lib/core/baseProvider.js +208 -9
- package/dist/lib/core/conversationMemoryManager.js +3 -2
- package/dist/lib/core/factory.js +13 -2
- package/dist/lib/factories/providerFactory.js +5 -11
- package/dist/lib/factories/providerRegistry.js +2 -2
- package/dist/lib/mcp/externalServerManager.d.ts +115 -0
- package/dist/lib/mcp/externalServerManager.js +677 -0
- package/dist/lib/mcp/mcpCircuitBreaker.d.ts +184 -0
- package/dist/lib/mcp/mcpCircuitBreaker.js +338 -0
- package/dist/lib/mcp/mcpClientFactory.d.ts +104 -0
- package/dist/lib/mcp/mcpClientFactory.js +416 -0
- package/dist/lib/mcp/toolDiscoveryService.d.ts +192 -0
- package/dist/lib/mcp/toolDiscoveryService.js +578 -0
- package/dist/lib/neurolink.d.ts +111 -16
- package/dist/lib/neurolink.js +517 -50
- package/dist/lib/providers/googleVertex.d.ts +1 -1
- package/dist/lib/providers/googleVertex.js +23 -7
- package/dist/lib/types/externalMcp.d.ts +282 -0
- package/dist/lib/types/externalMcp.js +6 -0
- package/dist/lib/types/generateTypes.d.ts +0 -1
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/mcp/externalServerManager.d.ts +115 -0
- package/dist/mcp/externalServerManager.js +677 -0
- package/dist/mcp/mcpCircuitBreaker.d.ts +184 -0
- package/dist/mcp/mcpCircuitBreaker.js +338 -0
- package/dist/mcp/mcpClientFactory.d.ts +104 -0
- package/dist/mcp/mcpClientFactory.js +416 -0
- package/dist/mcp/toolDiscoveryService.d.ts +192 -0
- package/dist/mcp/toolDiscoveryService.js +578 -0
- package/dist/neurolink.d.ts +111 -16
- package/dist/neurolink.js +517 -50
- package/dist/providers/googleVertex.d.ts +1 -1
- package/dist/providers/googleVertex.js +23 -7
- package/dist/types/externalMcp.d.ts +282 -0
- package/dist/types/externalMcp.js +6 -0
- package/dist/types/generateTypes.d.ts +0 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/lib/neurolink.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { SimpleTool } from "./sdk/toolRegistration.js";
|
|
|
12
12
|
import type { InMemoryMCPServerConfig } from "./types/mcpTypes.js";
|
|
13
13
|
import { EventEmitter } from "events";
|
|
14
14
|
import type { ConversationMemoryConfig } from "./types/conversationTypes.js";
|
|
15
|
+
import type { ExternalMCPServerConfig, ExternalMCPServerInstance, ExternalMCPOperationResult, ExternalMCPToolInfo } from "./types/externalMcp.js";
|
|
15
16
|
export interface ProviderStatus {
|
|
16
17
|
provider: string;
|
|
17
18
|
status: "working" | "failed" | "not-configured";
|
|
@@ -30,6 +31,10 @@ export interface MCPStatus {
|
|
|
30
31
|
autoDiscoveredServers: MCPServerInfo[];
|
|
31
32
|
customToolsCount: number;
|
|
32
33
|
inMemoryServersCount: number;
|
|
34
|
+
externalMCPServersCount?: number;
|
|
35
|
+
externalMCPConnectedCount?: number;
|
|
36
|
+
externalMCPFailedCount?: number;
|
|
37
|
+
externalMCPServers?: MCPServerInfo[];
|
|
33
38
|
error?: string;
|
|
34
39
|
[key: string]: unknown;
|
|
35
40
|
}
|
|
@@ -48,6 +53,7 @@ export declare class NeuroLink {
|
|
|
48
53
|
private contextManager;
|
|
49
54
|
private customTools;
|
|
50
55
|
private inMemoryServers;
|
|
56
|
+
private externalServerManager;
|
|
51
57
|
private toolCircuitBreakers;
|
|
52
58
|
private toolExecutionMetrics;
|
|
53
59
|
/**
|
|
@@ -200,22 +206,7 @@ export declare class NeuroLink {
|
|
|
200
206
|
* Get all available tools including custom and in-memory ones
|
|
201
207
|
* @returns Array of available tools with metadata
|
|
202
208
|
*/
|
|
203
|
-
getAllAvailableTools(): Promise<
|
|
204
|
-
toolName: string;
|
|
205
|
-
serverId: string | undefined;
|
|
206
|
-
name: string;
|
|
207
|
-
description?: string;
|
|
208
|
-
category?: string;
|
|
209
|
-
inputSchema?: Record<string, unknown>;
|
|
210
|
-
outputSchema?: Record<string, unknown>;
|
|
211
|
-
} | {
|
|
212
|
-
name: string;
|
|
213
|
-
toolName: string;
|
|
214
|
-
description: string;
|
|
215
|
-
serverId: string;
|
|
216
|
-
category: string;
|
|
217
|
-
inputSchema: {};
|
|
218
|
-
})[]>;
|
|
209
|
+
getAllAvailableTools(): Promise<any[]>;
|
|
219
210
|
/**
|
|
220
211
|
* Get comprehensive status of all AI providers
|
|
221
212
|
* Primary method for provider health checking and diagnostics
|
|
@@ -402,6 +393,110 @@ export declare class NeuroLink {
|
|
|
402
393
|
* Clear all conversation history (public API)
|
|
403
394
|
*/
|
|
404
395
|
clearAllConversations(): Promise<void>;
|
|
396
|
+
/**
|
|
397
|
+
* Add an external MCP server
|
|
398
|
+
* Automatically discovers and registers tools from the server
|
|
399
|
+
* @param serverId - Unique identifier for the server
|
|
400
|
+
* @param config - External MCP server configuration
|
|
401
|
+
* @returns Operation result with server instance
|
|
402
|
+
*/
|
|
403
|
+
addExternalMCPServer(serverId: string, config: ExternalMCPServerConfig): Promise<ExternalMCPOperationResult<ExternalMCPServerInstance>>;
|
|
404
|
+
/**
|
|
405
|
+
* Remove an external MCP server
|
|
406
|
+
* Stops the server and removes all its tools
|
|
407
|
+
* @param serverId - ID of the server to remove
|
|
408
|
+
* @returns Operation result
|
|
409
|
+
*/
|
|
410
|
+
removeExternalMCPServer(serverId: string): Promise<ExternalMCPOperationResult<void>>;
|
|
411
|
+
/**
|
|
412
|
+
* List all external MCP servers
|
|
413
|
+
* @returns Array of server health information
|
|
414
|
+
*/
|
|
415
|
+
listExternalMCPServers(): Array<{
|
|
416
|
+
serverId: string;
|
|
417
|
+
status: string;
|
|
418
|
+
toolCount: number;
|
|
419
|
+
uptime: number;
|
|
420
|
+
isHealthy: boolean;
|
|
421
|
+
config: ExternalMCPServerConfig;
|
|
422
|
+
}>;
|
|
423
|
+
/**
|
|
424
|
+
* Get external MCP server status
|
|
425
|
+
* @param serverId - ID of the server
|
|
426
|
+
* @returns Server instance or undefined if not found
|
|
427
|
+
*/
|
|
428
|
+
getExternalMCPServer(serverId: string): ExternalMCPServerInstance | undefined;
|
|
429
|
+
/**
|
|
430
|
+
* Execute a tool from an external MCP server
|
|
431
|
+
* @param serverId - ID of the server
|
|
432
|
+
* @param toolName - Name of the tool
|
|
433
|
+
* @param parameters - Tool parameters
|
|
434
|
+
* @param options - Execution options
|
|
435
|
+
* @returns Tool execution result
|
|
436
|
+
*/
|
|
437
|
+
executeExternalMCPTool(serverId: string, toolName: string, parameters: Record<string, any>, options?: {
|
|
438
|
+
timeout?: number;
|
|
439
|
+
}): Promise<any>;
|
|
440
|
+
/**
|
|
441
|
+
* Get all tools from external MCP servers
|
|
442
|
+
* @returns Array of external tool information
|
|
443
|
+
*/
|
|
444
|
+
getExternalMCPTools(): ExternalMCPToolInfo[];
|
|
445
|
+
/**
|
|
446
|
+
* Get tools from a specific external MCP server
|
|
447
|
+
* @param serverId - ID of the server
|
|
448
|
+
* @returns Array of tool information for the server
|
|
449
|
+
*/
|
|
450
|
+
getExternalMCPServerTools(serverId: string): ExternalMCPToolInfo[];
|
|
451
|
+
/**
|
|
452
|
+
* Test connection to an external MCP server
|
|
453
|
+
* @param config - Server configuration to test
|
|
454
|
+
* @returns Test result with connection status
|
|
455
|
+
*/
|
|
456
|
+
testExternalMCPConnection(config: ExternalMCPServerConfig): Promise<{
|
|
457
|
+
success: boolean;
|
|
458
|
+
error?: string;
|
|
459
|
+
toolCount?: number;
|
|
460
|
+
}>;
|
|
461
|
+
/**
|
|
462
|
+
* Get external MCP server manager statistics
|
|
463
|
+
* @returns Statistics about external servers and tools
|
|
464
|
+
*/
|
|
465
|
+
getExternalMCPStatistics(): {
|
|
466
|
+
totalServers: number;
|
|
467
|
+
connectedServers: number;
|
|
468
|
+
failedServers: number;
|
|
469
|
+
totalTools: number;
|
|
470
|
+
totalConnections: number;
|
|
471
|
+
totalErrors: number;
|
|
472
|
+
};
|
|
473
|
+
/**
|
|
474
|
+
* Shutdown all external MCP servers
|
|
475
|
+
* Called automatically on process exit
|
|
476
|
+
*/
|
|
477
|
+
shutdownExternalMCPServers(): Promise<void>;
|
|
478
|
+
/**
|
|
479
|
+
* Convert external MCP tools to Vercel AI SDK tool format
|
|
480
|
+
* This allows AI providers to use external tools directly
|
|
481
|
+
*/
|
|
482
|
+
private convertExternalMCPToolsToAISDKFormat;
|
|
483
|
+
/**
|
|
484
|
+
* Convert JSON Schema to AI SDK compatible format
|
|
485
|
+
* For now, we'll skip schema validation and let the AI SDK handle parameters dynamically
|
|
486
|
+
*/
|
|
487
|
+
private convertJSONSchemaToAISDKFormat;
|
|
488
|
+
/**
|
|
489
|
+
* Unregister external MCP tools from a specific server
|
|
490
|
+
*/
|
|
491
|
+
private unregisterExternalMCPToolsFromRegistry;
|
|
492
|
+
/**
|
|
493
|
+
* Unregister a specific external MCP tool from the main registry
|
|
494
|
+
*/
|
|
495
|
+
private unregisterExternalMCPToolFromRegistry;
|
|
496
|
+
/**
|
|
497
|
+
* Unregister all external MCP tools from the main registry
|
|
498
|
+
*/
|
|
499
|
+
private unregisterAllExternalMCPToolsFromRegistry;
|
|
405
500
|
}
|
|
406
501
|
export declare const neurolink: NeuroLink;
|
|
407
502
|
export default neurolink;
|