@juspay/neurolink 9.26.2 → 9.28.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.
Files changed (125) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +59 -9
  3. package/dist/cli/commands/config.d.ts +4 -4
  4. package/dist/cli/commands/mcp.d.ts +87 -0
  5. package/dist/cli/commands/mcp.js +1524 -0
  6. package/dist/cli/loop/optionsSchema.js +4 -0
  7. package/dist/core/modules/ToolsManager.js +29 -2
  8. package/dist/index.d.ts +2 -1
  9. package/dist/index.js +27 -1
  10. package/dist/lib/core/modules/ToolsManager.js +29 -2
  11. package/dist/lib/index.d.ts +2 -1
  12. package/dist/lib/index.js +27 -1
  13. package/dist/lib/mcp/agentExposure.d.ts +228 -0
  14. package/dist/lib/mcp/agentExposure.js +357 -0
  15. package/dist/lib/mcp/batching/index.d.ts +11 -0
  16. package/dist/lib/mcp/batching/index.js +11 -0
  17. package/dist/lib/mcp/batching/requestBatcher.d.ts +202 -0
  18. package/dist/lib/mcp/batching/requestBatcher.js +442 -0
  19. package/dist/lib/mcp/caching/index.d.ts +11 -0
  20. package/dist/lib/mcp/caching/index.js +11 -0
  21. package/dist/lib/mcp/caching/toolCache.d.ts +221 -0
  22. package/dist/lib/mcp/caching/toolCache.js +434 -0
  23. package/dist/lib/mcp/elicitation/elicitationManager.d.ts +169 -0
  24. package/dist/lib/mcp/elicitation/elicitationManager.js +377 -0
  25. package/dist/lib/mcp/elicitation/index.d.ts +11 -0
  26. package/dist/lib/mcp/elicitation/index.js +12 -0
  27. package/dist/lib/mcp/elicitation/types.d.ts +278 -0
  28. package/dist/lib/mcp/elicitation/types.js +11 -0
  29. package/dist/lib/mcp/elicitationProtocol.d.ts +228 -0
  30. package/dist/lib/mcp/elicitationProtocol.js +376 -0
  31. package/dist/lib/mcp/enhancedToolDiscovery.d.ts +205 -0
  32. package/dist/lib/mcp/enhancedToolDiscovery.js +482 -0
  33. package/dist/lib/mcp/index.d.ts +38 -1
  34. package/dist/lib/mcp/index.js +36 -3
  35. package/dist/lib/mcp/mcpRegistryClient.d.ts +332 -0
  36. package/dist/lib/mcp/mcpRegistryClient.js +489 -0
  37. package/dist/lib/mcp/mcpServerBase.d.ts +227 -0
  38. package/dist/lib/mcp/mcpServerBase.js +374 -0
  39. package/dist/lib/mcp/multiServerManager.d.ts +310 -0
  40. package/dist/lib/mcp/multiServerManager.js +580 -0
  41. package/dist/lib/mcp/routing/index.d.ts +11 -0
  42. package/dist/lib/mcp/routing/index.js +11 -0
  43. package/dist/lib/mcp/routing/toolRouter.d.ts +219 -0
  44. package/dist/lib/mcp/routing/toolRouter.js +417 -0
  45. package/dist/lib/mcp/serverCapabilities.d.ts +341 -0
  46. package/dist/lib/mcp/serverCapabilities.js +503 -0
  47. package/dist/lib/mcp/toolAnnotations.d.ts +154 -0
  48. package/dist/lib/mcp/toolAnnotations.js +240 -0
  49. package/dist/lib/mcp/toolConverter.d.ts +178 -0
  50. package/dist/lib/mcp/toolConverter.js +259 -0
  51. package/dist/lib/mcp/toolIntegration.d.ts +136 -0
  52. package/dist/lib/mcp/toolIntegration.js +335 -0
  53. package/dist/lib/memory/hippocampusInitializer.d.ts +2 -2
  54. package/dist/lib/memory/hippocampusInitializer.js +1 -1
  55. package/dist/lib/neurolink.d.ts +275 -2
  56. package/dist/lib/neurolink.js +596 -56
  57. package/dist/lib/providers/litellm.d.ts +10 -0
  58. package/dist/lib/providers/litellm.js +104 -2
  59. package/dist/lib/types/configTypes.d.ts +56 -0
  60. package/dist/lib/types/conversation.d.ts +2 -2
  61. package/dist/lib/types/generateTypes.d.ts +4 -0
  62. package/dist/lib/types/index.d.ts +2 -1
  63. package/dist/lib/types/modelTypes.d.ts +6 -6
  64. package/dist/lib/types/streamTypes.d.ts +2 -0
  65. package/dist/lib/types/tools.d.ts +2 -0
  66. package/dist/lib/utils/pricing.js +177 -17
  67. package/dist/lib/utils/schemaConversion.d.ts +6 -1
  68. package/dist/lib/utils/schemaConversion.js +50 -28
  69. package/dist/lib/workflow/config.d.ts +16 -16
  70. package/dist/mcp/agentExposure.d.ts +228 -0
  71. package/dist/mcp/agentExposure.js +356 -0
  72. package/dist/mcp/batching/index.d.ts +11 -0
  73. package/dist/mcp/batching/index.js +10 -0
  74. package/dist/mcp/batching/requestBatcher.d.ts +202 -0
  75. package/dist/mcp/batching/requestBatcher.js +441 -0
  76. package/dist/mcp/caching/index.d.ts +11 -0
  77. package/dist/mcp/caching/index.js +10 -0
  78. package/dist/mcp/caching/toolCache.d.ts +221 -0
  79. package/dist/mcp/caching/toolCache.js +433 -0
  80. package/dist/mcp/elicitation/elicitationManager.d.ts +169 -0
  81. package/dist/mcp/elicitation/elicitationManager.js +376 -0
  82. package/dist/mcp/elicitation/index.d.ts +11 -0
  83. package/dist/mcp/elicitation/index.js +11 -0
  84. package/dist/mcp/elicitation/types.d.ts +278 -0
  85. package/dist/mcp/elicitation/types.js +10 -0
  86. package/dist/mcp/elicitationProtocol.d.ts +228 -0
  87. package/dist/mcp/elicitationProtocol.js +375 -0
  88. package/dist/mcp/enhancedToolDiscovery.d.ts +205 -0
  89. package/dist/mcp/enhancedToolDiscovery.js +481 -0
  90. package/dist/mcp/index.d.ts +38 -1
  91. package/dist/mcp/index.js +36 -3
  92. package/dist/mcp/mcpRegistryClient.d.ts +332 -0
  93. package/dist/mcp/mcpRegistryClient.js +488 -0
  94. package/dist/mcp/mcpServerBase.d.ts +227 -0
  95. package/dist/mcp/mcpServerBase.js +373 -0
  96. package/dist/mcp/multiServerManager.d.ts +310 -0
  97. package/dist/mcp/multiServerManager.js +579 -0
  98. package/dist/mcp/routing/index.d.ts +11 -0
  99. package/dist/mcp/routing/index.js +10 -0
  100. package/dist/mcp/routing/toolRouter.d.ts +219 -0
  101. package/dist/mcp/routing/toolRouter.js +416 -0
  102. package/dist/mcp/serverCapabilities.d.ts +341 -0
  103. package/dist/mcp/serverCapabilities.js +502 -0
  104. package/dist/mcp/toolAnnotations.d.ts +154 -0
  105. package/dist/mcp/toolAnnotations.js +239 -0
  106. package/dist/mcp/toolConverter.d.ts +178 -0
  107. package/dist/mcp/toolConverter.js +258 -0
  108. package/dist/mcp/toolIntegration.d.ts +136 -0
  109. package/dist/mcp/toolIntegration.js +334 -0
  110. package/dist/memory/hippocampusInitializer.d.ts +2 -2
  111. package/dist/memory/hippocampusInitializer.js +1 -1
  112. package/dist/neurolink.d.ts +275 -2
  113. package/dist/neurolink.js +596 -56
  114. package/dist/providers/litellm.d.ts +10 -0
  115. package/dist/providers/litellm.js +104 -2
  116. package/dist/types/configTypes.d.ts +56 -0
  117. package/dist/types/conversation.d.ts +2 -2
  118. package/dist/types/generateTypes.d.ts +4 -0
  119. package/dist/types/index.d.ts +2 -1
  120. package/dist/types/streamTypes.d.ts +2 -0
  121. package/dist/types/tools.d.ts +2 -0
  122. package/dist/utils/pricing.js +177 -17
  123. package/dist/utils/schemaConversion.d.ts +6 -1
  124. package/dist/utils/schemaConversion.js +50 -28
  125. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [9.28.0](https://github.com/juspay/neurolink/compare/v9.27.0...v9.28.0) (2026-03-18)
2
+
3
+ ### Features
4
+
5
+ - **(mcp):** add MCP enhancement modules with routing, caching, batching, and wire into core SDK ([ee8a0b8](https://github.com/juspay/neurolink/commit/ee8a0b8e5e33dcafe44d33944bf9ff99ef59701a))
6
+
7
+ ## [9.27.0](https://github.com/juspay/neurolink/compare/v9.26.2...v9.27.0) (2026-03-18)
8
+
9
+ ### Features
10
+
11
+ - **(memory):** add CustomStorageConfig type to Hippocampus integration ([dfcea2b](https://github.com/juspay/neurolink/commit/dfcea2b04834a86812f13c5d85ad3d7b9ab530a7))
12
+
1
13
  ## [9.26.2](https://github.com/juspay/neurolink/compare/v9.26.1...v9.26.2) (2026-03-18)
2
14
 
3
15
  ### Bug Fixes
package/README.md CHANGED
@@ -37,15 +37,20 @@ Extracted from production systems at Juspay and battle-tested at enterprise scal
37
37
 
38
38
  ## What's New (Q1 2026)
39
39
 
40
- | Feature | Version | Description | Guide |
41
- | ----------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
42
- | **External TracerProvider Support** | v8.43.0 | Integrate NeuroLink with existing OpenTelemetry instrumentation. Prevents duplicate registration conflicts. | [Observability Guide](docs/features/observability.md) |
43
- | **Server Adapters** | v8.43.0 | Multi-framework HTTP server with Hono, Express, Fastify, Koa support. Full CLI for server management with foreground/background modes. | [Server Adapters Guide](docs/guides/server-adapters/index.md) |
44
- | **Title Generation Events** | v8.38.0 | Emit `conversation:titleGenerated` event when conversation title is generated. Supports custom title prompts via `NEUROLINK_TITLE_PROMPT`. | [Conversation Memory Guide](docs/conversation-memory.md) |
45
- | **Video Generation with Veo** | v8.32.0 | Video generation using Veo 3.1 (`veo-3.1`). Realistic video generation with many parameter options | [Video Generation Guide](docs/features/video-generation.md) |
46
- | **Image Generation with Gemini** | v8.31.0 | Native image generation using Gemini 2.0 Flash Experimental (`imagen-3.0-generate-002`). High-quality image synthesis directly from Google AI. | [Image Generation Guide](docs/image-generation-streaming.md) |
47
- | **RAG with generate()/stream()** | v9.2.0 | Pass `rag: { files }` to generate/stream for automatic document chunking, embedding, and AI-powered search. 10 chunking strategies, hybrid search, reranking. | [RAG Guide](docs/features/rag.md) |
48
- | **HTTP/Streamable HTTP Transport** | v8.29.0 | Connect to remote MCP servers via HTTP with authentication headers, automatic retry with exponential backoff, and configurable rate limiting. | [HTTP Transport Guide](docs/mcp-http-transport.md) |
40
+ | Feature | Version | Description | Guide |
41
+ | ----------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
42
+ | **MCP Enhancements** | v9.16.0 | Advanced MCP features: tool routing, result caching, request batching, annotations, elicitation, custom server base, multi-server management | [MCP Enhancements Guide](docs/features/mcp-enhancements.md) |
43
+ | **Memory** | v9.12.0 | Per-user condensed memory that persists across conversations. LLM-powered condensation with S3, Redis, or SQLite backends. | [Memory Guide](docs/features/memory.md) |
44
+ | **Context Window Management** | v9.2.0 | 4-stage compaction pipeline with auto-detection, budget gate at 80% usage, per-provider token estimation | [Context Compaction Guide](docs/features/context-compaction.md) |
45
+ | **Tool Execution Control** | v9.3.0 | `prepareStep` and `toolChoice` support for per-step tool enforcement in multi-step agentic loops. API-level control over tool calls. | [API Reference](docs/api/type-aliases/GenerateOptions.md#preparestep) |
46
+ | **File Processor System** | v9.1.0 | 17+ file type processors with ProcessorRegistry, security sanitization, SVG text injection | [File Processors Guide](docs/features/file-processors.md) |
47
+ | **RAG with generate()/stream()** | v9.2.0 | Pass `rag: { files }` to generate/stream for automatic document chunking, embedding, and AI-powered search. 10 chunking strategies, hybrid search, reranking. | [RAG Guide](docs/features/rag.md) |
48
+ | **External TracerProvider Support** | v8.43.0 | Integrate NeuroLink with existing OpenTelemetry instrumentation. Prevents duplicate registration conflicts. | [Observability Guide](docs/features/observability.md) |
49
+ | **Server Adapters** | v8.43.0 | Multi-framework HTTP server with Hono, Express, Fastify, Koa support. Full CLI for server management with foreground/background modes. | [Server Adapters Guide](docs/guides/server-adapters/index.md) |
50
+ | **Title Generation Events** | v8.38.0 | Emit `conversation:titleGenerated` event when conversation title is generated. Supports custom title prompts via `NEUROLINK_TITLE_PROMPT`. | [Conversation Memory Guide](docs/conversation-memory.md) |
51
+ | **Video Generation with Veo** | v8.32.0 | Video generation using Veo 3.1 (`veo-3.1`). Realistic video generation with many parameter options | [Video Generation Guide](docs/features/video-generation.md) |
52
+ | **Image Generation with Gemini** | v8.31.0 | Native image generation using Gemini 2.0 Flash Experimental (`imagen-3.0-generate-002`). High-quality image synthesis directly from Google AI. | [Image Generation Guide](docs/image-generation-streaming.md) |
53
+ | **HTTP/Streamable HTTP Transport** | v8.29.0 | Connect to remote MCP servers via HTTP with authentication headers, automatic retry with exponential backoff, and configurable rate limiting. | [HTTP Transport Guide](docs/mcp-http-transport.md) |
49
54
 
50
55
  - **Memory** – Per-user condensed memory that persists across all conversations. Automatically retrieves and stores memory on each `generate()`/`stream()` call. Supports S3, Redis, and SQLite storage with LLM-powered condensation. → [Memory Guide](docs/features/memory.md)
51
56
  - **External TracerProvider Support** – Integrate NeuroLink with applications that already have OpenTelemetry instrumentation. Supports auto-detection and manual configuration. → [Observability Guide](docs/features/observability.md)
@@ -69,6 +74,7 @@ Extracted from production systems at Juspay and battle-tested at enterprise scal
69
74
  - **Human-in-the-loop workflows** – Pause generation for user approval/input before tool execution. → [HITL Guide](docs/features/hitl.md)
70
75
  - **Guardrails middleware** – Block PII, profanity, and unsafe content with built-in filtering. → [Guardrails Guide](docs/features/guardrails.md)
71
76
  - **Context summarization** – Automatic conversation compression for long-running sessions. → [Summarization Guide](docs/context-summarization.md)
77
+ - **MCP Enhancements** – 14 production-grade modules: tool routing (6 strategies), result caching (LRU/FIFO/LFU), request batching, tool annotations with auto-inference, middleware chain, elicitation protocol, multi-server management, and more. → [MCP Enhancements Guide](docs/features/mcp-enhancements.md)
72
78
  - **Redis conversation export** – Export full session history as JSON for analytics and debugging. → [History Guide](docs/features/conversation-history.md)
73
79
 
74
80
  ```typescript
@@ -233,6 +239,50 @@ const result = await neurolink.generate({
233
239
 
234
240
  ---
235
241
 
242
+ ### 🔌 MCP Enhancements
243
+
244
+ **Production-grade MCP capabilities** for managing tool calls at scale across multi-server environments:
245
+
246
+ | Module | Purpose |
247
+ | ----------------------------- | ---------------------------------------------------------- |
248
+ | **Tool Router** | Intelligent routing across servers with 6 strategies |
249
+ | **Tool Cache** | Result caching with LRU, FIFO, and LFU eviction |
250
+ | **Request Batcher** | Automatic batching of tool calls for throughput |
251
+ | **Tool Annotations** | Safety metadata and behavior hints for MCP tools |
252
+ | **Tool Converter** | Bidirectional conversion between NeuroLink and MCP formats |
253
+ | **Elicitation Protocol** | Interactive user input during tool execution (HITL) |
254
+ | **Multi-Server Manager** | Load balancing and failover across server groups |
255
+ | **MCP Server Base** | Abstract base class for building custom MCP servers |
256
+ | **Enhanced Tool Discovery** | Advanced search and filtering across servers |
257
+ | **Agent & Workflow Exposure** | Expose agents and workflows as MCP tools |
258
+ | **Server Capabilities** | Resource and prompt management per MCP spec |
259
+ | **Registry Client** | Discover and connect to MCP servers from registries |
260
+ | **Tool Integration** | End-to-end tool lifecycle with middleware chain |
261
+ | **Elicitation Manager** | Manages elicitation flows with validation and timeouts |
262
+
263
+ ```typescript
264
+ import { ToolRouter, ToolCache, RequestBatcher } from "@juspay/neurolink";
265
+
266
+ // Route tool calls across multiple MCP servers
267
+ const router = new ToolRouter({
268
+ strategy: "capability-based",
269
+ servers: [
270
+ { name: "github", url: "https://mcp-github.example.com" },
271
+ { name: "db", url: "https://mcp-postgres.example.com" },
272
+ ],
273
+ });
274
+
275
+ // Cache repeated tool results (LRU, FIFO, or LFU)
276
+ const cache = new ToolCache({ strategy: "lru", maxSize: 500, ttl: 60_000 });
277
+
278
+ // Batch concurrent tool calls for throughput
279
+ const batcher = new RequestBatcher({ maxBatchSize: 10, maxWaitMs: 50 });
280
+ ```
281
+
282
+ **[📖 MCP Enhancements Guide](docs/features/mcp-enhancements.md)** - Full reference for all 14 modules
283
+
284
+ ---
285
+
236
286
  ### 💻 Developer Experience Features
237
287
 
238
288
  **SDK-First Design** with TypeScript, IntelliSense, and type safety:
@@ -247,8 +247,8 @@ declare const ConfigSchema: z.ZodObject<{
247
247
  enableEvaluationByDefault: z.ZodDefault<z.ZodBoolean>;
248
248
  }, "strip", z.ZodTypeAny, {
249
249
  temperature: number;
250
- outputFormat: "text" | "json" | "yaml";
251
250
  enableLogging: boolean;
251
+ outputFormat: "text" | "json" | "yaml";
252
252
  enableCaching: boolean;
253
253
  cacheStrategy: "memory" | "redis" | "file";
254
254
  enableAnalyticsByDefault: boolean;
@@ -258,8 +258,8 @@ declare const ConfigSchema: z.ZodObject<{
258
258
  }, {
259
259
  temperature?: number | undefined;
260
260
  maxTokens?: number | undefined;
261
- outputFormat?: "text" | "json" | "yaml" | undefined;
262
261
  enableLogging?: boolean | undefined;
262
+ outputFormat?: "text" | "json" | "yaml" | undefined;
263
263
  enableCaching?: boolean | undefined;
264
264
  cacheStrategy?: "memory" | "redis" | "file" | undefined;
265
265
  defaultEvaluationDomain?: string | undefined;
@@ -509,8 +509,8 @@ declare const ConfigSchema: z.ZodObject<{
509
509
  profiles: Record<string, any>;
510
510
  preferences: {
511
511
  temperature: number;
512
- outputFormat: "text" | "json" | "yaml";
513
512
  enableLogging: boolean;
513
+ outputFormat: "text" | "json" | "yaml";
514
514
  enableCaching: boolean;
515
515
  cacheStrategy: "memory" | "redis" | "file";
516
516
  enableAnalyticsByDefault: boolean;
@@ -608,8 +608,8 @@ declare const ConfigSchema: z.ZodObject<{
608
608
  preferences?: {
609
609
  temperature?: number | undefined;
610
610
  maxTokens?: number | undefined;
611
- outputFormat?: "text" | "json" | "yaml" | undefined;
612
611
  enableLogging?: boolean | undefined;
612
+ outputFormat?: "text" | "json" | "yaml" | undefined;
613
613
  enableCaching?: boolean | undefined;
614
614
  cacheStrategy?: "memory" | "redis" | "file" | undefined;
615
615
  defaultEvaluationDomain?: string | undefined;
@@ -2,6 +2,13 @@
2
2
  * MCP CLI Commands for NeuroLink
3
3
  * Implements comprehensive MCP server management commands
4
4
  * Part of Phase 4.2 - MCP CLI Commands
5
+ *
6
+ * Enhanced in Phase 8.39.0 with:
7
+ * - neurolink mcp servers - List all MCP servers
8
+ * - neurolink mcp tools - List all available tools
9
+ * - neurolink mcp discover - Enhanced tool discovery
10
+ * - neurolink mcp create-server - Scaffold a new MCP server
11
+ * - neurolink mcp annotate - Add/update tool annotations
5
12
  */
6
13
  import type { CommandModule } from "yargs";
7
14
  /**
@@ -76,4 +83,84 @@ export declare class MCPCommandFactory {
76
83
  * Discover servers from VS Code configuration
77
84
  */
78
85
  private static discoverFromVSCode;
86
+ /**
87
+ * Build options for servers command
88
+ */
89
+ private static buildServersOptions;
90
+ /**
91
+ * Build options for tools command
92
+ */
93
+ private static buildToolsOptions;
94
+ /**
95
+ * Build options for discover tools command
96
+ */
97
+ private static buildDiscoverToolsOptions;
98
+ /**
99
+ * Build options for create-server command
100
+ */
101
+ private static buildCreateServerOptions;
102
+ /**
103
+ * Execute servers command
104
+ */
105
+ private static executeServers;
106
+ /**
107
+ * Execute tools command
108
+ */
109
+ private static executeTools;
110
+ /**
111
+ * Execute discover tools command
112
+ */
113
+ private static executeDiscoverTools;
114
+ /**
115
+ * Execute create-server command
116
+ */
117
+ private static executeCreateServer;
118
+ /**
119
+ * Generate TypeScript MCP server
120
+ */
121
+ private static generateTypeScriptServer;
122
+ /**
123
+ * Generate Python MCP server
124
+ */
125
+ private static generatePythonServer;
126
+ /**
127
+ * Generate basic JavaScript MCP server
128
+ */
129
+ private static generateBasicServer;
130
+ /**
131
+ * Infer tool category from name and description
132
+ */
133
+ private static inferToolCategory;
134
+ /**
135
+ * Create the registry subcommand
136
+ */
137
+ static createRegistryCommand(): CommandModule;
138
+ /**
139
+ * Execute registry search
140
+ */
141
+ private static executeRegistrySearch;
142
+ /**
143
+ * Execute registry list
144
+ */
145
+ private static executeRegistryList;
146
+ /**
147
+ * Execute registry info
148
+ */
149
+ private static executeRegistryInfo;
150
+ /**
151
+ * Execute registry categories
152
+ */
153
+ private static executeRegistryCategories;
154
+ /**
155
+ * Execute registry popular
156
+ */
157
+ private static executeRegistryPopular;
158
+ /**
159
+ * Build options for annotate command
160
+ */
161
+ private static buildAnnotateOptions;
162
+ /**
163
+ * Execute annotate command
164
+ */
165
+ private static executeAnnotate;
79
166
  }