Skip to main content

foxfetch

Read a page the way a browser does — only when plain HTTP is not enough.

PyPI Python npm plugin License MCP install

foxfetch drives a real Firefox engine (SpiderMonkey + Necko, no window, no renderer) to run a site's own JavaScript: pass a bot check, read a DOM that only exists after the scripts run, find the signature and the real API host. When a screenshot or a click is needed, it hands the identity it earned to Chromium.

It speaks the Model Context Protocol, so one service serves every agent host — Pi, Claude Code, Codex, DeepSeek Harness.

pip install foxfetch
python -m foxfetch doctor

The rule that saves the most time

Situation Use
Static HTML, JSON endpoints, RSS plain HTTP — do not call foxfetch
Content appears after JS runs run
403 / Cloudflare / DataDome / Kasada probe, then run
Someone needs to see the page handoff → the generated Playwright script

probe answers the first two questions with evidence, so the choice is not a guess:

probe("https://shop.example/item")
→ verdict: blocked
  evidence: HTTP 403, DataDome (matched 'datadome'), 512 bytes, 0 visible text
  suggestion: use run — the engine's TLS and JS profile match a real Firefox

Most pages do not need the engine. Reaching for it anyway costs ~90 MB of RAM and ~3 s per open, and buys nothing on a document curl could have fetched.

Tools

Tool What it does
probe Classify a URL: plain_http / needs_engine / blocked, with the evidence
run Evaluate JavaScript in the engine; returns the value, console and request log
net Read the request log and console of a live context
handoff Export cookies (including HttpOnly), localStorage, UA; write a Playwright script
close Close one context (by id or origin) or all of them
cleanup Delete every artifact except the ones in keep, close contexts, sweep temp scratch dirs
status Live contexts, artifact usage, environment check

Contexts

One engine world per origin, kept alive between calls so a multi-step flow is several small calls instead of one giant script:

run("window.step = 1", url="https://x.test")      # opens the page
run("window.step + 1")                            # → 2, same document
run("fetch('/api/me').then(r => r.text())",
    advance_ms=800, read="window.__last")         # carries the cookies earned above

A context dies on close, after FOXFETCH_IDLE_SECONDS (default 60) of silence, or when the pool exceeds FOXFETCH_MAX_CONTEXTS (default 2) — the least recently used goes first.

Install

Two pieces, always two: the service (all the logic, from PyPI) and a host entry (how your agent finds it). The service is the same everywhere; only the wiring differs.

pip install foxfetch          # or: python -m pip install --upgrade foxfetch
python -m foxfetch doctor     # exits non-zero and prints fixes when something is missing

doctor reports Python, ruyijs, mcp, Chromium and the artifact directory:

{ "ok": true,
  "python":   { "version": "3.14.6",  "ok": true },
  "ruyijs":   { "version": "0.4.5",   "ok": true },
  "mcp":      { "version": "1.30.0",  "ok": true },
  "chromium": { "found": true, "path": "…/chrome-headless-shell.exe" },
  "fixes":    [] }

Chromium is optional: without it handoff still exports the identity, it just cannot write the screenshot script.

Then pick your host — one entry per host, never two, or the model sees the same seven tools twice:

Host Where the entry goes
Pi ~/.pi/agent/mcp.json → mcpServers.foxfetch
Claude Code claude mcp add foxfetch -- python -m foxfetch serve
Codex ~/.codex/config.toml → [mcp_servers.foxfetch]
DeepSeek Harness pnpm add dsh-foxfetch in the profile, then add it to dsh.profile.bundles
anything else a stdio server: python + ["-m", "foxfetch", "serve"]
// Pi / Claude Code / Codex — the same shape everywhere
{
  "mcpServers": {
    "foxfetch": {
      "command": "python",
      "args": ["-m", "foxfetch", "serve"],
      "timeout": 180
    }
  }
}

Every step, per host, with the exact commands and a verification call: INSTALL.md. SETUP.md is the version written for an agent doing the install on a fresh machine (it detects which hosts exist instead of asking).

The DSH plugin holds no logic; upgrading foxfetch on PyPI upgrades what the plugin can do.

Verify it works

Ask the host, not a shell:

foxfetch_run(js="navigator.userAgent", url="https://example.com")
→ Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:160.0) Gecko/20100101 Firefox/160.0

Python-urllib or HeadlessChrome in that string means the call never reached the engine.

Configuration

Variable Default Meaning
FOXFETCH_HOME %LOCALAPPDATA%\foxfetch Artifact root (credentials pass through it)
FOXFETCH_MAX_CONTEXTS 2 Live engine contexts before LRU eviction
FOXFETCH_IDLE_SECONDS 60 Silence before a context is killed
FOXFETCH_TIMEOUT_MS 30000 Default navigation budget
FOXFETCH_MAX_BYTES 65536 Output cap before spilling to a file
FOXFETCH_ARTIFACT_TTL 86400 Seconds before an artifact is deleted automatically
FOXFETCH_ARTIFACT_MAX 67108864 Artifact directory byte budget
FOXFETCH_REMIND_AFTER 600 Seconds before tool results start mentioning pending artifacts (0 disables)
FOXFETCH_PY — Interpreter the DSH plugin should start

Safety

handoff writes live credentials — cookies including the HttpOnly ones page script cannot read. They land under FOXFETCH_HOME, owner-only, and expire after FOXFETCH_ARTIFACT_TTL. Call cleanup when the task is delivered, and pass keep=[...] for the screenshot or token the user still needs to look at.

You do not have to remember on your own: every tool response carries the artifact state, and once a file is older than FOXFETCH_REMIND_AFTER (default 600 s) the response grows a reminder saying how many files are still on disk and that they may hold credentials. The field vanishes the moment cleanup runs, so a stale reminder is a visible bug, not a silent one.

What it is not

  • Not a screenshot tool, not a clicker, not a layout engine — Chromium does that, once it has the identity handoff exported.
  • Not a session store. Every context is fresh; nothing survives close, and handoff output is meant to be deleted.
  • Not a fingerprint randomiser. Guessing a profile that matches nobody is worse than sending a real Firefox.

Development

pip install -e '.[dev]'
pytest -q          # 45 tests, no network
mypy src           # strict
python tools/push_via_api.py --repo <owner>/<name> --dry-run   # push when github.com:443 is reset

The tests encode the bugs this rewrite exists to prevent: a clip that split UTF-8 sequences, a URL compare that ignored the trailing slash, sameSite: "Default" rejected by Playwright, a cleanup that only deleted expired files, and a runaway browser left behind when the screenshot threw.

Licence

MIT. The engine (ruyijs) is a separate project under AGPL-3.0; foxfetch only calls it — no ruyijs code is bundled.

Metadata

Release files for foxfetch 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foxfetch 0.1.1
File Size Uploaded Provenance Actions
foxfetch-0.1.1.tar.gz 40.9 kB Without provenance Details for foxfetch-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for foxfetch 0.1.1
File Interpreter ABI Platform Actions
foxfetch-0.1.1-py3-none-any.whl Python 3 none any Details for foxfetch-0.1.1-py3-none-any.whl

Total release size: 69.9 kB

Release files / foxfetch-0.1.1.tar.gz

Download URL foxfetch-0.1.1.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cafe423d405306faa3185f4ec184b6b4e0664e094ec9d507b3ac7e17659bf88d
BLAKE2b-256 checksum
How to use checksums
83fee40216a59230ce37df8edbab786e548da3435548fb0c701cc086e3e7033f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / foxfetch-0.1.1-py3-none-any.whl

Download URL foxfetch-0.1.1-py3-none-any.whl
Size 29.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93a734ea1eb7129a7539689e8fa814ff2202cb9fc9b4602150ba65e621b7b75b
BLAKE2b-256 checksum
How to use checksums
4a9954da57cb7c807e1298301ad6f4cec8389bc36c5e1fda771f438e89a1b30f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for foxfetch 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page