UNPKG

@juspay/neurolink

Version:

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

104 lines (103 loc) 3.63 kB
/** * MCP Registry - Industry Standard Interface with camelCase */ import type { DiscoveredMcp, ExecutionContext, ToolInfo } from "./contracts/mcpContract.js"; import type { UnknownRecord } from "../types/common.js"; /** * MCP Registry interface with optional methods for maximum flexibility */ export interface McpRegistry { registerServer?(serverId: string, serverConfig?: unknown, context?: ExecutionContext): Promise<void>; executeTool?<T = unknown>(toolName: string, args?: unknown, context?: ExecutionContext): Promise<T>; listTools?(context?: ExecutionContext): Promise<ToolInfo[]>; } /** * Simple MCP registry for plugin management * Maintains backward compatibility with existing code */ export declare class MCPRegistry implements McpRegistry { plugins: Map<string, DiscoveredMcp<import("../types/typeAliases.js").StandardRecord>>; /** * Register a plugin */ register(plugin: DiscoveredMcp): void; /** * Unregister a plugin */ unregister(name: string): boolean; /** * Get a plugin */ get(name: string): DiscoveredMcp | undefined; /** * List all plugins */ list(): DiscoveredMcp[]; /** * Check if plugin exists */ has(name: string): boolean; /** * Clear all plugins */ clear(): void; /** * Register a server (compatible with new interface) */ registerServer(serverId: string, serverConfig?: unknown, context?: ExecutionContext): Promise<void>; /** * Execute a tool (mock implementation for tests) */ executeTool<T = unknown>(toolName: string, args?: unknown, context?: ExecutionContext): Promise<T>; /** * List all tools (compatible with new interface) */ listTools(context?: ExecutionContext): Promise<ToolInfo[]>; /** * Register a server (legacy sync version) */ registerServerSync(plugin: DiscoveredMcp): void; /** * Execute a tool (legacy sync version) */ executeToolSync(toolName: string, args?: unknown): UnknownRecord; /** * List all tools (legacy sync version) */ listToolsSync(): Array<{ name: string; description?: string; }>; /** * List all registered server IDs * * Returns an array of server IDs that are currently registered in the MCP registry. * This complements listTools() by providing server-level information, while listTools() * provides tool-level information across all servers. * * @returns Array of registered server identifier strings * @see listTools() for getting detailed tool information from all servers * @see list() for getting complete server metadata objects * * @example * ```typescript * const serverIds = registry.listServers(); * // ['ai-core', 'external-api', 'database-connector'] * * // Compare with listTools() for comprehensive overview: * const servers = registry.listServers(); // ['server1', 'server2'] * const tools = await registry.listTools(); // [{ name: 'tool1', serverId: 'server1' }, ...] * ``` */ listServers(): string[]; } /** * Enhanced MCP Registry implementation with config integration * Will be implemented in Phase 3.2 */ export declare class McpRegistryImpl implements McpRegistry { private baseRegistry; registerServer(serverId: string, serverConfig?: unknown, context?: ExecutionContext): Promise<void>; executeTool<T = unknown>(toolName: string, args?: unknown, context?: ExecutionContext): Promise<T>; listTools(context?: ExecutionContext): Promise<ToolInfo[]>; }