Skip to content

About

F5 WAAP governance framework for MCP/AI-agent API traffic - detection engine, F5 policy artifacts, Claude triage pipeline.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Agentic API Security Governance Framework

CI Python 3.9+ MIT License 100% recall / 0 false positives

Agentic API Security Governance Framework

Applying F5 WAAP to MCP / AI-agent API traffic. Full project: charter, architecture, a working detection engine (validated against both simulated and real MCP protocol traffic), a multi-agent Claude analysis pipeline, F5 policy artifacts, an expanded precision/recall benchmark, and a live dashboard β€” all built on top of the same detection engine.

πŸ“„ Read the whitepaper β€” "Securing the Agentic Attack Surface: An F5 WAAP Governance Framework for MCP and AI-Agent API Traffic." Every number in it is reproducible from the commands in this README.

Highlights

  • 100% recall, 0 false positives across a 36-incident labeled benchmark spanning all 5 detection rules, enforced as a CI gate on every push
  • Detection accuracy holds against genuine MCP JSON-RPC protocol traffic (official MCP SDK), not just the synthetic simulator
  • Every finding maps 1:1 to a deployable F5 AS3 declaration or iRule β€” see f5-policy-artifacts/
  • A 4-agent Claude pipeline (Triage β†’ Root-Cause β†’ Remediation β†’ Report-Writer) triages every CRITICAL/HIGH finding with a logged, auditable reasoning trail
  • A live dashboard ties all of the above together β€” traffic feed, findings, agent reasoning, benchmark trend β€” in one view

Contents

Traffic flow, live

Animated traffic flow: AI agents through the MCP gateway, mirrored to F5 WAAP, benign traffic passing to enterprise APIs, flagged traffic routed to SIEM and ticketing

Green traffic sails through to the downstream APIs untouched; the gray mirrored copy is what the WAF layer actually inspects; anything that trips one of the 5 detection rules turns red and gets diverted into the SIEM β†’ ticket path instead. This is the same rule engine end to end β€” POC, real-MCP lab, benchmark, and dashboard all score traffic through poc/waf_detection_engine.py unmodified.

Project structure

agentic-api-security-framework/
β”œβ”€β”€ PROJECT_CHARTER.md          Scope, phases, success metrics
β”œβ”€β”€ ARCHITECTURE.md             System design + traffic flow
β”œβ”€β”€ assets/                     Animated SVG diagrams embedded in this README
β”œβ”€β”€ poc/                        Standalone simulator + detection engine (first-stage signal generator)
β”‚   β”œβ”€β”€ mcp_traffic_simulator.py
β”‚   β”œβ”€β”€ waf_detection_engine.py
β”‚   β”œβ”€β”€ run_demo.py
β”‚   β”œβ”€β”€ tests/                  pytest suite (recall + false-positive checks)
β”‚   └── sample_output/
β”œβ”€β”€ mcp_layer/                  Real MCP server/client (official MCP SDK) β€” genuine JSON-RPC
β”‚   β”‚                           traffic against the unchanged detection engine
β”‚   β”œβ”€β”€ mcp_server.py
β”‚   β”œβ”€β”€ client_agents.py
β”‚   └── run_lab.py
β”œβ”€β”€ agents/                     Multi-agent Claude pipeline
β”‚   β”œβ”€β”€ triage_agent.py         Severity/priority + false-positive triage
β”‚   β”œβ”€β”€ root_cause_agent.py     Why it happened, with a confidence level
β”‚   β”œβ”€β”€ remediation_agent.py    Proposed F5 AS3/iRule diff
β”‚   β”œβ”€β”€ report_writer_agent.py  Anonymized incident summary
β”‚   β”œβ”€β”€ ticketing.py            GitHub Issues (dry-run by default)
β”‚   └── pipeline.py             Chains all of the above; logs the reasoning trail
β”œβ”€β”€ benchmark/                  ~30-incident labeled corpus + precision/recall report
β”‚   β”œβ”€β”€ scenarios.py
β”‚   β”œβ”€β”€ run_benchmark.py
β”‚   └── tests/
β”œβ”€β”€ backend/                    Flask API wrapping the detection engine + agent outputs
β”‚   β”œβ”€β”€ app.py
β”‚   └── data_engine.py
β”œβ”€β”€ frontend/                   Dashboard (vanilla HTML/CSS/JS, Chart.js β€” vendored, no CDN)
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ styles.css
β”‚   └── app.js
β”œβ”€β”€ f5-policy-artifacts/        Real F5 config mapped to each finding
β”‚   β”œβ”€β”€ agentic_api_waf_policy.as3.json
β”‚   β”œβ”€β”€ mcp_traffic_irule.tcl
β”‚   └── README.md
β”œβ”€β”€ docker-compose.yml          backend + frontend + one-shot mcp-lab job
└── .github/workflows/ci.yml    Runs the pytest suites on every push

Run the dashboard (full stack, recommended)

Requires Python 3.9+.

cd backend
pip install -r requirements.txt
python3 app.py

Then open http://localhost:5050 in a browser.

What you'll see:

  • Live traffic feed β€” a tail -f-style stream of simulated MCP/agent API events, color-coded by severity
  • Findings by severity / by rule β€” donut + bar charts driven by /api/summary
  • Findings table β€” filterable, click any row to expand and see the OWASP mapping, the F5 control, a ticket status chip, and (if agents/pipeline.py has been run) the full Agent Reasoning trail β€” Triage β†’ Root-Cause β†’ Remediation β†’ Ticket
  • Agent risk profile β€” per-agent risk score derived from finding count
  • Detection Benchmark panel β€” precision/recall/false-positive rate per rule from the last benchmark/run_benchmark.py run, plus a recall trend sparkline across runs
  • Re-run simulation β€” regenerates traffic and re-scores it live, no page reload

The backend serves the frontend directly (same origin, no CORS needed) and reuses the exact detection logic from poc/waf_detection_engine.py β€” every layer below (real MCP traffic, the agent pipeline, the benchmark) runs the same unmodified rule engine; nothing replaces it.

Run just the POC (no UI)

cd poc
python3 run_demo.py
cat sample_output/detection_report.md

Run the real MCP protocol lab

Drives genuine MCP JSON-RPC traffic (official mcp Python SDK, stdio transport) against a real MCP server, then runs the exact same detection rules against the resulting log β€” proving detection isn't an artifact of the synthetic generator.

pip install mcp
cd mcp_layer
python3 run_lab.py
cat sample_output/mcp_detection_report.md

Run the multi-agent analysis pipeline

Animated multi-agent pipeline: Finding lights up Triage, then Root-Cause, then Remediation, then Report-Writer, then Ticket, in sequence

Chains four Claude agents over every CRITICAL/HIGH finding: Triage (severity/priority + false-positive filtering) β†’ Root-Cause (why it happened, with a confidence level) β†’ Remediation (a proposed F5 AS3/iRule diff) β†’ Report-Writer (one anonymized incident summary for the whole batch). Logs every agent's full response β€” including its thinking/reasoning text β€” so the dashboard can show a "why the system flagged this" trail per finding.

Requires ANTHROPIC_API_KEY in your environment.

pip install -r agents/requirements.txt
export ANTHROPIC_API_KEY=sk-ant-...      # never commit this
python3 agents/pipeline.py

Writes agents/sample_output/reasoning_trail.json (read by the dashboard's Agent Reasoning panel and ticket status column) and agents/sample_output/incident_report.md.

Model defaults to claude-sonnet-5; override with AGENT_MODEL.

Filing tickets

agents/ticketing.py opens a GitHub Issue for each non-false-positive CRITICAL/HIGH finding, with the Remediation Agent's proposed fix attached. Dry-run by default β€” nothing calls the GitHub API unless you opt in:

export TICKET_DRY_RUN=false
export GITHUB_TOKEN=ghp_...
export GITHUB_REPO=your-org/your-repo
python3 agents/pipeline.py

Run the tests

# Original 5-scenario POC suite (recall + false-positive guard)
cd poc && pip install -r requirements-dev.txt && python3 -m pytest tests/ -v

# Expanded ~30-incident benchmark suite (100% recall / 0 FP gate)
python3 -m pytest benchmark/tests -v

# Full precision/recall/false-positive report, per rule, plus OWASP coverage gaps
python3 benchmark/run_benchmark.py
cat benchmark/sample_output/benchmark_report.md

CI (.github/workflows/ci.yml) runs both pytest suites on every push. The agents/ pipeline isn't in CI since it requires a committed API key β€” smoke-test it manually with a real key instead.

Run with Docker Compose

docker compose up backend frontend
# One-shot real-MCP-protocol lab job, on demand:
docker compose --profile lab up mcp-lab

backend serves the dashboard at :5050; frontend is a standalone nginx static host of the same UI at :8080 (the backend also serves it directly β€” this is for the "frontend as its own service" deployment shape). Set ANTHROPIC_API_KEY, TICKET_DRY_RUN, GITHUB_TOKEN, GITHUB_REPO in your shell or a local .env (not committed) before docker compose up if you want the agent pipeline / real ticketing inside the container.

API reference

Endpoint Method Description
/api/health GET Liveness check
/api/summary GET Counts by severity / rule, agent count
/api/findings GET All findings; optional ?severity= ?rule= filters
/api/traffic GET Raw traffic events; optional ?limit=
/api/agents GET Per-agent event/finding counts + risk score
/api/simulate POST Regenerate traffic and re-run detection
/api/reasoning-trail GET Last agents/pipeline.py run's Triage/Root-Cause/Remediation/Ticket trail per finding
/api/benchmark GET Latest per-rule precision/recall/false-positive results
/api/benchmark-history GET Overall recall across every benchmark run (trend data)

Further reading

Document What's in it
WHITEPAPER.md The flagship write-up β€” problem statement, methodology, validation results, and honest gap list, built on this repo's actual output as evidence
PROJECT_CHARTER.md Scope, phased delivery status, success metrics
ARCHITECTURE.md Component-level design and traffic flow
f5-policy-artifacts/README.md How each detection rule maps to a real AS3/iRule control, plus known deployment gaps
CONTRIBUTING.md Project layout, setup, ground rules for changes
LICENSE MIT

About

F5 WAAP governance framework for MCP/AI-agent API traffic - detection engine, F5 policy artifacts, Claude triage pipeline.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages