@scarlet-mesh/mcp-rhds
Version:
RHDS MCP Server - All-in-One Model Context Protocol server for Red Hat Design System components with manifest discovery, HTML validation, and developer tooling
36 lines (35 loc) • 1.43 kB
JavaScript
import { ManifestService, IdGeneratorService, ValidationService, ComponentService } from '../services/index.js';
import { DEFAULT_PACKAGE } from '../constants/index.js';
export class ServiceContainer {
static instance;
manifestService;
idGeneratorService;
validationService;
componentService;
constructor() {
// Initialize services with dependencies
this.manifestService = new ManifestService();
this.idGeneratorService = new IdGeneratorService();
this.validationService = new ValidationService(this.manifestService);
this.componentService = new ComponentService(this.manifestService, this.validationService, this.idGeneratorService);
}
static getInstance() {
if (!ServiceContainer.instance) {
ServiceContainer.instance = new ServiceContainer();
}
return ServiceContainer.instance;
}
getManifestService() { return this.manifestService; }
getIdGeneratorService() { return this.idGeneratorService; }
getValidationService() { return this.validationService; }
getComponentService() { return this.componentService; }
async initialize() {
try {
await this.manifestService.getComponents(DEFAULT_PACKAGE);
console.error('Initialized RHDS services');
}
catch (error) {
console.error('Could not initialize RHDS services:', error);
}
}
}