Skip to main content
Glama

🤔 Why

AI coding agents pull packages from stale training data. They install outdated versions with known CVEs. They hallucinate package names that don't exist, opening the door to typosquatting attacks. They default to deprecated libraries when better alternatives exist.

There's no checkpoint between "agent decides to use a package" and "package lands in your project." DepShield is that checkpoint.


Related MCP server: DepHealth MCP

⚡ What It Does

Seven security tools exposed over the Model Context Protocol:

Tool

What it does

check_dependency

Pre-install gate — verifies a package exists on the registry and has no known CVEs. Your agent calls this before every install.

audit_project

Scans an entire package.json or requirements.txt and returns a full vulnerability audit report.

find_safe_version

Finds the newest version of a package with zero known vulnerabilities.

get_advisory_detail

Deep dive into a specific CVE/GHSA — full description, affected versions, fix info, references.

check_npm_health

Package health report card: weekly downloads, last publish date, maintainer count, license, deprecation status. Scored 0–100.

suggest_alternative

Finds better packages when one is vulnerable, deprecated, or abandoned.

deep_scan

Scans a package's transitive dependency tree for vulnerabilities, typosquats, and suspicious patterns.

Plus a depshield://status resource and a security_review prompt template for guided full-project audits.

Zero API keys required. DepShield uses free, open APIs: npm Registry, OSV.dev (Google's open vulnerability database), and PyPI.


🚀 Quick Start

Option 1: npx (no install)

Add to your IDE's MCP configuration and you're done. No global install needed.

Option 2: Clone and build

git clone https://github.com/devanshkaria88/depshield-mcp.git
cd depshield-mcp
npm install
npm run build

🔌 IDE Setup

Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project-level):

{
  "mcpServers": {
    "depshield": {
      "command": "npx",
      "args": ["-y", "depshield-mcp"]
    }
  }
}

Or if you cloned the repo locally:

{
  "mcpServers": {
    "depshield": {
      "command": "node",
      "args": ["/absolute/path/to/depshield-mcp/dist/index.js"]
    }
  }
}

Optionally, copy .cursor/rules/dep-shield.mdc into your project's .cursor/rules/ directory. This rule forces the Cursor agent to call check_dependency before every package install.

claude mcp add depshield -- npx depshield-mcp

Or from a cloned repo:

claude mcp add depshield -- node /absolute/path/to/depshield-mcp/dist/index.js

Add to your Windsurf MCP configuration:

{
  "mcpServers": {
    "depshield": {
      "command": "npx",
      "args": ["-y", "depshield-mcp"]
    }
  }
}

DepShield uses stdio transport. Any tool that supports MCP over stdio can use it:

npx depshield-mcp

💡 Usage Examples

Once connected, your AI agent has access to all seven tools. Try these prompts:

Pre-install check (automatic with .mdc rule)

"Add lodash for deep cloning"

Agent calls check_dependency → finds CVE → auto-upgrades to safe version

Block hallucinated packages

"Install react-super-utils-pro for state management"

Agent calls check_dependency → package doesn't exist → blocks install, suggests alternatives

Full project audit

"Run a security audit on this project's dependencies"

Agent calls audit_project on package.json → returns full vulnerability report

Package health check

"Is this package well maintained?"

Agent calls check_npm_health → returns health score (0–100) with breakdown

Supply chain deep scan

"Deep scan express for transitive vulnerabilities"

Agent calls deep_scan → scans dependency tree, flags suspicious patterns

Advisory deep dive

"Tell me more about GHSA-jf85-cpcp-j695"

Agent calls get_advisory_detail → returns full CVE details, remediation info


📖 Tools Reference

Parameter

Type

Required

Default

Description

name

string

yes

—

Package name (e.g., lodash, express)

version

string

no

latest

Specific version to check

ecosystem

npm | pypi

no

npm

Package ecosystem

Returns: ✅ SAFE, ⚠️ VULNERABLE (with fix version), 🚫 BLOCKED (doesn't exist), or ⚠️ CANNOT VERIFY (registry unreachable).

Parameter

Type

Required

Default

Description

filePath

string

yes

—

Path to package.json or requirements.txt

includeDevDependencies

boolean

no

true

Include devDependencies in scan

Returns: Full audit report with summary stats, per-dependency vulnerability breakdown, severity counts, and risk verdict.

Parameter

Type

Required

Default

Description

name

string

yes

—

Package name

ecosystem

npm | pypi

no

npm

Package ecosystem

Returns: The newest stable version with zero known vulnerabilities, with comparison of all checked versions.

Parameter

Type

Required

Default

Description

vulnId

string

yes

—

Vulnerability ID (e.g., GHSA-jf85-cpcp-j695, CVE-2021-23337)

Returns: Full advisory with summary, severity, CVSS score, affected versions, fix versions, and reference links.

Parameter

Type

Required

Default

Description

name

string

yes

—

npm package name

Returns: Health report card (0–100 score) based on: publish recency, weekly downloads, license, repository presence, deprecation status, and maintainer count.

Parameter

Type

Required

Default

Description

name

string

yes

—

Package to find alternatives for

reason

string

no

—

Why an alternative is needed

Returns: Top 3 alternative packages with downloads, npm score, and publish date.

Parameter

Type

Required

Default

Description

name

string

yes

—

Package to deep scan

version

string

no

latest

Specific version to scan

depth

1 | 2

no

1

1 = direct deps, 2 = deps of deps

Returns: Dependency tree with vulnerability flags, suspicious pattern detection (newly added deps, nonexistent packages, low-download typosquat candidates), and risk verdict.


🔒 Cursor Rule (Optional)

The .cursor/rules/dep-shield.mdc file included in this repo forces the Cursor agent to automatically call check_dependency before every package install. Copy it to your project:

mkdir -p .cursor/rules
cp node_modules/depshield-mcp/.cursor/rules/dep-shield.mdc .cursor/rules/

This turns DepShield from a tool the agent can use into a gate the agent must pass through.


🧪 Testing

MCP Inspector (interactive UI for testing tools):

npm run inspect

Or:

npx @modelcontextprotocol/inspector node dist/index.js

Raw stdio (quick verification):

printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}\n{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"check_dependency","arguments":{"name":"lodash","version":"4.17.20"}}}\n' | node dist/index.js 2>/dev/null

🌐 APIs Used

All free, no API keys required:

API

What it provides

npm Registry

Package existence, versions, metadata, search

npm Downloads API

Weekly download counts

OSV.dev

Open source vulnerability database (Google)

PyPI

Python package metadata


📁 Project Structure

depshield-mcp/
├── src/
│   ├── index.ts                    # MCP server entry — tool/resource/prompt registration
│   ├── cache.ts                    # In-memory TTL cache (5 min)
│   ├── utils.ts                    # Severity parsing, version sorting, fetch helpers
│   ├── apis/
│   │   ├── npm-registry.ts         # npm registry, search, downloads
│   │   ├── osv.ts                  # OSV.dev vulnerability queries
│   │   └── pypi-registry.ts        # PyPI JSON API
│   └── tools/
│       ├── check-dependency.ts     # Pre-install gate
│       ├── audit-project.ts        # Full manifest audit
│       ├── find-safe-version.ts    # Safe version finder
│       ├── get-advisory-detail.ts  # CVE/GHSA deep dive
│       ├── check-npm-health.ts     # Package health scoring
│       ├── suggest-alternative.ts  # Alternative package finder
│       └── deep-scan.ts            # Transitive dependency scanner
├── .cursor/rules/
│   └── dep-shield.mdc             # Cursor agent rule (alwaysApply)
├── package.json
├── tsconfig.json
├── LICENSE
└── README.md

📋 Requirements

  • Node.js 22 or later

  • An MCP-compatible AI coding tool


🤝 Contributing

Contributions are welcome. Please open an issue first to discuss what you'd like to change.

Areas where help would be appreciated:

  • Additional ecosystem support (Cargo, Go modules, Maven)

  • Improved CVSS vector string parsing

  • Integration tests with mocked API responses

  • GitHub Actions CI pipeline


📄 License

MIT — see LICENSE for details.


Available Tools

7 tools
audit_projectB

Scan a package.json or requirements.txt for all dependency vulnerabilities. Returns a full audit report.

Inputs: filePath (required), includeDevDependencies.

check_dependencyA

Check a package for known vulnerabilities and verify it exists on the registry. MUST be called before installing any dependency.

Inputs: name (required), version, ecosystem.

check_npm_healthB

Assess package health and trustworthiness: downloads, maintenance, license, deprecation status. Scored 0-100.

Inputs: name (required).

deep_scanA

Scan a package's transitive dependency tree for vulnerabilities and suspicious patterns (newly added deps, typosquats, low-download packages).

Inputs: name (required), version, depth.

find_safe_versionB

Find the newest version of a package with zero known vulnerabilities.

Inputs: name (required), ecosystem.

get_advisory_detailC

Get full details about a specific security advisory (CVE, GHSA, etc).

Inputs: vulnId (required).

suggest_alternativeA

Find alternative packages when one is vulnerable, deprecated, or unmaintained.

Inputs: name (required), reason.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 7 tools

    Disambiguation4/5

    Tools are generally distinct with clear boundaries: audit_project targets manifest files, check_dependency is for pre-install validation, check_npm_health focuses on maintenance metrics, and deep_scan examines transitive dependencies. Minor overlap exists between check_dependency and check_npm_health (both examine single packages), but their purposes (security vs health) are different enough to guide selection.

    Naming Consistency4/5

    Most tools follow a clear verb_noun pattern (audit_project, check_dependency, find_safe_version, get_advisory_detail, suggest_alternative). However, 'deep_scan' breaks the convention by using an adjective_noun structure rather than a verb-led name like 'scan_dependencies' or 'analyze_transitive_deps'. 'check_npm_health' is consistent but domain-specific (npm) while others are generic.

    Tool Count5/5

    Seven tools is an ideal count for this domain. The set covers the full workflow: project scanning (audit_project), package vetting (check_dependency, check_npm_health, deep_scan), remediation (find_safe_version, suggest_alternative), and investigation (get_advisory_detail). No tool feels redundant or filler.

    Completeness4/5

    Strong coverage of the dependency security lifecycle including vulnerability detection, health assessment, transitive dependency analysis, and remediation strategies. Minor gaps include the lack of an 'apply_fix' or 'update_manifest' tool to automatically remediate findings, and no SBOM generation capability, but agents can work around these with the existing tools.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Validates and checks packages across 19 ecosystems to prevent AI agents from installing hallucinated, deprecated, or malicious packages.
      55 npm
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI coding agents to scan projects or changed files for risky leftovers like hallucinated packages, exposed secrets, truncated code, and unfinished stubs, and to verify that packages exist before installing them.
      27 npm
      MIT