A comprehensive security scanner for Model Context Protocol (MCP) servers that detects vulnerabilities and security issues in your MCP server implementations.
A comprehensive security scanner for Model Context Protocol (MCP) servers that detects vulnerabilities and security issues in your MCP implementations.
npm install -g mcp-watchnpm install mcp-watchgit clone https://github.com/yourusername/mcp-watch.git
cd mcp-watch
npm install
npm run build# Scan a GitHub repository
mcp-watch scan https://github.com/user/mcp-server
# Scan with JSON output
mcp-watch scan https://github.com/user/mcp-server --format json
# Filter by severity
mcp-watch scan https://github.com/user/mcp-server --severity high
# Filter by category
mcp-watch scan https://github.com/user/mcp-server --category credential-leakNote: If you don't want to download npm then just substitute mcp-watch with node dist/main.js.
Example: node dist/main.js scan https://github.com/user/repo
--format <type> - Output format: console (default) or json--severity <level> - Minimum severity: low, medium, high, critical--category <cat> - Filter by vulnerability categorycredential-leak - Hardcoded credentials and insecure storagetool-poisoning - Malicious tool descriptionsdata-exfiltration - Data theft and parameter injectionprompt-injection - Prompt manipulation attackstool-mutation - Dynamic tool changessteganographic-attack - Hidden content in escape sequencesprotocol-violation - MCP protocol security issuesinput-validation - Command injection, SSRF, path traversalserver-spoofing - Server impersonationtoxic-flow - Dangerous data flowsaccess-control - Permission and access issues🔍 Scanning repository: https://github.com/user/mcp-server
📊 Based on vulnerablemcp.info, HiddenLayer, Invariant Labs, and Trail of Bits research
🔑 Scanning for credential vulnerabilities...
🧪 Scanning for tool poisoning vulnerabilities...
🎯 Scanning for parameter injection vulnerabilities...
💉 Scanning for prompt injection vulnerabilities...
📊 MCP SECURITY SCAN RESULTS
===============================
📈 Summary by Severity:
🚨 CRITICAL: 2
⚠️ HIGH: 1
⚡ MEDIUM: 3
🔍 Detailed Results:
--------------------
1. 🚨 Hardcoded credentials detected
📋 ID: HARDCODED_CREDENTIALS
🎯 Severity: CRITICAL
📂 Category: credential-leak
📍 Location: src/config.ts:15
🔍 Evidence: const apiKey = "sk-***REDACTED***"mcp-watch/
├── main.ts # CLI entry point
├── types/
│ └── Vulnerability.ts # Type definitions
├── scanner/
│ ├── MCPScanner.ts # Main scanner orchestrator
│ ├── BaseScanner.ts # Base scanner utilities
│ └── scanners/ # Individual vulnerability scanners
│ ├── CredentialScanner.ts
│ ├── ParameterInjectionScanner.ts
│ └── ...
└── utils/
└── reportFormatter.ts # Report formatting# Build the project
npm run build
# Run in development mode
npm run dev scan https://github.com/user/repo
# Quick scan during development
npm run scan https://github.com/user/repo
# Clean build artifacts
npm run cleanscanner/scanners/AbstractScannerscan() methodMCPScanner.tsExample:
import { AbstractScanner } from "../BaseScanner";
import { Vulnerability } from "../../types/Vulnerability";
export class MyScanner extends AbstractScanner {
async scan(projectPath: string): Promise<Vulnerability[]> {
console.log("🔍 Scanning for my vulnerability type...");
const vulnerabilities: Vulnerability[] = [];
// Your scanning logic here
return vulnerabilities;
}
}This tool is based on security research from leading organizations in AI and cybersecurity, identifying novel attack vectors specific to MCP environments including:
0 - No critical or high severity vulnerabilities found1 - Critical or high severity vulnerabilities detected1 - Scan error occurrednpm run type-checkMIT License - see LICENSE file for details.
⚠️ Security Notice: This tool identifies potential security issues but should not be the only security measure. Always perform manual security reviews and follow security best practices.
kapilduraphe/mcp-watch
May 29, 2025
July 4, 2025
TypeScript