
Agent Immune
io.github.denial-web由 GitHub 帳號 denial-web 發布v0.2.2更新於 Oct 24, 2026
AI agent security: prompt injection detection, semantic memory, output scanning, prompt hardening
概覽
一個本機 MCP 伺服器,為助理提供提示注入偵測、輸出掃描、威脅學習與提示加固等代理程式安全能力。
- 可以做什麼
- 評估使用者輸入中的注入、外洩與間接攻擊,回傳允許、複核、淨化或封鎖動作及分數,並依工作階段追蹤多輪升級。掃描模型輸出中的憑證、個人資料、提示洩漏與編碼內容。將新的攻擊文字寫入語意記憶庫,以便日後辨識改寫過的攻擊。對訊息清單進行角色鎖定、沙箱化與輸出防護的加固。回報評估次數、封鎖次數與延遲等指標。
- 適用情境
- 當助理需要處理不受信任的使用者輸入或模型輸出,並希望在靜態規則之上再加一層執行期防護時適合使用,尤其是希望從事件中學習並辨識改寫或多語言攻擊的情境。
- 執行需求
- 從 PyPI 安裝的本機 Python 程序;需要 Python 3.9 以上(MCP 部分需 3.10 以上)。安裝 mcp 附加元件後以 serve 指令透過 stdio、sse 或 streamable-http 啟動。語意記憶需 memory 附加元件與 sentence-transformers,快速檢索需 hnswlib。未宣告帳號或 API 金鑰。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Agent Immune,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
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.
來源:README.md,提交 d220dd5
工具
0版本歷史
1- v0.2.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分