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.
Agent skill: a full compliance audit, with receipts
scan is deterministic: it can tell you "this project calls an overseas LLM endpoint", but not whether personal data actually flows to it — and 11 of the 14 regulatory controls can only be marked "needs manual review". The china-ai-compliance-audit skill hands that part to your coding agent (Claude Code, Cursor, Codex, or anything that supports Agent Skills).
Paste this into your agent:
text
Install the china-ai-compliance-audit skill from https://github.com/jnMetaCode/shellward and audit this project with it.
or npx skills add jnMetaCode/shellward --skill china-ai-compliance-audit.
It runs shellward scan as a deterministic baseline, traces the data flow control by control, and writes .compliance/COMPLIANCE-REPORT.md. What makes it different from "ask the AI if this looks compliant" is three gates:
Evidence gate — every finding needs file:line plus a verbatim quote. A zero-dependency validator opens each file and checks the quote is really there. Hallucinated citations fail the run.
Verification gate — every "gap" and every "measure found" is handed to a fresh agent that never saw the auditor's reasoning, whose only job is to disprove it. Overturned findings are kept on record, not deleted.
Honesty gate — facts that aren't in the repo (filings, impact assessments, actual log retention) can't be guessed. The agent must ask one specific question a human can answer, with no severity attached.
All 14 controls must reach a verdict — no silent skips — and the report itself may not contain full secrets, phone numbers or ID numbers.
Example (demo project, full record): a support bot that shellward scan grades 75/100 [B] with a single "OpenAI endpoint" note. The audit follows the call chain and finds customer phone and national-ID numbers interpolated into the system prompt sent overseas — 2 critical, 3 high, plus 6 questions only a human can answer.
A technical self-check, not legal advice.
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:
path — one pattern or a list, relative to the repo root: ** any depth, * within one directory, ? one char. A pattern without / (e.g. *.py) matches at any depth, like .gitignore; a pattern without wildcards (e.g. agents) matches that file or everything under that directory.
failOn / maxFindings — same meaning as the global fields, counted only over findings in scope.
allowOverseas — omitted = inherit the global list; set it (even to []) to override for that path. Above, agents/** must have no overseas calls at all, while OpenAI stays allowed elsewhere.
Unknown fields, misspelled failOn values (e.g. "secrets") and a broken JSON file are printed as ⚠️ warnings in CI instead of being silently ignored — a typo can no longer turn the gate into a no-op.
shellward scan --ci reads it; without the file it defaults to "fail on any critical". 实现「策略在 Git push 时声明 → 运行时执行」的纵深防御。
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 41 labeled cases (24 real risks + 17 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.