tryaii-mcp-server
Version:
TryAII MCP Server - 15+ AI models with comparison, cost tracking, and collective intelligence
33 lines • 2.08 kB
TypeScript
import { Request, Response, NextFunction } from 'express';
import { AuthenticatedUser } from './services/AuthenticationService.js';
export interface AuthenticatedRequest extends Request {
user?: AuthenticatedUser;
startTime?: number;
requestId?: string;
}
export interface AuthMiddlewareOptions {
requireAuth?: boolean;
requiredPermissions?: string[];
rateLimitTier?: string;
skipRateLimit?: boolean;
skipMetrics?: boolean;
}
export declare class AuthMiddleware {
static authenticate(options?: AuthMiddlewareOptions): Promise<(req: AuthenticatedRequest, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>>;
static requestTracker(): (req: AuthenticatedRequest, res: Response, next: NextFunction) => void;
private static trackRequestCompletion;
private static estimateRequestCost;
private static sendErrorResponse;
private static sendRateLimitResponse;
static requirePermission(permission: string): Promise<(req: AuthenticatedRequest, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>>;
static withRateLimit(tier: string): Promise<(req: AuthenticatedRequest, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>>;
static optionalAuth(): Promise<(req: AuthenticatedRequest, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>>;
static adminOnly(): Promise<(req: AuthenticatedRequest, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>>;
}
export declare const authenticate: typeof AuthMiddleware.authenticate;
export declare const requestTracker: typeof AuthMiddleware.requestTracker;
export declare const requirePermission: typeof AuthMiddleware.requirePermission;
export declare const withRateLimit: typeof AuthMiddleware.withRateLimit;
export declare const optionalAuth: typeof AuthMiddleware.optionalAuth;
export declare const adminOnly: typeof AuthMiddleware.adminOnly;
//# sourceMappingURL=AuthMiddleware.d.ts.map