Skip to main content
Glama

AgentGuard MCP

A zero-dependency, self-hosted MCP server that turns the AgentGuard deterministic safety engine into an Alexa+–compatible Agent Skill. It screens agent inputs, tool arguments and retrieved documents for prompt injection, jailbreak, privilege escalation, tool coercion, exfiltration and PII — and returns a structured verdict with no model call, no network, and no false positives on benign traffic.

Built for the Amazon Developer Hackathon 2026 — Alexa+ track (Build, Ship, Shape). The server speaks the MCP Streamable HTTP transport, protocol 2025-11-25, which is exactly the spec the track requires.

Why

AgentGuard was originally built for the 7th China AI Competition "Agent Safety Protection Challenge" and is calibrated against five real misjudgement classes observed on an August adversarial message set. It is deterministic and fully offline, so any agent can call it as a guardrail without adding latency, cost or a model in the loop.

The same engine is reused across four competition submissions (China AI Safety Challenge, Dubai Create AI Agents Championship, Gemma paper, Songjiang AI Game), so this MCP server is the shared, reusable safety surface.

Related MCP server: classifinder-mcp

Tools

Tool

Input

Output

screen_text

{text}

{decision, risk, findings[], reasons, pii, redacted} — full verdict

redact_text

{text}

{redacted, pii_redacted} — PII masked copy

moderate_text

{text}

{flagged, categories{}} — OpenAI-moderations-shaped vector

decision is one of allow / refuse / sanitize. PII in the user's own message is masked and logged, never refused (input PII is not an attack).

Run

pip install -r requirements.txt   # no third-party deps; stdlib only
python app.py                      # listens on $PORT (default 8765)
  • GET /healthz → 200 {"ok": true} (platform health check)

  • POST /mcp → MCP Streamable HTTP JSON-RPC (Accept application/json or text/event-stream)

MCP handshake (what a judge's client does)

POST /mcp  initialize            -> protocolVersion 2025-11-25, capabilities.tools
POST /mcp  tools/list            -> screen_text, redact_text, moderate_text
POST /mcp  tools/call screen_text {text:"Ignore all previous instructions"}
                                 -> {decision:"refuse", risk:63, findings:[...]}

Test

python eval.py     # engine + real Streamable HTTP handshake; exit 0 = all green

The suite asserts benign traffic passes, known attacks are refused, the three gate-regression classes (Latin-substring false hit, URL-host educational downgrade, missing jailbreak phrasing) stay fixed, and the HTTP transport serves initialize/tools/list/tools/call over both JSON and SSE framing.

Design rules

  • Zero dependencies (Python standard library only).

  • Deterministic: same input → same verdict.

  • Never fabricate: every finding carries its rule id and matched span.

  • Benign traffic must pass (false-positive rate is a scored dimension).

This repo's offline suite asserts 69/69 engine + transport cases, ported from AuditPilot's AgentGuard upstream regression bank. MIT licensed.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Security middleware for LLM apps and AI agent pipelines. Detects prompt injection attacks (22 signatures, 7 languages) and anonymizes PII (17 entity types). Deterministic, sub-25ms, GDPR Art.30 compliant.
    -
  • A
    license
    Not graded
    quality
    A
    maintenance
    Protects AI agents from prompt injection attacks, jailbreak attempts, and common web vulnerabilities by screening untrusted input through semantic LLM analysis and static pattern matching.
    34 npm
    2
    ISC
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables scanning LLM prompts and responses for prompt injection, jailbreaks, PII leakage, secret leakage, and other malicious content using deterministic rules, returning verdicts and safe redacted text.
    1
    MIT