Guard
Before every npm install — whether the user asked or the AI decided on its own — depguard verifies the package exists, checks for typosquatting, and runs a security audit.
depguard_guard("express")
An MCP server that guards your codebase from three threats: compromised npm packages, insecure dependencies, and debris left by AI coding agents. Backed by a curated advisory database of known attacks. Every package is verified before install, every coding session is reviewed, every unused dependency is flagged.
// Add depguard to any MCP-compatible AI agent $ claude mcp add depguard -- npx -y depguard-cli --mcp // 1. AI agent wants to install a package Agent "I need RTSP streaming support" depguard guard — go2rtc (score 72/100, allow) // 2. AI agent finishes coding depguard review — Found 3 console.logs, 1 empty catch, 1 TODO Agent Fixing 5 issues before committing... // 3. Cleanup unused packages depguard sweep — lodash unused (~1.4 MB savings)
AI coding agents create two problems: they install packages without checking security, and they leave garbage in your code (console.logs, empty catch blocks, broken imports, orphan files). Without depguard, every npm install is a blind trust decision and every coding session adds invisible debt.
One command connects depguard to your AI agent. From that moment, every install is verified and every coding session is reviewed.
Before every npm install — whether the user asked or the AI decided on its own — depguard verifies the package exists, checks for typosquatting, and runs a security audit.
depguard_guard("express")
After coding, depguard scans the source files for debris the AI left behind: console.logs, empty catch blocks, broken imports, orphan files. The AI agent fixes them before reporting done.
depguard_review(".", "quick")
At the end of a session, depguard finds unused packages that were installed but never imported. The AI agent removes them, keeping the project lean.
depguard_sweep(".")
This is a limited demo with pre-loaded data for 6 popular packages. For live audits on any package, install depguard-cli locally.
// Select a package above or type one to see the audit report $ depguard-cli audit ___
No API keys. No accounts. No configuration. Your AI agent gets security superpowers in 10 seconds.
$ claude mcp add depguard -- npx -y depguard-cli --mcp
One command. Zero configuration. Your AI agent starts checking every dependency immediately.
// Claude Code — one command $ claude mcp add depguard -- npx -y depguard-cli --mcp // Claude Desktop, Cursor, Windsurf, Continue.dev, Cline, Roo Code // Add to your MCP config file: { "mcpServers": { "depguard": { "command": "npx", "args": ["-y", "depguard-cli", "--mcp"] } } } // That's it. Your agent now has 10 security tools. // No API keys. No accounts. No configuration.
Organized by workflow: before installing, after coding, project health, and quick lookups. The AI agent knows when to call each one.
Called before every npm install, whether the user asked or the AI decided. Verifies the package exists, detects typosquatting, runs security audit, returns allow/warn/block.
Before InstallWhen the AI needs functionality ("RTSP streaming", "date formatting"), it calls this before choosing a package. Checks native Node.js alternatives first, then scores npm candidates.
Before InstallCalled after code changes or before commit. Finds console.logs, empty catch blocks, broken imports, orphan files, abandoned TODOs. The AI fixes them before reporting done.
After CodingFinds packages installed but never imported. Config-aware, workspace-aware, peer-dep-aware. Also detects phantom dependencies in node_modules.
After CodingDeep security audit of a single package. Downloads tarball, scans source code for 18+ malware patterns, checks dual advisory databases, analyzes install scripts.
Project HealthAudit all dependencies from a package.json in one call. Auto-detects project license. Use after cloning a repo or reviewing project security.
Project HealthCrawls the full transitive dependency tree. Aggregates vulnerabilities across all nested packages. Shows circular dependencies and total attack surface.
Project HealthQuick 0-100 quality score. Faster than full audit when you only need the number. Critical vulns cap at 30, high at 50.
Quick LookupQuick existence check + typosquatting detection. Faster than guard when you only need to verify a package name exists.
Quick LookupSearch npm by keywords, sorted by depguard quality score. Find packages without web searches.
Quick LookupAudit multiple packages in one call. Use audit_project instead if you have a package.json path.
Quick LookupEvery package scored 0–100 across five weighted dimensions. CVSS scores used when available. Hard security ceiling: critical vulns cap total at 30, high vulns at 50. Code analysis findings further reduce the score.
depguard checks 20+ native alternatives before recommending npm packages. Less bloat, smaller attack surface.
Without depguard, you need to check multiple sources, analyze scripts by hand, and make gut-feel decisions. Here's what one command replaces.
| Task | depguard | Manual Approach |
|---|---|---|
| Check known CVEs | ✓ Automated | Search npm + GitHub advisories manually |
| GitHub Advisory Database | ✓ Included | Visit github.com/advisories, search, cross-reference |
| Static code analysis | ✓ 18+ patterns | Download tarball, read source code manually |
| Inspect install scripts | ✓ 20+ patterns | Read package source code line by line |
| Behavioral mismatch | ✓ Automated | Compare description vs code behavior yourself |
| Check maintenance health | ✓ Scored | Check npm page, GitHub commits, last publish date |
| Verify license compatibility | ✓ 25+ SPDX | Read LICENSE file, understand copyleft hierarchy |
| Evaluate package quality | ✓ 0–100 | Subjective judgement, no consistent scoring |
| Find native alternatives | ✓ 20+ mapped | Know Node.js APIs by heart or search docs |
| AI agent integration | ✓ 10 MCP tools | Not possible — agents install blindly |
| Time per package | ~2 seconds | 15–30 minutes of research |
depguard now downloads the package tarball and scans the actual source code for malware patterns, obfuscation, data exfiltration, and behavioral mismatches. Every finding includes a detailed explanation suitable for developers.
Eval of decoded payloads, reverse shells via net.connect, cryptocurrency mining pool URLs (stratum+tcp). Critical severity — auto-blocks.
CriticalJSON.stringify(process.env), Object.keys(process.env), fetch with dynamic URLs from env vars, bracket-notation env access to evade scanners.
Criticaleval(), new Function(), child_process.exec/spawn, shell interpreter spawning. Flags dangerous patterns with context.
HighLong hex/unicode-encoded strings, base64 payloads, minified source in non-.min.js files. Techniques used to hide malicious code from reviewers.
HighA "string formatter" that makes network calls? A "date utility" that reads the filesystem? depguard compares what a package says it does vs what it actually does.
UniqueEvery finding includes: severity, category, title, a detailed explanation of why it's dangerous, the exact evidence from source code, and a recommendation.
Developer-Friendly// What your AI agent receives for a suspicious package: { "severity": "critical", "category": "data-exfiltration", "title": "Serialization of entire environment", "explanation": "This package serializes your ENTIRE environment into a JSON string. Your API keys, database passwords, JWT secrets would be exposed.", "evidence": "const d = JSON.stringify(process.env);", "file": "src/index.js", "recommendation": "Do NOT install this package." }
depguard statically analyzes install scripts (preinstall, install, postinstall) for 20+ suspicious patterns. Each finding now includes a rich explanation and recommendation.
| Pattern | Severity | What It Detects |
|---|---|---|
| Remote code execution | Critical | curl/wget piped to sh, download-and-execute chains |
| Credential file access | Critical | Reading ~/.ssh, ~/.aws, ~/.npmrc, ~/.gnupg, /etc/passwd |
| Sensitive env vars | Critical | Accessing $NPM_TOKEN, $AWS_SECRET, $GITHUB_TOKEN |
| Eval of decoded content | Critical | eval(atob(...)), eval(Buffer.from(..., "base64")) |
| Reverse shells | Critical | /dev/tcp connections, netcat with -e flag |
| Shell typosquatting | Critical | /bin/ssh instead of /bin/sh |
| Process spawning | High | child_process, execSync, spawn |
| Dynamic code execution | High | eval(), exec() in install scripts |
| Obfuscated strings | High | Hex-encoded strings, base64 payloads |
| Network APIs | High | net.connect, dgram, dns.resolve in install scripts |
Major npm supply chain incidents and how depguard detects the patterns that made them possible.
| Package | Year | Severity | What Happened | depguard Detection |
|---|---|---|---|---|
| event-stream | 2018 | Critical | Malicious dependency stole cryptocurrency wallet keys. 8M weekly downloads compromised. | Code analysis flags obfuscated code + credential access patterns. Script analysis catches eval of decoded content. |
| ua-parser-js | 2021 | Critical | Hijacked account published cryptominers and password stealers via postinstall. | Code analysis detects stratum+tcp mining URLs. Install script analysis catches process spawning and credential file access. |
| node-ipc | 2022 | Critical | Maintainer added code to wipe files based on geolocation. Dependency of vue-cli. | Behavioral mismatch: IPC library making network calls + filesystem writes. Advisory database flags GHSA. |
| colors + faker | 2022 | High | Maintainer sabotaged packages with infinite loops. Broke thousands of projects. | Maintenance score drops. Advisory database flags incident. Score falls below threshold. |
| eslint-scope | 2018 | Critical | Compromised token published version stealing npm tokens from ~/.npmrc. | Code analysis detects credential file reads. Script analysis flags env var exfiltration. |
| coa + rc | 2021 | Critical | Hijacked accounts. Obfuscated malware in preinstall scripts. | Code analysis detects base64 + eval pattern. Script analysis flags obfuscated code + process spawning. |
| crossenv (typosquat) | Ongoing | High | Names mimicking popular packages. Steal environment variables on install. | Typosquatting detection via Levenshtein distance. Code analysis flags JSON.stringify(process.env). |
depguard now downloads package tarballs and scans source code for malware patterns, obfuscation, and behavioral mismatches. Every finding includes a rich, human-readable explanation.
Downloads the npm package tarball, extracts JS files, and scans with 18+ pattern rules across 6 threat categories: malware, data-exfiltration, code-execution, obfuscation, unexpected-behavior, supply-chain.
Compares the package description and keywords against detected code behavior. A "string formatter" making network calls? Flagged as unexpected-behavior with explanation.
Every finding returns: severity, category, title, detailed explanation, evidence (exact code), file path, and recommendation. AI agents can present these directly to developers.
depguard is the only MCP tool that covers the full AI coding lifecycle: verify packages before install, audit for vulnerabilities, review the code the AI generated, and clean up unused dependencies.
depguard_guard — Before every npm install, whether the user asked or the AI decided. Blocks hallucinated packages, detects typosquatting, runs security audit.
depguard_audit — Deep security analysis. Downloads the tarball, scans source code for malware, checks dual advisory databases, analyzes install scripts.
depguard_review — After coding, scans source files for debris the AI left behind. Console.logs, empty catch blocks, broken imports, orphan files, abandoned TODOs. The AI fixes them before reporting done.
depguard_sweep — Finds packages that were installed but never imported. Config-aware (eslint, typescript, jest...), workspace-aware, with estimated size savings.
Questions, partnerships, security reports, or feedback — reach out through any of these channels.