UNPKG

@alcyone-labs/simple-mcp-logger

Version:

Logging solution for MCP servers. Prevents console output from corrupting MCP protocol communication. Drop-in replacement for console, Winston, and Pino with automatic STDOUT suppression in MCP mode.

71 lines 1.79 kB
import { Logger, LogLevel } from '../SimpleMcpLogger.js'; import TransportStream = require('winston-transport'); interface TransportStreamOptions { level?: string; silent?: boolean; handleExceptions?: boolean; handleRejections?: boolean; [key: string]: any; } /** * Winston transport that uses SimpleMcpLogger as the underlying logger */ export declare class SimpleMcpWinstonTransport extends TransportStream { private logger; private options; constructor(options?: TransportStreamOptions & { mcpMode?: boolean; prefix?: string; logToFile?: string; }); /** * Emit method for Winston compatibility */ emit(event: string, ...args: any[]): boolean; /** * Map Winston log levels to SimpleMcpLogger levels */ private mapWinstonLevelToMcp; /** * Log method called by Winston */ log(info: any, callback?: () => void): void; /** * Set MCP mode */ setMcpMode(enabled: boolean): void; /** * Set log level */ setLevel(level: LogLevel): void; /** * Set prefix */ setPrefix(prefix: string): void; /** * Create child logger */ child(prefix: string): SimpleMcpWinstonTransport; /** * Get the underlying SimpleMcpLogger instance */ getLogger(): Logger; /** * Set log file path */ setLogFile(filePath: string): Promise<void>; /** * Close file stream */ close(): Promise<void>; } /** * Factory function to create Winston transport */ export declare function createWinstonTransport(options?: TransportStreamOptions & { mcpMode?: boolean; prefix?: string; logToFile?: string; }): SimpleMcpWinstonTransport; export {}; //# sourceMappingURL=winston.d.ts.map