Class: Otto::MCP::RateLimitMiddleware

Inherits:
Security::RateLimitMiddleware
  • Object
show all
Defined in:
lib/otto/mcp/rate_limiting.rb

Overview

Middleware for applying rate limits to MCP protocol endpoints

Instance Method Summary collapse

Constructor Details

#initialize(app, security_config = nil) ⇒ RateLimitMiddleware

Returns a new instance of RateLimitMiddleware.



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/otto/mcp/rate_limiting.rb', line 131

def initialize(app, security_config = nil)
  @app                    = app
  @security_config        = security_config
  @rate_limiter_available = defined?(Rack::Attack)

  if @rate_limiter_available
    configure_mcp_rate_limiting
  else
    Otto.logger.warn '[MCP] rack-attack not available - rate limiting disabled'
  end
end