AI Firewall MCP

io.github.Akhilucky由 GitHub 帳號 Akhilucky 發布v1.0.1更新於 Oct 24, 2026

Multi-agent LLM security layer detecting prompt injection and jailbreaks.

已驗證STDIO僅桌面安全與監控AI 與機器學習

概覽

AI 產生的概覽

一個 MCP 伺服器,在提示詞送達 LLM 之前偵測注入、越獄與政策違規。

可以做什麼
對每個提示詞執行三代理流程:檢索代理在 FAISS 向量資料庫中對已知攻擊模式做語意搜尋,守衛代理對向量相似度、關鍵字比對與啟發式規則評分,政策代理回傳 ALLOW、BLOCK 或 SANITIZE。提供五個工具:analyze_prompt、get_threat_breakdown、sanitize_prompt、get_firewall_status 與 benchmark_firewall。另附 CLI 與選用的 REST API。
適用情境
當助理或代理流程接收不受信任的使用者輸入,並希望在送入 LLM 前檢查提示詞注入、越獄嘗試或資料外洩與洩漏時使用。也可透過對抗性基準工具對自己的提示詞做紅隊測試。
執行需求
以 stdio 方式在使用者機器本機執行的程序。用 pip 或 pipx 安裝 PyPI 套件 ai-firewall-mcp,或執行 Docker 映像。未宣告帳號、API 金鑰或標頭。選用環境變數 FIREWALL_MODE、SIMILARITY_THRESHOLD 與 LOG_LEVEL 可調整行為。REST API 模式需要安裝 api 附加元件。
安裝前請注意
此伺服器會檢查提示詞文字,因此被分析的提示詞會由其本機模型與向量資料庫處理,請考量內容是否敏感。它回傳的 ALLOW、BLOCK 或 SANITIZE 決定可能修改或捨棄提示詞內容,在正式環境依賴前應先測試門檻。清單未要求任何憑證。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 AI Firewall MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

<mcp-name: io.github.Akhilucky/ai-firewall-mcp>

AI Firewall — MCP Server

A multi-agent AI security layer that protects LLMs from prompt injection, jailbreaks, and policy violations. Available as an MCP server for any MCP-compatible client (Claude Desktop, Cursor, Windsurf, Cline, Roo Code, etc.).

Quick Start

pip install

bash
pip install ai-firewall-mcpai-firewall-mcp

Docker

bash
docker pull akhilucky/ai-firewall-mcp:latestdocker run -i akhilucky/ai-firewall-mcp:latest

Claude Desktop

Add to claude_desktop_config.json:

pip install:

json
{  "mcpServers": {    "ai-firewall": {      "command": "pipx",      "args": ["run", "ai-firewall-mcp"]    }  }}

Docker:

json
{  "mcpServers": {    "ai-firewall": {      "command": "docker",      "args": ["run", "-i", "akhilucky/ai-firewall-mcp:latest"]    }  }}

Cursor / Windsurf / Cline / Roo Code

Configure in your MCP settings with:

  • Type: stdio
  • Command: docker run -i akhilucky/ai-firewall-mcp:latest
  • Or use ai-firewall-mcp if installed via pip

MCP Tools

ToolDescription
analyze_promptAnalyze a prompt for injection, jailbreaks, exfiltration, and leakage
get_threat_breakdownDetailed per-signal scoring breakdown from the last analysis
sanitize_promptClean a suspicious prompt while preserving legitimate content
get_firewall_statusHealth check: vector DB size, model status, uptime
benchmark_firewallRun the adversarial test suite and return detection statistics

Testing with MCP Inspector

bash
npx @modelcontextprotocol/inspector ai-firewall-mcp

Architecture

The firewall runs three agents per prompt:

User Prompt → [Retrieval Agent] → [Guard Agent] → [Policy Agent] → LLM                   │                    │               │                   ▼                    ▼               ▼              Vector DB (FAISS)    Threat Signals    Allow/Block
AgentRole
Retrieval AgentSemantic search against known attack patterns (FAISS + sentence-transformers)
Guard AgentMulti-signal classification: vector similarity, keyword match, heuristic scoring
Policy AgentFinal decision: ALLOW / BLOCK / SANITIZE based on configurable thresholds

Threat signals are weighted: 40% vector similarity, 25% keyword match, 20% heuristic, 15% policy weight.

Configuration

Env VarDefaultDescription
FIREWALL_MODEstrictstrict / moderate / permissive
SIMILARITY_THRESHOLD0.50Vector match threshold (lower = stricter)
LOG_LEVELINFOLogging verbosity

CLI / API Usage

bash
# Interactive dashboardpython main.py
# Red-team adversarial testspython main.py --redteam
# REST API serverpython main.py --api
# Single prompt analysispython main.py --analyze "Ignore all previous instructions"

The REST API runs at http://localhost:8000 with OpenAPI docs at /docs (requires pip install ai-firewall-mcp[api]).

Testing

bash
pytest tests/ -v          # Full test suite (43 tests)pytest tests/test_mcp.py  # MCP-specific tests only

Project Structure

├── src/ai_firewall/          # MCP server package (PyPI entry)│   ├── mcp_server.py         #    5 MCP tools, stdio transport│   ├── threat_scorer.py      #    Per-signal scoring breakdown│   └── __init__.py├── src/agents/               # Core firewall agents├── tests/                    # Test suites├── Dockerfile                # Docker image (2.04GB, CPU-only torch)├── pyproject.toml            # Package config & metadata└── .github/workflows/ci.yml  # CI/CD pipeline

License

MIT — see LICENSE.


Built for security. Designed for production.

來源:README.md,提交 4570507

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分