testing-and-validation
Skill1 starsChanged 12 days agoMITView on GitHub
How to test and validate this MCP server — unit tests for every SSRF threat, MCP Inspector checks, and external scanner validation. Use when writing tests, before shipping, or when verifying security correctness.
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Write the failing test before the guard exists, then implement until green.
- Very specific: line 58
Test the guard directly (unit) _and_ through the fetch_url tool (integration), so a future refactor can't route around it.
- Very specific: line 67
Verify: the tool lists with the right title/description/annotations, the Zod schema rejects bad input, a good URL returns text + …
- Distinctive: line 73
Do NOT build your own scanner — run the established ones and aim for a clean result:
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Testing & Validation
Testing here is security testing. A fetch server that "works" is not enough — it must provably refuse the dangerous cases. Ordinary AI-generated tests only assert that valid URLs succeed; they never assert that internal targets are refused. Those refusals are the whole point.
1. Test-first, one test per threat
Write the failing test before the guard exists, then implement until green. There must be a test for every row of the threat matrix in the security skill. Minimum set:
- Refuse
http://169.254.169.254/latest/meta-data/(cloud metadata). - Refuse loopback
http://127.0.0.1,http://127.1. - Refuse private ranges
http://10.0.0.5,http://192.168.1.1. - Refuse IPv4-mapped IPv6 loopback
http://[::ffff:127.0.0.1]. - Refuse IPv6 loopback/ULA
http://[::1]. - Refuse encoded IPs (octal/hex/decimal/dotless variants).
- Refuse a redirect whose next hop is internal (302 →
http://127.0.0.1). - Refuse non-http(s) schemes (
file:,gopher:,ftp:). - Refuse URLs with userinfo (
http://user:pass@host). - Enforce max-bytes truncation and timeouts.
- Regression: a re-fetch / poller path also goes through the guard (the 2026 bypass).
- Allow a normal public URL and return clean markdown.
Example (Vitest)
import { describe, it, expect } from "vitest";
import { assertSafeUrl } from "../src/security/index.js";
describe("SSRF guard", () => {
it("refuses the cloud metadata endpoint", async () => {
await expect(
assertSafeUrl("http://169.254.169.254/latest/meta-data/")
).rejects.toThrow();
});
it("refuses IPv4-mapped IPv6 loopback", async () => {
await expect(assertSafeUrl("http://[::ffff:127.0.0.1]/")).rejects.toThrow();
});
it("re-validates each redirect hop", async () => {
// Spin up a local server that 302s to http://127.0.0.1 and assert the fetch is refused.
});
it("allows a normal public URL", async () => {
await expect(assertSafeUrl("https://example.com")).resolves.toBeTruthy();
});
});Test the guard directly (unit) and through the fetch_url tool (integration), so a future
refactor can't route around it.
2. MCP Inspector (manual protocol check)
npm run inspectorVerify: the tool lists with the right title/description/annotations, the Zod schema
rejects bad input, a good URL returns text + structuredContent, and a blocked URL returns
isError: true with an actionable message.
3. External scanner validation (the headline proof)
Do NOT build your own scanner — run the established ones and aim for a clean result:
- OWASP MCP Top 10 — the reference checklist; map each item to a pass.
- AgentAuditKit — SSRF redirect-bypass, DNS-rebinding, transport, config rules.
- MCPSafe / badchars/mcp-security-scanner — SAST for SSRF/injection/secrets.
Capture a clean score (screenshot / SARIF) for the README — third-party validation is a
stronger claim than a homegrown suite. Optionally gate CI on a scan (see ci.yml).
4. Standard testing layers
- Functional: valid and invalid inputs behave correctly.
- Integration: redirects, timeouts, large bodies, content-type handling.
- Security: the whole threat matrix (above).
- Build gate:
npm run build,npm run lint,npm testall clean before shipping.
Definition of done (testing)
- A passing test exists for every threat-matrix row, including the poller/redirect regression.
fetch_urlverified in the MCP Inspector.- Clean result on OWASP MCP Top 10 + at least one scanner, evidenced in the README.
- CI green on all supported Node versions.
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- rluders/amaru★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- secure-fetch-ssrfSkill
- writing-mcp-serversSkill
- safe-web-fetchSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

