# Fetch Guard
[](https://pypi.org/project/fetch-guard/)
[](https://pepy.tech/project/fetch-guard)
[](https://github.com/Erodenn/fetch-guard/actions/workflows/ci.yml)
[](https://pypi.org/project/fetch-guard/)
[](LICENSE)
An [MCP](https://modelcontextprotocol.io/) server and CLI tool that fetches URLs and returns clean, LLM-ready markdown. A purpose-built extraction pipeline sanitizes HTML, pulls structured metadata, detects prompt injection attempts, and handles the edge cases that break naive fetchers: bot blocks, paywalls, login walls, non-HTML content types, and pages that require JavaScript to render.
The core problem is straightforward: LLMs need web content, but raw HTML is noisy and potentially hostile. Fetched pages can contain hidden text, invisible Unicode, off-screen elements, and outright prompt injection attempts embedded in the content itself. This pipeline strips all of that before the content reaches the model.
Three layers handle the injection defense specifically:
1. **Pre-extraction sanitization** removes hidden elements (`display:none`, `visibility:hidden`, `opacity:0`, `font-size:0`, `transform:scale(0)`, `clip:rect(0,0,0,0)`, zero-height overflow containers, and elements with matching foreground and background colors), elements hidden via CSS class/ID rules in `