@vfarcic/dot-ai
Version:
AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance
53 lines (52 loc) • 1.53 kB
JavaScript
;
/**
* MCP Client Registry - Unified MCP Server Tool Access
*
* PRD #358: Provides a single, consistent way to access MCP server tools
* from anywhere in the codebase (remediate, operate, query).
*
* Usage:
* // At startup (src/mcp/server.ts):
* initializeMcpClientRegistry(mcpClientManager);
*
* // Anywhere in the codebase:
* if (isMcpClientInitialized()) {
* const tools = getMcpClientManager()!.getToolsForOperation('remediate');
* }
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.initializeMcpClientRegistry = initializeMcpClientRegistry;
exports.getMcpClientManager = getMcpClientManager;
exports.isMcpClientInitialized = isMcpClientInitialized;
exports.resetMcpClientRegistry = resetMcpClientRegistry;
/**
* Global MCP client manager instance (set once at startup)
*/
let mcpClientManager = null;
/**
* Initialize the MCP client registry with a McpClientManager instance.
* Must be called once at startup after MCP servers are discovered.
*/
function initializeMcpClientRegistry(manager) {
mcpClientManager = manager;
}
/**
* Get the McpClientManager instance.
* Returns null if not initialized.
*/
function getMcpClientManager() {
return mcpClientManager;
}
/**
* Check if the MCP client registry is initialized.
*/
function isMcpClientInitialized() {
return mcpClientManager !== null;
}
/**
* Reset the MCP client registry (for testing only).
* @internal
*/
function resetMcpClientRegistry() {
mcpClientManager = null;
}