Dev.to
7/1/2026

Stop Letting AI Agents Raw-Dog Your Filesystem: Building SafeMCP
Short summary
SafeMCP is an open-source security gateway that sits between AI agents and MCP servers, blocking path traversal, shell injection, SSRF attempts to private networks, and cloud metadata endpoint probes. It enforces input validation at the transport layer and logs all transactions to audit.jsonl for forensic review; dangerous payloads never reach the backend. Zero dependencies, auditable code, integrates via configuration.
- •SafeMCP acts as a security middleware between AI clients (Cursor, etc.) and MCP servers
- •Blocks path traversal, shell metacharacters, SSRF, and metadata service attacks
- •Zero-dependency Node.js tool with forensic audit logging; open source on GitHub
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



