
Agent Immune
io.github.denial-webPublished by GitHub account denial-webv0.2.2Updated Oct 24, 2026
AI agent security: prompt injection detection, semantic memory, output scanning, prompt hardening
Overview
A local MCP server that gives an assistant prompt-injection detection, output scanning, threat learning and prompt hardening for agent security.
- What you can do
- Assess user input for injection, exfiltration and indirect attacks, returning an allow, review, sanitize or block action with a score and session tracking for multi-turn escalation. Scan model output for credentials, PII, prompt leaks and encoded blobs. Record new attack text into a semantic memory bank so rephrased attacks are caught later. Harden message lists with role-lock, sandboxing and an output guard. Report assessment, block and latency metrics.
- When to use it
- Worth adding when an assistant handles untrusted user input or model output and you want a runtime guard layer on top of static rules, especially if you want it to learn from incidents and catch paraphrased or multilingual attacks.
- Requirements
- Local Python process installed from PyPI; Python 3.9+ (3.10+ for the MCP stack). Install the mcp extra and start it with the serve command over stdio, sse or streamable-http. Semantic memory needs the memory extra with sentence-transformers; fast search needs hnswlib. No accounts or API keys declared.
Installation
In SourceWeft
- Open Agent Immune in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
agent-immune
[CI] [Python 3.9+] [Coverage 94%] [License Apache-2.0] [181 tests] [Glama]
Adaptive threat intelligence for AI agent security: semantic memory, multi-turn escalation, output scanning, rate limiting, and prompt hardening — designed to complement deterministic governance stacks (e.g. Microsoft Agent OS), not replace them.
The immune system that governance toolkits don't include: it learns from incidents and catches rephrased attacks that slip past static rules.
Try it now
Run python demos/demo_quick.py for the full interactive demo.
Install
Python 3.9+ required; 3.11+ recommended. The MCP stack targets Python 3.10+ (see the mcp package).
MCP server (local)
Run agent-immune as an MCP server so hosts (Claude Desktop, Cursor, VS Code, etc.) can call security tools without embedding the library:
Tools exposed: assess_input, assess_output, learn_threat, harden_prompt, get_metrics.
Example Claude Code (HTTP):
Available on
[MCP Registry] [MCP.so] [Glama] [PulseMCP]
Quick start
Custom security policy
Pre-built attack corpus
Bootstrap semantic memory instantly with 50 curated attacks across 11 languages:
This gives you immediate protection against common injection, exfiltration, and indirect attacks without any training data. Add your own incidents on top with immune.learn().
Async support
JSON persistence & threat sharing
Observability
Structured JSON events are emitted to the agent_immune.events logger — pipe to any log aggregator.
Rate limiting / circuit breaker
Prompt hardening
The memory advantage
Regex alone catches known patterns. After learning 8 attacks, semantic memory catches rephrased attacks that evade all regex rules — while benign queries stay untouched:
Run PYTHONPATH=src python demos/demo_full_lifecycle.py to reproduce this on your machine.
Why agent-immune?
Architecture
Benchmarks
Regex-only baseline
Zero false positives across all datasets. Multilingual patterns cover English, German, Spanish, French, Croatian, Russian, Chinese, Japanese, Korean, Arabic, and Hindi.
With adversarial memory
The core thesis: learning from a small incident log lifts recall on unseen attacks through semantic similarity.
F1 improves from 0.657 → 0.849 (+29%) with 92 learned attacks. 67.4% of never-seen attacks are caught purely through semantic similarity. Precision stays >= 99.1%.
Methodology: "flagged" =
action != ALLOW. Held-out recall excludes training slice. Seed = 42.
Demos
Documentation
- Getting started — install → assess → scan → learn in 5 minutes
- Architecture — full system internals
- Integration guide — CLI, adapters, memory, policy, async
- Threat model
- Comparison
- Benchmarks
- Roadmap
- MCP marketplaces — Smithery, MCP.so, Glama, registry, Cursor
- Changelog
Landscape
License
Apache-2.0. See LICENSE.
Source: README.md at commit d220dd5
Tools
0Version history
1- v0.2.2LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts