@mickdarling/dollhousemcp
Version:
DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.
45 lines • 1.34 kB
TypeScript
/**
* MCP-safe logger that avoids writing to stdout/stderr during protocol communication
*
* In MCP servers, stdout and stderr are reserved for JSON-RPC protocol messages.
* Any non-protocol output will cause "Unexpected token" errors in the MCP client.
*
* This logger:
* - Writes to stderr ONLY during server initialization (before MCP connection)
* - Stores all logs in memory during runtime
* - Provides methods to retrieve logs via MCP tools if needed
*/
interface LogEntry {
timestamp: Date;
level: 'debug' | 'info' | 'warn' | 'error';
message: string;
data?: any;
}
declare class MCPLogger {
private logs;
private maxLogs;
private isMCPConnected;
/**
* Call this after MCP connection is established to stop console output
*/
setMCPConnected(): void;
/**
* Internal logging method
*/
private log;
debug(message: string, data?: any): void;
info(message: string, data?: any): void;
warn(message: string, data?: any): void;
error(message: string, data?: any): void;
/**
* Get recent logs (for MCP tools to retrieve)
*/
getLogs(count?: number, level?: LogEntry['level']): LogEntry[];
/**
* Clear logs
*/
clearLogs(): void;
}
export declare const logger: MCPLogger;
export {};
//# sourceMappingURL=logger.d.ts.map