MCP server: One MCP server.

AI Firewall MCP

@akhiluckyMCP server · External

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

AI agent governancev1.0.1MITPython
Freeno charge per call

Runs on your machine from its package; the steps are below.

What it does

  1. Reads
  2. Writes
  3. High impact

At most: only reads or looks up information.

What it costs

Free

Odel charges nothing per call. The publisher may charge for its own service.

Runs locally over stdio

This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).

PyPIai-firewall-mcpv1.0.1

Run

uvx ai-firewall-mcp

MCP client config

{
  "mcpServers": {
    "ai-firewall-mcp": {
      "command": "uvx",
      "args": [
        "ai-firewall-mcp"
      ]
    }
  }
}
README2 min read

<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-mcp
ai-firewall-mcp

Docker

bash
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:

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 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

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.

Similar modules

Browse AI agent governance