@upstash/context7-mcp
Version:
MCP server for Context7
15 lines (14 loc) • 477 B
JavaScript
import { Redis } from "@upstash/redis";
let cached;
/**
* Returns the shared Upstash Redis client. Throws if credentials are missing.
*/
export function getRedis() {
if (cached)
return cached;
if (!process.env.UPSTASH_REDIS_REST_URL || !process.env.UPSTASH_REDIS_REST_TOKEN) {
throw new Error("Upstash Redis credentials are required. Set UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.");
}
cached = Redis.fromEnv();
return cached;
}