Skip to content

feat(cloudflare): add IP-based rate limiting for MCP and OAuth routes - #619

Merged
dcramer merged 1 commit into
mainfrom
rate-limit-mcp
Oct 31, 2025
Merged

dcramer merged 1 commit into
mainfrom
rate-limit-mcp

Conversation

@dcramer

@dcramer dcramer commented Oct 31, 2025

Copy link
Copy Markdown
Member

Implements rate limiting for MCP clients at 60 requests per minute per IP to protect against high traffic volumes. Built on Cloudflare rate limit bindings with privacy-preserving SHA-256 IP hashing.

Key changes:

  • Add MCP_RATE_LIMITER binding (60 req/60s per IP)
  • Create reusable rate-limiter utility with graceful degradation
  • Create client-ip utility for consistent IP extraction across routes
  • Apply rate limiting before OAuth processing in index.ts
  • Update app.ts and search.ts to use centralized IP extraction
  • Add error handling and Sentry logging when IP cannot be extracted
  • Update tests to include required CF-Connecting-IP headers

🤖 Generated with Claude Code

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Implements rate limiting for MCP clients at 60 requests per minute per IP
to protect against high traffic volumes. Built on Cloudflare rate limit
bindings with privacy-preserving SHA-256 IP hashing.

Key changes:
- Add MCP_RATE_LIMITER binding (60 req/60s per IP)
- Create reusable rate-limiter utility with graceful degradation
- Create client-ip utility for consistent IP extraction across routes
- Apply rate limiting before OAuth processing in index.ts
- Update app.ts and search.ts to use centralized IP extraction
- Add error handling and Sentry logging when IP cannot be extracted
- Update tests to include required CF-Connecting-IP headers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Code <noreply@anthropic.com>
@dcramer
dcramer merged commit a6a5a76 into main Oct 31, 2025
14 checks passed
@dcramer
dcramer deleted the rate-limit-mcp branch October 31, 2025 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant