@juspay/neurolink 1.10.0 → 1.11.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 (144) hide show
  1. package/CHANGELOG.md +36 -33
  2. package/README.md +16 -0
  3. package/dist/agent/direct-tools.d.ts +9 -9
  4. package/dist/cli/commands/agent-generate.d.ts +1 -2
  5. package/dist/cli/commands/agent-generate.js +5 -8
  6. package/dist/cli/commands/config.d.ts +2 -2
  7. package/dist/cli/commands/config.js +1 -1
  8. package/dist/cli/commands/mcp.js +91 -100
  9. package/dist/cli/commands/ollama.d.ts +2 -7
  10. package/dist/cli/commands/ollama.js +5 -8
  11. package/dist/cli/index.js +185 -276
  12. package/dist/core/factory.js +9 -10
  13. package/dist/index.d.ts +23 -0
  14. package/dist/index.js +35 -0
  15. package/dist/lib/agent/direct-tools.d.ts +9 -9
  16. package/dist/lib/core/factory.js +9 -10
  17. package/dist/lib/index.d.ts +23 -0
  18. package/dist/lib/index.js +35 -0
  19. package/dist/lib/mcp/adapters/plugin-bridge.d.ts +39 -0
  20. package/dist/lib/mcp/adapters/plugin-bridge.js +82 -0
  21. package/dist/lib/mcp/auto-discovery.d.ts +38 -96
  22. package/dist/lib/mcp/auto-discovery.js +100 -744
  23. package/dist/lib/mcp/client.js +4 -4
  24. package/dist/lib/mcp/context-manager.js +72 -1
  25. package/dist/lib/mcp/contracts/mcp-contract.d.ts +162 -0
  26. package/dist/lib/mcp/contracts/mcp-contract.js +58 -0
  27. package/dist/lib/mcp/core/plugin-manager.d.ts +45 -0
  28. package/dist/lib/mcp/core/plugin-manager.js +110 -0
  29. package/dist/lib/mcp/demo/plugin-demo.d.ts +20 -0
  30. package/dist/lib/mcp/demo/plugin-demo.js +116 -0
  31. package/dist/lib/mcp/ecosystem.d.ts +75 -0
  32. package/dist/lib/mcp/ecosystem.js +161 -0
  33. package/dist/lib/mcp/external-client.d.ts +88 -0
  34. package/dist/lib/mcp/external-client.js +323 -0
  35. package/dist/lib/mcp/external-manager.d.ts +112 -0
  36. package/dist/lib/mcp/external-manager.js +302 -0
  37. package/dist/lib/mcp/factory.d.ts +4 -4
  38. package/dist/lib/mcp/function-calling.js +59 -34
  39. package/dist/lib/mcp/index.d.ts +39 -184
  40. package/dist/lib/mcp/index.js +72 -150
  41. package/dist/lib/mcp/initialize.js +5 -5
  42. package/dist/lib/mcp/logging.d.ts +27 -60
  43. package/dist/lib/mcp/logging.js +77 -165
  44. package/dist/lib/mcp/neurolink-mcp-client.js +31 -3
  45. package/dist/lib/mcp/orchestrator.d.ts +1 -1
  46. package/dist/lib/mcp/orchestrator.js +13 -12
  47. package/dist/lib/mcp/plugin-manager.d.ts +98 -0
  48. package/dist/lib/mcp/plugin-manager.js +294 -0
  49. package/dist/lib/mcp/plugins/core/filesystem-mcp.d.ts +35 -0
  50. package/dist/lib/mcp/plugins/core/filesystem-mcp.js +139 -0
  51. package/dist/lib/mcp/plugins/filesystem-mcp.d.ts +36 -0
  52. package/dist/lib/mcp/plugins/filesystem-mcp.js +54 -0
  53. package/dist/lib/mcp/registry.d.ts +27 -176
  54. package/dist/lib/mcp/registry.js +31 -372
  55. package/dist/lib/mcp/security-manager.d.ts +85 -0
  56. package/dist/lib/mcp/security-manager.js +344 -0
  57. package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
  58. package/dist/lib/mcp/tool-integration.d.ts +4 -14
  59. package/dist/lib/mcp/tool-integration.js +43 -21
  60. package/dist/lib/mcp/tool-registry.d.ts +66 -0
  61. package/dist/lib/mcp/tool-registry.js +160 -0
  62. package/dist/lib/mcp/unified-mcp.d.ts +123 -0
  63. package/dist/lib/mcp/unified-mcp.js +246 -0
  64. package/dist/lib/mcp/unified-registry.d.ts +42 -229
  65. package/dist/lib/mcp/unified-registry.js +96 -1346
  66. package/dist/lib/neurolink.d.ts +3 -4
  67. package/dist/lib/neurolink.js +17 -18
  68. package/dist/lib/providers/agent-enhanced-provider.js +2 -2
  69. package/dist/lib/providers/amazonBedrock.js +2 -2
  70. package/dist/lib/providers/anthropic.js +3 -3
  71. package/dist/lib/providers/azureOpenAI.js +3 -3
  72. package/dist/lib/providers/function-calling-provider.js +34 -25
  73. package/dist/lib/providers/googleAIStudio.js +3 -3
  74. package/dist/lib/providers/googleVertexAI.js +2 -2
  75. package/dist/lib/providers/huggingFace.js +2 -2
  76. package/dist/lib/providers/mcp-provider.js +33 -5
  77. package/dist/lib/providers/mistralAI.js +2 -2
  78. package/dist/lib/providers/ollama.js +2 -2
  79. package/dist/lib/providers/openAI.js +2 -2
  80. package/dist/lib/utils/providerUtils-fixed.js +9 -9
  81. package/dist/mcp/adapters/plugin-bridge.d.ts +39 -0
  82. package/dist/mcp/adapters/plugin-bridge.js +82 -0
  83. package/dist/mcp/auto-discovery.d.ts +38 -96
  84. package/dist/mcp/auto-discovery.js +100 -745
  85. package/dist/mcp/client.js +4 -4
  86. package/dist/mcp/context-manager.js +72 -1
  87. package/dist/mcp/contracts/mcp-contract.d.ts +162 -0
  88. package/dist/mcp/contracts/mcp-contract.js +58 -0
  89. package/dist/mcp/core/plugin-manager.d.ts +45 -0
  90. package/dist/mcp/core/plugin-manager.js +110 -0
  91. package/dist/mcp/demo/plugin-demo.d.ts +20 -0
  92. package/dist/mcp/demo/plugin-demo.js +116 -0
  93. package/dist/mcp/ecosystem.d.ts +75 -0
  94. package/dist/mcp/ecosystem.js +162 -0
  95. package/dist/mcp/external-client.d.ts +88 -0
  96. package/dist/mcp/external-client.js +323 -0
  97. package/dist/mcp/external-manager.d.ts +112 -0
  98. package/dist/mcp/external-manager.js +302 -0
  99. package/dist/mcp/factory.d.ts +4 -4
  100. package/dist/mcp/function-calling.js +59 -34
  101. package/dist/mcp/index.d.ts +39 -184
  102. package/dist/mcp/index.js +72 -150
  103. package/dist/mcp/initialize.js +5 -5
  104. package/dist/mcp/logging.d.ts +27 -60
  105. package/dist/mcp/logging.js +77 -165
  106. package/dist/mcp/neurolink-mcp-client.js +31 -3
  107. package/dist/mcp/orchestrator.d.ts +1 -1
  108. package/dist/mcp/orchestrator.js +13 -12
  109. package/dist/mcp/plugin-manager.d.ts +98 -0
  110. package/dist/mcp/plugin-manager.js +295 -0
  111. package/dist/mcp/plugins/core/filesystem-mcp.d.ts +35 -0
  112. package/dist/mcp/plugins/core/filesystem-mcp.js +139 -0
  113. package/dist/mcp/plugins/core/neurolink-mcp.json +17 -0
  114. package/dist/mcp/plugins/filesystem-mcp.d.ts +36 -0
  115. package/dist/mcp/plugins/filesystem-mcp.js +54 -0
  116. package/dist/mcp/registry.d.ts +27 -176
  117. package/dist/mcp/registry.js +31 -372
  118. package/dist/mcp/security-manager.d.ts +85 -0
  119. package/dist/mcp/security-manager.js +344 -0
  120. package/dist/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
  121. package/dist/mcp/tool-integration.d.ts +4 -14
  122. package/dist/mcp/tool-integration.js +43 -21
  123. package/dist/mcp/tool-registry.d.ts +66 -0
  124. package/dist/mcp/tool-registry.js +160 -0
  125. package/dist/mcp/unified-mcp.d.ts +123 -0
  126. package/dist/mcp/unified-mcp.js +246 -0
  127. package/dist/mcp/unified-registry.d.ts +42 -229
  128. package/dist/mcp/unified-registry.js +96 -1345
  129. package/dist/neurolink.d.ts +3 -4
  130. package/dist/neurolink.js +17 -18
  131. package/dist/providers/agent-enhanced-provider.js +2 -2
  132. package/dist/providers/amazonBedrock.js +2 -2
  133. package/dist/providers/anthropic.js +3 -3
  134. package/dist/providers/azureOpenAI.js +3 -3
  135. package/dist/providers/function-calling-provider.js +34 -25
  136. package/dist/providers/googleAIStudio.js +3 -3
  137. package/dist/providers/googleVertexAI.js +2 -2
  138. package/dist/providers/huggingFace.js +2 -2
  139. package/dist/providers/mcp-provider.js +33 -5
  140. package/dist/providers/mistralAI.js +2 -2
  141. package/dist/providers/ollama.js +2 -2
  142. package/dist/providers/openAI.js +2 -2
  143. package/dist/utils/providerUtils-fixed.js +9 -9
  144. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -54,3 +54,26 @@ export declare function createAIProviderWithFallback(primaryProvider?: string, f
54
54
  * ```
55
55
  */
56
56
  export declare function createBestAIProvider(requestedProvider?: string, modelName?: string): Promise<import("./core/types.js").AIProvider>;
57
+ /**
58
+ * MCP (Model Context Protocol) Plugin Ecosystem
59
+ *
60
+ * Extensible plugin architecture based on research blueprint for
61
+ * transforming NeuroLink into a Universal AI Development Platform.
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * import { mcpEcosystem, readFile, writeFile } from 'neurolink';
66
+ *
67
+ * // Initialize the ecosystem
68
+ * await mcpEcosystem.initialize();
69
+ *
70
+ * // List available plugins
71
+ * const plugins = await mcpEcosystem.list();
72
+ *
73
+ * // Use filesystem operations
74
+ * const content = await readFile('README.md');
75
+ * await writeFile('output.txt', 'Hello from MCP!');
76
+ * ```
77
+ */
78
+ export { MCPEcosystem, mcpEcosystem, initializeMCPEcosystem, PluginManager, pluginManager, listMCPs, executeMCP, getMCPStats, readFile, writeFile, listFiles, createDirectory, MCP, SecurityManager, mcpLogger, FileSystemMCP, } from "./mcp/index.js";
79
+ export type { MCPMetadata, ExecutionContext, MCPConstructor, MCPInstance, DiscoveredMCP, LogLevel, } from "./mcp/index.js";
package/dist/index.js CHANGED
@@ -60,3 +60,38 @@ export async function createAIProviderWithFallback(primaryProvider, fallbackProv
60
60
  export async function createBestAIProvider(requestedProvider, modelName) {
61
61
  return await AIProviderFactory.createBestProvider(requestedProvider, modelName);
62
62
  }
63
+ // ============================================================================
64
+ // MCP PLUGIN ECOSYSTEM - Universal AI Development Platform
65
+ // ============================================================================
66
+ /**
67
+ * MCP (Model Context Protocol) Plugin Ecosystem
68
+ *
69
+ * Extensible plugin architecture based on research blueprint for
70
+ * transforming NeuroLink into a Universal AI Development Platform.
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * import { mcpEcosystem, readFile, writeFile } from 'neurolink';
75
+ *
76
+ * // Initialize the ecosystem
77
+ * await mcpEcosystem.initialize();
78
+ *
79
+ * // List available plugins
80
+ * const plugins = await mcpEcosystem.list();
81
+ *
82
+ * // Use filesystem operations
83
+ * const content = await readFile('README.md');
84
+ * await writeFile('output.txt', 'Hello from MCP!');
85
+ * ```
86
+ */
87
+ export {
88
+ // Core MCP ecosystem
89
+ MCPEcosystem, mcpEcosystem, initializeMCPEcosystem,
90
+ // Plugin management
91
+ PluginManager, pluginManager, listMCPs, executeMCP, getMCPStats,
92
+ // Quick filesystem operations
93
+ readFile, writeFile, listFiles, createDirectory,
94
+ // Core contracts and types
95
+ MCP, SecurityManager, mcpLogger,
96
+ // Core plugins
97
+ FileSystemMCP, } from "./mcp/index.js";
@@ -280,12 +280,12 @@ export declare const directAgentTools: {
280
280
  pattern: z.ZodString;
281
281
  recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
282
282
  }, "strip", z.ZodTypeAny, {
283
- pattern: string;
284
283
  directory: string;
284
+ pattern: string;
285
285
  recursive: boolean;
286
286
  }, {
287
- pattern: string;
288
287
  directory: string;
288
+ pattern: string;
289
289
  recursive?: boolean | undefined;
290
290
  }>, {
291
291
  success: boolean;
@@ -315,8 +315,8 @@ export declare const directAgentTools: {
315
315
  count?: undefined;
316
316
  }> & {
317
317
  execute: (args: {
318
- pattern: string;
319
318
  directory: string;
319
+ pattern: string;
320
320
  recursive: boolean;
321
321
  }, options: import("ai").ToolExecutionOptions) => PromiseLike<{
322
322
  success: boolean;
@@ -623,12 +623,12 @@ export declare function getToolsForCategory(category?: "basic" | "filesystem" |
623
623
  pattern: z.ZodString;
624
624
  recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
625
625
  }, "strip", z.ZodTypeAny, {
626
- pattern: string;
627
626
  directory: string;
627
+ pattern: string;
628
628
  recursive: boolean;
629
629
  }, {
630
- pattern: string;
631
630
  directory: string;
631
+ pattern: string;
632
632
  recursive?: boolean | undefined;
633
633
  }>, {
634
634
  success: boolean;
@@ -658,8 +658,8 @@ export declare function getToolsForCategory(category?: "basic" | "filesystem" |
658
658
  count?: undefined;
659
659
  }> & {
660
660
  execute: (args: {
661
- pattern: string;
662
661
  directory: string;
662
+ pattern: string;
663
663
  recursive: boolean;
664
664
  }, options: import("ai").ToolExecutionOptions) => PromiseLike<{
665
665
  success: boolean;
@@ -967,12 +967,12 @@ export declare function getToolsForCategory(category?: "basic" | "filesystem" |
967
967
  pattern: z.ZodString;
968
968
  recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
969
969
  }, "strip", z.ZodTypeAny, {
970
- pattern: string;
971
970
  directory: string;
971
+ pattern: string;
972
972
  recursive: boolean;
973
973
  }, {
974
- pattern: string;
975
974
  directory: string;
975
+ pattern: string;
976
976
  recursive?: boolean | undefined;
977
977
  }>, {
978
978
  success: boolean;
@@ -1002,8 +1002,8 @@ export declare function getToolsForCategory(category?: "basic" | "filesystem" |
1002
1002
  count?: undefined;
1003
1003
  }> & {
1004
1004
  execute: (args: {
1005
- pattern: string;
1006
1005
  directory: string;
1006
+ pattern: string;
1007
1007
  recursive: boolean;
1008
1008
  }, options: import("ai").ToolExecutionOptions) => PromiseLike<{
1009
1009
  success: boolean;
@@ -157,16 +157,15 @@ export class AIProviderFactory {
157
157
  // Wrap with MCP if enabled
158
158
  if (enableMCP) {
159
159
  try {
160
- // TEMPORARY: Disable MCP wrapping to test for hanging issues
161
- logger.debug(`[${functionTag}] MCP wrapping temporarily disabled for debugging`);
162
- // const { createMCPAwareProviderV3 } = await import("../providers/function-calling-provider.js");
163
- // provider = createMCPAwareProviderV3(provider, {
164
- // providerName,
165
- // modelName: resolvedModelName || undefined,
166
- // enableMCP: true,
167
- // enableFunctionCalling: true,
168
- // });
169
- // logger.debug(`[${functionTag}] Provider wrapped with MCP support`);
160
+ logger.debug(`[${functionTag}] Enabling MCP wrapping for AI integration`);
161
+ const { createMCPAwareProviderV3 } = await import("../providers/function-calling-provider.js");
162
+ provider = createMCPAwareProviderV3(provider, {
163
+ providerName,
164
+ modelName: resolvedModelName || undefined,
165
+ enableMCP: true,
166
+ enableFunctionCalling: true,
167
+ });
168
+ logger.debug(`[${functionTag}] Provider wrapped with MCP support`);
170
169
  }
171
170
  catch (mcpError) {
172
171
  logger.warn(`[${functionTag}] Failed to wrap with MCP, using base provider`, {
@@ -54,3 +54,26 @@ export declare function createAIProviderWithFallback(primaryProvider?: string, f
54
54
  * ```
55
55
  */
56
56
  export declare function createBestAIProvider(requestedProvider?: string, modelName?: string): Promise<import("./index.js").AIProvider>;
57
+ /**
58
+ * MCP (Model Context Protocol) Plugin Ecosystem
59
+ *
60
+ * Extensible plugin architecture based on research blueprint for
61
+ * transforming NeuroLink into a Universal AI Development Platform.
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * import { mcpEcosystem, readFile, writeFile } from 'neurolink';
66
+ *
67
+ * // Initialize the ecosystem
68
+ * await mcpEcosystem.initialize();
69
+ *
70
+ * // List available plugins
71
+ * const plugins = await mcpEcosystem.list();
72
+ *
73
+ * // Use filesystem operations
74
+ * const content = await readFile('README.md');
75
+ * await writeFile('output.txt', 'Hello from MCP!');
76
+ * ```
77
+ */
78
+ export { MCPEcosystem, mcpEcosystem, initializeMCPEcosystem, PluginManager, pluginManager, listMCPs, executeMCP, getMCPStats, readFile, writeFile, listFiles, createDirectory, MCP, SecurityManager, mcpLogger, FileSystemMCP, } from "./mcp/index.js";
79
+ export type { MCPMetadata, ExecutionContext, MCPConstructor, MCPInstance, DiscoveredMCP, LogLevel, } from "./mcp/index.js";
package/dist/lib/index.js CHANGED
@@ -60,3 +60,38 @@ export async function createAIProviderWithFallback(primaryProvider, fallbackProv
60
60
  export async function createBestAIProvider(requestedProvider, modelName) {
61
61
  return await AIProviderFactory.createBestProvider(requestedProvider, modelName);
62
62
  }
63
+ // ============================================================================
64
+ // MCP PLUGIN ECOSYSTEM - Universal AI Development Platform
65
+ // ============================================================================
66
+ /**
67
+ * MCP (Model Context Protocol) Plugin Ecosystem
68
+ *
69
+ * Extensible plugin architecture based on research blueprint for
70
+ * transforming NeuroLink into a Universal AI Development Platform.
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * import { mcpEcosystem, readFile, writeFile } from 'neurolink';
75
+ *
76
+ * // Initialize the ecosystem
77
+ * await mcpEcosystem.initialize();
78
+ *
79
+ * // List available plugins
80
+ * const plugins = await mcpEcosystem.list();
81
+ *
82
+ * // Use filesystem operations
83
+ * const content = await readFile('README.md');
84
+ * await writeFile('output.txt', 'Hello from MCP!');
85
+ * ```
86
+ */
87
+ export {
88
+ // Core MCP ecosystem
89
+ MCPEcosystem, mcpEcosystem, initializeMCPEcosystem,
90
+ // Plugin management
91
+ PluginManager, pluginManager, listMCPs, executeMCP, getMCPStats,
92
+ // Quick filesystem operations
93
+ readFile, writeFile, listFiles, createDirectory,
94
+ // Core contracts and types
95
+ MCP, SecurityManager, mcpLogger,
96
+ // Core plugins
97
+ FileSystemMCP, } from "./mcp/index.js";
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Plugin Bridge Adapter
3
+ * Provides compatibility layer for existing MCP integrations
4
+ */
5
+ import type { ExecutionContext } from "../contracts/mcp-contract.js";
6
+ /**
7
+ * Bridge interface for legacy MCP compatibility
8
+ */
9
+ export interface LegacyMCPBridge {
10
+ writeFile: (filePath: string, content: string) => Promise<void>;
11
+ readFile: (filePath: string) => Promise<string>;
12
+ listFiles: (dirPath: string) => Promise<string[]>;
13
+ }
14
+ /**
15
+ * Create a bridge for legacy MCP integrations
16
+ */
17
+ export declare function createLegacyBridge(context: ExecutionContext): LegacyMCPBridge;
18
+ /**
19
+ * Enhanced execution context with bridge compatibility
20
+ */
21
+ export declare function enhanceExecutionContext(context: ExecutionContext): ExecutionContext;
22
+ /**
23
+ * Utility function to adapt legacy MCP calls
24
+ */
25
+ export declare function adaptLegacyMCPCall(context: ExecutionContext, operation: string, ...args: any[]): Promise<any>;
26
+ /**
27
+ * Quick plugin factory for simple plugin creation
28
+ */
29
+ export declare class QuickPluginFactory {
30
+ static create(name: string, config: any): Promise<{
31
+ name: string;
32
+ config: any;
33
+ initialized: boolean;
34
+ }>;
35
+ }
36
+ /**
37
+ * Execute plugin with enhanced context
38
+ */
39
+ export declare function executePlugin(plugin: any, context: ExecutionContext, operation: string, ...args: any[]): Promise<any>;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Plugin Bridge Adapter
3
+ * Provides compatibility layer for existing MCP integrations
4
+ */
5
+ import * as path from "path";
6
+ /**
7
+ * Create a bridge for legacy MCP integrations
8
+ */
9
+ export function createLegacyBridge(context) {
10
+ const basePath = process.cwd();
11
+ return {
12
+ async writeFile(filePath, content) {
13
+ const fullPath = path.resolve(basePath, filePath);
14
+ await context.secureFS.writeFile(fullPath, content);
15
+ },
16
+ async readFile(filePath) {
17
+ const fullPath = path.resolve(basePath, filePath);
18
+ const result = await context.secureFS.readFile(fullPath, "utf-8");
19
+ return typeof result === "string" ? result : result.toString();
20
+ },
21
+ async listFiles(dirPath) {
22
+ const fullPath = path.resolve(basePath, dirPath);
23
+ return await context.secureFS.readdir(fullPath);
24
+ },
25
+ };
26
+ }
27
+ /**
28
+ * Enhanced execution context with bridge compatibility
29
+ */
30
+ export function enhanceExecutionContext(context) {
31
+ return {
32
+ ...context,
33
+ path: {
34
+ join: path.join,
35
+ resolve: path.resolve,
36
+ relative: path.relative,
37
+ dirname: path.dirname,
38
+ basename: path.basename,
39
+ },
40
+ plugin: createLegacyBridge(context),
41
+ };
42
+ }
43
+ /**
44
+ * Utility function to adapt legacy MCP calls
45
+ */
46
+ export async function adaptLegacyMCPCall(context, operation, ...args) {
47
+ const bridge = createLegacyBridge(context);
48
+ switch (operation) {
49
+ case "writeFile":
50
+ return bridge.writeFile(args[0], args[1]);
51
+ case "readFile":
52
+ return bridge.readFile(args[0]);
53
+ case "listFiles":
54
+ return bridge.listFiles(args[0]);
55
+ default:
56
+ throw new Error(`Unsupported legacy operation: ${operation}`);
57
+ }
58
+ }
59
+ /**
60
+ * Quick plugin factory for simple plugin creation
61
+ */
62
+ export class QuickPluginFactory {
63
+ static async create(name, config) {
64
+ // Simple factory implementation
65
+ return {
66
+ name,
67
+ config,
68
+ initialized: true,
69
+ };
70
+ }
71
+ }
72
+ /**
73
+ * Execute plugin with enhanced context
74
+ */
75
+ export async function executePlugin(plugin, context, operation, ...args) {
76
+ const enhancedContext = enhanceExecutionContext(context);
77
+ if (typeof plugin.execute === "function") {
78
+ return plugin.execute(enhancedContext, { operation, args });
79
+ }
80
+ // Fallback to legacy adaptation
81
+ return adaptLegacyMCPCall(enhancedContext, operation, ...args);
82
+ }
@@ -1,120 +1,62 @@
1
1
  /**
2
- * NeuroLink MCP Auto-Discovery System
3
- * Automatically discovers MCP servers from common configuration locations across different tools
4
- * Supports VS Code, Cursor, Claude Desktop, Windsurf, Roo Code, and generic configurations
2
+ * Auto-Discovery Module for MCP Plugins
3
+ * Handles automatic plugin discovery and registration
5
4
  */
6
- import { MCPToolRegistry } from "./registry.js";
5
+ import type { DiscoveredMCP } from "./contracts/mcp-contract.js";
7
6
  /**
8
- * Discovered MCP server configuration
7
+ * Auto-discovery configuration
9
8
  */
10
- export interface DiscoveredMCPServer {
11
- id: string;
12
- title: string;
13
- command: string;
14
- args?: string[];
15
- env?: Record<string, string>;
16
- cwd?: string;
17
- source: DiscoverySource;
18
- configPath: string;
19
- rawConfig: any;
9
+ interface AutoDiscoveryConfig {
10
+ searchPaths: string[];
11
+ manifestName: string;
12
+ maxDepth: number;
20
13
  }
21
14
  /**
22
- * Discovery source information
15
+ * Auto-discovery service for MCP plugins
23
16
  */
24
- export interface DiscoverySource {
25
- tool: string;
26
- type: "global" | "workspace" | "project";
27
- priority: number;
28
- description: string;
29
- }
30
- /**
31
- * Discovery configuration options
32
- */
33
- export interface DiscoveryOptions {
34
- searchWorkspace?: boolean;
35
- searchGlobal?: boolean;
36
- searchCommonPaths?: boolean;
37
- followSymlinks?: boolean;
38
- maxDepth?: number;
39
- includeInactive?: boolean;
40
- preferredTools?: string[];
41
- }
42
- /**
43
- * Discovery result
44
- */
45
- export interface DiscoveryResult {
46
- discovered: DiscoveredMCPServer[];
47
- sources: DiscoverySource[];
48
- errors: string[];
49
- stats: {
50
- configFilesFound: number;
51
- serversDiscovered: number;
52
- duplicatesRemoved: number;
53
- executionTime: number;
54
- };
55
- }
56
- /**
57
- * MCP Auto-Discovery Engine
58
- */
59
- export declare class MCPAutoDiscovery {
60
- private parsers;
61
- /**
62
- * Discover MCP servers from all common locations
63
- *
64
- * @param options Discovery configuration options
65
- * @returns Discovery result with found servers
66
- */
67
- discoverServers(options?: DiscoveryOptions): Promise<DiscoveryResult>;
68
- /**
69
- * Auto-register discovered servers with a registry
70
- *
71
- * @param registry Target MCP registry
72
- * @param options Discovery options
73
- * @returns Registration results
74
- */
75
- autoRegisterServers(registry: MCPToolRegistry, options?: DiscoveryOptions): Promise<{
76
- registered: string[];
77
- failed: string[];
78
- errors: string[];
79
- }>;
80
- /**
81
- * Get standard search paths for MCP configurations
82
- */
83
- private getSearchPaths;
84
- /**
85
- * Search a specific path for MCP configurations
86
- */
87
- private searchPath;
17
+ export declare class AutoDiscovery {
18
+ private config;
19
+ constructor(config?: Partial<AutoDiscoveryConfig>);
88
20
  /**
89
- * Parse JSON with resilience to common syntax issues
21
+ * Discover all available MCP plugins
90
22
  */
91
- private parseJsonResilient;
23
+ discover(): Promise<DiscoveredMCP[]>;
92
24
  /**
93
- * Remove duplicate servers and apply prioritization
25
+ * Discover plugins in a specific path
94
26
  */
95
- private deduplicateServers;
27
+ private discoverInPath;
96
28
  /**
97
- * Map tool names to valid MCP server categories
29
+ * Load plugin from manifest
98
30
  */
99
- private mapToolToCategory;
31
+ private loadPlugin;
100
32
  /**
101
- * Convert discovered server to NeuroLink MCP server format
33
+ * Determine plugin source based on path
102
34
  */
103
- private convertToMCPServer;
35
+ private determineSource;
104
36
  }
105
37
  /**
106
38
  * Default auto-discovery instance
107
39
  */
108
- export declare const defaultAutoDiscovery: MCPAutoDiscovery;
40
+ export declare const autoDiscovery: AutoDiscovery;
41
+ /**
42
+ * Discovery options interface
43
+ */
44
+ export interface DiscoveryOptions {
45
+ searchPaths?: string[];
46
+ manifestName?: string;
47
+ maxDepth?: number;
48
+ includeDevPlugins?: boolean;
49
+ }
109
50
  /**
110
- * Utility function to discover servers with default instance
51
+ * Discover MCP servers using auto-discovery
111
52
  */
112
- export declare function discoverMCPServers(options?: DiscoveryOptions): Promise<DiscoveryResult>;
53
+ export declare function discoverMCPServers(options?: DiscoveryOptions): Promise<DiscoveredMCP[]>;
113
54
  /**
114
- * Utility function to auto-register discovered servers
55
+ * Auto-register discovered MCP servers
115
56
  */
116
- export declare function autoRegisterMCPServers(registry: MCPToolRegistry, options?: DiscoveryOptions): Promise<{
117
- registered: string[];
118
- failed: string[];
119
- errors: string[];
57
+ export declare function autoRegisterMCPServers(options?: DiscoveryOptions): Promise<{
58
+ registered: number;
59
+ failed: number;
60
+ plugins: DiscoveredMCP[];
120
61
  }>;
62
+ export {};