UNPKG

vineguard-mcp-server-standalone

Version:

VineGuard MCP Server v2.1 - Intelligent QA Workflow System with advanced test generation for Jest/RTL, Cypress, and Playwright. Features smart project analysis, progressive testing strategies, and comprehensive quality patterns for React/Vue/Angular proje

71 lines 2.2 kB
/** * Rate limiting functionality for VineGuard MCP Server * Prevents abuse and DoS attacks by limiting the number of requests per time window */ export interface RateLimitConfig { windowMs: number; maxRequests: number; toolSpecific?: Map<string, { windowMs: number; maxRequests: number; }>; } export interface RateLimitResult { allowed: boolean; remainingRequests?: number; resetTime?: number; error?: string; } export declare class RateLimiter { private requests; private config; constructor(config?: Partial<RateLimitConfig>); /** * Check if a request should be allowed based on rate limits */ checkLimit(identifier: string, toolName?: string): RateLimitResult; /** * Get current usage stats for an identifier */ getUsageStats(identifier: string, toolName?: string): { count: number; limit: number; resetTime: number; } | null; /** * Reset rate limit for a specific identifier (admin function) */ resetLimit(identifier: string, toolName?: string): void; /** * Clean up expired records to prevent memory leaks */ private cleanupExpiredRecords; /** * Get all active rate limit records (for monitoring) */ getActiveRecords(): Array<{ key: string; count: number; resetTime: number; }>; /** * Update rate limit configuration */ updateConfig(newConfig: Partial<RateLimitConfig>): void; /** * Create identifier from request context * In production, this could use IP address, user ID, API key, etc. */ static createIdentifier(context?: any): string; /** * Create a rate limit middleware for tool calls */ createMiddleware(): (identifier: string, toolName: string) => RateLimitResult; /** * Get human-readable rate limit info */ getRateLimitInfo(toolName?: string): string; } export declare const defaultRateLimiter: RateLimiter; export declare function rateLimit(toolName: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor; //# sourceMappingURL=rate-limiter.d.ts.map