Skip to main content
Glama
// Todo: Implement a caching mechanism for Azure API calls to reduce latency and avoid hitting rate limits. export class CacheManager<T> { private cache: Map<string, { data: T; timestamp: number }>; private readonly maxSize: number; private readonly cleanupInterval: NodeJS.Timeout; constructor(maxSize: number = 1000, cleanupIntervalMs: number = 300000) { this.cache = new Map(); this.maxSize = maxSize; this.cleanupInterval = setInterval(() => this.cleanup(), cleanupIntervalMs); } async get(key: string, fetchFn: () => Promise<T>, ttlMs: number): Promise<T> { const cachedItem = this.cache.get(key); if (cachedItem && Date.now() - cachedItem.timestamp < ttlMs) { return cachedItem.data; } const data = await fetchFn(); this.set(key, data); return data; } private set(key: string, data: T): void { if (this.cache.size >= this.maxSize) { const oldestKey = Array.from(this.cache.keys())[0]; this.cache.delete(oldestKey); } this.cache.set(key, { data, timestamp: Date.now() }); } private cleanup(): void { const now = Date.now(); for (const [key, value] of this.cache.entries()) { if (now - value.timestamp > 600000) { // 10 minutes TTL this.cache.delete(key); } } } clear(): void { this.cache.clear(); } dispose(): void { clearInterval(this.cleanupInterval); this.clear(); } }

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/kalivaraprasad-gonapa/azure-mcp'

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