Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions apps/api/mcp/rate-limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ export class RateLimiter {

private readonly buckets = new Map<string, Bucket>();
private callsSinceSweep = 0;
private readonly limit: number;
private readonly windowMs: number;

constructor(
private readonly limit: number,
private readonly windowMs: number,
) {}
constructor(limit: number, windowMs: number) {
this.limit = limit;
this.windowMs = windowMs;
}

/** Increment the bucket for `key` and return whether the request is allowed. */
check(key: string, now: number = Date.now()): RateLimitResult {
Expand Down
Loading