UNPKG

@smithery/sdk

Version:

SDK to develop with Smithery

18 lines (17 loc) 768 B
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; export interface SessionStore<T extends Transport> { /** return existing transport (or `undefined`) */ get(id: string): T | undefined; /** insert / update */ set(id: string, t: T): void; /** optional - explicit eviction */ delete?(id: string): void; } /** * Minimal Map‑based LRU implementation that fulfils {@link SessionStore}. * Keeps at most `max` transports; upon insert, the least‑recently‑used entry * (oldest insertion order) is removed and the evicted transport is closed. * * @param max maximum number of sessions to retain (default = 1000) */ export declare const createLRUStore: <T extends Transport>(max?: number) => SessionStore<T>;