limit_req_zone $binary_remote_addr zone=mcp_sample:1m rate=30r/m; server { listen 8080; server_name _; location = /health { access_log off; return 200 'ok'; } location ~ ^/(mcp|\.well-known/oauth-protected-resource/mcp)$ { client_max_body_size 32k; client_body_timeout 15s; limit_req zone=mcp_sample burst=10 nodelay; limit_req_status 429; proxy_pass http://mcp:3000; proxy_set_header X-Forwarded-For $remote_addr; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_buffering off; proxy_request_buffering off; proxy_cache off; proxy_connect_timeout 5s; proxy_read_timeout 25s; proxy_send_timeout 25s; add_header Cache-Control no-store always; add_header X-Accel-Buffering no always; error_page 429 = @rate; } location @rate { default_type application/json; add_header Retry-After 60 always; return 429 '{"error":"rate_limited"}'; } location / { return 404; } }