Without proper controls for how many times an Agent/LLM can hit an MCP Server, you open yourself up to potential DOS attacks, memory hogging, insane API bills, and server/system overload. Luckily, this can be mitigated quickly by rate-limiting the number of requests an Agent can make to an MCP Server.

In this blog post, you'll learn how to implement rate limiting for MCP using agentgateway.

Prerequisites

To follow along with this blog post from a hands-on perspective, you will need:

A k8s cluster (local with something like Kind or Minikube is perfect).