← all repositories
affaan-m/agentshield

Security scanner grades your AI agent config F–A

AgentShield audits Claude Code and MCP server setups for hardcoded secrets, overbroad permissions, and prompt-injection risks before they become exploits.

1.2k stars TypeScript LLMOps · EvalCoding Assistants
agentshield
Velocity · 7d
+6.0
★ / day
Trend
accelerating
star history

What it does

AgentShield is a security scanner aimed at AI agent configurations, with a primary focus on Claude Code setups. It crawls your .claude/ directory and flags hardcoded API keys, wildcard tool permissions like Bash(*), risky MCP server definitions, malicious hook patterns, and prompt-injection vectors hidden in agent instructions. Each scan produces a graded report from F to A with a 0–100 numeric score, and it can auto-fix safe issues such as swapping exposed secrets for environment variable references.

The interesting bit

The tool tries to avoid false alarms by tagging findings with runtimeConfidence levels—distinguishing active runtime configs from repository templates, plugin caches, and documentation examples. A risky MCP server in a template file gets weighted at 0.25× rather than scoring like a live enabled server. It also scans for persistence artifacts used in recent npm and PyPI malware campaigns that specifically targeted AI developer tooling.

Key highlights

  • 102 audit rules across five categories: secrets, permissions, hooks, MCP servers, and agent configs
  • Supply-chain verification for MCP packages, checking provenance, pin status, and postinstall scripts
  • Auto-discovery of ~/.claude/ with sensible skips for transient directories like node_modules
  • Optional three-agent Opus 4.6 adversarial analysis mode (--opus) for deeper inspection
  • Built at the Anthropic × Cerebral Valley Claude Code Hackathon; part of the 42K-star Everything Claude Code ecosystem

Caveats

  • The Opus deep-analysis pipeline requires a valid ANTHROPIC_API_KEY
  • npm lifecycle-script checks can flag unsupported release-age keys that create false confidence
  • Aggregate MCP server counts in template catalogs may overstate actual runtime exposure

Verdict

Worth running if you use Claude Code, MCP servers, or agent hooks in production. If your workflow is still copy-pasting into a chat window, you can safely skip it for now.

Frequently asked

What is affaan-m/agentshield?
AgentShield audits Claude Code and MCP server setups for hardcoded secrets, overbroad permissions, and prompt-injection risks before they become exploits.
Is agentshield open source?
Yes — affaan-m/agentshield is open source, released under the MIT license.
What language is agentshield written in?
affaan-m/agentshield is primarily written in TypeScript.
How popular is agentshield?
affaan-m/agentshield has 1.2k stars on GitHub and is currently accelerating.
Where can I find agentshield?
affaan-m/agentshield is on GitHub at https://github.com/affaan-m/agentshield.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.