Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clean-fetch

A clean, trustworthy WebFetch replacement for Claude Code.

Why

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

Tools

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).

Installation

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.txt

2. Register with Claude Code

claude mcp add --scope user clean-fetch -- \
  ~/.claude/clean-fetch/.venv/bin/python \
  ~/.claude/clean-fetch/server.py

3. Disable built-in WebFetch (optional but recommended)

Add to ~/.claude/settings.json:

{
  "permissions": {
    "deny": ["WebFetch"]
  }
}

Configuration

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")

Limitations

  • 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.

License

MIT

About

Clean, trustworthy WebFetch replacement for Claude Code. Trafilatura-based extraction + injection protection + SSRF blocking.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages