{
  "markdown": "<div align=\"center\">\n  <img src=\"https://img.shields.io/badge/python-3.10%20|%203.11%20|%203.12-blue?logo=python&logoColor=white\">\n  <img src=\"https://img.shields.io/badge/License-MIT-green\">\n  <img src=\"https://img.shields.io/github/actions/workflow/status/Akhilucky/AI-firewall/ci.yml?branch=main&label=CI&logo=github\">\n  <img src=\"https://img.shields.io/pypi/v/ai-firewall-mcp?label=PyPI&logo=pypi\">\n  <img src=\"https://img.shields.io/docker/v/akhilucky/ai-firewall-mcp/latest?label=Docker%20Hub&logo=docker\">\n  <img src=\"https://img.shields.io/badge/MCP-Registry-8A2BE2\">\n  <br>\n  <a href=\"https://github.com/Akhilucky/AI-firewall\"><b>GitHub</b></a> •\n  <a href=\"https://pypi.org/project/ai-firewall-mcp/\"><b>PyPI</b></a> •\n  <a href=\"https://hub.docker.com/r/akhilucky/ai-firewall-mcp\"><b>Docker Hub</b></a>\n</div>\n\n<mcp-name: io.github.Akhilucky/ai-firewall-mcp>\n\n# AI Firewall — MCP Server\n\nA multi-agent AI security layer that protects LLMs from **prompt injection**, **jailbreaks**, and **policy violations**. Available as an [MCP](https://modelcontextprotocol.io) server for any MCP-compatible client (Claude Desktop, Cursor, Windsurf, Cline, Roo Code, etc.).\n\n## Quick Start\n\n### pip install\n\n```bash\npip install ai-firewall-mcp\nai-firewall-mcp\n```\n\n### Docker\n\n```bash\ndocker pull akhilucky/ai-firewall-mcp:latest\ndocker run -i akhilucky/ai-firewall-mcp:latest\n```\n\n### Claude Desktop\n\nAdd to `claude_desktop_config.json`:\n\n**pip install:**\n```json\n{\n  \"mcpServers\": {\n    \"ai-firewall\": {\n      \"command\": \"pipx\",\n      \"args\": [\"run\", \"ai-firewall-mcp\"]\n    }\n  }\n}\n```\n\n**Docker:**\n```json\n{\n  \"mcpServers\": {\n    \"ai-firewall\": {\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"-i\", \"akhilucky/ai-firewall-mcp:latest\"]\n    }\n  }\n}\n```\n\n### Cursor / Windsurf / Cline / Roo Code\n\nConfigure in your MCP settings with:\n- **Type:** `stdio`\n- **Command:** `docker run -i akhilucky/ai-firewall-mcp:latest`\n- Or use `ai-firewall-mcp` if installed via pip\n\n## MCP Tools\n\n| Tool | Description |\n|------|-------------|\n| `analyze_prompt` | Analyze a prompt for injection, jailbreaks, exfiltration, and leakage |\n| `get_threat_breakdown` | Detailed per-signal scoring breakdown from the last analysis |\n| `sanitize_prompt` | Clean a suspicious prompt while preserving legitimate content |\n| `get_firewall_status` | Health check: vector DB size, model status, uptime |\n| `benchmark_firewall` | Run the adversarial test suite and return detection statistics |\n\n### Testing with MCP Inspector\n\n```bash\nnpx @modelcontextprotocol/inspector ai-firewall-mcp\n```\n\n## Architecture\n\nThe firewall runs three agents per prompt:\n\n```\nUser Prompt → [Retrieval Agent] → [Guard Agent] → [Policy Agent] → LLM\n                   │                    │               │\n                   ▼                    ▼               ▼\n              Vector DB (FAISS)    Threat Signals    Allow/Block\n```\n\n| Agent | Role |\n|-------|------|\n| **Retrieval Agent** | Semantic search against known attack patterns (FAISS + sentence-transformers) |\n| **Guard Agent** | Multi-signal classification: vector similarity, keyword match, heuristic scoring |\n| **Policy Agent** | Final decision: `ALLOW` / `BLOCK` / `SANITIZE` based on configurable thresholds |\n\nThreat signals are weighted: **40% vector similarity**, **25% keyword match**, **20% heuristic**, **15% policy weight**.\n\n## Configuration\n\n| Env Var | Default | Description |\n|---------|---------|-------------|\n| `FIREWALL_MODE` | `strict` | `strict` / `moderate` / `permissive` |\n| `SIMILARITY_THRESHOLD` | `0.50` | Vector match threshold (lower = stricter) |\n| `LOG_LEVEL` | `INFO` | Logging verbosity |\n\n## CLI / API Usage\n\n```bash\n# Interactive dashboard\npython main.py\n\n# Red-team adversarial tests\npython main.py --redteam\n\n# REST API server\npython main.py --api\n\n# Single prompt analysis\npython main.py --analyze \"Ignore all previous instructions\"\n```\n\nThe REST API runs at `http://localhost:8000` with OpenAPI docs at `/docs` (requires `pip install ai-firewall-mcp[api]`).\n\n## Testing\n\n```bash\npytest tests/ -v          # Full test suite (43 tests)\npytest tests/test_mcp.py  # MCP-specific tests only\n```\n\n## Project Structure\n\n```\n├── src/ai_firewall/          # MCP server package (PyPI entry)\n│   ├── mcp_server.py         #    5 MCP tools, stdio transport\n│   ├── threat_scorer.py      #    Per-signal scoring breakdown\n│   └── __init__.py\n├── src/agents/               # Core firewall agents\n├── tests/                    # Test suites\n├── Dockerfile                # Docker image (2.04GB, CPU-only torch)\n├── pyproject.toml            # Package config & metadata\n└── .github/workflows/ci.yml  # CI/CD pipeline\n```\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n\n---\n\n<div align=\"center\">Built for security. Designed for production.</div>\n",
  "bytes": 4778,
  "sha": "6bee7f0a13687ce6dac272a0dc29ddbbff45667788fdeb5695df2f5cce80efaa",
  "repo_slug": "akhilucky/ai-firewall",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_akhilucky_ai_firewall_mcp_85d562c0/readme"
}