@m4ss/pi-web-fetch
Web fetch (HTML→Markdown) tool for pi-coding-agent
Package details
Install @m4ss/pi-web-fetch from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@m4ss/pi-web-fetch- Package
@m4ss/pi-web-fetch- Version
0.1.0- Published
- Jul 6, 2026
- Downloads
- not available
- Author
- paolobarbolini
- License
- MIT
- Types
- extension
- Size
- 33.4 KB
- Dependencies
- 2 dependencies · 4 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@m4ss/pi-web-fetch
We built this so the model can fetch web pages and get clean Markdown instead of raw HTML. It converts HTML automatically, blocks private network addresses, and caps response size to keep things manageable.
Features
- Fetches any HTTP/HTTPS URL and converts HTML to clean Markdown (JSON is pretty-printed)
- Blocks private network addresses (localhost, RFC 1918, link-local); every redirect hop is validated, so a redirect can't bounce into an internal address
- Follows instant meta-refresh redirects (the stub pages static site generators emit)
- 10s default timeout, overrideable per call; large responses capped at 5MB
Install
pi install npm:@m4ss/pi-web-fetch
Usage
web_fetch(url="https://www.postgresql.org/docs/current/", format="markdown")
web_fetch(url="https://redis.io/docs/latest/", format="html")
web_fetch(url="https://api.github.com/repos/M4SS-Code/watermelon/contents")
web_fetch(url="https://example.com/slow", timeoutMs=20000)
Private networks
Blocks private/internal addresses (localhost, RFC 1918, link-local) on all redirect hops (max 5, each validated).
The check runs on the URL's hostname, so it does not defend against DNS rebinding — a hostile public hostname that resolves to a private address gets through (that would require a pinned resolver). Treat the guard as protection against accidental internal access, not as a hard security boundary; don't rely on it to isolate a machine that can reach sensitive internal services.
Related packages
@m4ss/pi-staan-search– search for URLs, then fetch them withweb_fetch@m4ss/pi-llms-txt– discover important pages fromllms.txt, then fetch withweb_fetch@m4ss/pi-search-delegator– delegatesweb_fetchto the searcher subagent when installed
License
MIT