pypi ai-firewall-mcpstdioMITupdated 3mo ago
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.).
Was kannst du mit AI Firewall MCP machen?
<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
pip install ai-firewall-mcp
ai-firewall-mcp
Docker
docker pull akhilucky/ai-firewall-mcp:latest
docker run -i akhilucky/ai-firewall-mcp:latest
Claude Desktop
Add to claude_desktop_config.json:
pip install:
{
"mcpServers": {
"ai-firewall": {
"command": "pipx",
"args": ["run", "ai-firewall-mcp"]
}
}
}
Docker:
{
"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-mcpif installed via pip
MCP Tools
| Tool | Description |
|---|---|
analyze_prompt |
Analyze a prompt for injection, jailbreaks, exfiltration, and leakage |
get_threat_breakdown |
Detailed per-signal scoring breakdown from the last analysis |
sanitize_prompt |
Clean a suspicious prompt while preserving legitimate content |
get_firewall_status |
Health check: vector DB size, model status, uptime |
benchmark_firewall |
Run the adversarial test suite and return detection statistics |
Testing with MCP Inspector
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
| Agent | Role |
|---|---|
| Retrieval Agent | Semantic search against known attack patterns (FAISS + sentence-transformers) |
| Guard Agent | Multi-signal classification: vector similarity, keyword match, heuristic scoring |
| Policy Agent | Final 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 Var | Default | Description |
|---|---|---|
FIREWALL_MODE |
strict |
strict / moderate / permissive |
SIMILARITY_THRESHOLD |
0.50 |
Vector match threshold (lower = stricter) |
LOG_LEVEL |
INFO |
Logging verbosity |
CLI / API Usage
# Interactive dashboard
python main.py
# Red-team adversarial tests
python main.py --redteam
# REST API server
python main.py --api
# Single prompt analysis
python 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
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.
Installation
AI Firewall MCP zu deinem Client hinzufügen. Wähl den, den du nutzt.
claude mcp add ai-firewall-mcp -- uvx ai-firewall-mcpcodex mcp add ai-firewall-mcp -- uvx ai-firewall-mcpamp mcp add ai-firewall-mcp -- uvx ai-firewall-mcp{
"mcpServers": {
"ai-firewall-mcp": {
"command": "uvx",
"args": [
"ai-firewall-mcp"
]
}
}
}Add to `claude_desktop_config.json`, then restart Claude Desktop.
{
"mcpServers": {
"ai-firewall-mcp": {
"command": "uvx",
"args": [
"ai-firewall-mcp"
]
}
}
}Add to `~/.cursor/mcp.json`, or `.cursor/mcp.json` for a single project.
code --add-mcp '{"name":"ai-firewall-mcp","command":"uvx","args":["ai-firewall-mcp"]}'Or add the block manually to `.vscode/mcp.json` under `servers`.
{
"mcpServers": {
"ai-firewall-mcp": {
"command": "uvx",
"args": [
"ai-firewall-mcp"
]
}
}
}Add to `~/.codeium/windsurf/mcp_config.json`.
{
"mcpServers": {
"ai-firewall-mcp": {
"command": "uvx",
"args": [
"ai-firewall-mcp"
]
}
}
}Add to `cline_mcp_settings.json` via the MCP Servers panel.
{
"mcpServers": {
"ai-firewall-mcp": {
"command": "uvx",
"args": [
"ai-firewall-mcp"
]
}
}
}Add to `~/.gemini/settings.json`.
{
"mcpServers": {
"ai-firewall-mcp": {
"type": "local",
"command": "uvx",
"args": [
"ai-firewall-mcp"
],
"tools": [
"*"
]
}
}
}Add to `~/.copilot/mcp-config.json`, or run `/mcp add` inside the CLI.
{
"context_servers": {
"ai-firewall-mcp": {
"command": {
"path": "uvx",
"args": [
"ai-firewall-mcp"
]
}
}
}
}Add to your Zed `settings.json`.
uvx ai-firewall-mcpRun `goose configure`, choose **Add Extension → Command-line Extension**, and paste this command.
Score
39 / 100
Unvollständig
- Dokumentation25/25
- Pflege16/25
- Vertrauen13/20
- Funktionsumfang0/15
- Installation12/15
- Documents what it does and how to connect
- Has a resolvable package or endpoint
- Exposes at least one tool, prompt or resource
- README has substantive content
- Includes a code example
- Documents its configuration
- Mentions credentials or security posture
- Last commit 84 days ago
- Has a release history
- Repository is not archived
- Licensed MIT
- Namespace verified in the official MCP registry
- Claimed by its owner
- Published under an organisation
- 0 tool(s) documented
- Provides prompt templates
- Provides resources
- 12 documented install method(s)
- Published to a package registry
- Offers a hosted endpoint — no local install
Versionsverlauf
| Versionen | Veröffentlicht |
|---|---|
| 1.0.1Aktuell | 9. Juni 2026 |