Skip to main content
Glama
utils.ts1 kB
import crypto from 'crypto' export function getServerUrlHash(key: URL): string { return crypto.createHash('sha256').update(key.toString()).digest('hex') } export function getTimestamp(): string { const now = new Date() return `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}.${now.getMilliseconds().toString().padStart(3, '0')}` } export function debugLog(str: string, ...rest: any[]) { if (!process.env.DEBUG) { return } console.error(`[DEBUG] [${process.pid}] ${str}`, ...rest) } export function log(str: string, ...rest: unknown[]) { if (!process.env.LOGGING && !process.env.DEBUG) { return } console.error(`[LOG] [${process.pid}] ${str}`, ...rest) } export function setupShutdownHook(cleanup: () => Promise<void>) { const fn = async () => { log('Shutting down...') await cleanup() process.exit(0) } process.on('SIGINT', fn) process.on('SIGTERM', fn) }

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/saqua-ai/sequa-mcp'

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