dome-throttle
Token-bucket rate limiting and budget tracking for MCPDome.
What it does
- Provides
RateLimiterwith per-identity and per-tool token-bucket rate limiting, using DashMap for lock-free concurrent access. - Provides
BudgetTrackerfor cumulative spend tracking per identity with configurable rolling time windows and caps. - Returns
DomeError::RateLimitedorDomeError::BudgetExhaustedon violation, allowing the interceptor chain to block and audit the request. - Supports configurable bucket sizes, refill rates, and budget limits via
RateLimiterConfigandBudgetTrackerConfig.
Usage
[]
= "0.1"
use ;
let limiter = new;
limiter.check_rate_limit?;
Part of MCPDome
This crate is part of MCPDome, a security gateway for the Model Context Protocol. See the main repository for full documentation.
License
Apache-2.0