Skip to content

feat(rate-limiter): add per-server user limits - #198

Merged
lucarlig merged 3 commits into
mainfrom
feat/rate-limiter-user-server-limits
Oct 7, 2026
Merged

lucarlig merged 3 commits into
mainfrom
feat/rate-limiter-user-server-limits

Conversation

@vishu-bh

@vishu-bh vishu-bh commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add optional by_user_per_server rate limits keyed by user and MCP server
  • keep by_user as the global per-user ceiling across servers
  • keep by_tenant as an optional shared infrastructure ceiling
  • validate server identifiers and fail closed when the configured dimension is unavailable
  • support memory and Redis backends across fixed-window, sliding-window, and token-bucket algorithms
  • update manifest, Python API/stubs, documentation, tests, and package version to 0.1.11

Why

A shared tenant bucket does not provide fair allocation between users. One user can consume nearly all shared capacity. The new dimension gives every user an independent allowance for each server while preserving the existing global user limit.

Testing

  • cargo test -p rate_limiter — 89 passed
  • cargo clippy -p rate_limiter --all-targets -- -D warnings
  • focused Python integration suite — 61 passed
  • real Redis replica/isolation test — passed
  • cargo fmt --all -- --check
  • git diff --check

The umbrella integration run reached the existing Redis TLS fixture but could not complete locally because its generated certificate was rejected for a missing Authority Key Identifier. The focused feature suites and real Redis isolation test pass.

Closes #172.

Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>

@gandhipratik203 gandhipratik203 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vishu-bh vishu-bh self-assigned this Oct 6, 2026
Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>
Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>

@lucarlig lucarlig left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lucarlig
lucarlig merged commit 57fc9f0 into main Oct 7, 2026
29 checks passed
@lucarlig
lucarlig deleted the feat/rate-limiter-user-server-limits branch October 7, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Scope per-user rate limits by MCP server in cpex-rate-limiter

3 participants