Skip to main content
Glama

IT-MCP

by acampkin95
logger.ts1.26 kB
import { createLogger, format, transports } from "winston"; import type { TransformableInfo } from "logform"; const { combine, timestamp, errors, splat, metadata, printf } = format; const LOG_LEVEL = process.env.IT_MCP_LOG_LEVEL ?? (process.env.NODE_ENV === "production" ? "info" : "debug"); type LoggerInfo = TransformableInfo & { timestamp?: string; stack?: string; metadata?: Record<string, unknown>; }; const logFormat = printf((info: LoggerInfo) => { const { timestamp: ts, level, message, stack, metadata: meta = {}, } = info; const normalizedMessage = typeof message === "string" ? message : JSON.stringify(message); const payload: Record<string, unknown> = { timestamp: ts, level, message: stack ?? normalizedMessage, }; if (Object.keys(meta).length) { payload.meta = meta; } return JSON.stringify(payload); }); export const logger = createLogger({ level: LOG_LEVEL, defaultMeta: { service: "it-mcp" }, format: combine( timestamp(), errors({ stack: true }), splat(), metadata({ fillExcept: ["timestamp", "level", "message", "stack"] }), logFormat, ), transports: [ new transports.Console({ stderrLevels: ["error", "warn"], }), ], });

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/acampkin95/MCP'

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