Skip to main content
Glama

ZigBee2MQTT MCP Server

by ichbinder
logger.ts•1.37 kB
/** * Simple logger with configurable log levels * Uses stderr to not interfere with MCP stdio communication */ export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent'; const LOG_LEVELS: Record<LogLevel, number> = { debug: 0, info: 1, warn: 2, error: 3, silent: 999, }; class Logger { private level: LogLevel; constructor(level: LogLevel = 'info') { this.level = level; } setLevel(level: LogLevel): void { this.level = level; } private shouldLog(level: LogLevel): boolean { return LOG_LEVELS[level] >= LOG_LEVELS[this.level]; } debug(...args: any[]): void { if (this.shouldLog('debug')) { console.error('[DEBUG]', ...args); } } info(...args: any[]): void { if (this.shouldLog('info')) { console.error('[INFO]', ...args); } } warn(...args: any[]): void { if (this.shouldLog('warn')) { console.error('[WARN]', ...args); } } error(...args: any[]): void { if (this.shouldLog('error')) { console.error('[ERROR]', ...args); } } // Minimal startup info (always except when silent) startup(...args: any[]): void { if (this.level !== 'silent') { console.error(...args); } } } // Singleton instance const logLevel = (process.env.LOG_LEVEL?.toLowerCase() as LogLevel) || 'error'; export const logger = new Logger(logLevel);

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/ichbinder/MCP2ZigBee2MQTT'

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