Your MCP server's fetch_url tool is an SSRF hole — the guard layer most templates skip A developer built and is selling a minimal stdio MCP server kit in which the SSRF and path-traversal guard layer is the core feature rather than an afterthought. The kit's fetch_url tool resolves hostnames via getaddrinfo before connecting and validates every returned address against private, loopback, link-local, multicast and reserved ranges, while read_file resolves real paths, rejects '..' escapes, refuses symlinks pointing outside the allowed root and caps file size. The developer acknowledges a residual DNS-rebinding gap between the resolve-time check and the actual connection, recommending egress pinning or connect-time re-validation for adversarial environments, and ships a five-case unittest suite that stands up a real localhost HTTP server to prove fetch_url refuses to touch it. Every "build an MCP server in 50 lines" tutorial ships the same two tools: fetch url and read file . Almost none of them guard them. That means the demo server you copied into your client config last weekend will happily fetch http://169.254.169.254/latest/meta-data/ on EC2, or read ../../.ssh/id rsa if you pointed read file at the wrong root. I got burned enough by config footguns to start selling lint kits, so when MCP tooling took off I built the thing I actually wanted: a minimal stdio MCP server where the guard layer is the product, not an afterthought. fetch url looks harmless — it's a GET request. But an MCP client will call it with whatever URL the model produces, and models produce URLs from tool output, docs, and — increasingly — attacker-controlled content. That's a Server-Side Request Forgery primitive handed to an LLM: http://127.0.0.1:8080/admin — internal services http://169.254.169.254/ — cloud metadata credentials http:// ::1 / , 10.x , 192.168.x , link-local, multicast — the whole private range file:///etc/passwd — scheme confusion if you don't whitelist read file is the quieter one: path traversal ../../ , symlink escapes, and unbounded reads that will happily slurp a 4GB log into the model's context. The naive fix — a regex blocklist of "localhost" and "127.0.0.1" — misses decimal IP notation 2130706433 , hex 0x7f000001 , IPv6 loopback, DNS names that resolve to private addresses, and every redirect target. The check that works resolves the hostname via getaddrinfo before connecting and validates every returned address against private/loopback/link-local/multicast/reserved ranges. For read file : resolve the real path, reject .. escapes, refuse symlinks that point outside the allowed root, cap file size. I want to be straight about the residual gap, because it's the one that matters in hostile environments: checking the resolved IP and then connecting are two different moments. A hostname can pass the check and re-resolve to a private IP before the connection opens — DNS rebinding. For most internal tooling the resolve-time check is enough; for anything facing adversarial input you pin egress or re-validate at connect time. Any vendor claiming "SSRF-proof" without mentioning this is selling something. The thing I cared about most: the guards should be tested , not asserted. The kit ships a 5-case unittest suite — including one that stands up a real localhost HTTP server and proves fetch url refuses to touch it. If you add tools, the suite shows you exactly what a guard test looks like. What's inside: server/mcp server.py — dependency-free JSON-RPC 2.0 over stdio Python 3.8+, no FastMCP, no Node tests/test server.py — 5 tests, all passing examples/client-config.json — Claude Desktop / Cursor stdio snippet DEPLOY.md + Dockerfile — because "works on my machine" isn't a deployment story It's a template, not audited infrastructure — tools you add inherit nothing automatically, and it covers initialize/ping/tools only no resources, prompts, or sampling . $19, BTC or EVM checkout: https://wesleygitari2-cloud.github.io/nexus-store-redirect/p/mcp-secure-server-kit https://wesleygitari2-cloud.github.io/nexus-store-redirect/p/mcp-secure-server-kit If you just want to poke at the guard behavior first, the test file is the fastest way — it demonstrates the SSRF block live without installing anything.