by KeyValueSoftwareSystems
Enables adversary emulation for AI agents, LLM applications, and MCP servers, letting teams test their AI systems against realistic attack scenarios.
Agent Opfor provides an open‑source red‑team framework that automatically generates and executes adversarial attacks across the full surface of AI agents, tool‑calling agents, MCP servers, and APIs. It maps attacks to the OWASP LLM Top 10, Agentic AI Top 10, MCP Top 10, API Security Top 10, and EU AI Act bias suites, then judges each response with a separate LLM evaluator.
npm install -g @keyvaluesystems/agent-opfor-cli
export OPENAI_API_KEY=your-key # or other provider keys
One‑shot:
opfor run
Two‑step (save reusable config):
opfor setup # wizard creates .opfor/configs/<file>
opfor run --config .opfor/configs/<file>
@keyvaluesystems/agent-opfor-sdk to a TypeScript project and call run or hunt programmatically.opfor hunt --endpoint <url> --objective "..." for a self‑directed, multi‑agent attack campaign.Q: Which LLM providers are supported? A: OpenAI, Anthropic, Google Gemini, Groq, and any OpenAI‑compatible service (LiteLLM, OpenRouter, Azure, Ollama, etc.) via environment variables.
Q: Do I need a separate server for MCP testing?
A: No. The same CLI/SDK can act as an MCP server; just register it in your IDE and invoke opfor commands through natural language.
Q: How are results stored?
A: Each run creates a timestamped folder under .opfor/reports/ containing an HTML report for browsing and a JSON file for programmatic consumption.
Q: Can I customize the attack suites?
A: Yes. You can select built‑in suites or create your own evaluator config files and reference them with --suite.
Q: Is the tool open source? A: Yes, licensed under Apache 2.0, with source hosted on GitHub.
OPFOR is short for Opposition Force — a military term for the unit that plays the enemy in training, so the rest of the army learns what real attacks feel like before they come. We named the tool after that idea: to defend AI agents better, you have to attack them first.
We've shipped 130 products for 90 startups over the last ten years. In the last 18 months, almost every one of them had an AI agent in it — and every one of those teams hit the same wall when it came to testing.
So we built OPFOR. For ourselves first. Now open source.
Apache 2.0. Built from India.
npm install -g @keyvaluesystems/agent-opfor-cli
export OPENAI_API_KEY=your-key # or GEMINI_API_KEY, ANTHROPIC_API_KEY, etc.
One-shot — runs the setup wizard and immediately starts the scan:
opfor run
Two-step — save a config you can reuse or commit to CI:
opfor setup # wizard saves a config to .opfor/configs/
opfor run --config .opfor/configs/<file> # run any time against the saved config
https://github.com/user-attachments/assets/a6a3cff2-2cf9-4486-944e-ac0163e7ea04
Opfor red-teams the full AI agent surface — prompts, tools, MCP servers, memory, and multi-turn reasoning. It generates targeted attacks for OWASP LLM Top 10, OWASP Agentic AI Top 10, OWASP MCP Top 10, OWASP API Security, and EU AI Act bias suites, fires them at your target, and judges each response with an LLM.
Most red-team tooling in this space is excellent at one thing — a probe library, a developer evaluator, a programmatic framework. Opfor covers more ground in one tool:
Different people on your team need different entry points. Opfor ships five.
| Mode | How | Best for |
|---|---|---|
| 🖥️ CLI | opfor setup → opfor run |
Engineers, CI/CD, terminal-first workflows |
| 🌐 Browser extension | Install the extension, click the icon on any chat interface | Product managers, designers, QA, security analysts — anyone who can't or won't write code |
| 🤖 MCP server | Register opfor in Cursor or Claude Desktop, then ask in chat | AI coding agents that test your other agents |
| ⚡ Skills | /opfor-setup · /opfor-run · /opfor-mcp-setup · /opfor-mcp-run |
Developers who want one-command testing inside their IDE |
| 📦 SDK | npm install @keyvaluesystems/agent-opfor-sdk, then call run / hunt from your code |
Programmatic red-teaming and custom workflows |
All five share the same evaluators, attack templates, and judge logic.
→ CLI reference · Browser extension setup · MCP setup · Skills setup · SDK reference · Session handling
When you run a scan, opfor:
Each run lands in its own subfolder under .opfor/reports/run-report-<compactTs>-<slug>-<shortId>/ containing <slug>-report.html and <slug>-report.json. Autonomous opfor hunt runs use the same layout under hunt-report-<compactTs>-<slug>-<shortId>/.
Opfor ships with curated suites that map to industry standards. Pick a suite or run individual evaluators.
| Suite ID | Standard | Focus |
|---|---|---|
owasp-llm-top10 |
OWASP LLM Top 10 (2025) | Prompt injection, jailbreaks, sensitive disclosure, system prompt leakage |
owasp-agentic-ai |
OWASP Agentic AI Top 10 | Excessive agency, tool misuse, agent goal hijack, memory poisoning |
owasp-mcp-top10 |
OWASP MCP Top 10 (2025) | Secret exposure, scope escalation, tool description injection, SSRF |
owasp-api |
OWASP API Security Top 10 | BOLA, BFLA, SQL injection |
eu-ai-act-bias |
EU AI Act — Bias | Age, gender, race, disability |
→ Full evaluator reference and OWASP mapping
Plug opfor into your observability stack and the LLM judge sees not just the final response — but every tool call, retrieval, and intermediate reasoning step. Out of the box, opfor integrates with Langfuse and Netra.
"telemetry": {
"provider": "langfuse",
"langfuse": { "baseUrl": "https://cloud.langfuse.com" }
}
This catches what input/output testing misses — PII that leaks into a tool call but never reaches the user, scope escalations in MCP that don't change the response text, agents that retrieve unauthorized data but render a clean reply.
opfor hunt skips the config file entirely. Give it an endpoint and an objective, and a multi-agent system — commander, operators, scout — runs an adaptive attack campaign on its own: recon, strategy, multi-turn probing, report. Unlike opfor run, the agents run on Claude only (via a Claude API key, claude setup-token, or your local claude login session) — your target can be anything.
opfor hunt \
--endpoint "https://your-agent.com/v1/chat" \
--objective "Find jailbreaks, system-prompt leakage, and safety bypasses."
Add --ui to watch the attack tree unfold in a live dashboard.
The browser extension is opfor's no-code path. Install from the Chrome Web Store, open any chat interface, click the opfor icon, pick a suite, and watch it run.
https://github.com/user-attachments/assets/80c2692f-b18b-4899-99df-e7eb8d50b02a
It auto-detects the chat interface, sends attack prompts as if you were typing them, watches the responses, and downloads an HTML report when done. No CLI, no target setup, no YAML.
This is the path for the half of every product team that doesn't open a terminal.
→ Install from the Chrome Web Store · Setup guide
The SDK is opfor's programmatic path. Install @keyvaluesystems/agent-opfor-sdk, call run or hunt, and get structured results back — no CLI, no config files, no subprocess.
import { Opfor } from "@keyvaluesystems/agent-opfor-sdk";
const opfor = new Opfor({ apiKey: process.env.ANTHROPIC_API_KEY });
const results = await opfor.run({
target: { url: "https://api.example.com/chat" },
suite: "owasp-llm-top10",
});
Use it in CI, in test suites, or anywhere you need red-teaming without leaving TypeScript.
| Example | Description |
|---|---|
| vanilla-chat | Plain customer support chatbot — test LLM-level vulnerabilities |
| customer-support | Tool-calling agent with PostgreSQL — test BOLA, BFLA, RBAC, PII |
| vulnerable-server | Sample MCP server with intentional vulnerabilities |
| Provider | Env var | Default model |
|---|---|---|
| Groq | GROQ_API_KEY |
llama-3.3-70b-versatile |
| OpenAI | OPENAI_API_KEY |
gpt-4o-mini |
| Anthropic | ANTHROPIC_API_KEY |
claude-3-5-haiku-20241022 |
GOOGLE_GENERATIVE_AI_API_KEY |
gemini-2.0-flash |
|
| OpenAI-compatible | OPFOR_API_KEY + baseURL |
LiteLLM, OpenRouter, Azure, Ollama |
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Built by the team at KeyValue Software Systems. Contact contact@agentopfor.ai for all enquiries.
Use opfor only on systems you own or are authorized to test. To report a vulnerability in opfor itself, see SECURITY.md — do not open a public issue.
Opfor is licensed under Apache 2.0 — see the LICENSE file for details.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by chaitin
A self‑hosted web application firewall and reverse proxy that protects web applications from attacks and exploits by filtering, monitoring, and blocking malicious HTTP/S traffic.
by snyk
Scans installed AI agent components, MCP servers, and skill files for prompt‑injection, tool poisoning, toxic flows, hard‑coded secrets and other supply‑chain risks.
by OpenOSINT
Provides an AI‑driven OSINT workflow that lets users query a natural‑language REPL, CLI, web UI, or MCP server, automatically selecting and chaining 18 reconnaissance tools to collect, pivot, verify, and report public‑source intelligence.
by safedep
Provides enterprise‑grade open source software supply chain security by scanning source code, dependencies, containers and SBOMs, detecting vulnerabilities and malicious packages, and enforcing policy as code.
by semgrep
Offers an MCP server that lets LLMs, agents, and IDEs run Semgrep scans to detect security vulnerabilities in source code.
by PortSwigger
Enables Burp Suite to communicate with AI clients via the Model Context Protocol, providing an MCP server and bundled stdio proxy.
by gensecaihq
Provides AI‑driven conversational access to Wazuh SIEM data, allowing natural‑language queries, threat analysis, incident triage, and compliance checks through a Model Context Protocol‑compliant remote server.
by cycodehq
Boost security in the development lifecycle via SAST, SCA, secrets, and IaC scanning.
by mobb-dev
Provides automatic security vulnerability remediation for code via a command‑line interface and an MCP server, leveraging findings from popular SAST tools such as Checkmarx, CodeQL, Fortify, and Snyk.