Skip to main content
Glama
util.ts933 B
export const nowIso = () => new Date().toISOString(); export function recencyDecay(d?: string, halfLifeDays = 30): number { if (!d) return 0.6; const days = (Date.now() - new Date(d).getTime()) / 864e5; return 1 / (1 + Math.max(days, 0) / halfLifeDays); } export function logErr(...args: unknown[]) { try { process.stderr.write(args.map(String).join(" ") + "\n"); } catch {} } export function cosineSimilarity(a?: number[], b?: number[]): number { if (!Array.isArray(a) || !Array.isArray(b)) return 0; const len = Math.min(a.length, b.length); if (len === 0) return 0; let dot = 0; let normA = 0; let normB = 0; for (let i = 0; i < len; i++) { const ai = a[i]; const bi = b[i]; if (!Number.isFinite(ai) || !Number.isFinite(bi)) continue; dot += ai * bi; normA += ai * ai; normB += bi * bi; } if (normA === 0 || normB === 0) return 0; return dot / Math.sqrt(normA * normB); }

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/ideadesignmedia/memory-mcp'

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