@juspay/neurolink 1.10.0 → 1.11.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 +43 -33
- package/README.md +16 -0
- package/dist/agent/direct-tools.d.ts +9 -9
- package/dist/cli/commands/agent-generate.d.ts +1 -2
- package/dist/cli/commands/agent-generate.js +5 -8
- package/dist/cli/commands/config.d.ts +2 -2
- package/dist/cli/commands/config.js +1 -1
- package/dist/cli/commands/mcp.js +91 -100
- package/dist/cli/commands/ollama.d.ts +2 -7
- package/dist/cli/commands/ollama.js +5 -8
- package/dist/cli/index.js +185 -276
- package/dist/core/factory.js +9 -10
- package/dist/index.d.ts +23 -0
- package/dist/index.js +35 -0
- package/dist/lib/agent/direct-tools.d.ts +9 -9
- package/dist/lib/core/factory.js +9 -10
- package/dist/lib/index.d.ts +23 -0
- package/dist/lib/index.js +35 -0
- package/dist/lib/mcp/adapters/plugin-bridge.d.ts +39 -0
- package/dist/lib/mcp/adapters/plugin-bridge.js +82 -0
- package/dist/lib/mcp/auto-discovery.d.ts +38 -96
- package/dist/lib/mcp/auto-discovery.js +100 -744
- package/dist/lib/mcp/client.js +4 -4
- package/dist/lib/mcp/context-manager.js +72 -1
- package/dist/lib/mcp/contracts/mcp-contract.d.ts +162 -0
- package/dist/lib/mcp/contracts/mcp-contract.js +58 -0
- package/dist/lib/mcp/core/plugin-manager.d.ts +45 -0
- package/dist/lib/mcp/core/plugin-manager.js +110 -0
- package/dist/lib/mcp/demo/plugin-demo.d.ts +20 -0
- package/dist/lib/mcp/demo/plugin-demo.js +116 -0
- package/dist/lib/mcp/ecosystem.d.ts +75 -0
- package/dist/lib/mcp/ecosystem.js +161 -0
- package/dist/lib/mcp/external-client.d.ts +88 -0
- package/dist/lib/mcp/external-client.js +323 -0
- package/dist/lib/mcp/external-manager.d.ts +112 -0
- package/dist/lib/mcp/external-manager.js +302 -0
- package/dist/lib/mcp/factory.d.ts +4 -4
- package/dist/lib/mcp/function-calling.js +59 -34
- package/dist/lib/mcp/index.d.ts +39 -184
- package/dist/lib/mcp/index.js +72 -150
- package/dist/lib/mcp/initialize.js +5 -5
- package/dist/lib/mcp/logging.d.ts +27 -60
- package/dist/lib/mcp/logging.js +77 -165
- package/dist/lib/mcp/neurolink-mcp-client.js +31 -3
- package/dist/lib/mcp/orchestrator.d.ts +1 -1
- package/dist/lib/mcp/orchestrator.js +13 -12
- package/dist/lib/mcp/plugin-manager.d.ts +98 -0
- package/dist/lib/mcp/plugin-manager.js +294 -0
- package/dist/lib/mcp/plugins/core/filesystem-mcp.d.ts +35 -0
- package/dist/lib/mcp/plugins/core/filesystem-mcp.js +139 -0
- package/dist/lib/mcp/plugins/filesystem-mcp.d.ts +36 -0
- package/dist/lib/mcp/plugins/filesystem-mcp.js +54 -0
- package/dist/lib/mcp/registry.d.ts +27 -176
- package/dist/lib/mcp/registry.js +31 -372
- package/dist/lib/mcp/security-manager.d.ts +85 -0
- package/dist/lib/mcp/security-manager.js +344 -0
- package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
- package/dist/lib/mcp/tool-integration.d.ts +4 -14
- package/dist/lib/mcp/tool-integration.js +43 -21
- package/dist/lib/mcp/tool-registry.d.ts +66 -0
- package/dist/lib/mcp/tool-registry.js +160 -0
- package/dist/lib/mcp/unified-mcp.d.ts +123 -0
- package/dist/lib/mcp/unified-mcp.js +246 -0
- package/dist/lib/mcp/unified-registry.d.ts +42 -229
- package/dist/lib/mcp/unified-registry.js +96 -1346
- package/dist/lib/neurolink.d.ts +3 -4
- package/dist/lib/neurolink.js +17 -18
- package/dist/lib/providers/agent-enhanced-provider.js +2 -2
- package/dist/lib/providers/amazonBedrock.js +2 -2
- package/dist/lib/providers/anthropic.js +3 -3
- package/dist/lib/providers/azureOpenAI.js +3 -3
- package/dist/lib/providers/function-calling-provider.js +34 -25
- package/dist/lib/providers/googleAIStudio.js +9 -3
- package/dist/lib/providers/googleVertexAI.js +2 -2
- package/dist/lib/providers/huggingFace.js +2 -2
- package/dist/lib/providers/mcp-provider.js +33 -5
- package/dist/lib/providers/mistralAI.js +2 -2
- package/dist/lib/providers/ollama.js +2 -2
- package/dist/lib/providers/openAI.js +2 -2
- package/dist/lib/utils/providerUtils-fixed.js +9 -9
- package/dist/mcp/adapters/plugin-bridge.d.ts +39 -0
- package/dist/mcp/adapters/plugin-bridge.js +82 -0
- package/dist/mcp/auto-discovery.d.ts +38 -96
- package/dist/mcp/auto-discovery.js +100 -745
- package/dist/mcp/client.js +4 -4
- package/dist/mcp/context-manager.js +72 -1
- package/dist/mcp/contracts/mcp-contract.d.ts +162 -0
- package/dist/mcp/contracts/mcp-contract.js +58 -0
- package/dist/mcp/core/plugin-manager.d.ts +45 -0
- package/dist/mcp/core/plugin-manager.js +110 -0
- package/dist/mcp/demo/plugin-demo.d.ts +20 -0
- package/dist/mcp/demo/plugin-demo.js +116 -0
- package/dist/mcp/ecosystem.d.ts +75 -0
- package/dist/mcp/ecosystem.js +162 -0
- package/dist/mcp/external-client.d.ts +88 -0
- package/dist/mcp/external-client.js +323 -0
- package/dist/mcp/external-manager.d.ts +112 -0
- package/dist/mcp/external-manager.js +302 -0
- package/dist/mcp/factory.d.ts +4 -4
- package/dist/mcp/function-calling.js +59 -34
- package/dist/mcp/index.d.ts +39 -184
- package/dist/mcp/index.js +72 -150
- package/dist/mcp/initialize.js +5 -5
- package/dist/mcp/logging.d.ts +27 -60
- package/dist/mcp/logging.js +77 -165
- package/dist/mcp/neurolink-mcp-client.js +31 -3
- package/dist/mcp/orchestrator.d.ts +1 -1
- package/dist/mcp/orchestrator.js +13 -12
- package/dist/mcp/plugin-manager.d.ts +98 -0
- package/dist/mcp/plugin-manager.js +295 -0
- package/dist/mcp/plugins/core/filesystem-mcp.d.ts +35 -0
- package/dist/mcp/plugins/core/filesystem-mcp.js +139 -0
- package/dist/mcp/plugins/core/neurolink-mcp.json +17 -0
- package/dist/mcp/plugins/filesystem-mcp.d.ts +36 -0
- package/dist/mcp/plugins/filesystem-mcp.js +54 -0
- package/dist/mcp/registry.d.ts +27 -176
- package/dist/mcp/registry.js +31 -372
- package/dist/mcp/security-manager.d.ts +85 -0
- package/dist/mcp/security-manager.js +344 -0
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
- package/dist/mcp/tool-integration.d.ts +4 -14
- package/dist/mcp/tool-integration.js +43 -21
- package/dist/mcp/tool-registry.d.ts +66 -0
- package/dist/mcp/tool-registry.js +160 -0
- package/dist/mcp/unified-mcp.d.ts +123 -0
- package/dist/mcp/unified-mcp.js +246 -0
- package/dist/mcp/unified-registry.d.ts +42 -229
- package/dist/mcp/unified-registry.js +96 -1345
- package/dist/neurolink.d.ts +3 -4
- package/dist/neurolink.js +17 -18
- package/dist/providers/agent-enhanced-provider.js +2 -2
- package/dist/providers/amazonBedrock.js +2 -2
- package/dist/providers/anthropic.js +3 -3
- package/dist/providers/azureOpenAI.js +3 -3
- package/dist/providers/function-calling-provider.js +34 -25
- package/dist/providers/googleAIStudio.js +9 -3
- package/dist/providers/googleVertexAI.js +2 -2
- package/dist/providers/huggingFace.js +2 -2
- package/dist/providers/mcp-provider.js +33 -5
- package/dist/providers/mistralAI.js +2 -2
- package/dist/providers/ollama.js +2 -2
- package/dist/providers/openAI.js +2 -2
- package/dist/utils/providerUtils-fixed.js +9 -9
- package/package.json +1 -1
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,190 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* for use throughout the application, following Lighthouse's patterns.
|
|
2
|
+
* MCP Ecosystem - Main Export
|
|
3
|
+
* Universal AI Development Platform with Extensible Plugin Architecture
|
|
4
|
+
* Implementation based on research blueprint
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
export type { MCPClientConfig } from "./client.js";
|
|
6
|
+
export { MCP } from "./contracts/mcp-contract.js";
|
|
7
|
+
export type { MCPMetadata, ExecutionContext, MCPConstructor, MCPInstance, DiscoveredMCP, } from "./contracts/mcp-contract.js";
|
|
8
|
+
export { MCPEcosystem, mcpEcosystem } from "./ecosystem.js";
|
|
9
|
+
export { PluginManager, pluginManager } from "./plugin-manager.js";
|
|
10
|
+
export { SecurityManager } from "./security-manager.js";
|
|
11
|
+
export { mcpLogger } from "./logging.js";
|
|
12
|
+
export type { LogLevel } from "./logging.js";
|
|
13
|
+
export { FileSystemMCP } from "./plugins/core/filesystem-mcp.js";
|
|
14
|
+
import type { MCPMetadata } from "./contracts/mcp-contract.js";
|
|
17
15
|
/**
|
|
18
|
-
*
|
|
16
|
+
* Initialize the MCP ecosystem
|
|
19
17
|
*/
|
|
20
|
-
export declare
|
|
21
|
-
/**
|
|
22
|
-
* Get a formatted list of all available tools across all registered MCP servers
|
|
23
|
-
* Useful for documentation or configuration UI
|
|
24
|
-
*/
|
|
25
|
-
getAvailableTools: () => Promise<{
|
|
26
|
-
serverId: string;
|
|
27
|
-
serverTitle: string;
|
|
28
|
-
serverDescription: string | undefined;
|
|
29
|
-
category: import("./factory.js").MCPServerCategory | undefined;
|
|
30
|
-
toolCount: number;
|
|
31
|
-
tools: {
|
|
32
|
-
name: string;
|
|
33
|
-
description: string;
|
|
34
|
-
isImplemented: boolean;
|
|
35
|
-
}[];
|
|
36
|
-
}[]>;
|
|
37
|
-
/**
|
|
38
|
-
* Function to test connectivity with MCP servers
|
|
39
|
-
* Returns diagnostics about the MCP server initialization status
|
|
40
|
-
*/
|
|
41
|
-
testConnectivity: () => Promise<{
|
|
42
|
-
status: string;
|
|
43
|
-
message: string;
|
|
44
|
-
servers: {
|
|
45
|
-
serverId: string;
|
|
46
|
-
serverTitle: string;
|
|
47
|
-
status: string;
|
|
48
|
-
toolCount: number;
|
|
49
|
-
implementedTools: number;
|
|
50
|
-
}[];
|
|
51
|
-
timestamp: string;
|
|
52
|
-
} | {
|
|
53
|
-
status: string;
|
|
54
|
-
message: string;
|
|
55
|
-
timestamp: string;
|
|
56
|
-
servers?: undefined;
|
|
57
|
-
}>;
|
|
58
|
-
/**
|
|
59
|
-
* Get statistics about MCP usage
|
|
60
|
-
*/
|
|
61
|
-
getStatistics: () => Promise<{
|
|
62
|
-
servers: {
|
|
63
|
-
total: number;
|
|
64
|
-
byCategory: Record<string, number>;
|
|
65
|
-
};
|
|
66
|
-
tools: {
|
|
67
|
-
totalTools: number;
|
|
68
|
-
implementedTools: number;
|
|
69
|
-
byCategory: Record<string, number>;
|
|
70
|
-
};
|
|
71
|
-
sessions: {
|
|
72
|
-
instanceCount: number;
|
|
73
|
-
maxInstances: number;
|
|
74
|
-
instances: Record<string, any>;
|
|
75
|
-
};
|
|
76
|
-
}>;
|
|
77
|
-
/**
|
|
78
|
-
* Initialize MCP for a session
|
|
79
|
-
* Convenience method that sets up everything needed for a session
|
|
80
|
-
*/
|
|
81
|
-
initializeSession: (sessionId: string, config?: {
|
|
82
|
-
userId?: string;
|
|
83
|
-
aiProvider?: string;
|
|
84
|
-
modelId?: string;
|
|
85
|
-
}) => Promise<{
|
|
86
|
-
sessionId: string;
|
|
87
|
-
client: import("./client.js").NeuroLinkMCPClient;
|
|
88
|
-
context: import("./factory.js").NeuroLinkExecutionContext;
|
|
89
|
-
toolCount: number;
|
|
90
|
-
}>;
|
|
91
|
-
/**
|
|
92
|
-
* Clean up a session
|
|
93
|
-
*/
|
|
94
|
-
cleanupSession: (sessionId: string) => Promise<boolean>;
|
|
95
|
-
};
|
|
18
|
+
export declare function initializeMCPEcosystem(): Promise<void>;
|
|
96
19
|
/**
|
|
97
|
-
*
|
|
20
|
+
* List available MCPs
|
|
98
21
|
*/
|
|
99
|
-
declare
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
description: string;
|
|
124
|
-
isImplemented: boolean;
|
|
125
|
-
}[];
|
|
126
|
-
}[]>;
|
|
127
|
-
/**
|
|
128
|
-
* Function to test connectivity with MCP servers
|
|
129
|
-
* Returns diagnostics about the MCP server initialization status
|
|
130
|
-
*/
|
|
131
|
-
testConnectivity: () => Promise<{
|
|
132
|
-
status: string;
|
|
133
|
-
message: string;
|
|
134
|
-
servers: {
|
|
135
|
-
serverId: string;
|
|
136
|
-
serverTitle: string;
|
|
137
|
-
status: string;
|
|
138
|
-
toolCount: number;
|
|
139
|
-
implementedTools: number;
|
|
140
|
-
}[];
|
|
141
|
-
timestamp: string;
|
|
142
|
-
} | {
|
|
143
|
-
status: string;
|
|
144
|
-
message: string;
|
|
145
|
-
timestamp: string;
|
|
146
|
-
servers?: undefined;
|
|
147
|
-
}>;
|
|
148
|
-
/**
|
|
149
|
-
* Get statistics about MCP usage
|
|
150
|
-
*/
|
|
151
|
-
getStatistics: () => Promise<{
|
|
152
|
-
servers: {
|
|
153
|
-
total: number;
|
|
154
|
-
byCategory: Record<string, number>;
|
|
155
|
-
};
|
|
156
|
-
tools: {
|
|
157
|
-
totalTools: number;
|
|
158
|
-
implementedTools: number;
|
|
159
|
-
byCategory: Record<string, number>;
|
|
160
|
-
};
|
|
161
|
-
sessions: {
|
|
162
|
-
instanceCount: number;
|
|
163
|
-
maxInstances: number;
|
|
164
|
-
instances: Record<string, any>;
|
|
165
|
-
};
|
|
166
|
-
}>;
|
|
167
|
-
/**
|
|
168
|
-
* Initialize MCP for a session
|
|
169
|
-
* Convenience method that sets up everything needed for a session
|
|
170
|
-
*/
|
|
171
|
-
initializeSession: (sessionId: string, config?: {
|
|
172
|
-
userId?: string;
|
|
173
|
-
aiProvider?: string;
|
|
174
|
-
modelId?: string;
|
|
175
|
-
}) => Promise<{
|
|
176
|
-
sessionId: string;
|
|
177
|
-
client: import("./client.js").NeuroLinkMCPClient;
|
|
178
|
-
context: import("./factory.js").NeuroLinkExecutionContext;
|
|
179
|
-
toolCount: number;
|
|
180
|
-
}>;
|
|
181
|
-
/**
|
|
182
|
-
* Clean up a session
|
|
183
|
-
*/
|
|
184
|
-
cleanupSession: (sessionId: string) => Promise<boolean>;
|
|
185
|
-
};
|
|
186
|
-
createServer: typeof createMCPServer;
|
|
187
|
-
getManager: typeof getMCPManager;
|
|
188
|
-
removeManager: typeof removeMCPManager;
|
|
189
|
-
};
|
|
190
|
-
export default _default;
|
|
22
|
+
export declare function listMCPs(): Promise<MCPMetadata[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Execute an MCP operation
|
|
25
|
+
*/
|
|
26
|
+
export declare function executeMCP<T = any>(name: string, config: any, args: any, context?: {
|
|
27
|
+
sessionId?: string;
|
|
28
|
+
userId?: string;
|
|
29
|
+
}): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Quick filesystem operations
|
|
32
|
+
*/
|
|
33
|
+
export declare function readFile(path: string, basePath?: string): Promise<any>;
|
|
34
|
+
export declare function writeFile(path: string, content: string, basePath?: string): Promise<any>;
|
|
35
|
+
export declare function listFiles(path: string, basePath?: string): Promise<any>;
|
|
36
|
+
export declare function createDirectory(path: string, basePath?: string): Promise<any>;
|
|
37
|
+
/**
|
|
38
|
+
* Get MCP ecosystem statistics
|
|
39
|
+
*/
|
|
40
|
+
export declare function getMCPStats(): Promise<{
|
|
41
|
+
initialized: boolean;
|
|
42
|
+
pluginsDiscovered: number;
|
|
43
|
+
pluginsBySource: Record<string, number>;
|
|
44
|
+
availablePlugins: string[];
|
|
45
|
+
}>;
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,156 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* for use throughout the application, following Lighthouse's patterns.
|
|
2
|
+
* MCP Ecosystem - Main Export
|
|
3
|
+
* Universal AI Development Platform with Extensible Plugin Architecture
|
|
4
|
+
* Implementation based on research blueprint
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
|
|
6
|
+
// Core contracts and types
|
|
7
|
+
export { MCP } from "./contracts/mcp-contract.js";
|
|
8
|
+
// Main ecosystem interface
|
|
9
|
+
export { MCPEcosystem, mcpEcosystem } from "./ecosystem.js";
|
|
10
|
+
// Plugin management
|
|
11
|
+
export { PluginManager, pluginManager } from "./plugin-manager.js";
|
|
12
|
+
// Security
|
|
13
|
+
export { SecurityManager } from "./security-manager.js";
|
|
14
|
+
// Logging
|
|
15
|
+
export { mcpLogger } from "./logging.js";
|
|
16
|
+
// Core plugins
|
|
17
|
+
export { FileSystemMCP } from "./plugins/core/filesystem-mcp.js";
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Quick access functions for common MCP operations
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* Get a formatted list of all available tools across all registered MCP servers
|
|
24
|
-
* Useful for documentation or configuration UI
|
|
25
|
-
*/
|
|
26
|
-
getAvailableTools: async () => {
|
|
27
|
-
const servers = await mcpConfig.getServers();
|
|
28
|
-
return servers.map((server) => ({
|
|
29
|
-
serverId: server.id,
|
|
30
|
-
serverTitle: server.title,
|
|
31
|
-
serverDescription: server.description,
|
|
32
|
-
category: server.category,
|
|
33
|
-
toolCount: Object.keys(server.tools).length,
|
|
34
|
-
tools: Object.entries(server.tools).map(([name, tool]) => ({
|
|
35
|
-
name,
|
|
36
|
-
description: tool.description,
|
|
37
|
-
isImplemented: tool.isImplemented !== false,
|
|
38
|
-
})),
|
|
39
|
-
}));
|
|
40
|
-
},
|
|
41
|
-
/**
|
|
42
|
-
* Function to test connectivity with MCP servers
|
|
43
|
-
* Returns diagnostics about the MCP server initialization status
|
|
44
|
-
*/
|
|
45
|
-
testConnectivity: async () => {
|
|
46
|
-
try {
|
|
47
|
-
const servers = await mcpConfig.getServers();
|
|
48
|
-
const results = servers.map((server) => ({
|
|
49
|
-
serverId: server.id,
|
|
50
|
-
serverTitle: server.title,
|
|
51
|
-
status: "connected",
|
|
52
|
-
toolCount: Object.keys(server.tools).length,
|
|
53
|
-
implementedTools: Object.values(server.tools).filter((tool) => tool.isImplemented !== false).length,
|
|
54
|
-
}));
|
|
55
|
-
const totalToolCount = results.reduce((acc, server) => acc + server.toolCount, 0);
|
|
56
|
-
const totalImplemented = results.reduce((acc, server) => acc + server.implementedTools, 0);
|
|
57
|
-
logger.info("[MCP Utils] Connectivity test successful", {
|
|
58
|
-
serverCount: results.length,
|
|
59
|
-
totalToolCount,
|
|
60
|
-
totalImplemented,
|
|
61
|
-
});
|
|
62
|
-
return {
|
|
63
|
-
status: "ok",
|
|
64
|
-
message: `Connected to ${results.length} MCP servers with ${totalToolCount} total tools (${totalImplemented} implemented)`,
|
|
65
|
-
servers: results,
|
|
66
|
-
timestamp: new Date().toISOString(),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
71
|
-
logger.error("[MCP Utils] Connectivity test failed", {
|
|
72
|
-
error: errorMessage,
|
|
73
|
-
});
|
|
74
|
-
return {
|
|
75
|
-
status: "error",
|
|
76
|
-
message: `Failed to connect to MCP servers: ${errorMessage}`,
|
|
77
|
-
timestamp: new Date().toISOString(),
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
/**
|
|
82
|
-
* Get statistics about MCP usage
|
|
83
|
-
*/
|
|
84
|
-
getStatistics: async () => {
|
|
85
|
-
const servers = await mcpConfig.getServers();
|
|
86
|
-
const managerStats = MCPManager.getAllStats();
|
|
87
|
-
const toolStats = servers.reduce((acc, server) => {
|
|
88
|
-
const tools = Object.values(server.tools);
|
|
89
|
-
acc.totalTools += tools.length;
|
|
90
|
-
acc.implementedTools += tools.filter((t) => t.isImplemented !== false).length;
|
|
91
|
-
// Count by category
|
|
92
|
-
if (server.category) {
|
|
93
|
-
acc.byCategory[server.category] =
|
|
94
|
-
(acc.byCategory[server.category] || 0) + tools.length;
|
|
95
|
-
}
|
|
96
|
-
return acc;
|
|
97
|
-
}, {
|
|
98
|
-
totalTools: 0,
|
|
99
|
-
implementedTools: 0,
|
|
100
|
-
byCategory: {},
|
|
101
|
-
});
|
|
102
|
-
return {
|
|
103
|
-
servers: {
|
|
104
|
-
total: servers.length,
|
|
105
|
-
byCategory: servers.reduce((acc, server) => {
|
|
106
|
-
const category = server.category || "custom";
|
|
107
|
-
acc[category] = (acc[category] || 0) + 1;
|
|
108
|
-
return acc;
|
|
109
|
-
}, {}),
|
|
110
|
-
},
|
|
111
|
-
tools: toolStats,
|
|
112
|
-
sessions: managerStats,
|
|
113
|
-
};
|
|
114
|
-
},
|
|
115
|
-
/**
|
|
116
|
-
* Initialize MCP for a session
|
|
117
|
-
* Convenience method that sets up everything needed for a session
|
|
118
|
-
*/
|
|
119
|
-
initializeSession: async (sessionId, config) => {
|
|
120
|
-
// Get or create MCP client for session
|
|
121
|
-
const client = getMCPManager(sessionId, config);
|
|
122
|
-
// Create context for tool execution
|
|
123
|
-
const context = {
|
|
124
|
-
sessionId,
|
|
125
|
-
userId: config?.userId,
|
|
126
|
-
aiProvider: config?.aiProvider,
|
|
127
|
-
modelId: config?.modelId,
|
|
128
|
-
timestamp: Date.now(),
|
|
129
|
-
};
|
|
130
|
-
// Initialize all tools
|
|
131
|
-
initializeMCPTools(sessionId, client, context);
|
|
132
|
-
// Return session info
|
|
133
|
-
return {
|
|
134
|
-
sessionId,
|
|
135
|
-
client,
|
|
136
|
-
context,
|
|
137
|
-
toolCount: Object.keys(client.getTools()).length,
|
|
138
|
-
};
|
|
139
|
-
},
|
|
140
|
-
/**
|
|
141
|
-
* Clean up a session
|
|
142
|
-
*/
|
|
143
|
-
cleanupSession: async (sessionId) => {
|
|
144
|
-
return removeMCPManager(sessionId);
|
|
145
|
-
},
|
|
146
|
-
};
|
|
21
|
+
// Import the ecosystem singleton
|
|
22
|
+
import { mcpEcosystem } from "./ecosystem.js";
|
|
147
23
|
/**
|
|
148
|
-
*
|
|
24
|
+
* Initialize the MCP ecosystem
|
|
149
25
|
*/
|
|
150
|
-
export
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
26
|
+
export async function initializeMCPEcosystem() {
|
|
27
|
+
return mcpEcosystem.initialize();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* List available MCPs
|
|
31
|
+
*/
|
|
32
|
+
export async function listMCPs() {
|
|
33
|
+
return mcpEcosystem.list();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Execute an MCP operation
|
|
37
|
+
*/
|
|
38
|
+
export async function executeMCP(name, config, args, context) {
|
|
39
|
+
return mcpEcosystem.execute(name, config, args, context);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Quick filesystem operations
|
|
43
|
+
*/
|
|
44
|
+
export async function readFile(path, basePath) {
|
|
45
|
+
return mcpEcosystem.filesystem({
|
|
46
|
+
action: "readFile",
|
|
47
|
+
path,
|
|
48
|
+
basePath,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export async function writeFile(path, content, basePath) {
|
|
52
|
+
return mcpEcosystem.filesystem({
|
|
53
|
+
action: "writeFile",
|
|
54
|
+
path,
|
|
55
|
+
content,
|
|
56
|
+
basePath,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export async function listFiles(path, basePath) {
|
|
60
|
+
return mcpEcosystem.filesystem({
|
|
61
|
+
action: "listFiles",
|
|
62
|
+
path,
|
|
63
|
+
basePath,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export async function createDirectory(path, basePath) {
|
|
67
|
+
return mcpEcosystem.filesystem({
|
|
68
|
+
action: "createDir",
|
|
69
|
+
path,
|
|
70
|
+
basePath,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get MCP ecosystem statistics
|
|
75
|
+
*/
|
|
76
|
+
export async function getMCPStats() {
|
|
77
|
+
return mcpEcosystem.getStats();
|
|
78
|
+
}
|
package/dist/mcp/initialize.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Automatically registers built-in NeuroLink servers with the default registry
|
|
4
4
|
* Ensures built-in tools are always available without manual configuration
|
|
5
5
|
*/
|
|
6
|
-
import { defaultToolRegistry } from "./registry.js";
|
|
6
|
+
import { toolRegistry, defaultToolRegistry } from "./tool-registry.js";
|
|
7
7
|
import { mcpLogger } from "./logging.js";
|
|
8
8
|
let isInitialized = false;
|
|
9
9
|
/**
|
|
@@ -19,14 +19,14 @@ export async function initializeNeuroLinkMCP() {
|
|
|
19
19
|
// Note: AI core server temporarily disabled due to circular dependency issues
|
|
20
20
|
const { utilityServer } = await import("./servers/utilities/utility-server.js");
|
|
21
21
|
// Register built-in NeuroLink servers with default registry
|
|
22
|
-
await
|
|
22
|
+
await toolRegistry.registerServer(utilityServer.id, utilityServer);
|
|
23
23
|
mcpLogger.debug("Registered neurolink-utility server with built-in tools");
|
|
24
24
|
// TODO: Re-enable AI core server once circular dependencies are resolved
|
|
25
25
|
// const { aiCoreServer } = await import('./servers/ai-providers/ai-core-server.js');
|
|
26
|
-
// await
|
|
26
|
+
// await toolRegistry.registerServer(aiCoreServer.id, aiCoreServer);
|
|
27
27
|
// mcpLogger.debug('Registered neurolink-ai-core server with AI tools');
|
|
28
|
-
const stats =
|
|
29
|
-
mcpLogger.info(`Initialization complete: ${stats.totalServers}
|
|
28
|
+
const stats = await toolRegistry.getStats();
|
|
29
|
+
mcpLogger.info(`Initialization complete: ${stats.totalServers} server, ${stats.totalTools} tools available`);
|
|
30
30
|
isInitialized = true;
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
package/dist/mcp/logging.d.ts
CHANGED
|
@@ -1,71 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* MCP Logging Utility
|
|
3
|
+
* Centralized logging for the MCP ecosystem
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
ERROR = 1,
|
|
8
|
-
WARN = 2,
|
|
9
|
-
INFO = 3,
|
|
10
|
-
DEBUG = 4
|
|
11
|
-
}
|
|
12
|
-
export interface LoggerConfig {
|
|
5
|
+
export type LogLevel = "debug" | "info" | "warn" | "error";
|
|
6
|
+
interface LogEntry {
|
|
13
7
|
level: LogLevel;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
message: string;
|
|
9
|
+
timestamp: Date;
|
|
10
|
+
data?: unknown;
|
|
17
11
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Set log level
|
|
26
|
-
*/
|
|
27
|
-
setLevel(level: LogLevel): void;
|
|
28
|
-
/**
|
|
29
|
-
* Get current log level
|
|
30
|
-
*/
|
|
31
|
-
getLevel(): LogLevel;
|
|
32
|
-
/**
|
|
33
|
-
* Log an error message
|
|
34
|
-
*/
|
|
35
|
-
error(message: string, ...args: any[]): void;
|
|
36
|
-
/**
|
|
37
|
-
* Log a warning message
|
|
38
|
-
*/
|
|
39
|
-
warn(message: string, ...args: any[]): void;
|
|
40
|
-
/**
|
|
41
|
-
* Log an info message
|
|
42
|
-
*/
|
|
43
|
-
info(message: string, ...args: any[]): void;
|
|
44
|
-
/**
|
|
45
|
-
* Log a debug message
|
|
46
|
-
*/
|
|
47
|
-
debug(message: string, ...args: any[]): void;
|
|
48
|
-
/**
|
|
49
|
-
* Internal logging method
|
|
50
|
-
*/
|
|
12
|
+
declare class MCPLogger {
|
|
13
|
+
private logLevel;
|
|
14
|
+
private logs;
|
|
15
|
+
private maxLogs;
|
|
16
|
+
constructor();
|
|
17
|
+
setLogLevel(level: LogLevel): void;
|
|
18
|
+
private shouldLog;
|
|
51
19
|
private log;
|
|
20
|
+
debug(message: string, data?: unknown): void;
|
|
21
|
+
info(message: string, data?: unknown): void;
|
|
22
|
+
warn(message: string, data?: unknown): void;
|
|
23
|
+
error(message: string, data?: unknown): void;
|
|
24
|
+
getLogs(level?: LogLevel): LogEntry[];
|
|
25
|
+
clearLogs(): void;
|
|
52
26
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Create logger instances for different MCP components
|
|
55
|
-
*/
|
|
56
|
-
export declare const createLogger: (component: string) => MCPLogger;
|
|
57
|
-
/**
|
|
58
|
-
* Default loggers for common MCP components
|
|
59
|
-
*/
|
|
60
27
|
export declare const mcpLogger: MCPLogger;
|
|
61
28
|
export declare const autoDiscoveryLogger: MCPLogger;
|
|
62
29
|
export declare const registryLogger: MCPLogger;
|
|
63
30
|
export declare const unifiedRegistryLogger: MCPLogger;
|
|
64
|
-
/**
|
|
65
|
-
* Utility function to set global MCP log level
|
|
66
|
-
*/
|
|
67
31
|
export declare function setGlobalMCPLogLevel(level: LogLevel): void;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
32
|
+
export declare const LogLevels: {
|
|
33
|
+
readonly debug: "debug";
|
|
34
|
+
readonly info: "info";
|
|
35
|
+
readonly warn: "warn";
|
|
36
|
+
readonly error: "error";
|
|
37
|
+
};
|
|
38
|
+
export {};
|