Defending Claude Desktop & Cursor Against MCP Tool Poisoning and Rug-Pulls
Model Context Protocol (MCP) bridges models straight to local shells, databases, and OAuth tokens. Without deterministic pre-flight validation and schema pinning, a single malicious package update compromises every downstream conversation.
1. Six High-Signal Static Audit Rules (MG-001..MG-006)
MG-001Indirect Prompt Injection: Detects hidden<IMPORTANT>/ system-override tags and Base64-obfuscated payloads inside tool docstrings.MG-002Cross-Server Tool Shadowing: Flags exact duplicate/cross-server tool name collisions and override-hijack descriptions across server definitions.MG-003Unpinned Package & Piped Shell Execution: Catchescurl | bashand floatingnpx/bunxpackage invocations lacking explicit version pinning.MG-004Plaintext Secret Exposure: Flags live API secrets while cleanly exempting safe templates such as${VAR}or${input:...}.MG-005Cleartext Remote Transport: Alerts on non-loopbackhttp://SSE/HTTP URLs.MG-006Exfil-Prone Schemas: Detects missingadditionalProperties: falsebounds and suspicious exfil callback parameters.
2. Deterministic mcp.lock.json Integrity & Benchmark
Across 12 curated red-team & benign test cases, mcpguard-core v0.1.3 blocks 9/9 (100.0%) attacks while sustaining a 0.0% false-positive rate in < 2ms with $0 LLM API spend, emitting CI-ready SARIF 2.1.0 findings and hashing server definitions into mcp.lock.json without leaking credential values.
uvx --from git+https://github.com/qwnzkkldsfai/mcpguard-core mcpguard-core self-check