A clean, trustworthy WebFetch replacement for Claude Code.
Claude Code's built-in WebFetch tool processes pages through an intermediate model (Haiku) before passing content to Claude. This MCP replaces that flow with a local pipeline that:
- Extracts main content only using Trafilatura (higher accuracy than the default Turndown-based conversion)
- Removes known prompt injection patterns before content reaches Claude
- Blocks SSRF — private/internal network addresses are rejected
- Keeps all processing local — no third-party APIs or cloud services involved
- Ships under the MIT License
| Tool | Description |
|---|---|
fetch_clean(url, mode?) |
Fetch a URL and return clean Markdown. mode="main" (default) extracts body text only; mode="full" includes sidebars. |
fetch_add_domain(domain) |
Add a domain to the trusted whitelist. |
fetch_list_domains() |
List all trusted domains. |
fetch_stats(days?) |
Show token-saving statistics for recent fetches (default: last 7 days). |
1. Clone and set up virtualenv
git clone https://github.com/kenta-hi/clean-fetch ~/.claude/clean-fetch
cd ~/.claude/clean-fetch
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt2. Register with Claude Code
claude mcp add --scope user clean-fetch -- \
~/.claude/clean-fetch/.venv/bin/python \
~/.claude/clean-fetch/server.py3. Disable built-in WebFetch (optional but recommended)
Add to ~/.claude/settings.json:
{
"permissions": {
"deny": ["WebFetch"]
}
}The whitelist is stored at <install-dir>/whitelist.json:
{
"domains": [
"docs.python.org",
"developer.mozilla.org",
"github.com"
]
}You can also add domains at runtime:
fetch_add_domain("example.com")
- JavaScript-rendered pages (SPAs) — React/Next.js sites that require JS execution are not supported. Use Playwright MCP for those cases.
- Paywalled content — login-required pages will return an error or empty content.
MIT