Monday, November 16, 2026

agent-security-scanner-mcp for grading AI-written code and auditing MCP servers

agent-security-scanner-mcp for grading AI-written code and auditing MCP servers

agent-security-scanner-mcp is a defensive scanner that grades AI-generated code, audits MCP servers for tool poisoning, and detects hallucinated packages during authorized development and security review workflows.

Toolsinewaveai/agent-security-scanner-mcp — a JavaScript security scanner for AI coding agents, MCP servers, prompts, and AI-suggested packages
CategorySAST / supply-chain security / AI agent security (MCP server)
Primary UseScanning agent-written repos and diffs, auditing MCP servers with scan-mcp, detecting prompt injection with scan-prompt, and verifying AI-generated imports against 4.3M+ real package names
Safe UseDefensive use inside your own repositories, CI pipelines, and authorized security assessments to review AI-generated code before it is trusted; local rule-based scans do not transmit source code
Telemetry NotePurely defensive tooling; rule-based CLI and MCP scans run locally, and cr-agent semantic review only contacts the LLM provider you configure — defenders observe it as a quality gate in CI, not as network attack traffic

agent-security-scanner-mcp from sinewaveai sits at the intersection of two problems that did not meaningfully exist three years ago: coding agents that write insecure code at machine speed, and an MCP ecosystem where third-party tool servers can poison descriptions, spoof well-known tool names, or exfiltrate environment variables. The project, written in JavaScript and MIT-licensed with a healthy 122 stars, positions itself as the pre-trust gate you run before Claude Code, Cursor, Windsurf, Cline, OpenCode, or any other agent is allowed to act on new code, tools, prompts, or dependencies. It is distributed as an npm package, which means the entire surface is reachable through npx with zero persistent installation, and it installs into eight different coding clients via a single init command.

The core workflow is a graded project scan: npx agent-security-scanner-mcp scan-project . --verbosity compact produces an A-F agent security grade rather than a raw finding dump. That grading abstraction is a deliberate design choice for agentic workflows — an LLM agent consuming scanner output benefits from a single ordinal signal it can branch on, rather than parsing hundreds of findings. The README is explicit that output verbosity is tuned for context windows: --verbosity minimal emits counts only for CI, compact is the default balanced mode, and full provides audit-grade detail. This is a small detail but it reveals the intended consumer is frequently another model, not a human.

What separates this tool from a conventional SAST engine is the MCP-specific rule set surfaced by scan-mcp. The demo output shows concrete rule identifiers like mcp.description-injection — flagging tool descriptions containing imperative language directed at the LLM — and mcp.tool-name-spoofing, which catches tool names deliberately close to well-known MCP tool names. These are exactly the confusion attacks documented in recent MCP security research, where a malicious server's metadata manipulates the host agent rather than exploiting any memory-safety bug. The fact that the project ships a safe local demo (demo --type mcp --no-prompt) that creates intentionally vulnerable fixtures, scans them, and cleans up, is good educational hygiene: you can see every detection fire without touching real infrastructure.

Package hallucination detection is the second genuinely AI-specific capability. Coding models routinely invent plausible dependency names that do not exist, and attackers monitor registries to later register those names — a squatter variant of typosquatting. check-package verifies a single name against an ecosystem, while scan-packages <file> <ecosystem> walks a file's imports and flags anything that matches no real package. The README claims coverage of 4.3M+ package names across npm, PyPI, RubyGems, crates.io, pub.dev, CPAN, and raku.land, which is a broader registry footprint than most dependency scanners bother with. In an authorized workflow, this belongs in the loop whenever an agent edits dependency manifests or adds imports.

Prompt injection gets its own scanner surface. scan-prompt "<text>" detects injection and jailbreak attempts in text destined for an agent, which matters because agents increasingly process untrusted documents, tickets, scraped pages, and tool output as part of their normal loop. Complementing it, scan-action <type> <value> acts as a pre-execution safety check for shell, file, and network actions — effectively a firewall slot between the agent's decision and the side-effecting call. The README does not detail the rule engine behind these, so treat them as heuristic layers rather than guarantees, but the architecture of gating actions before execution is the correct place to intervene.

Once installed via init claude-code (or cursor, claude-desktop, windsurf, cline, kilo-code, opencode, cody), the scanner exposes itself as an MCP server and grants the agent tool families like scan_security, scan_git_diff, scan_mcp_server, scan_agent_prompt, check_package, and sbom_generate. There is an elegant recursion here: the agent audits its own proposed actions and the MCP servers it might install, using the same protocol layer it is defending. The scan-diff --base main --target HEAD command scopes review to changed files only, which is the right shape for pre-PR gating where full-repo noise buries the signal.

Supply-chain and compliance evidence round out the feature set. sbom-generate produces CycloneDX SBOMs, sbom-vulnerabilities cross-references dependencies against OSV.dev, and sbom-check-hallucinations extends the hallucination detector to the manifest level. There is also a compliance angle: evaluate-compliance . --framework soc2-technical maps technical evidence against SOC2, GDPR, and an AIUC-1 framework, plus export-vanta for pushing scan evidence into a Vanta instance. This is clearly aimed at engineering orgs that need AI-tooling assurances to survive audit, not just individual operators.

Beyond the rule engine, cr-agent provides LLM-powered semantic review bundled with the package. Rather than pattern matching, it reads project intent and asks whether the code makes sense for what the project is supposed to do — the class of issue rule-based scanners structurally miss, such as logic that is technically correct but violates the design. It runs with npx cr-agent analyze ./path/to/project -p claude-cli and supports --format sarif output, and the latest release, v4.5.8, adds diff-scoped semantic review that filters findings to changed hunks so PR review stays focused. Note the privacy boundary the FAQ draws clearly: rule-based CLI and MCP scans are local, while cr-agent sends code to whichever LLM provider you configure.

Deployment surfaces are broader than a laptop CLI. init-ci github wires the scanner into GitHub Actions, an Apify Actor mode offers hosted scheduled scans with input knobs like maxRepositoryFiles and severityThreshold, and share-kit generates public-safe copy from a real scan result — useful when you want to publish security posture without leaking internals. The doctor command checks local setup health, and quickstart --client cursor generates repo-specific next steps, both small affordances that indicate the project expects non-expert adoption.

For defenders and authorized security teams, agent-security-scanner-mcp is best understood as a quality gate for the AI-assisted development pipeline rather than a penetration tool. It complements npm audit instead of replacing it, catching AI-specific risk classes — hallucinated packages, prompt injection, MCP tool poisoning, unsafe agent actions — that traditional dependency and SAST tooling was never designed to see. The honest caveats: the README does not publish detection benchmarks, heuristic injection and hallucination checks will have false rates in both directions, and a scanner installed as an MCP server is itself an MCP server you should audit. Still, as a defensive control at exactly the layer where agent risk materializes, it is one of the more complete implementations in the emerging agent-security niche.

Official project repository for sinewaveai/agent-security-scanner-mcp.
Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.

Sponsored
Share articleFacebookXLinkedIn

Continue exploring

Browse all articles →

0 comentários:

Post a Comment

Note: Only a member of this blog may post a comment.