Skip to main content
Glama

MCP Documentation Server

by mahawi1992
cache.ts785 B
import { Request, Response, NextFunction } from 'express'; import { cacheManager } from '../utils/cache'; export const cacheMiddleware = (type: string) => { return async (req: Request, res: Response, next: NextFunction) => { const key = type === 'search' ? cacheManager.generateSearchKey(req.body) : cacheManager.generateAnalysisKey(req.body); const cachedData = cacheManager.get(key); if (cachedData) { // Add cache headers res.setHeader('Cache-Control', 'public, max-age=3600'); res.setHeader('ETag', `"${key}"`); return res.json({ success: true, results: cachedData }); } // Store the key for later use res.locals.cacheKey = key; next(); }; };

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/mahawi1992/mcp-documentation-server'

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