🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

mcpshield-cli

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mcpshield-cli

Security scanner for MCP (Model Context Protocol) servers. Scans live servers for vulnerabilities, tool poisoning, prompt injection, and more.

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
35
-14.63%
Maintainers
1
Weekly downloads
 
Created
Source

MCPShield

Security scanner for MCP (Model Context Protocol) servers.

Scans live MCP servers for vulnerabilities, tool poisoning, prompt injection, credential leaks, and more. Maps findings to the OWASP MCP Top 10.

Why MCPShield?

The MCP ecosystem has 20,000+ servers with serious security problems:

  • 82% of MCP servers are vulnerable to path traversal
  • 53% use hardcoded static API keys
  • 30+ CVEs filed in just 60 days (Jan-Feb 2026)
  • 72.8% tool poisoning success rate on leading LLMs

Existing tools only scan static source code on GitHub. MCPShield scans live running servers -- the first runtime MCP security scanner.

Quick Start

# Scan a local MCP server
npx mcpshield scan --stdio "node your-server.js"

# Scan a remote MCP server
npx mcpshield scan --url https://your-server.com/mcp

# JSON output (for CI/CD)
npx mcpshield scan --stdio "node server.js" --json

# Only show critical and high severity
npx mcpshield scan --stdio "node server.js" --severity high

Installation

npm install -g mcpshield

Or use directly with npx:

npx mcpshield scan --stdio "node server.js"

What It Scans For

MCPShield runs 30+ security rules across 7 categories:

Prompt Injection (PI)

RuleSeverityWhat It Detects
PI-001HighHidden Unicode characters (zero-width spaces, BOM)
PI-002HighLLM injection markers ("ignore previous instructions", etc.)
PI-003MediumBase64/URL encoded payloads
PI-004MediumHTML entity obfuscation
PI-005MediumWhitespace smuggling with hidden instructions

Tool Poisoning (TP)

RuleSeverityWhat It Detects
TP-001HighCross-tool references (tool shadowing setup)
TP-002HighBehavioral manipulation ("always BCC", "secretly forward")
TP-003CriticalCredentials in tool descriptions
TP-004HighEnvironment variable access instructions
TP-005HighSensitive file path references (.ssh, .aws, .env)
TP-006CriticalExfiltration URLs/emails in descriptions
TP-007HighData harvesting instructions
TP-008MediumTool name-description mismatch

Tool Shadowing (TS)

RuleSeverityWhat It Detects
TS-001MediumDuplicate tool names
TS-002MediumNon-ASCII characters in tool names (homograph attacks)

Authentication (AUTH)

RuleSeverityWhat It Detects
AUTH-001CriticalNo authentication on HTTP servers
AUTH-002HighNo TLS encryption
AUTH-003MediumStdio transport auth limitations

Authorization (AUTHZ)

RuleSeverityWhat It Detects
AUTHZ-001MediumRead-only annotation contradicts write behavior
AUTHZ-002MediumMissing destructive hint on delete/remove tools

Input Validation (IV)

RuleSeverityWhat It Detects
IV-001HighCommand execution without sanitization
IV-002HighPath traversal risk in file tools
IV-003HighSQL injection risk
IV-004HighSSRF risk in URL-accepting tools
IV-005MediumUnbounded string/array input sizes

Metadata & Configuration (META)

RuleSeverityWhat It Detects
META-001LowMissing server version
META-002LowMissing server name
META-003InfoUnusually large tool count
META-004LowTools missing descriptions
META-005MediumExcessively long descriptions (hidden content)
META-006InfoServer capabilities summary

OWASP MCP Top 10 Mapping

All findings map to the OWASP MCP Top 10:

OWASP CategoryMCPShield Rules
MCP01: Token MismanagementTP-003, TP-004, AUTH-001, AUTH-002
MCP02: Tool PoisoningTP-001, TP-002, TP-005, TP-006, TP-007, TP-008, TS-001, TS-002
MCP03: Insufficient Input ValidationIV-001, IV-002, IV-003, IV-004, IV-005
MCP06: Prompt InjectionPI-001, PI-002, PI-003, PI-004, PI-005
MCP07: Insufficient Auth & AuthorizationAUTH-001, AUTH-002, AUTH-003, AUTHZ-001, AUTHZ-002

CLI Options

mcpshield scan [options]

Options:
  --stdio <command>   Scan a local stdio MCP server
  --url <url>         Scan a remote HTTP MCP server
  --json              Output results as JSON
  --severity <level>  Minimum severity: critical, high, medium, low, info (default: info)
  --timeout <ms>      Connection timeout in milliseconds (default: 30000)
  -h, --help          Display help

Exit Codes

CodeMeaning
0Scan completed, no critical findings
1Scan failed (connection error, timeout, etc.)
2Scan completed, critical findings detected

Use exit code 2 in CI/CD pipelines to fail builds when critical vulnerabilities are found.

Scoring

MCPShield assigns a security score (0-100) and letter grade:

GradeScoreMeaning
A90-100Excellent security posture
B80-89Good, minor issues only
C70-79Fair, some medium issues
D50-69Poor, significant issues
F0-49Critical security failures

Deductions: Critical = -25, High = -15, Medium = -8, Low = -3, Info = 0.

How It Works

MCPShield connects to MCP servers as a standard MCP client:

  • Connect via stdio (local) or HTTP (remote) transport
  • Enumerate all tools, resources, and prompts via listTools(), listResources(), listPrompts()
  • Analyze every tool description, schema field, parameter, and annotation
  • Score findings using CVSS-style severity levels
  • Report with actionable remediation guidance

Safe by default -- MCPShield only reads metadata. It never calls your tools or modifies anything.

JSON Output

Use --json for machine-readable output:

{
  "serverInfo": { "name": "my-server", "version": "1.0.0" },
  "target": "node server.js",
  "transport": "stdio",
  "scanDate": "2026-04-06T15:30:00.000Z",
  "scanDurationMs": 327,
  "toolCount": 5,
  "resourceCount": 0,
  "promptCount": 0,
  "findings": [
    {
      "ruleId": "TP-003",
      "category": "Tool Poisoning",
      "severity": "critical",
      "title": "Credentials Referenced in Tool Description",
      "description": "Tool metadata references credentials or secrets...",
      "evidence": "Credential pattern: \"API_KEY\"",
      "location": "tool:query_db.description",
      "owaspCategory": "MCP01: Token Mismanagement",
      "remediation": "Never reference credentials in tool descriptions."
    }
  ],
  "score": 42,
  "grade": "D"
}

Contributing

MCPShield is open source under the MIT license. Contributions welcome.

git clone https://github.com/mcpshield/mcpshield.git
cd mcpshield
npm install
npm run build
npm test

License

MIT

Keywords

mcp

FAQs

Package last updated on 06 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts