Skip to content

MCP mode, URL rate limits, proxy error codes, dashboard updates#1

Merged
sergeyfast merged 3 commits into
masterfrom
sync/2026-05-01
May 1, 2026
Merged

MCP mode, URL rate limits, proxy error codes, dashboard updates#1
sergeyfast merged 3 commits into
masterfrom
sync/2026-05-01

Conversation

@sergeyfast
Copy link
Copy Markdown
Contributor

Summary

  • Add MCP RPC mode for JSON-RPC tools/call (composite method names enable per-tool rate limits, whitelist and metrics) and per-URL rate limit rules (HTTP path/method/host matching)
  • Differentiate proxy error status codes: 503+Retry-After for circuit-breaker open and empty backend pool, 502 for real upstream errors, 500 for panic recovery; new wafsrv_proxy_errors_total{target, reason} metric
  • Surface URLRules and Proxy.NoBackendRetryAfter in the dashboard config view and config builder UI; minor alerter cleanup and nil-interface fix

Test plan

  • make fmt lint clean
  • go test ./... green
  • Spot-check /rpc/ config view shows new fields
  • Config builder TOML round-trip preserves URLRules and NoBackendRetryAfter

@sergeyfast sergeyfast changed the title Sync: MCP mode, URL rate limits, proxy error codes, dashboard updates MCP mode, URL rate limits, proxy error codes, dashboard updates May 1, 2026
sergeyfast added 3 commits May 1, 2026 10:16
- Add MCP mode to internal/waf/rpc: extract params.name from
  tools/call into composite method names like
  "tools/call:search_issues" for per-tool rate limits, whitelist
  and metrics; discover tools via POST tools/list
- Add URLRule limiter in internal/waf/limit for HTTP path/method/
  host matching alongside per-method JSON-RPC rules, AND-semantics
  across non-empty fields
- Refactor internal/waf/alerting payload to a single " · "-joined
  line; add table-driven tests
- Fix nil interface panic when alerter is unconfigured
- Add rule validation tests in internal/app/config_test.go: Name
  required, unique across Rules and URLRules, at least one match
  field
- Add custom ReverseProxy ErrorHandler in internal/waf/proxy:
  503 + Retry-After for circuit-breaker open / half-open-exceeded,
  502 for real upstream errors (TCP refused, DNS, timeout)
- Return 503 + Retry-After when backend pool is empty
- Add ErrorRecorder hook with reasons cb_open / upstream_error /
  no_backends; expose wafsrv_proxy_errors_total{target, reason}
- Fix panic recovery in accessLog middleware: return 500 (internal
  failure) instead of 502 (upstream error)
- Add Proxy.NoBackendRetryAfter config (default "5s") and document
  it in cfg/local.toml.dist
- Wire MCPMode into rpc.Discovery / rpc.Parse and LimiterConfig
  builds URLRules; build metrics before proxy so ErrorRecorder is
  ready at startup
- Document MCPMode and RateLimit.URLRules examples in
  cfg/local.toml.dist
- Include URLRules and Proxy.NoBackendRetryAfter in the config
  view exposed via /rpc/ (internal/app/config_view.go,
  internal/dashboard/config.go)
- Regenerate ProxySection / RateLimitSection wiring in
  internal/dashboard/dashboard_zenrpc.go for the new fields
- Render NoBackendRetryAfter under Proxy in the dashboard config
  tab and add a static line describing proxy error codes
  (cb_open=503+RA, upstream_error=502, no_backends=503+RA,
  panic=500)
- Add URLRules block (Path/Method/Host inputs, AND-semantics) and
  NoBackendRetryAfter input under Circuit Breaker in the config
  builder, with TOML round-tripping (default config, importer,
  emitter)
@sergeyfast sergeyfast merged commit a55da38 into master May 1, 2026
2 checks passed
@sergeyfast sergeyfast deleted the sync/2026-05-01 branch May 1, 2026 07:24
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