Per-key token-bucket rate limiter for /mcp requests.
Nginx already rate-limits by IP. This is the second tier: a misbehaving
key (runaway client loop) gets throttled even when its IP is fine. The
rate key is derived from the provider's non-secret credential/principal
cache key (see deriveRateKey in http-fetch-handler.ts), so raw credentials
and key IDs never become metrics/log labels. The HTTP entry derives it after
per-request credential resolution.
Defaults: 60 requests/sec sustained, burst capacity 120. Override via
B2_MCP_RATE_LIMIT_RPS and B2_MCP_RATE_LIMIT_BURST env vars.
Buckets that have been full for over IDLE_TTL_MS are evicted by periodic
HTTP sweeps and by throttled opportunistic sweeps so the Map doesn't grow
unbounded.
Per-key token-bucket rate limiter for /mcp requests.
Nginx already rate-limits by IP. This is the second tier: a misbehaving key (runaway client loop) gets throttled even when its IP is fine. The rate key is derived from the provider's non-secret credential/principal cache key (see deriveRateKey in http-fetch-handler.ts), so raw credentials and key IDs never become metrics/log labels. The HTTP entry derives it after per-request credential resolution.
Defaults: 60 requests/sec sustained, burst capacity 120. Override via B2_MCP_RATE_LIMIT_RPS and B2_MCP_RATE_LIMIT_BURST env vars.
Buckets that have been full for over IDLE_TTL_MS are evicted by periodic HTTP sweeps and by throttled opportunistic sweeps so the Map doesn't grow unbounded.