MCP Rate Limiter Middleware: Claude Code, Cursor Prompt

MCPMCP

MCP Rate Limiter Middleware: Claude Code, Cursor Prompt

Build a sliding window rate limiter for MCP servers that limits tool call frequency per caller identity

Write the TypeScript rate limiter middleware for the MCP server in [YOUR_PROJECT].

Requirements:
**Algorithm**: Sliding window counter. Track call timestamps per identity and tool pair in memory (or Redis if REDIS_URL i
TLDR

Sliding window rate limiter middleware for MCP servers. Limits tool calls per identity per time window, returns Retry-After in errors, and tracks usage in an in-memory store or Redis.

How to use

  1. 1

    Replace [YOUR_PROJECT] with the actual name of your project to ensure the middleware is tailored specifically to your application's context.

  2. 2

    Add any necessary environment variables like RATE_LIMIT_CALLS and RATE_LIMIT_WINDOW_SECONDS to customize the rate limiting behavior according to your MCP server's requirements.

  3. 3

    Try implementing the wrapWithRateLimit function to effectively manage tool calls and monitor usage, ensuring compliance with your defined rate limits.

Frequently asked questions

What is the MCP Rate Limiter Middleware: Claude Code, Cursor Prompt prompt used for?

Sliding window rate limiter middleware for MCP servers. Limits tool calls per identity per time window, returns Retry-After in errors, and tracks usage in an in-memory store or Redis.

How do I get the best results from this mcp server design prompt?

Paste the prompt into Claude Code, Cursor, fill in every bracketed placeholder with your specific information, then submit. The more detail you add to each placeholder, the more targeted the output. You can continue in the same conversation to refine tone, length, or focus without restarting from scratch.

Does this prompt work with Claude Code?

Yes. This prompt is optimized for Claude Code and also works well with Cursor. The structured format with a defined role and numbered steps produces consistent results across all major instruction-following models, so you can use whichever tool you prefer.

How do I access this mcp prompt?

This mcp server design prompt is available through TopFreePrompts with a Lucy+ licence. You can get access with a one-time Lucy+ purchase for $109, or a $15/month plan you can cancel anytime. Both options give access to the full library of 1,000,000+ prompts across all categories.

More MCP Prompts

View all

Related Prompts

View all