AgentShield
Security layer for AI agents: real-time interception of pip/npm/cargo/gem/go installs via Hermes & OpenClaw plugins, Claude Code/Codex hooks, MCP, shell guard, PATH shim, execve, and index proxy. Checks CVEs (OSV/NVD/GitHub), typosquats, malware, licenses, provenance, trust, lockfile hashes.
Install / Use
claude mcp add mkarvan -- npx -y github:mkarvan/AgentShieldIf the server publishes to npm under a different name, use that package instead — check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
SecuritySupported Platforms
Our assessment of AgentShield
AgentShield scores 74/100 on our quality scale, 1048th of 1,125 Security skills we index.
Its MCP Server is 93 KB long, well organised into 191 sections with 76 code examples: long enough that it reads more like full documentation than a focused instruction file, which agents can find harder to follow.
It has 3 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated 31 days ago, so AgentShield is actively maintained.
- Our last check on 2026-09-26 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 92/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
WarningOur scan of the whole file found 2 high-risk patterns. Read the lines below before installing AgentShield, and do not run it with automatic approvals. An AI review of the same text found nothing harmful.
- highDecodes hidden content and executes itline 215
| T3.4 | Obfuscated code | `exec(base64.b64decode(...))`, marshal/zlib chains | - highDecodes hidden content and executes itline 1237
| `T3_4_obfuscation.yaml` | T3.4 | `exec(base64.b64decode(...))`, marshal/zlib deobfuscation |
AI review by kimi-k2.7-code on 2026-09-27. Automated pattern scan on 2026-09-27. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
AgentShield compared with similar skills
All 4 of these similar skills score higher than AgentShield; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| AgentShield (this skill)by mkarvan | 74 | 3 | 31d ago | MCP Server |
| Agent-Reachby Panniantong | 100 | 101.3k | today | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 77.6k | 1d ago | CLAUDE.md |
| CowAgentby zhayujie | 100 | 47.5k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 89.3k | 1d ago | MCP Server |
Frequently asked questions
- How do I install AgentShield?
- Run
claude mcp add mkarvan -- npx -y github:mkarvan/AgentShield. The install tabs above show the steps for each supported agent. - Which AI agents does AgentShield work with?
- It is written for Claude Code, Claude Desktop and OpenAI Codex, as a MCP Server file. Other agents that read the same format can often use it too.
- Is AgentShield safe to use?
- Our scan of the whole file found 2 high-risk patterns. Read the lines below before installing AgentShield, and do not run it with automatic approvals. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 92/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is AgentShield still maintained?
- The repository was last updated 31 days ago, so AgentShield is actively maintained.
Skill content
View source on GitHubAgentShield
Security layer for AI agent frameworks. AgentShield intercepts package installation requests made by AI agents, checks them against CVE databases and static analysis tools, enforces configurable response policies, and generates security posture reports — all locally, with no telemetry.
AI agent? Skip straight to the Agent Setup Guide — it has everything your agent needs to integrate AgentShield in one self-contained document.
Why this exists
AI agents can now install arbitrary packages on behalf of users. This creates a novel attack surface that existing security tooling doesn't address:
- An agent can be prompt-injected — a malicious web page or tool result instructs the agent to install a backdoored package
- Agents may typosquat — suggest
requetsinstead ofrequests, orpandainstead ofpandas - Agents don't inherently check CVEs or audit dependency trees before installing
- Compromised packages can exfiltrate context windows, API keys, tool credentials, or local files before the user notices anything
AgentShield sits between the agent's intent ("install X") and the system executing that intent, providing a security checkpoint the agent cannot bypass. It works with any framework through native plugins (Hermes, OpenClaw) or the MCP protocol.
Table of Contents
- Architecture
- Threat model
- Installation
- Quick start
- Configuration
- CLI reference
- Framework integrations
- Posture reports
- Python API
- Static analysis (--deep)
- Transitive dependency scanning
- SBOM generation
- License compliance scanning
- pre-commit hook
- GitHub Action
- Drift detection
- Rate limits
- Diff scan mode
- Trust score / reputation system
- Container / Docker scanning
- HTTP daemon mode
- agentshield guard
- Offline mode
- Caching
- Audit log
- Provenance / attestations
- SARIF output
- Waivers
- Notifications
- Testing
- Contributing
- License
Architecture
┌───────────────────────────────── Entry points ─────────────────────────────────┐
│ │
│ Agent plugins (in-process) Agent hooks Servers / CLI │
│ ┌───────────────────────┐ ┌────────────────────┐ ┌─────────────────────────┐ │
│ │ Hermes pre_tool_call │ │ Claude Code, Codex │ │ MCP (stdio) · HTTP :8765│ │
│ │ OpenClaw │ │ PreToolUse │ │ IPC socket · CLI / CI │ │
│ │ before_tool_call │ │ (agentshield hook) │ │ GitHub Action·pre-commit│ │
│ └───────────┬───────────┘ └─────────┬──────────┘ └────────────┬────────────┘ │
└──────────────┼────────────────────────┼──────────────────────────┼──────────────┘
│ │ │
┌──────────────┴────────────────────────┴──────────────────────────┴──────────────┐
│ Enforcement layers (all fail CLOSED) │
│ guard shell wrapper · PATH shim · execve interceptor (LD_PRELOAD/dyld) │
│ index proxy :8799 — PIP_INDEX_URL / npm registry / GOPROXY │
└──────────────────────────────────────┬──────────────────────────────────────────┘
│ ScanRequest
┌──────────▼──────────┐
│ Core Engine │
│ denylist → allowlist│
│ → cache → rate limit│
└──────────┬──────────┘
│ cache miss
┌─────────────────────────────┼─────────────────────────────┐
│ │ │
┌────────▼─────────┐ ┌───────────▼───────────┐ ┌──────────▼──────────┐
│ Enrichment │ │ Local heuristics │ │ Static analysis │
│ (parallel, fails │ │ (offline-capable) │ │ (--deep only) │
│ open) │ │ │ │ │
│ • OSV │ │ • typosquat (T1.2) │ │ • semgrep │
│ • NVD (CPE- │ │ • malicious DB (T1.1) │ │ • bandit │
│ version-aware) │ │ • prompt-inj. (T4.1) │ │ • AST inspector │
│ • GitHub Advisory│ │ • drift (D1.1) │ │ (PyPI wheels/ │
│ • license (L1.1) │ │ • lockfile hashes │ │ sdists) (T3.x) │
│ • provenance │ │ (H1.x) │ └─────────────────────┘
│ (T6.x) │ │ • syspkg CVEs (SP1.x) │
│ • trust score │ └───────────────────────┘
│ (T5.1) │
└──────────────────┘
│
┌────────▼────────────────────────────────────────────────┐
│ Response Engine │
│ severity policy → per-ecosystem → per-rule-ID → waivers │
│ ⇒ ALLOW · BLOCK · NEEDS_CONFIRMATION · LOG_ASYNC │
└────────┬────────────────────────────────────────────────┘
│ every decision
┌────────▼─────────────────────────┐ ┌──────────────────────────────────┐
│ Audit log — hash-chained JSONL │ │ Local SQLite │
│ + SQLite query index │ │ scan cache · CVE mirror · │
│ + HTTP/syslog forwarding │ │ malicious DB · scan history · │
│ Webhook notifications (Slack) │ │ provenance history · rate limits │
└──────────────────────────────────┘ └──────────────────────────────────┘
Data flow
Agent: "pip install numpy==1.24.0"
│
▼
[Entry point] plugin hook / PreToolUse / guard / shim / execve / proxy / CLI
└─→ ScanRequest(package="numpy", version="1.24.0", ecosystem="pypi")
│
▼
[Core Engine]
├── denylist → BLOCK immediately (never scanned)
├── allowlist → ALLOW immediately (never scanned)
├── cache HIT → return cached ScanResult (< 5 ms; BLOCK verdicts never expire)
└── cache MISS →
├── [Rate limits] packages/hour + per-session wheel budget (R1.1)
├── [Enrichment ∥] OSV + NVD + GitHub Advisory — version-filtered when
│ pinned — plus license policy (L1.1), provenance
│ attestations (T6.x), trust score (T5.1)
├── [Typosquat] Levenshtein vs. top-N package list (T1.2)
├── [Malicious] curated DB + warmed OSV malicious feed (T1.1)
├── [T4.1] prompt-injection heuristic on context_hint
├── [--deep] download wheel → semgrep + bandit + AST (T3.x)
├── [Drift] decision regressed since last scan? (D1.1)
└── [--verify-hashes, scan-file] recorded lockfile hashes vs.
live registry digests (H1.x)
│
▼
[Response Engine] severity policy → ecosystem → rule overrides
│ → waivers (time-boxed, annotated, never silent)
┌─────┴──────┐
│ │
ALLOW BLOCK / NEEDS_CONFIRMATION / LOG_ASYNC
│ │
└─────┬──────┘
▼
[Cache write] severity-based TTL (3 h critical → 7 d clean);
│ BLOCK cached with no expiry (never silently flips to ALLOW)
▼
[Audit log] hash-chained record for EVERY decision — including
│ short-circuits and cache hits (+ webhook notification)
▼
[Entry point] → decision returned to the framework — fail closed on errors
Design principles
- Local-first. The SQLite cache, CVE mirror, and malicious-package list are all on disk. Core scans work without network after
cache warm. No telemetry, no cloud dependency. - Enrichment fails open; enforcement fails closed. When an enrichment source (OSV/NVD/GitHub) times out or errors, it's skipped and logged at WARNING — the scan continues with remaining sources. But the enforcement layers (hooks, guard, shim, execve, proxy) fail closed: a detected install that cannot be verified — unanalyzable arguments, an unsupported source, or a scanner error — is blocked, not allowed through.
- Static analysis is opt-in.
--deepdownloads the wheel and runs semgrep/bandit. Default scans (CVE + typosquat) run in < 3 seconds without downloading anything. - Policy over hard-coding. Every response (block/warn/ignore/log) is driven by the config. You can tune per-severity, per-ecosystem, or per-rule-ID.
Threat model
Informed by "A Security Analysis of the OpenClaw AI Agent Framework" (arXiv 2603.27517), adapted for supply-chain attack vectors.
T1 — Supply Chain Attacks
| ID | Threat | Description |
|----|--------|-------------|
| T1.1 | Malicious package | Package exists solely to exfiltrate data or execute malicious code |
| T1.2 | Typosquatting | Name is a near-miss of a legitimate package (reqests vs requests) |
| T1.3 | Dependency confusion | Internal package name shadowed by a public registry package |
| T1.4 | Compromised package | Legitimate package with a malicious version injected post-publish |
T2 — Known Vulnerabilities (CVEs)
| ID | Threat | Description | |----|--------|-------------| | T2.1 | Critical CVE | CVSS ≥ 9.0 in the requested version | | T2.2 | High CVE | CVSS 7.0–8.9 in the requested version | | T2.3 | Transitive CVE | Vulnerability in a dependency of the requested package | | T2.4 | Outdated package | Newer version available with security fixes |
T3 — Install-time Code Red Flags (--deep)
| ID | Threat | Detected by |
|----|--------|-------------|
| T3.1 | Shell execution | subprocess, exec, eval, os.system in setup.py |
| T3.2 | Network at install time | urllib.request, requests, socket calls in setup.py |
| T3.3 | Filesystem write outside package dir | Writes to ~/.ssh, ~/.aws, /etc at install |
| T3.4 | Obfuscated code | exec(base64.b64decode(...)), marshal/zlib chains |
| T3.5 | Credential harvesting | Reads *_KEY, *_TOKEN, *_SECRET env vars at install |
T4 — Agent-Specific Risks
| ID | Threat | Coverage |
|----|--------|---------|
| T4.1 | Prompt-injected install | Heuristic: flags package names in quoted/code-block patterns in context_hint |
| T4.2 | Excessive tool permissions | Posture report: tool risk classification |
| T4.3 | Context exfiltration risk | Posture report: sensitive env var detection |
Severity and response defaults
| Severity | CVSS range | Default response | |----------|-----------
Truncated for display — read the full file on GitHub.
Related Skills
Agent-Reach
101.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
77.6kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
CowAgent
47.5kOpen-source personal AI assistant & Agent Harness. Plans tasks, runs tools and skills, self-evolves with memory and knowledge. Multi-agent, multi-model, multi-channel. Lightweight, extensible, one-line install.
Scrapling
89.3k🕷️ A Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
