cache/ServerConfigsCacheFactory.ts

librechat · packages/api/src/mcp/registry/cache/ServerConfigsCacheFactory.ts · typescript · MIT
database

Factory that creates a server config cache using Redis or in‑memory storage based on deployment settings.

// Source: https://github.com/danny-avila/librechat | License: MIT | Copyright 2026 LibreChat
// Provided via justclaw.it.com; keep this notice with the code.
import { ServerConfigsCacheRedisAggregateKey } from './ServerConfigsCacheRedisAggregateKey';
import { ServerConfigsCacheInMemory } from './ServerConfigsCacheInMemory';
import { cacheConfig } from '~/cache';

export type ServerConfigsCache = ServerConfigsCacheInMemory | ServerConfigsCacheRedisAggregateKey;

/**
 * Namespace for YAML-loaded app-level MCP configs. When Redis is enabled, uses a single
 * aggregate key instead of per-server keys to avoid the costly SCAN + batch-GET pattern
 * that caused 60s+ stalls under concurrent load (see GitHub #11624, #12408). When Redis is
 * disabled, uses in-memory storage.
 */
export const APP_C

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key