foxfetch 0.1.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {foxfetch-0.1.1 → foxfetch-0.1.2}/INSTALL.md +4 -0
  2. foxfetch-0.1.2/PKG-INFO +367 -0
  3. foxfetch-0.1.2/README.md +318 -0
  4. foxfetch-0.1.2/README.zh.md +316 -0
  5. {foxfetch-0.1.1 → foxfetch-0.1.2}/pyproject.toml +9 -1
  6. {foxfetch-0.1.1 → foxfetch-0.1.2}/src/foxfetch/__init__.py +1 -1
  7. foxfetch-0.1.1/PKG-INFO +0 -241
  8. foxfetch-0.1.1/README.md +0 -192
  9. foxfetch-0.1.1/SETUP.md +0 -204
  10. foxfetch-0.1.1/dsh/cordis.patch.yml +0 -5
  11. foxfetch-0.1.1/dsh/index.js +0 -352
  12. foxfetch-0.1.1/dsh/package.json +0 -48
  13. foxfetch-0.1.1/tests/conftest.py +0 -6
  14. foxfetch-0.1.1/tests/test_contexts.py +0 -118
  15. foxfetch-0.1.1/tests/test_engine.py +0 -78
  16. foxfetch-0.1.1/tests/test_probe.py +0 -99
  17. foxfetch-0.1.1/tests/test_shapes.py +0 -78
  18. foxfetch-0.1.1/tools/push_via_api.py +0 -223
  19. {foxfetch-0.1.1 → foxfetch-0.1.2}/.gitignore +0 -0
  20. {foxfetch-0.1.1 → foxfetch-0.1.2}/LICENSE +0 -0
  21. {foxfetch-0.1.1 → foxfetch-0.1.2}/dsh/README.md +0 -0
  22. {foxfetch-0.1.1 → foxfetch-0.1.2}/src/foxfetch/__main__.py +0 -0
  23. {foxfetch-0.1.1 → foxfetch-0.1.2}/src/foxfetch/cli.py +0 -0
  24. {foxfetch-0.1.1 → foxfetch-0.1.2}/src/foxfetch/config.py +0 -0
  25. {foxfetch-0.1.1 → foxfetch-0.1.2}/src/foxfetch/contexts.py +0 -0
  26. {foxfetch-0.1.1 → foxfetch-0.1.2}/src/foxfetch/doctor.py +0 -0
  27. {foxfetch-0.1.1 → foxfetch-0.1.2}/src/foxfetch/engine.py +0 -0
  28. {foxfetch-0.1.1 → foxfetch-0.1.2}/src/foxfetch/probe.py +0 -0
  29. {foxfetch-0.1.1 → foxfetch-0.1.2}/src/foxfetch/server.py +0 -0
  30. {foxfetch-0.1.1 → foxfetch-0.1.2}/src/foxfetch/shapes.py +0 -0
@@ -1,5 +1,9 @@
1
1
  # Install
2
2
 
3
+ > The same content lives in [README.md](README.md) (English) and [README.zh.md](README.zh.md)
4
+ > (简体中文), which is what most people want. This file is the longer reference: it keeps the
5
+ > doctor output, the interpreter-path note and the troubleshooting table in one place.
6
+
3
7
  Two pieces, always two:
4
8
 
5
9
  | Piece | What it is | Where it comes from |
@@ -0,0 +1,367 @@
1
+ Metadata-Version: 2.5
2
+ Name: foxfetch
3
+ Version: 0.1.2
4
+ Summary: Fetch pages through a real Firefox engine (ruyijs) for AI agents: pass bot checks, run the page's own JavaScript, then hand the identity to Chromium when a screenshot is needed.
5
+ Project-URL: Homepage, https://github.com/zhuchongba-01/foxfetch
6
+ Project-URL: Repository, https://github.com/zhuchongba-01/foxfetch
7
+ Project-URL: Issues, https://github.com/zhuchongba-01/foxfetch/issues
8
+ Project-URL: Changelog, https://github.com/zhuchongba-01/foxfetch/commits/master
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 foxfetch contributors
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+
31
+ Note: `ruyijs`, the Firefox engine this package drives, is a separate project
32
+ under AGPL-3.0. foxfetch only imports and calls it; no ruyijs code is bundled.
33
+ License-File: LICENSE
34
+ Keywords: agent,anti-bot,firefox,mcp,playwright,ruyijs,scraping
35
+ Classifier: Environment :: Console
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Operating System :: Microsoft :: Windows
39
+ Classifier: Operating System :: POSIX :: Linux
40
+ Classifier: Programming Language :: Python :: 3
41
+ Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
42
+ Requires-Python: >=3.10
43
+ Requires-Dist: mcp<2,>=1.30
44
+ Requires-Dist: ruyijs>=0.4.5
45
+ Provides-Extra: dev
46
+ Requires-Dist: mypy>=1.10; extra == 'dev'
47
+ Requires-Dist: pytest>=8; extra == 'dev'
48
+ Description-Content-Type: text/markdown
49
+
50
+ # foxfetch
51
+
52
+ **Read pages that block plain HTTP — by running them in a real Firefox engine.**
53
+
54
+ [English](README.md) · [简体中文](README.zh.md)
55
+
56
+ [![PyPI](https://img.shields.io/pypi/v/foxfetch?logo=pypi&label=PyPI)](https://pypi.org/project/foxfetch/)
57
+ [![Python](https://img.shields.io/pypi/pyversions/foxfetch?logo=python&logoColor=white)](https://pypi.org/project/foxfetch/)
58
+ [![npm plugin](https://img.shields.io/npm/v/dsh-foxfetch?logo=npm&label=dsh-foxfetch)](https://www.npmjs.com/package/dsh-foxfetch)
59
+ [![License](https://img.shields.io/pypi/l/foxfetch)](LICENSE)
60
+
61
+ `curl` gets a 403. Headless Chrome gets fingerprinted. foxfetch uses a real Firefox engine
62
+ (SpiderMonkey + Necko, no window, no renderer) to run the site's own JavaScript, pass the bot
63
+ check, and read what only a browser can see. When a screenshot is needed, it hands the identity
64
+ it earned to Chromium.
65
+
66
+ ---
67
+
68
+ ## Install in 30 seconds
69
+
70
+ **1. Install the service** (once per machine):
71
+
72
+ ```bash
73
+ pip install foxfetch
74
+ ```
75
+
76
+ **2. Check it** — should print `"ok": true`:
77
+
78
+ ```bash
79
+ python -m foxfetch doctor
80
+ ```
81
+
82
+ **3. Connect your agent** — pick one line, copy it:
83
+
84
+ | Your agent | Run this |
85
+ |---|---|
86
+ | **Pi** | `pi mcp add foxfetch -- python -m foxfetch serve` |
87
+ | **Claude Code** | `claude mcp add foxfetch -- python -m foxfetch serve` |
88
+ | **Codex** | see [`[mcp_servers.foxfetch]` below](#codex) |
89
+ | **DeepSeek Harness** | see [DSH below](#deepseek-harness) |
90
+ | **Other MCP client** | `command: python`, `args: ["-m", "foxfetch", "serve"]` |
91
+
92
+ **4. Prove it works** — ask your agent:
93
+
94
+ ```
95
+ foxfetch_run(js="navigator.userAgent", url="https://example.com")
96
+ ```
97
+
98
+ You must see `Firefox/160.0` in the answer. If you see `Python-urllib` or `HeadlessChrome`, the
99
+ agent is not talking to the engine — nothing else will work until you fix it.
100
+
101
+ > **One entry per host.** Never add both an MCP entry and the DSH plugin to the same agent:
102
+ > you would get the same seven tools twice (`foxfetch_run` and `mcp__foxfetch__run`).
103
+
104
+ ---
105
+
106
+ ## Detailed install
107
+
108
+ ### Requirements
109
+
110
+ - **Python 3.10+** — that is all. Chromium is optional (screenshots only).
111
+ - The `ruyijs` engine (44 MB wheel) comes in automatically as a dependency.
112
+
113
+ If `doctor` reports a problem, run the command it prints. The three that happen:
114
+
115
+ | `doctor` says | Fix |
116
+ |---|---|
117
+ | `ruyijs` missing or `< 0.4.5` | `pip install -U "ruyijs>=0.4.5"` |
118
+ | `mcp` is 2.x | `pip install "mcp>=1.30,<2"` — 2.x renamed `FastMCP`; this server cannot import it |
119
+ | `chromium: found: false` | optional: `npx playwright install chromium` |
120
+
121
+ **Which Python?** The agent must start the same interpreter that `pip install` used:
122
+
123
+ ```powershell
124
+ (Get-Command python).Source # Windows
125
+ which python3 # macOS / Linux
126
+ ```
127
+
128
+ ```bash
129
+ # If it is not plain `python`, put the absolute path in the config:
130
+ # "command": "C:/Users/you/AppData/Local/Programs/Python/Python314/python.exe"
131
+ ```
132
+
133
+ ### Pi
134
+
135
+ `pi mcp add foxfetch -- python -m foxfetch serve`
136
+
137
+ Or write `~/.pi/agent/mcp.json` yourself:
138
+
139
+ ```json
140
+ {
141
+ "mcpServers": {
142
+ "foxfetch": {
143
+ "command": "python",
144
+ "args": ["-m", "foxfetch", "serve"],
145
+ "timeout": 180
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ Verify: `pi mcp list` → `foxfetch: connected, 7 tools`.
152
+ Inside a running Pi session, `/reload` picks it up.
153
+
154
+ ### Claude Code
155
+
156
+ `claude mcp add foxfetch -- python -m foxfetch serve`
157
+
158
+ Verify: `claude mcp list`.
159
+
160
+ ### Codex
161
+
162
+ Append to `~/.codex/config.toml`, then restart Codex:
163
+
164
+ ```toml
165
+ [mcp_servers.foxfetch]
166
+ command = "python"
167
+ args = ["-m", "foxfetch", "serve"]
168
+ ```
169
+
170
+ ### DeepSeek Harness
171
+
172
+ DSH has a native plugin API, so it gets a real plugin instead of an MCP entry. The plugin holds
173
+ no logic — it starts the same Python service and reshapes results for the DSH UI.
174
+
175
+ ```powershell
176
+ # 1. service (same as everyone else)
177
+ pip install foxfetch
178
+
179
+ # 2. plugin, into the DSH profile
180
+ cd "$env:USERPROFILE\.dsh\profiles\desktop"
181
+ pnpm add dsh-foxfetch
182
+
183
+ # 3. register it (keep the entries already in the file)
184
+ $pkg = Get-Content package.json -Raw | ConvertFrom-Json
185
+ if ($pkg.dsh.profile.bundles -notcontains "dsh-foxfetch") {
186
+ $pkg.dsh.profile.bundles += "dsh-foxfetch"
187
+ }
188
+ $pkg | ConvertTo-Json -Depth 20 | Set-Content package.json
189
+
190
+ # 4. restart DSH
191
+ ```
192
+
193
+ The result should look like this:
194
+
195
+ ```json
196
+ {
197
+ "name": "dsh-profile-desktop",
198
+ "private": true,
199
+ "dependencies": {
200
+ "dsh-foxfetch": "^0.1.1"
201
+ },
202
+ "dsh": {
203
+ "profile": {
204
+ "bundles": [
205
+ "@deepseek-ai/dsh-base",
206
+ "@deepseek-ai/dsh-web-app",
207
+ "dsh-foxfetch"
208
+ ]
209
+ }
210
+ }
211
+ }
212
+ ```
213
+
214
+ `pnpm` not on PATH? DSH ships its own:
215
+
216
+ ```powershell
217
+ $dsh = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
218
+ $node = Join-Path $dsh "node\bin\node.exe"
219
+ $pnpm = Join-Path $dsh "pnpm\bin\pnpm.cjs"
220
+ & $node $pnpm add dsh-foxfetch
221
+ ```
222
+
223
+ After restarting DSH the tool list shows `foxfetch_probe`, `foxfetch_run`, `foxfetch_net`,
224
+ `foxfetch_handoff`, `foxfetch_close`, `foxfetch_cleanup`, `foxfetch_status` — and no
225
+ `mcp__foxfetch__*` entries.
226
+
227
+ ### Any other MCP client
228
+
229
+ Most clients take the same stdio block:
230
+
231
+ ```json
232
+ {
233
+ "mcpServers": {
234
+ "foxfetch": {
235
+ "command": "python",
236
+ "args": ["-m", "foxfetch", "serve"]
237
+ }
238
+ }
239
+ }
240
+ ```
241
+
242
+ ---
243
+
244
+ ## What you get
245
+
246
+ Seven tools:
247
+
248
+ | Tool | What it does |
249
+ |---|---|
250
+ | `probe` | Classify a URL — `plain_http` / `needs_engine` / `blocked` — with the evidence |
251
+ | `run` | Evaluate JavaScript in the engine; returns the value, console and request log |
252
+ | `net` | Read the request log and console of a live context |
253
+ | `handoff` | Export cookies (incl. HttpOnly), localStorage, UA; write a Playwright script |
254
+ | `close` | Close one context (by id or origin) or all of them |
255
+ | `cleanup` | Delete artifacts, close contexts, sweep temp scratch dirs |
256
+ | `status` | Live contexts, artifact usage, environment check |
257
+
258
+ ### Use the cheapest layer
259
+
260
+ | Situation | Use |
261
+ |---|---|
262
+ | Static HTML, JSON endpoints, RSS | plain HTTP — **do not call foxfetch** |
263
+ | Content appears only after JS runs | `run` |
264
+ | 403 / Cloudflare / DataDome / Kasada | `probe`, then `run` |
265
+ | Someone needs to *see* the page | `handoff` → the generated Playwright script |
266
+
267
+ ```
268
+ probe("https://shop.example/item")
269
+ → verdict: blocked
270
+ evidence: HTTP 403, DataDome (matched 'datadome'), 512 bytes, 0 visible text
271
+ suggestion: use run — the engine's TLS and JS profile match a real Firefox
272
+ ```
273
+
274
+ The engine costs ~90 MB of RAM and ~3 s per open. On a page `curl` could have fetched, that buys
275
+ nothing — hence `probe`.
276
+
277
+ ### Contexts
278
+
279
+ One engine world per origin, kept alive between calls, so a multi-step flow is several small
280
+ calls instead of one giant script:
281
+
282
+ ```python
283
+ run("window.step = 1", url="https://x.test") # opens the page
284
+ run("window.step + 1") # → 2, same document
285
+ run("fetch('/api/me').then(r => r.text())",
286
+ advance_ms=800, read="window.__last") # carries the cookies earned above
287
+ ```
288
+
289
+ A context dies on `close`, after `FOXFETCH_IDLE_SECONDS` (default 60) of silence, or when the pool
290
+ exceeds `FOXFETCH_MAX_CONTEXTS` (default 2) — least recently used first.
291
+
292
+ ---
293
+
294
+ ## Configuration
295
+
296
+ | Variable | Default | Meaning |
297
+ |---|---|---|
298
+ | `FOXFETCH_HOME` | `%LOCALAPPDATA%\foxfetch` | Artifact root (credentials pass through it) |
299
+ | `FOXFETCH_MAX_CONTEXTS` | 2 | Live contexts before LRU eviction |
300
+ | `FOXFETCH_IDLE_SECONDS` | 60 | Silence before a context is killed |
301
+ | `FOXFETCH_TIMEOUT_MS` | 30000 | Default navigation budget |
302
+ | `FOXFETCH_MAX_BYTES` | 65536 | Output cap before spilling to a file |
303
+ | `FOXFETCH_ARTIFACT_TTL` | 86400 | Seconds before an artifact is deleted |
304
+ | `FOXFETCH_ARTIFACT_MAX` | 67108864 | Artifact directory byte budget |
305
+ | `FOXFETCH_REMIND_AFTER` | 600 | Seconds before responses start reminding about pending artifacts (0 disables) |
306
+ | `FOXFETCH_PY` | — | Interpreter the DSH plugin starts |
307
+
308
+ ## Safety
309
+
310
+ `handoff` writes **live credentials** — cookies including the HttpOnly ones page script cannot
311
+ read. They land under `FOXFETCH_HOME`, owner-only, and expire after `FOXFETCH_ARTIFACT_TTL`.
312
+
313
+ Every tool response reports what is still on disk, and once a file is older than
314
+ `FOXFETCH_REMIND_AFTER` the response grows a `reminder` telling the agent to call `cleanup` and to
315
+ pass `keep=[...]` for anything the user still needs to look at. The field disappears the moment
316
+ cleanup runs, so a stale reminder is a visible bug rather than a silent one.
317
+
318
+ ## What it is not
319
+
320
+ - Not a screenshot tool, not a clicker, not a layout engine — Chromium does that, once it has the
321
+ identity `handoff` exported.
322
+ - Not a session store: every context is fresh, nothing survives `close`.
323
+ - Not a fingerprint randomiser: guessing a profile that matches nobody is worse than sending a
324
+ real Firefox.
325
+
326
+ ## Development
327
+
328
+ ```bash
329
+ pip install -e '.[dev]'
330
+ pytest -q # 45 tests, no network
331
+ mypy src # strict
332
+ ```
333
+
334
+ ```bash
335
+ # when github.com:443 is reset but api.github.com answers, push through the API
336
+ python tools/push_via_api.py --repo <owner>/<name> --dry-run
337
+ ```
338
+
339
+ The tests encode the bugs this rewrite exists to prevent: a clip that split UTF-8 sequences, a URL
340
+ compare that ignored the trailing slash, `sameSite: "Default"` rejected by Playwright, a `cleanup`
341
+ that only deleted expired files, and a runaway browser left behind when the screenshot threw.
342
+
343
+ ## Troubleshooting
344
+
345
+ | Symptom | Cause | Fix |
346
+ |---|---|---|
347
+ | `cannot start the Python service` (DSH) | the plugin found a different interpreter | set `FOXFETCH_PY` to the absolute path |
348
+ | `ModuleNotFoundError: mcp.server.fastmcp` | `mcp` 2.x installed | `pip install "mcp>=1.30,<2"` |
349
+ | `no live context for that origin` | context idled out (60 s) or was evicted | pass `url` again, or keep `context_id` |
350
+ | `navigation produced an empty document` | slow page, or one that needs a real renderer | raise `timeout_ms`, or use `handoff` + Chromium |
351
+ | tools appear twice | two entries in one host | remove one |
352
+ | `pip install` stops mid-download | flaky network to `files.pythonhosted.org` | retry, or `pip install --proxy http://127.0.0.1:7897 foxfetch` |
353
+
354
+ ## Uninstall
355
+
356
+ ```bash
357
+ pip uninstall foxfetch
358
+ ```
359
+
360
+ Artifacts: `%LOCALAPPDATA%\foxfetch` (Windows) or `~/.local/share/foxfetch`. Then delete the host
361
+ entry — the `mcpServers` block, the `[mcp_servers.foxfetch]` table, or the `dsh-foxfetch`
362
+ dependency plus its bundle line.
363
+
364
+ ## Licence
365
+
366
+ MIT. The engine (`ruyijs`) is a separate project under AGPL-3.0; foxfetch only calls it — no
367
+ ruyijs code is bundled.
@@ -0,0 +1,318 @@
1
+ # foxfetch
2
+
3
+ **Read pages that block plain HTTP — by running them in a real Firefox engine.**
4
+
5
+ [English](README.md) · [简体中文](README.zh.md)
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/foxfetch?logo=pypi&label=PyPI)](https://pypi.org/project/foxfetch/)
8
+ [![Python](https://img.shields.io/pypi/pyversions/foxfetch?logo=python&logoColor=white)](https://pypi.org/project/foxfetch/)
9
+ [![npm plugin](https://img.shields.io/npm/v/dsh-foxfetch?logo=npm&label=dsh-foxfetch)](https://www.npmjs.com/package/dsh-foxfetch)
10
+ [![License](https://img.shields.io/pypi/l/foxfetch)](LICENSE)
11
+
12
+ `curl` gets a 403. Headless Chrome gets fingerprinted. foxfetch uses a real Firefox engine
13
+ (SpiderMonkey + Necko, no window, no renderer) to run the site's own JavaScript, pass the bot
14
+ check, and read what only a browser can see. When a screenshot is needed, it hands the identity
15
+ it earned to Chromium.
16
+
17
+ ---
18
+
19
+ ## Install in 30 seconds
20
+
21
+ **1. Install the service** (once per machine):
22
+
23
+ ```bash
24
+ pip install foxfetch
25
+ ```
26
+
27
+ **2. Check it** — should print `"ok": true`:
28
+
29
+ ```bash
30
+ python -m foxfetch doctor
31
+ ```
32
+
33
+ **3. Connect your agent** — pick one line, copy it:
34
+
35
+ | Your agent | Run this |
36
+ |---|---|
37
+ | **Pi** | `pi mcp add foxfetch -- python -m foxfetch serve` |
38
+ | **Claude Code** | `claude mcp add foxfetch -- python -m foxfetch serve` |
39
+ | **Codex** | see [`[mcp_servers.foxfetch]` below](#codex) |
40
+ | **DeepSeek Harness** | see [DSH below](#deepseek-harness) |
41
+ | **Other MCP client** | `command: python`, `args: ["-m", "foxfetch", "serve"]` |
42
+
43
+ **4. Prove it works** — ask your agent:
44
+
45
+ ```
46
+ foxfetch_run(js="navigator.userAgent", url="https://example.com")
47
+ ```
48
+
49
+ You must see `Firefox/160.0` in the answer. If you see `Python-urllib` or `HeadlessChrome`, the
50
+ agent is not talking to the engine — nothing else will work until you fix it.
51
+
52
+ > **One entry per host.** Never add both an MCP entry and the DSH plugin to the same agent:
53
+ > you would get the same seven tools twice (`foxfetch_run` and `mcp__foxfetch__run`).
54
+
55
+ ---
56
+
57
+ ## Detailed install
58
+
59
+ ### Requirements
60
+
61
+ - **Python 3.10+** — that is all. Chromium is optional (screenshots only).
62
+ - The `ruyijs` engine (44 MB wheel) comes in automatically as a dependency.
63
+
64
+ If `doctor` reports a problem, run the command it prints. The three that happen:
65
+
66
+ | `doctor` says | Fix |
67
+ |---|---|
68
+ | `ruyijs` missing or `< 0.4.5` | `pip install -U "ruyijs>=0.4.5"` |
69
+ | `mcp` is 2.x | `pip install "mcp>=1.30,<2"` — 2.x renamed `FastMCP`; this server cannot import it |
70
+ | `chromium: found: false` | optional: `npx playwright install chromium` |
71
+
72
+ **Which Python?** The agent must start the same interpreter that `pip install` used:
73
+
74
+ ```powershell
75
+ (Get-Command python).Source # Windows
76
+ which python3 # macOS / Linux
77
+ ```
78
+
79
+ ```bash
80
+ # If it is not plain `python`, put the absolute path in the config:
81
+ # "command": "C:/Users/you/AppData/Local/Programs/Python/Python314/python.exe"
82
+ ```
83
+
84
+ ### Pi
85
+
86
+ `pi mcp add foxfetch -- python -m foxfetch serve`
87
+
88
+ Or write `~/.pi/agent/mcp.json` yourself:
89
+
90
+ ```json
91
+ {
92
+ "mcpServers": {
93
+ "foxfetch": {
94
+ "command": "python",
95
+ "args": ["-m", "foxfetch", "serve"],
96
+ "timeout": 180
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ Verify: `pi mcp list` → `foxfetch: connected, 7 tools`.
103
+ Inside a running Pi session, `/reload` picks it up.
104
+
105
+ ### Claude Code
106
+
107
+ `claude mcp add foxfetch -- python -m foxfetch serve`
108
+
109
+ Verify: `claude mcp list`.
110
+
111
+ ### Codex
112
+
113
+ Append to `~/.codex/config.toml`, then restart Codex:
114
+
115
+ ```toml
116
+ [mcp_servers.foxfetch]
117
+ command = "python"
118
+ args = ["-m", "foxfetch", "serve"]
119
+ ```
120
+
121
+ ### DeepSeek Harness
122
+
123
+ DSH has a native plugin API, so it gets a real plugin instead of an MCP entry. The plugin holds
124
+ no logic — it starts the same Python service and reshapes results for the DSH UI.
125
+
126
+ ```powershell
127
+ # 1. service (same as everyone else)
128
+ pip install foxfetch
129
+
130
+ # 2. plugin, into the DSH profile
131
+ cd "$env:USERPROFILE\.dsh\profiles\desktop"
132
+ pnpm add dsh-foxfetch
133
+
134
+ # 3. register it (keep the entries already in the file)
135
+ $pkg = Get-Content package.json -Raw | ConvertFrom-Json
136
+ if ($pkg.dsh.profile.bundles -notcontains "dsh-foxfetch") {
137
+ $pkg.dsh.profile.bundles += "dsh-foxfetch"
138
+ }
139
+ $pkg | ConvertTo-Json -Depth 20 | Set-Content package.json
140
+
141
+ # 4. restart DSH
142
+ ```
143
+
144
+ The result should look like this:
145
+
146
+ ```json
147
+ {
148
+ "name": "dsh-profile-desktop",
149
+ "private": true,
150
+ "dependencies": {
151
+ "dsh-foxfetch": "^0.1.1"
152
+ },
153
+ "dsh": {
154
+ "profile": {
155
+ "bundles": [
156
+ "@deepseek-ai/dsh-base",
157
+ "@deepseek-ai/dsh-web-app",
158
+ "dsh-foxfetch"
159
+ ]
160
+ }
161
+ }
162
+ }
163
+ ```
164
+
165
+ `pnpm` not on PATH? DSH ships its own:
166
+
167
+ ```powershell
168
+ $dsh = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
169
+ $node = Join-Path $dsh "node\bin\node.exe"
170
+ $pnpm = Join-Path $dsh "pnpm\bin\pnpm.cjs"
171
+ & $node $pnpm add dsh-foxfetch
172
+ ```
173
+
174
+ After restarting DSH the tool list shows `foxfetch_probe`, `foxfetch_run`, `foxfetch_net`,
175
+ `foxfetch_handoff`, `foxfetch_close`, `foxfetch_cleanup`, `foxfetch_status` — and no
176
+ `mcp__foxfetch__*` entries.
177
+
178
+ ### Any other MCP client
179
+
180
+ Most clients take the same stdio block:
181
+
182
+ ```json
183
+ {
184
+ "mcpServers": {
185
+ "foxfetch": {
186
+ "command": "python",
187
+ "args": ["-m", "foxfetch", "serve"]
188
+ }
189
+ }
190
+ }
191
+ ```
192
+
193
+ ---
194
+
195
+ ## What you get
196
+
197
+ Seven tools:
198
+
199
+ | Tool | What it does |
200
+ |---|---|
201
+ | `probe` | Classify a URL — `plain_http` / `needs_engine` / `blocked` — with the evidence |
202
+ | `run` | Evaluate JavaScript in the engine; returns the value, console and request log |
203
+ | `net` | Read the request log and console of a live context |
204
+ | `handoff` | Export cookies (incl. HttpOnly), localStorage, UA; write a Playwright script |
205
+ | `close` | Close one context (by id or origin) or all of them |
206
+ | `cleanup` | Delete artifacts, close contexts, sweep temp scratch dirs |
207
+ | `status` | Live contexts, artifact usage, environment check |
208
+
209
+ ### Use the cheapest layer
210
+
211
+ | Situation | Use |
212
+ |---|---|
213
+ | Static HTML, JSON endpoints, RSS | plain HTTP — **do not call foxfetch** |
214
+ | Content appears only after JS runs | `run` |
215
+ | 403 / Cloudflare / DataDome / Kasada | `probe`, then `run` |
216
+ | Someone needs to *see* the page | `handoff` → the generated Playwright script |
217
+
218
+ ```
219
+ probe("https://shop.example/item")
220
+ → verdict: blocked
221
+ evidence: HTTP 403, DataDome (matched 'datadome'), 512 bytes, 0 visible text
222
+ suggestion: use run — the engine's TLS and JS profile match a real Firefox
223
+ ```
224
+
225
+ The engine costs ~90 MB of RAM and ~3 s per open. On a page `curl` could have fetched, that buys
226
+ nothing — hence `probe`.
227
+
228
+ ### Contexts
229
+
230
+ One engine world per origin, kept alive between calls, so a multi-step flow is several small
231
+ calls instead of one giant script:
232
+
233
+ ```python
234
+ run("window.step = 1", url="https://x.test") # opens the page
235
+ run("window.step + 1") # → 2, same document
236
+ run("fetch('/api/me').then(r => r.text())",
237
+ advance_ms=800, read="window.__last") # carries the cookies earned above
238
+ ```
239
+
240
+ A context dies on `close`, after `FOXFETCH_IDLE_SECONDS` (default 60) of silence, or when the pool
241
+ exceeds `FOXFETCH_MAX_CONTEXTS` (default 2) — least recently used first.
242
+
243
+ ---
244
+
245
+ ## Configuration
246
+
247
+ | Variable | Default | Meaning |
248
+ |---|---|---|
249
+ | `FOXFETCH_HOME` | `%LOCALAPPDATA%\foxfetch` | Artifact root (credentials pass through it) |
250
+ | `FOXFETCH_MAX_CONTEXTS` | 2 | Live contexts before LRU eviction |
251
+ | `FOXFETCH_IDLE_SECONDS` | 60 | Silence before a context is killed |
252
+ | `FOXFETCH_TIMEOUT_MS` | 30000 | Default navigation budget |
253
+ | `FOXFETCH_MAX_BYTES` | 65536 | Output cap before spilling to a file |
254
+ | `FOXFETCH_ARTIFACT_TTL` | 86400 | Seconds before an artifact is deleted |
255
+ | `FOXFETCH_ARTIFACT_MAX` | 67108864 | Artifact directory byte budget |
256
+ | `FOXFETCH_REMIND_AFTER` | 600 | Seconds before responses start reminding about pending artifacts (0 disables) |
257
+ | `FOXFETCH_PY` | — | Interpreter the DSH plugin starts |
258
+
259
+ ## Safety
260
+
261
+ `handoff` writes **live credentials** — cookies including the HttpOnly ones page script cannot
262
+ read. They land under `FOXFETCH_HOME`, owner-only, and expire after `FOXFETCH_ARTIFACT_TTL`.
263
+
264
+ Every tool response reports what is still on disk, and once a file is older than
265
+ `FOXFETCH_REMIND_AFTER` the response grows a `reminder` telling the agent to call `cleanup` and to
266
+ pass `keep=[...]` for anything the user still needs to look at. The field disappears the moment
267
+ cleanup runs, so a stale reminder is a visible bug rather than a silent one.
268
+
269
+ ## What it is not
270
+
271
+ - Not a screenshot tool, not a clicker, not a layout engine — Chromium does that, once it has the
272
+ identity `handoff` exported.
273
+ - Not a session store: every context is fresh, nothing survives `close`.
274
+ - Not a fingerprint randomiser: guessing a profile that matches nobody is worse than sending a
275
+ real Firefox.
276
+
277
+ ## Development
278
+
279
+ ```bash
280
+ pip install -e '.[dev]'
281
+ pytest -q # 45 tests, no network
282
+ mypy src # strict
283
+ ```
284
+
285
+ ```bash
286
+ # when github.com:443 is reset but api.github.com answers, push through the API
287
+ python tools/push_via_api.py --repo <owner>/<name> --dry-run
288
+ ```
289
+
290
+ The tests encode the bugs this rewrite exists to prevent: a clip that split UTF-8 sequences, a URL
291
+ compare that ignored the trailing slash, `sameSite: "Default"` rejected by Playwright, a `cleanup`
292
+ that only deleted expired files, and a runaway browser left behind when the screenshot threw.
293
+
294
+ ## Troubleshooting
295
+
296
+ | Symptom | Cause | Fix |
297
+ |---|---|---|
298
+ | `cannot start the Python service` (DSH) | the plugin found a different interpreter | set `FOXFETCH_PY` to the absolute path |
299
+ | `ModuleNotFoundError: mcp.server.fastmcp` | `mcp` 2.x installed | `pip install "mcp>=1.30,<2"` |
300
+ | `no live context for that origin` | context idled out (60 s) or was evicted | pass `url` again, or keep `context_id` |
301
+ | `navigation produced an empty document` | slow page, or one that needs a real renderer | raise `timeout_ms`, or use `handoff` + Chromium |
302
+ | tools appear twice | two entries in one host | remove one |
303
+ | `pip install` stops mid-download | flaky network to `files.pythonhosted.org` | retry, or `pip install --proxy http://127.0.0.1:7897 foxfetch` |
304
+
305
+ ## Uninstall
306
+
307
+ ```bash
308
+ pip uninstall foxfetch
309
+ ```
310
+
311
+ Artifacts: `%LOCALAPPDATA%\foxfetch` (Windows) or `~/.local/share/foxfetch`. Then delete the host
312
+ entry — the `mcpServers` block, the `[mcp_servers.foxfetch]` table, or the `dsh-foxfetch`
313
+ dependency plus its bundle line.
314
+
315
+ ## Licence
316
+
317
+ MIT. The engine (`ruyijs`) is a separate project under AGPL-3.0; foxfetch only calls it — no
318
+ ruyijs code is bundled.