Skip to content

Configure per-user rate limits on MCPServer #4550

Closed

Description

@jerm-dro

User Story

As a cluster admin,
I want to configure per-user rate limits on MCPServer,
so that no single user can monopolize a server's tools.

Context

See THV-0057: Rate Limiting for MCP Servers for full design details.

Acceptance Criteria

  • MCPServerSpec includes a rateLimiting.perUser field with maxTokens and refillPeriod
  • Per-tool per-user limits supported via rateLimiting.tools[].perUser
  • CRD admission validation rejects perUser when auth is not enabled
  • CRD admission validation rejects rateLimiting when neither global nor perUser is set
  • Operator sets RateLimitingConfigValid status condition at reconciliation time
  • Unit: User exceeds maxTokens — next request is rejected with JSON-RPC error -32029 and retryAfterSeconds
  • Unit: User A is rate-limited; User B's bucket is independent
  • Unit: Per-tool limit hit on expensive_tool doesn't affect other_tool
  • Unit: Request must pass both server-level per-user and per-tool per-user limits
  • Unit: Redis unavailable — request passes through (fail-open)
  • E2E: Deploy MCPServer with perUser rate limit, send traffic, verify rejection after limit exceeded
  • E2E: Streamable HTTP rejection returns HTTP 429 with Retry-After header
  • E2E: kubectl apply with perUser and no auth config is rejected at admission

Out of Scope

  • Global rate limits (STORY-002)
  • VirtualMCPServer (STORY-003)
  • Observability beyond fail-open counter (STORY-004)

Metadata

Metadata

Assignees

Labels

apienhancementgokubernetesoperator

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions