lokalise-mcp
Version:
The Lokalise MCP Server brings Lokalise's localization power to Claude and AI assistants—manage projects, keys, and translations by chat.
82 lines (81 loc) • 2.7 kB
JavaScript
import { Logger } from "../shared/utils/logger.util.js";
import { domainRegistry } from "./registry.js";
// Lazy logger initialization to avoid module-level side effects
let logger = null;
function getLogger() {
if (!logger) {
logger = Logger.forContext("domains/index.ts");
}
return logger;
}
/**
* Register all domain MCP tools with the server
* This is the main entry point for tool registration
*/
export async function registerAllTools(server) {
const methodLogger = getLogger().forMethod("registerAllTools");
methodLogger.info("Starting domain tools registration");
try {
await domainRegistry.registerAllTools(server);
methodLogger.info("Domain tools registration completed successfully");
}
catch (error) {
methodLogger.error("Failed to register domain tools", { error });
throw error;
}
}
/**
* Register all domain CLI commands with the Commander program
* This is the main entry point for CLI registration
*/
export async function registerAllCli(program) {
const methodLogger = getLogger().forMethod("registerAllCli");
methodLogger.info("Starting domain CLI registration");
try {
await domainRegistry.registerAllCli(program);
methodLogger.info("Domain CLI registration completed successfully");
}
catch (error) {
methodLogger.error("Failed to register domain CLI", { error });
throw error;
}
}
/**
* Register all domain MCP resources with the server
* This is the main entry point for resource registration
*/
export async function registerAllResources(server) {
const methodLogger = getLogger().forMethod("registerAllResources");
methodLogger.info("Starting domain resources registration");
try {
await domainRegistry.registerAllResources(server);
methodLogger.info("Domain resources registration completed successfully");
}
catch (error) {
methodLogger.error("Failed to register domain resources", { error });
throw error;
}
}
/**
* Get domain registry status and health information
* Useful for debugging and monitoring
*/
export function getDomainRegistryStatus() {
return domainRegistry.getRegistryStatus();
}
/**
* Discover all available domains
* Can be used for diagnostics or dynamic domain listing
*/
export async function discoverDomains() {
return domainRegistry.discoverDomains();
}
/**
* Load a specific domain module
* Useful for testing or selective domain loading
*/
export async function loadDomain(name) {
return domainRegistry.loadDomain(name);
}
// Re-export the registry instance for advanced usage
export { domainRegistry } from "./registry.js";