Skip to content

Commit e16cf8d

Browse files
tadasantclaude
andcommitted
Document rate limiting and multi-pod behavior
- Add rate limit section to official-registry-api.md documenting the 429 response format, limits, and client guidance - Add note in .env.example about per-pod rate limit behavior - Add code comment in server.go explaining multi-replica approximation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 358b21a commit e16cf8d

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ MCP_REGISTRY_OIDC_EDIT_PERMISSIONS=*
4040
MCP_REGISTRY_OIDC_PUBLISH_PERMISSIONS=*
4141

4242
# Rate limiting configuration
43+
# Note: Rate limits are enforced per-pod, so in multi-replica deployments the
44+
# effective limits are approximate (e.g., 2 replicas = up to 2x the configured rate).
4345
# Enable or disable rate limiting (default: true)
4446
MCP_REGISTRY_RATE_LIMIT_ENABLED=true
4547
# Maximum requests per minute per IP address (default: 60)

docs/reference/api/official-registry-api.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,28 @@ This API is based on the [generic registry API](./generic-registry-api.md) with
1414
- **[Live API Docs](https://registry.modelcontextprotocol.io/docs)** - Stoplight elements with try-it-now functionality
1515
- **[OpenAPI Spec](https://registry.modelcontextprotocol.io/openapi.yaml)** - Complete machine-readable specification
1616

17+
## Rate Limiting
18+
19+
The official registry enforces rate limits to protect against abuse:
20+
21+
- **60 requests per minute** per IP address
22+
- **1,000 requests per hour** per IP address
23+
24+
When rate limited, the API returns HTTP `429 Too Many Requests` with a `Retry-After: 60` header. The response body follows the [RFC 7807](https://tools.ietf.org/html/rfc7807) problem details format:
25+
26+
```json
27+
{
28+
"title": "Too Many Requests",
29+
"status": 429,
30+
"detail": "Rate limit exceeded. Please reduce request frequency and retry after some time."
31+
}
32+
```
33+
34+
**Notes:**
35+
- Rate limits are approximate due to the multi-replica deployment architecture
36+
- The `/health`, `/ping`, and `/metrics` endpoints are not rate limited
37+
- Clients should implement exponential backoff when receiving 429 responses
38+
1739
## Extensions
1840

1941
The official registry implements the [Generic Registry API](./generic-registry-api.md) with the following specific configurations and extensions:

internal/api/server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ func NewServer(cfg *config.Config, registryService service.RegistryService, metr
7272
// Order: TrailingSlash -> RateLimit -> CORS -> Mux
7373
handler := corsHandler.Handler(mux)
7474

75-
// Initialize rate limiter if enabled
75+
// Initialize rate limiter if enabled.
76+
// Note: Rate limits are enforced per-pod, so in multi-replica deployments the
77+
// effective limits are approximate (e.g., 2 replicas = up to 2x the configured rate).
7678
var rateLimiter *ratelimit.RateLimiter
7779
if cfg.RateLimitEnabled {
7880
rateLimitConfig := ratelimit.Config{

0 commit comments

Comments
 (0)