The CloudBees CI MCP Router can cap how quickly a single caller reaches its /mcp endpoint, so that one misconfigured client or a runaway agent loop cannot flood the CloudBees CI MCP Router and overwhelm the controllers behind it.
Rate limiting is disabled by default.
Enable it when you are ready to protect a shared or public deployment.
How rate limiting works
Rate limiting gives each caller its own allowance of requests over a rolling window of time. Each request consumes one unit of the allowance, which refills steadily as the window progresses. If you know the pattern, this is a per-identity token bucket.
While a caller stays within its allowance, its requests pass straight through without being rate limited.
Once the allowance runs out, further requests receive an HTTP 429 Too Many Requests response with a Retry-After header that tells the client how long to wait before trying again.
The check runs at the very front of the /mcp endpoint, before any message is parsed, so it applies to the whole MCP conversation, including initialize, tools/list, and tools/call.
The CloudBees CI MCP Router identifies each caller in one of two ways:
-
Authenticated callers are keyed by a hash of their
Authorizationheader, so the raw credential is never stored, and each token or user gets its own allowance. -
Callers with no
Authorizationheader are keyed by their client IP address, so one anonymous flood cannot lock everyone else out.
Enable rate limiting
To turn on rate limiting, set MCP_RATE_LIMIT_ENABLED to true on the CloudBees CI MCP Router when you deploy it.
The remaining variables are optional; they refine the limit and take the defaults shown below.
If you deploy the CloudBees CI MCP Router with the cloudbees-core Helm chart, set these variables using McpRouter.extraEnv instead.
|
Before you enable it, watch normal traffic for a while and pick a ceiling that leaves legitimate agents comfortable headroom. A good starting point is roughly twice your observed peak, which stops abuse without throttling healthy clients.
Rate limiting environment variables
| Environment variable | Possible values | Description |
|---|---|---|
|
|
The master switch.
Set it to |
|
A positive whole number |
The maximum number of requests each caller can make within one window. |
|
A number with the suffix |
The window over which each caller’s allowance refills. |
|
A positive whole number |
The maximum number of distinct callers tracked at once. When this limit is reached, the limiter evicts the least recently seen caller, which caps how much memory it can use. |
|
|
Whether to trust the |
With the defaults, each caller is allowed 120 requests per minute.
Security considerations
Rate limiting is a protective control, so keep the following in mind when you configure it.
|
Enable |
Rate limiting protects availability, not access. It limits how often a caller can reach the CloudBees CI MCP Router, but it does not authenticate or authorize anyone, so keep OAuth or another authentication method in place as well.
Authenticated callers are keyed by a hash of their Authorization header, so raw tokens and passwords are never stored.
MCP_RATE_LIMIT_MAX_BUCKETS also caps how many callers are tracked at once and evicts the least recently seen when the cap is reached, so a flood of ever-changing identities cannot grow the limiter’s memory without bound.