sequelae-mcp
Version:
Let Claude, Cursor, and other AI agents run real SQL queries on live Postgres databases. No more copy-pasting SQL, stale schema docs, or hallucinated DB adapters — just raw, real-time access. Now with MCP support!
51 lines • 1.41 kB
TypeScript
/**
* Simple rate limiter implementation using token bucket algorithm
*/
export interface RateLimiterOptions {
maxRequests: number;
windowMs: number;
toolSpecificLimits?: Record<string, {
maxRequests: number;
windowMs: number;
}>;
}
export declare class RateLimiter {
private options;
private requests;
private globalRequests;
constructor(options: RateLimiterOptions);
/**
* Check if a request is allowed and update counters
* @param identifier - Unique identifier for the requester (e.g., connection ID)
* @param tool - Optional tool name for tool-specific limits
* @returns Object with allowed status and retry-after time if rate limited
*/
checkLimit(identifier: string, tool?: string): {
allowed: boolean;
retryAfter?: number;
};
/**
* Get or create a request record
*/
private getOrCreateRecord;
/**
* Clean up expired records to prevent memory leaks
*/
cleanup(): void;
/**
* Get current usage statistics for a requester
*/
getUsage(identifier: string): {
global: {
used: number;
limit: number;
resetIn: number;
};
tools?: Record<string, {
used: number;
limit: number;
resetIn: number;
}>;
};
}
//# sourceMappingURL=rate-limiter.d.ts.map