Skip to content
Back to search

agent-security-scanner-mcp

Security scanner MCP server for AI coding agents. Prompt injection firewall, package hallucination detection (4.3M+ packages), 1000+ vulnerability rules with AST & taint analysis, auto-fix.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/sinewaveai--agent-security-scanner-mcp/badge.svg)](/listings/sinewaveai--agent-security-scanner-mcp)

HTML

<a href="/listings/sinewaveai--agent-security-scanner-mcp"><img src="/api/listings/sinewaveai--agent-security-scanner-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

npx agent-security-scanner-mcp init claude-code

| Client | Setup | | --- | --- | | Claude Code | `npx agent-security-scanner-mcp init claude-code` | | Cursor | `npx agent-security-scanner-mcp init cursor` | | Claude Desktop | `npx agent-security-scanner-mcp init claude-desktop` | | Windsurf | `npx agent-security-scanner-mcp init windsurf` | | Cline | `npx agent-security-scanner-mcp init cline` | | Kilo Code | `npx agent-security-scanner-mcp init kilo-code` | | OpenCode | `npx agent-security-scanner-mcp init opencode` | | Cody | `npx agent-security-scanner-mcp init cody` | | Interactive picker | `npx agent-security-scanner-mcp init` |

Then restart the client. Your agent can call the scanner as an MCP tool.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 292 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. <div align="center">
  2. <img src="./prooflayer-logo.png" alt="ProofLayer" width="360"/>
  3. # agent-security-scanner-mcp
  4. **Security scanner for AI coding agents, MCP servers, prompts, and AI-suggested packages.**
  5. Run it before Claude Code, Cursor, Windsurf, Cline, OpenCode, or another agent trusts new code, tools, prompts, or dependencies.
  6. [![npm downloads](https://img.shields.io/npm/dw/agent-security-scanner-mcp.svg)](https://www.npmjs.com/package/agent-security-scanner-mcp)
  7. [![npm version](https://img.shields.io/npm/v/agent-security-scanner-mcp.svg)](https://www.npmjs.com/package/agent-security-scanner-mcp)
  8. [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
  9. [![CI](https://github.com/sinewaveai/agent-security-scanner-mcp/actions/workflows/test.yml/badge.svg)](https://github.com/sinewaveai/agent-security-scanner-mcp/actions/workflows/test.yml)
  10. </div>
  11. ## Copy-Paste Start
  12. Scan any repo and get an A-F agent security grade:
  13. ```bash
  14. npx agent-security-scanner-mcp scan-project . --verbosity compact
  15. ```
  16. Install the scanner into your AI coding client:
  17. ```bash
  18. npx agent-security-scanner-mcp init claude-code
  19. ```
  20. Replace `claude-code` with `cursor`, `claude-desktop`, `windsurf`, `cline`, `kilo-code`, `opencode`, or `cody`.
  21. Audit an MCP server before adding it to an agent:
  22. ```bash
  23. npx agent-security-scanner-mcp scan-mcp ./path/to/mcp-server --verbosity compact
  24. ```
  25. Check AI-generated imports for package hallucinations:
  26. ```bash
  27. npx agent-security-scanner-mcp scan-packages ./src/app.ts npm --verbosity compact
  28. ```
  29. ## What It Catches
  30. | Risk | Why agents need it | Command |
  31. | --- | --- | --- |
  32. | Vulnerable generated code | Agents can introduce SQL injection, XSS, command injection, unsafe crypto, and secrets | `scan-project`, `scan-security`, `scan-diff` |
  33. | MCP server attacks | MCP tools can poison descriptions, spoof names, exfiltrate env vars, or execute commands | `scan-mcp` |
  34. | Prompt injection | Agents often process untrusted docs, tickets, pages, and tool output | `scan-prompt` |
  35. | Unsafe agent actions | Catch dangerous shell/file/network actions before execution | `scan-action` |
  36. | Hallucinated packages | AI often invents dependency names that attackers can later squat | `check-package`, `scan-packages` |
  37. | SBOM and CVEs | Generate CycloneDX SBOMs and scan dependencies with OSV.dev | `sbom-generate`, `sbom-vulnerabilities` |
  38. | Semantic review | LLM-powered review that uses project intent to find context-aware issues | `cr-agent` |
  39. ## Screenshots
  40. ### Project Scan
  41. ![Project scan demo](./images/readme-project-scan.svg)
  42. ### MCP Server Audit
  43. ![MCP audit demo](./images/readme-mcp-audit.svg)
  44. ### Package Hallucination Detection
  45. ![Package hallucination demo](./images/readme-package-check.svg)
  46. ## Demos
  47. Run a safe local demo that creates intentionally vulnerable fixtures, scans them, and cleans them up.
  48. ```bash
  49. # MCP audit demo: tool poisoning, spoofed tool name, command execution, secret exposure
  50. npx agent-security-scanner-mcp demo --type mcp --no-prompt
  51. # Package hallucination demo: real imports mixed with fake AI-generated package names
  52. npx agent-security-scanner-mcp demo --type packages --no-prompt
  53. ```
  54. Expected demo shape:
  55. ```json
  56. {
  57. "grade": "F",
  58. "findings_count": 8,
  59. "findings": [
  60. {
  61. "rule": "mcp.description-injection",
  62. "severity": "ERROR",
  63. "message": "Tool description contains imperative language directed at the LLM."
  64. },
  65. {
  66. "rule": "mcp.tool-name-spoofing",
  67. "severity": "ERROR",
  68. "message": "Tool name is close to a well-known MCP tool name."
  69. }
  70. ]
  71. }
  72. ```
  73. ## Install In Your Agent
  74. ```bash
  75. npx agent-security-scanner-mcp init claude-code
  76. ```
  77. | Client | Setup |
  78. | --- | --- |
  79. | Claude Code | `npx agent-security-scanner-mcp init claude-code` |
  80. | Cursor | `npx agent-security-scanner-mcp init cursor` |
  81. | Claude Desktop | `npx agent-security-scanner-mcp init claude-desktop` |
  82. | Windsurf | `npx agent-security-scanner-mcp init windsurf` |
  83. | Cline | `npx agent-security-scanner-mcp init cline` |
  84. | Kilo Code | `npx agent-security-scanner-mcp init kilo-code` |
  85. | OpenCode | `npx agent-security-scanner-mcp init opencode` |
  86. | Cody | `npx agent-security-scanner-mcp init cody` |
  87. | Interactive picker | `npx agent-security-scanner-mcp init` |
  88. Then restart the client. Your agent can call the scanner as an MCP tool.
  89. ## Agent Playbook
  90. Paste this into an agent task when you want it to work safely:
  91. ```text
  92. Before trusting new code, dependencies, prompts, or MCP tools, run:
  93. 1. npx agent-security-scanner-mcp scan-project . --verbosity compact
  94. 2. npx agent-security-scanner-mcp scan-packages ./src/app.ts npm --verbosity compact when imports change
  95. 3. npx agent-security-scanner-mcp scan-mcp ./path/to/mcp-server --verbosity compact before adding MCP servers
  96. 4. npx agent-security-scanner-mcp scan-diff --base main --target HEAD before opening a PR
  97. Fix high-confidence security findings before continuing.
  98. ```
  99. ## Common Workflows
  100. ### Before You Trust An Agent-Written PR
  101. ```bash
  102. npx agent-security-scanner-mcp scan-diff --base main --target HEAD --verbosity compact
  103. npx agent-security-scanner-mcp scan-packages ./src/app.ts npm --verbosity compact
  104. ```
  105. ### Before Installing An MCP Server
  106. ```bash
  107. npx agent-security-scanner-mcp scan-mcp ./path/to/mcp-server --verbosity compact
  108. ```
  109. ### Before Adding A Dependency Suggested By AI
  110. ```bash
  111. npx agent-security-scanner-mcp check-package express npm
  112. npx agent-security-scanner-mcp scan-packages ./package.json npm --verbosity compact
  113. ```
  114. ### Add CI
  115. ```bash
  116. npx agent-security-scanner-mcp init-ci github
  117. ```
  118. ### Generate Share Copy From A Real Scan
  119. ```bash
  120. npx agent-security-scanner-mcp scan-project . --verbosity compact > scan-result.json
  121. npx agent-security-scanner-mcp share-kit --scan-result scan-result.json --output share-kit.md
  122. ```
  123. ## CLI Reference
  124. | Command | Use |
  125. | --- | --- |
  126. | `scan-project <dir>` | Full project scan with A-F grade |
  127. | `scan-security <file>` | Single-file security scan |
  128. | `scan-diff --base main --target HEAD` | Scan changed files only |
  129. | `scan-mcp <path>` | Audit an MCP server before install |
  130. | `scan-prompt "<text>"` | Detect prompt injection and jailbreak attempts |
  131. | `scan-action <type> <value>` | Pre-execution safety check for shell/file/network actions |
  132. | `check-package <name> <ecosystem>` | Verify one package exists |
  133. | `scan-packages <file> <ecosystem>` | Verify imports/dependencies in a file |
  134. | `doctor` | Check local setup health |
  135. | `quickstart --client cursor` | Generate repo-specific next steps |
  136. | `share-kit` | Generate public-safe launch/share copy |
  137. | `export-vanta` | Export scan evidence to the ProofLayer Vanta integration |
  138. All scanner outputs support context-friendly verbosity:
  139. ```bash
  140. --verbosity minimal # counts only, best for CI
  141. --verbosity compact # default, best for agents and humans
  142. --verbosity full # audit/debug detail
  143. ```
  144. ## MCP Tools For Agents
  145. When installed as an MCP server, agents get these tool families:
  146. | Tool family | Purpose |
  147. | --- | --- |
  148. | `scan_security`, `fix_security`, `scan_git_diff`, `scan_project` | Code and repo security |
  149. | `scan_mcp_server`, `scan_skill` | MCP and AI skill security |
  150. | `scan_agent_prompt`, `scan_agent_action` | Prompt/action safety |
  151. | `check_package`, `scan_packages` | Package hallucination detection |
  152. | `sbom_generate`, `sbom_scan_vulnerabilities`, `sbom_diff`, `sbom_export_report` | Supply-chain and release evidence |
  153. | `get_compliance_controls`, `evaluate_compliance` | SOC2/GDPR/AIUC-1 technical evidence |
  154. | `scanner_health` | Runtime diagnostics |
  155. ## Why Developers Install It
  156. - One `npx` command gives an A-F security grade for AI-written code.
  157. - MCP-specific checks catch risks that normal SAST tools miss.
  158. - Package hallucination detection checks 4.3M+ package names across npm, PyPI, RubyGems, crates.io, pub.dev, CPAN, and raku.land.
  159. - Output is compact by default so coding agents can read it without burning the context window.
  160. - Works as a CLI, MCP server, GitHub Action workflow, Apify Actor, and semantic review agent.
  161. - MIT licensed.
  162. ## Semantic Code Review
  163. `cr-agent` is bundled with the npm package for LLM-powered semantic review. It reads project intent, then looks for code that violates that intent.
  164. ```bash
  165. npx cr-agent analyze ./path/to/project -p claude-cli --verbose
  166. npx cr-agent analyze ./path/to/project -p openai --format sarif
  167. ```
  168. Use it when rule-based scanning is not enough and the question is, "Does this code make sense for what this project is supposed to do?"
  169. ## SBOM And Compliance Evidence
  170. ```bash
  171. npx agent-security-scanner-mcp sbom-generate .
  172. npx agent-security-scanner-mcp sbom-vulnerabilities .
  173. npx agent-security-scanner-mcp sbom-check-hallucinations .
  174. npx agent-security-scanner-mcp evaluate-compliance . --framework soc2-technical
  175. ```
  176. Useful before releases, SOC 2 evidence collection, vendor reviews, and AI-generated dependency changes.
  177. ## Apify Actor
  178. Run the scanner as an Apify Actor when you want a hosted API or scheduled scans:
  179. ```json
  180. {
  181. "actorId": "folkloric_morale/agent-security-scanner",
  182. "input": {
  183. "target": "repository",
  184. "repoUrl": "https://github.com/your-org/your-agent.git",
  185. "repositoryScanMode": "quick",
  186. "includeTestFiles": false,
  187. "maxRepositoryFiles": 150,
  188. "severityThreshold": "medium"
  189. }
  190. }
  191. ```
  192. ## Latest Release
  193. `v4.5.8` adds diff-scoped `cr-agent` semantic review, fixes nested repository diff lookups, and filters semantic findings to changed hunks so PR reviews stay focused on code that actually changed.
  194. Detailed release history lives in [CHANGELOG.md](./CHANGELOG.md). The older README-embedded changelog is archived at [archive/README_CHANGELOG_ARCHIVE.md](./archive/README_CHANGELOG_ARCHIVE.md).
  195. ## FAQ
  196. **Is this only for MCP servers?**
  197. No. It scans normal repos, diffs, prompts, actions, packages, SBOMs, MCP servers, and AI skills.
  198. **Does it send my source code anywhere?**
  199. Rule-based CLI and MCP scans are local. `cr-agent` uses the provider you choose for semantic review.
  200. **Is it a replacement for npm audit?**
  201. No. It complements npm audit by catching AI-specific risks: hallucinated packages, prompt injection, MCP tool poisoning, unsafe agent actions, and vulnerable generated code.
  202. **What should I run first?**
  203. Run `npx agent-security-scanner-mcp scan-project . --verbosity compact`.
  204. ## Links
  205. - [npm package](https://www.npmjs.com/package/agent-security-scanner-mcp)
  206. - [GitHub issues](https://github.com/sinewaveai/agent-security-scanner-mcp/issues)
  207. - [Full changelog](./CHANGELOG.md)
  208. - [Code review agent docs](./code-review-agent/README.md)
  209. ## License
  210. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.