safe-fetch-mcp-server: Skill for Claude Code

.claude/skills/testing-and-validation/SKILL.md

testing-and-validation is a skill for Claude Code from Sanoy24/safe-fetch-mcp-server. It costs 44 tokens per session (1,025 once invoked), scanned B, original, MIT.

A testing guide for a server that fetches web content. It uses test-first development, or TDD, where a failing test is written before the code that fixes the problem.

In plain words
What is it for?
Use it to test blocked internal addresses, encoded IPs, unsafe URL schemes, user credentials in URLs, redirects, size limits, timeouts, and repeated-fetch paths. It also covers checks with MCP Inspector and an external scanner.
Why use it?
It helps prove that dangerous requests are refused, instead of testing only whether ordinary requests succeed.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is Sanoy24/safe-fetch-mcp-server's own configuration. It tells Claude Code how to work on safe-fetch-mcp-server itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything safe-fetch-mcp-server configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { assertSafeUrl } from '../src/security/index.js';.

Reuse

Borrowing it

Nothing to install: this file belongs to Sanoy24/safe-fetch-mcp-server. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Sanoy24/safe-fetch-mcp-server/main/.claude/skills/testing-and-validation/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/Sanoy24/safe-fetch-mcp-server

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for testing-and-validation

README.md
[![agentmods](https://agentmods.dev/badge/skills/sanoy24/safe-fetch-mcp-server/testing-and-validation/github.svg)](https://agentmods.dev/skills/sanoy24/safe-fetch-mcp-server/testing-and-validation)
Your own site
<a href="https://agentmods.dev/skills/sanoy24/safe-fetch-mcp-server/testing-and-validation"><img src="https://agentmods.dev/badge/skills/sanoy24/safe-fetch-mcp-server/testing-and-validation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for testing-and-validation

Your own site · 80×15
<a href="https://agentmods.dev/skills/sanoy24/safe-fetch-mcp-server/testing-and-validation"><img src="https://agentmods.dev/badge/skills/sanoy24/safe-fetch-mcp-server/testing-and-validation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,025 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00044 $0.01025
Opus 5 $0.00022 $0.00513
Sonnet 5 $0.00009 $0.00205
Haiku 4.5 $0.00004 $0.00103

Measured 9d ago against content hash 72ae3ac43d27, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade B, and why

testing-and-validation scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Cloud metadata endpointmediumServer-side request forgery

One request to 169.254.169.254 can return temporary IAM credentials.

- Refuse `http://169.254.169.254/latest/meta-data/` (cloud metadata).

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

.claude/skills/testing-and-validation/SKILL.md · 99 lines

How it starts

The opening of the file, as written. The whole thing — 99 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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();
    });
});

Read the full file on GitHub · 99 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 99 lines · 44 tokens per session scan B 72ae3ac43d27

Subscribe to this mod's changes

testing-and-validation is a skill published in the GitHub repository Sanoy24/safe-fetch-mcp-server (1 stars, last pushed 28d ago), licensed MIT. It adds 44 tokens to every session and 1,025 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (cloud metadata endpoint). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.