@mrclrchtr/supi-web

SuPi Web extension — fetch web pages as clean Markdown (web_fetch_md) and library docs via Context7 (web_docs_search, web_docs_fetch)

Packages

Package details

extension

Install @mrclrchtr/supi-web from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@mrclrchtr/supi-web
Package
@mrclrchtr/supi-web
Version
1.3.1
Published
May 17, 2026
Downloads
376/mo · 376/wk
Author
mrclrchtr
License
MIT
Types
extension
Size
86.9 KB
Dependencies
6 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./src/extension.ts",
    "node_modules/@mrclrchtr/supi-core/src/extension.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@mrclrchtr/supi-web

Fetch web pages as clean Markdown and query library documentation via Context7 for the pi coding agent.

Install

Included in @mrclrchtr/supi, or install standalone:

pi install npm:@mrclrchtr/supi-web

For local development:

pi install ./packages/supi-web

After editing the source, run /reload to pick up changes.

Package surfaces

  • @mrclrchtr/supi-web/api — programmatic exports (conversion helpers, fetch utilities, tool factories)
  • @mrclrchtr/supi-web/extension — aggregated pi extension entrypoint that registers all three tools

pi.extensions still points at the real file path ./src/extension.ts inside the package. The /api and /extension paths are consumer-facing package exports, not manifest aliases.

What it adds

Registers three agent-callable tools:

Tool Purpose
web_fetch_md Fetch an http(s) URL and return clean Markdown
web_docs_search Search Context7 for libraries by name
web_docs_fetch Retrieve up-to-date documentation for a specific library via Context7

web_fetch_md — Web Page to Markdown

Parameters

Parameter Type Default Description
url string required http:// or https:// URL to fetch
output_mode "auto" | "inline" | "file" "auto" auto returns inline if ≤15,000 chars, else writes to temp file
abs_links boolean true Absolutize relative links and image sources
timeout_ms number 30000 Fetch timeout in milliseconds

Content negotiation

The tool tries multiple strategies to get clean Markdown:

  1. HEAD negotiation — checks content-type for Markdown
  2. Sniffing — range GET of first 8KB to detect Markdown/plain text vs HTML
  3. Sibling probing — tries .md / .markdown variants (e.g. page.md for page.html)
  4. HTML conversion — full GET → JSDOM + Readability + Turndown → clean Markdown

web_docs_search — Library Lookup

Searches Context7's library index and returns a Markdown table of matching libraries with metadata.

Parameters

Parameter Type Default Description
library_name string required Library name to search for (e.g. "react", "next.js", "fastapi")
query string required What the agent is trying to do — used for relevance ranking

Output

Returns a Markdown table with columns: Name, ID, Description, Trust Score, Benchmark Score, Snippet Count, Versions. The agent picks a library ID from these results to pass to web_docs_fetch.

web_docs_fetch — Documentation Retrieval

Fetches up-to-date documentation context for a specific library via Context7's API.

Parameters

Parameter Type Default Description
library_id string required Context7 library ID (e.g. /facebook/react, /vercel/next.js/v15.1.8)
query string required Specific question about the library
raw boolean false When true, returns JSON-serialized snippet objects instead of plain text Markdown

API Key (optional)

The tool reads the CONTEXT7_API_KEY environment variable automatically when set. Without a key, it works with lower rate limits. Get a key at context7.com/dashboard.

Source files

  • src/api.ts — public package exports
  • src/extension.ts — aggregated extension entrypoint
  • src/web.tsweb_fetch_md tool registration
  • src/docs.tsweb_docs_search + web_docs_fetch tool registration
  • src/context7-client.ts — thin wrapper around @upstash/context7-sdk
  • src/fetch.ts — HTTP fetch logic
  • src/convert.ts — HTML to Markdown conversion

Commands

pnpm vitest run packages/supi-web/
pnpm exec tsc --noEmit -p packages/supi-web/tsconfig.json
pnpm exec biome check packages/supi-web/