AI agent security: 7 MCP tools for injection detection, PII scanning, command safety, DLP.
io.github.jnMetaCode/shellward MCP Server
The MCP server “ShellWard” provides AI agent security functionality via MCP tools for injection detection, PII scanning, command safety, and DLP. Its description frames the purpose as an AI application compliance gateway for AI-agent risk controls.
🛠️ Key Features
7 MCP tools for injection detection, PII scanning, command safety, and DLP
Threat detection focused on Chinese inputs (as stated)
Guards against prompt injection, data exfiltration, and dangerous commands (as stated)
Topics include mcp-security, dlp, guardrails, pii-detection, and ai-firewall
🚀 Use Cases
Use as an AI agent security/compliance layer for agent runtime protection
Apply to scenarios involving prompt injection risk and data exfiltration
Support command safety checks during agent execution
⚡ Developer Benefits
MCP integration with security-focused tooling
Centralized “compliance gateway” approach for AI applications
⚠️ Limitations
Provided excerpt does not specify tool names, exact interfaces, or the full toolCount.
AI Agent Security & Compliance Gateway — the AI agent security middleware built for China's regulatory regime (CSL / PIPL / MLPS 2.0 / cross-border data / AI labeling). Scan your project for compliance risks, then block prompt injection, data exfiltration, and dangerous commands at runtime. Chinese-language threat detection + Chinese PII + zero dependencies — things English tools don't do.
Quick start: npx shellward scan — zero install, read-only, nothing uploaded. Outputs a red/yellow/green scorecard mapped to Chinese regulations plus concrete file:line findings, and prescribes domestic compliant model alternatives for any overseas LLM it finds.
Demo
ShellWard AI agent firewall demo — blocking prompt injection, data exfiltration, and reverse shell attacks in real time
DLP model: data returns in full (no redaction), outbound sends are blocked when PII was recently accessed
PII detection: SSN, credit cards, API keys (OpenAI/GitHub/AWS), JWT, passwords — plus Chinese ID card (GB 11643 checksum), carrier-validated mobile, UnionPay bank card (Luhn) — precision-tuned to cut false positives
ShellWard runs as a standalone MCP server over stdio — zero dependencies, no @modelcontextprotocol/sdk needed.
Claude Desktop / Cursor / any MCP client:
Add to your MCP config (claude_desktop_config.json, .cursor/mcp.json, OpenClaw, etc.) — no install path needed, npx fetches the published shellward-mcp bin:
Block hardcoded secrets and overseas-LLM data-export risk before they merge. Add to .github/workflows/compliance.yml:
yaml
name:ComplianceScanon: [push, pull_request]
jobs:compliance:runs-on:ubuntu-lateststeps:-uses:actions/checkout@v4-uses:jnMetaCode/shellward@mainwith:path:'.'fail-on-critical:'true'# fail the build on critical findingslocale:'zh'# auto | zh | en
Or run it directly without the Action: npx shellward scan --ci.
Policy-as-code (.shellward.json)
声明式 CI 门禁(issue #2)— put a .shellward.json in your repo root:
Effectiveness is measured, not asserted. npm run bench runs every detector over a labeled corpus (attacks and hard negatives — benign text that looks suspicious) and reports precision/recall/F1. The corpus and harness live in bench/; CI fails on regression.
Category
Precision
Recall
F1
Prompt injection
100%
100%
100%
Dangerous commands
100%
100%
100%
PII / secrets
100%
100%
100%
MCP tool poisoning
100%
100%
100%
Compliance scan (overseas / secret / PII vs hard negatives)
100%
100%
100%
The compliance scanner has its own gated corpus — npm run bench:scan runs the real scanProject pipeline over 31 labeled cases (17 real risks + 14 hard negatives: domestic endpoints, placeholder keys, doc examples, lock files, invalid checksums). Self-authored corpus, CI-gated against regression.
83 gated samples (attacks + hard negatives). Zero-width-interleaved and empty-quote (r''m) obfuscation are normalized before matching. The corpus also tracks 5 documented bypasses (leetspeak, base64, non-zh/en languages, shell variable indirection) that regex/heuristics are not expected to catch — listed explicitly and excluded from the gate rather than hidden.
Numbers are on the current in-repo corpus — a floor, not a universal guarantee. Found a bypass? Add it to bench/corpus.ts as a labeled row and the gap becomes measurable (and CI-enforced).
Conservative by design: in enforce mode ShellWard fails safe — e.g. echo "rm -rf /" (printing a literal) is flagged, since regex can't distinguish it from echo "$(rm -rf /)" (which executes).
Vulnerability Database
17 built-in CVE / GitHub Security Advisories. /check-updates checks if your version is affected:
CVE-2025-59536 (CVSS 8.7) — Malicious repo executes commands via Hooks/MCP before trust prompt
CVE-2026-21852 (CVSS 5.3) — API key theft via settings.json
Remote vuln DB syncs every 24h, falls back to local DB when offline.
Use Cases
ShellWard is built for teams that need runtime security for AI agents — whether you are building autonomous coding assistants, customer-facing chatbots with tool access, or internal automation powered by LLMs. Common use cases include MCP security enforcement, tool call interception and filtering, and adding agent guardrails to any LLM-powered workflow.
ShellWard is the only tool with DLP-style data flow tracking + Chinese language security + zero dependencies in a single package.
Recent research (arXiv:2603.08665) demonstrates GenAI discovering 38 real-world vulnerabilities in 7 hours — AI-powered attacks are scaling fast. Defense must be built into the agent layer.