Skip to main content
Glama
logger.ts1.79 kB
import { pino, transport as buildTransport } from 'pino'; import { appConfig } from './config.js'; // Disable logging when running via stdio to avoid interfering with MCP protocol const shouldLogToConsole = process.env.MCP_DISABLE_LOGS !== 'true' && !process.argv.includes('--silent'); const logFilePath = process.env.MCP_LOG_FILE; const loggerDestination = (() => { const targets: Array<{ target: string; options: Record<string, unknown>; level?: string; }> = []; if (shouldLogToConsole) { const isPretty = process.env.NODE_ENV !== 'production' && process.stderr.isTTY; if (isPretty) { targets.push({ target: 'pino-pretty', options: { translateTime: 'SYS:standard', colorize: true, ignore: 'pid,hostname', destination: 2 } }); } else { targets.push({ target: 'pino/file', options: { destination: 2, mkdir: false, append: true } }); } } if (logFilePath) { targets.push({ target: 'pino/file', options: { destination: logFilePath, mkdir: true, append: true } }); } if (targets.length === 0) { return null; } return buildTransport({ targets }); })(); export const logger = loggerDestination ? pino( { level: appConfig.logLevel, base: { app: 'monica-crm-mcp' }, redact: { paths: ['req.headers.authorization', 'req.headers["x-api-key"]', 'req.headers["x-user-token"]'], remove: true } }, loggerDestination ) : ({ info: () => {}, error: () => {}, warn: () => {}, debug: () => {}, trace: () => {}, fatal: () => {} } as any);

Latest Blog Posts

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/Jacob-Stokes/monica-mcp'

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