Skip to main content
Glama

DollhouseMCP

by DollhouseMCP
startup.tsโ€ข2.66 kB
/** * Server startup utilities including migration */ import { PortfolioManager, ElementType } from '../portfolio/PortfolioManager.js'; import { MigrationManager } from '../portfolio/MigrationManager.js'; import { logger } from '../utils/logger.js'; export interface StartupOptions { skipMigration?: boolean; autoBackup?: boolean; } export class ServerStartup { private portfolioManager: PortfolioManager; private migrationManager: MigrationManager; constructor() { this.portfolioManager = PortfolioManager.getInstance(); this.migrationManager = new MigrationManager(this.portfolioManager); } /** * Initialize server with migration check */ async initialize(options: StartupOptions = {}): Promise<void> { logger.info('[ServerStartup] Initializing server...'); // Check if migration is needed if (!options.skipMigration) { const needsMigration = await this.migrationManager.needsMigration(); if (needsMigration) { logger.info('[ServerStartup] Legacy personas detected. Starting migration...'); const result = await this.migrationManager.migrate({ backup: options.autoBackup !== false // Default to true }); if (result.success) { logger.info(`[ServerStartup] Successfully migrated ${result.migratedCount} personas`); if (result.backedUp && result.backupPath) { logger.info(`[ServerStartup] Backup created at: ${result.backupPath}`); } } else { logger.error('[ServerStartup] Migration completed with errors:'); result.errors.forEach(err => logger.error(`[ServerStartup] - ${err}`)); } } } // Ensure portfolio structure exists const portfolioExists = await this.portfolioManager.exists(); if (!portfolioExists) { logger.info('[ServerStartup] Creating portfolio directory structure...'); await this.portfolioManager.initialize(); } // Log portfolio statistics const stats = await this.portfolioManager.getStatistics(); logger.info('[ServerStartup] Portfolio statistics:'); Object.entries(stats).forEach(([type, count]) => { if (count > 0) { logger.info(`[ServerStartup] - ${type}: ${count} elements`); } }); } /** * Get migration status without performing migration */ async getMigrationStatus() { return await this.migrationManager.getMigrationStatus(); } /** * Get the personas directory path for legacy compatibility */ getPersonasDir(): string { return this.portfolioManager.getElementDir(ElementType.PERSONA); } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DollhouseMCP/DollhouseMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server