foxfetch 0.1.0__tar.gz → 0.1.1__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.
- foxfetch-0.1.1/INSTALL.md +239 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/PKG-INFO +98 -28
- foxfetch-0.1.1/README.md +192 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/SETUP.md +44 -19
- foxfetch-0.1.1/dsh/README.md +78 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/dsh/cordis.patch.yml +5 -5
- foxfetch-0.1.1/dsh/package.json +48 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/pyproject.toml +50 -50
- {foxfetch-0.1.0 → foxfetch-0.1.1}/src/foxfetch/__init__.py +1 -1
- foxfetch-0.1.0/README.md +0 -122
- foxfetch-0.1.0/dsh/package.json +0 -20
- {foxfetch-0.1.0 → foxfetch-0.1.1}/.gitignore +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/LICENSE +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/dsh/index.js +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/src/foxfetch/__main__.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/src/foxfetch/cli.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/src/foxfetch/config.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/src/foxfetch/contexts.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/src/foxfetch/doctor.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/src/foxfetch/engine.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/src/foxfetch/probe.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/src/foxfetch/server.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/src/foxfetch/shapes.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/tests/conftest.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/tests/test_contexts.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/tests/test_engine.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/tests/test_probe.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/tests/test_shapes.py +0 -0
- {foxfetch-0.1.0 → foxfetch-0.1.1}/tools/push_via_api.py +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Install
|
|
2
|
+
|
|
3
|
+
Two pieces, always two:
|
|
4
|
+
|
|
5
|
+
| Piece | What it is | Where it comes from |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| **the service** | all the logic — 7 tools over MCP | `pip install foxfetch` |
|
|
8
|
+
| **a host entry** | how your agent finds the service | one config file per agent host |
|
|
9
|
+
|
|
10
|
+
The service is the same for every host. Only the wiring differs.
|
|
11
|
+
|
|
12
|
+
> **One entry per host.** Never register both the DSH plugin and an MCP entry in the same
|
|
13
|
+
> host: you would expose the same seven tools twice (`foxfetch_run` and
|
|
14
|
+
> `mcp__foxfetch__run`) and the model would have to guess.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Step 1 — install the service (once per machine)
|
|
19
|
+
|
|
20
|
+
**Windows (PowerShell):**
|
|
21
|
+
|
|
22
|
+
```powershell
|
|
23
|
+
python -m pip install --upgrade foxfetch
|
|
24
|
+
python -m foxfetch doctor
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**macOS / Linux:**
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
python3 -m pip install --upgrade foxfetch
|
|
31
|
+
python3 -m foxfetch doctor
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`doctor` prints a JSON report and exits non-zero when something required is missing. Success
|
|
35
|
+
looks like this (abridged — the real report also lists Chromium builds, Playwright, the artifact
|
|
36
|
+
directory and the active settings):
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
{
|
|
40
|
+
"ok": true,
|
|
41
|
+
"python": { "version": "3.14.6", "ok": true },
|
|
42
|
+
"ruyijs": { "version": "0.4.5", "ok": true, "min": "0.4.5" },
|
|
43
|
+
"mcp": { "version": "1.30.0", "ok": true, "constraint": ">=1.30,<2" },
|
|
44
|
+
"chromium": { "found": true, "path": "…/chrome-headless-shell.exe" },
|
|
45
|
+
"warnings": [],
|
|
46
|
+
"fixes": []
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If `ok` is `false`, run the commands in `fixes` and re-run `doctor`. Three matter:
|
|
51
|
+
|
|
52
|
+
| Report says | Run this |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `ruyijs` missing or < 0.4.5 | `python -m pip install -U "ruyijs>=0.4.5"` |
|
|
55
|
+
| `mcp` version is 2.x | `python -m pip install "mcp>=1.30,<2"` — 2.x renamed `FastMCP` and this server cannot import it |
|
|
56
|
+
| `chromium: found: false` | optional — `npx playwright install chromium`, only needed for screenshots |
|
|
57
|
+
|
|
58
|
+
**Note the interpreter path.** Every host entry below needs to start the *same* Python that
|
|
59
|
+
`pip install` used. Find it once:
|
|
60
|
+
|
|
61
|
+
```powershell
|
|
62
|
+
(Get-Command python).Source
|
|
63
|
+
# C:\Users\you\AppData\Local\Programs\Python\Python314\python.exe
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
which python3
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If you have several Pythons, use that absolute path in the config instead of plain `python`.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Step 2 — wire one host
|
|
75
|
+
|
|
76
|
+
Pick the row that matches the agent you actually use.
|
|
77
|
+
|
|
78
|
+
### Pi
|
|
79
|
+
|
|
80
|
+
Config file: `~/.pi/agent/mcp.json` (create it if absent):
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"foxfetch": {
|
|
86
|
+
"command": "python",
|
|
87
|
+
"args": ["-m", "foxfetch", "serve"],
|
|
88
|
+
"description": "Firefox-engine page fetching: pass bot checks, run the page's own JS, hand identity to Chromium.",
|
|
89
|
+
"timeout": 180
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Or from the shell, which writes the same file:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
pi mcp add foxfetch -- python -m foxfetch serve
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Verify:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
pi mcp list
|
|
105
|
+
# foxfetch: connected, 7 tools
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Claude Code
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
claude mcp add foxfetch -- python -m foxfetch serve
|
|
112
|
+
claude mcp list
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Codex
|
|
116
|
+
|
|
117
|
+
Append to `~/.codex/config.toml`:
|
|
118
|
+
|
|
119
|
+
```toml
|
|
120
|
+
[mcp_servers.foxfetch]
|
|
121
|
+
command = "python"
|
|
122
|
+
args = ["-m", "foxfetch", "serve"]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Restart Codex, then ask it for its tool list.
|
|
126
|
+
|
|
127
|
+
### DeepSeek Harness (DSH)
|
|
128
|
+
|
|
129
|
+
DSH has a native plugin API, and the plugin is published on npm. It holds **no logic** — it
|
|
130
|
+
starts the service once and reshapes results for the DSH UI.
|
|
131
|
+
|
|
132
|
+
```powershell
|
|
133
|
+
$profile = "$env:USERPROFILE\.dsh\profiles\desktop"
|
|
134
|
+
|
|
135
|
+
# 1. install the plugin into the profile
|
|
136
|
+
Push-Location $profile
|
|
137
|
+
pnpm add dsh-foxfetch
|
|
138
|
+
Pop-Location
|
|
139
|
+
|
|
140
|
+
# 2. register the bundle (keep the entries already there)
|
|
141
|
+
$pkg = Get-Content "$profile\package.json" -Raw | ConvertFrom-Json
|
|
142
|
+
if ($pkg.dsh.profile.bundles -notcontains "dsh-foxfetch") {
|
|
143
|
+
$pkg.dsh.profile.bundles += "dsh-foxfetch"
|
|
144
|
+
}
|
|
145
|
+
$pkg | ConvertTo-Json -Depth 20 | Set-Content "$profile\package.json"
|
|
146
|
+
|
|
147
|
+
# 3. restart DSH
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`~/.dsh/profiles/desktop/package.json` should end up looking like this:
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"name": "dsh-profile-desktop",
|
|
155
|
+
"private": true,
|
|
156
|
+
"dependencies": {
|
|
157
|
+
"dsh-foxfetch": "^0.1.1"
|
|
158
|
+
},
|
|
159
|
+
"dsh": {
|
|
160
|
+
"profile": {
|
|
161
|
+
"bundles": [
|
|
162
|
+
"@deepseek-ai/dsh-base",
|
|
163
|
+
"@deepseek-ai/dsh-web-app",
|
|
164
|
+
"dsh-foxfetch"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**`pnpm` is not on PATH?** DSH ships its own:
|
|
172
|
+
|
|
173
|
+
```powershell
|
|
174
|
+
$dsh = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
|
|
175
|
+
$node = Join-Path $dsh "node\bin\node.exe"
|
|
176
|
+
$pnpm = Join-Path $dsh "pnpm\bin\pnpm.cjs"
|
|
177
|
+
& $node $pnpm add dsh-foxfetch
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Editing the plugin itself?** Link a checkout instead of the published package — replace the
|
|
181
|
+
dependency with `"dsh-foxfetch": "link:C:/Users/<you>/.dsh/plugins/dsh-foxfetch"` after
|
|
182
|
+
`git clone https://github.com/zhuchongba-01/foxfetch` anywhere you like.
|
|
183
|
+
|
|
184
|
+
### Anything else (opencode, gemini, zcode, custom)
|
|
185
|
+
|
|
186
|
+
Most clients take a stdio server entry. The two values they all need:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
command: python (or the absolute path from step 1)
|
|
190
|
+
args: ["-m", "foxfetch", "serve"]
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Step 3 — prove it works
|
|
196
|
+
|
|
197
|
+
Ask the host (not a shell) to run these two calls:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
foxfetch_status
|
|
201
|
+
→ ok: true, ruyijs 0.4.5, chromium: yes
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
foxfetch_run(js="navigator.userAgent", url="https://example.com")
|
|
206
|
+
→ "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:160.0) Gecko/20100101 Firefox/160.0"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
A user agent that says `Python-urllib` or `HeadlessChrome` means the call never reached the
|
|
210
|
+
engine — fix that before trusting any other result.
|
|
211
|
+
|
|
212
|
+
Finally, close what you opened:
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
foxfetch_cleanup(scope="all")
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Troubleshooting
|
|
221
|
+
|
|
222
|
+
| Symptom | Cause | Fix |
|
|
223
|
+
|---|---|---|
|
|
224
|
+
| `cannot start the Python service` (DSH plugin) | the plugin found a different interpreter | set `FOXFETCH_PY` to the absolute path from step 1 |
|
|
225
|
+
| `ModuleNotFoundError: mcp.server.fastmcp` | `mcp` 2.x installed | `pip install "mcp>=1.30,<2"` |
|
|
226
|
+
| `no live context for that origin` | the context idled out (60 s) or was evicted | pass `url` again, or hold `context_id` from the previous call |
|
|
227
|
+
| `navigation produced an empty document` | slow page, or one that needs a real renderer | raise `timeout_ms`, or use `handoff` + Chromium |
|
|
228
|
+
| tools appear twice | two entries in one host | remove one — see the note at the top |
|
|
229
|
+
| `doctor` says chromium missing | Playwright browsers not installed | `npx playwright install chromium` (optional) |
|
|
230
|
+
|
|
231
|
+
## Uninstall
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
pip uninstall foxfetch
|
|
235
|
+
rm -rf "$HOME/.local/share/foxfetch" # artifacts; %LOCALAPPDATA%\foxfetch on Windows
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Then remove the host entry (the `mcpServers` block, the `[mcp_servers.foxfetch]` table, or the
|
|
239
|
+
`dsh-foxfetch` dependency + bundle line).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: foxfetch
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
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
5
|
Project-URL: Homepage, https://github.com/zhuchongba-01/foxfetch
|
|
6
6
|
Project-URL: Repository, https://github.com/zhuchongba-01/foxfetch
|
|
@@ -51,13 +51,25 @@ Description-Content-Type: text/markdown
|
|
|
51
51
|
|
|
52
52
|
**Read a page the way a browser does — only when plain HTTP is not enough.**
|
|
53
53
|
|
|
54
|
-
foxfetch
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
[](https://pypi.org/project/foxfetch/)
|
|
55
|
+
[](https://pypi.org/project/foxfetch/)
|
|
56
|
+
[](https://www.npmjs.com/package/dsh-foxfetch)
|
|
57
|
+
[](LICENSE)
|
|
58
|
+
[](https://modelcontextprotocol.io)
|
|
59
|
+
[](INSTALL.md)
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
foxfetch drives a real Firefox engine (SpiderMonkey + Necko, no window, no renderer) to run a
|
|
62
|
+
site's own JavaScript: pass a bot check, read a DOM that only exists after the scripts run, find
|
|
63
|
+
the signature and the real API host. When a screenshot or a click is needed, it hands the
|
|
64
|
+
identity it earned to Chromium.
|
|
65
|
+
|
|
66
|
+
It speaks the Model Context Protocol, so one service serves every agent host — Pi, Claude Code,
|
|
67
|
+
Codex, DeepSeek Harness.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install foxfetch
|
|
71
|
+
python -m foxfetch doctor
|
|
72
|
+
```
|
|
61
73
|
|
|
62
74
|
---
|
|
63
75
|
|
|
@@ -79,8 +91,8 @@ probe("https://shop.example/item")
|
|
|
79
91
|
suggestion: use run — the engine's TLS and JS profile match a real Firefox
|
|
80
92
|
```
|
|
81
93
|
|
|
82
|
-
Most pages do not need the engine. Reaching for it anyway costs ~90 MB of RAM and ~3 s per
|
|
83
|
-
|
|
94
|
+
Most pages do not need the engine. Reaching for it anyway costs ~90 MB of RAM and ~3 s per open,
|
|
95
|
+
and buys nothing on a document `curl` could have fetched.
|
|
84
96
|
|
|
85
97
|
## Tools
|
|
86
98
|
|
|
@@ -111,23 +123,68 @@ pool exceeds `FOXFETCH_MAX_CONTEXTS` (default 2) — the least recently used goe
|
|
|
111
123
|
|
|
112
124
|
## Install
|
|
113
125
|
|
|
126
|
+
Two pieces, always two: the **service** (all the logic, from PyPI) and a **host entry** (how
|
|
127
|
+
your agent finds it). The service is the same everywhere; only the wiring differs.
|
|
128
|
+
|
|
114
129
|
```bash
|
|
115
|
-
pip install foxfetch
|
|
116
|
-
python -m foxfetch doctor
|
|
130
|
+
pip install foxfetch # or: python -m pip install --upgrade foxfetch
|
|
131
|
+
python -m foxfetch doctor # exits non-zero and prints fixes when something is missing
|
|
117
132
|
```
|
|
118
133
|
|
|
119
|
-
|
|
134
|
+
`doctor` reports Python, `ruyijs`, `mcp`, Chromium and the artifact directory:
|
|
120
135
|
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
136
|
+
```
|
|
137
|
+
{ "ok": true,
|
|
138
|
+
"python": { "version": "3.14.6", "ok": true },
|
|
139
|
+
"ruyijs": { "version": "0.4.5", "ok": true },
|
|
140
|
+
"mcp": { "version": "1.30.0", "ok": true },
|
|
141
|
+
"chromium": { "found": true, "path": "…/chrome-headless-shell.exe" },
|
|
142
|
+
"fixes": [] }
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Chromium is optional: without it `handoff` still exports the identity, it just cannot write the
|
|
146
|
+
screenshot script.
|
|
125
147
|
|
|
126
|
-
|
|
148
|
+
Then pick your host — **one entry per host, never two**, or the model sees the same seven tools
|
|
149
|
+
twice:
|
|
150
|
+
|
|
151
|
+
| Host | Where the entry goes |
|
|
152
|
+
|---|---|
|
|
153
|
+
| **Pi** | `~/.pi/agent/mcp.json` → `mcpServers.foxfetch` |
|
|
154
|
+
| **Claude Code** | `claude mcp add foxfetch -- python -m foxfetch serve` |
|
|
155
|
+
| **Codex** | `~/.codex/config.toml` → `[mcp_servers.foxfetch]` |
|
|
156
|
+
| **DeepSeek Harness** | `pnpm add dsh-foxfetch` in the profile, then add it to `dsh.profile.bundles` |
|
|
157
|
+
| anything else | a stdio server: `python` + `["-m", "foxfetch", "serve"]` |
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
// Pi / Claude Code / Codex — the same shape everywhere
|
|
161
|
+
{
|
|
162
|
+
"mcpServers": {
|
|
163
|
+
"foxfetch": {
|
|
164
|
+
"command": "python",
|
|
165
|
+
"args": ["-m", "foxfetch", "serve"],
|
|
166
|
+
"timeout": 180
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
127
170
|
```
|
|
128
171
|
|
|
129
|
-
|
|
130
|
-
the
|
|
172
|
+
**Every step, per host, with the exact commands and a verification call: [INSTALL.md](INSTALL.md).**
|
|
173
|
+
[SETUP.md](SETUP.md) is the version written for an agent doing the install on a fresh machine
|
|
174
|
+
(it detects which hosts exist instead of asking).
|
|
175
|
+
|
|
176
|
+
The DSH plugin holds no logic; upgrading `foxfetch` on PyPI upgrades what the plugin can do.
|
|
177
|
+
|
|
178
|
+
## Verify it works
|
|
179
|
+
|
|
180
|
+
Ask the host, not a shell:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
foxfetch_run(js="navigator.userAgent", url="https://example.com")
|
|
184
|
+
→ Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:160.0) Gecko/20100101 Firefox/160.0
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`Python-urllib` or `HeadlessChrome` in that string means the call never reached the engine.
|
|
131
188
|
|
|
132
189
|
## Configuration
|
|
133
190
|
|
|
@@ -139,33 +196,46 @@ the screenshot script.
|
|
|
139
196
|
| `FOXFETCH_TIMEOUT_MS` | 30000 | Default navigation budget |
|
|
140
197
|
| `FOXFETCH_MAX_BYTES` | 65536 | Output cap before spilling to a file |
|
|
141
198
|
| `FOXFETCH_ARTIFACT_TTL` | 86400 | Seconds before an artifact is deleted automatically |
|
|
199
|
+
| `FOXFETCH_ARTIFACT_MAX` | 67108864 | Artifact directory byte budget |
|
|
142
200
|
| `FOXFETCH_REMIND_AFTER` | 600 | Seconds before tool results start mentioning pending artifacts (0 disables) |
|
|
143
|
-
| `FOXFETCH_PY` | — | Interpreter the DSH plugin should
|
|
201
|
+
| `FOXFETCH_PY` | — | Interpreter the DSH plugin should start |
|
|
144
202
|
|
|
145
203
|
## Safety
|
|
146
204
|
|
|
147
205
|
`handoff` writes **live credentials** — cookies including the HttpOnly ones page script cannot
|
|
148
206
|
read. They land under `FOXFETCH_HOME`, owner-only, and expire after `FOXFETCH_ARTIFACT_TTL`.
|
|
149
|
-
Call `cleanup` when the task is delivered, and pass `keep=[...]` for the screenshot or token
|
|
150
|
-
|
|
207
|
+
Call `cleanup` when the task is delivered, and pass `keep=[...]` for the screenshot or token the
|
|
208
|
+
user still needs to look at.
|
|
151
209
|
|
|
152
210
|
You do not have to remember on your own: **every tool response carries the artifact state**, and
|
|
153
211
|
once a file is older than `FOXFETCH_REMIND_AFTER` (default 600 s) the response grows a `reminder`
|
|
154
212
|
saying how many files are still on disk and that they may hold credentials. The field vanishes
|
|
155
213
|
the moment `cleanup` runs, so a stale reminder is a visible bug, not a silent one.
|
|
156
214
|
|
|
215
|
+
## What it is not
|
|
216
|
+
|
|
217
|
+
- Not a screenshot tool, not a clicker, not a layout engine — Chromium does that, once it has
|
|
218
|
+
the identity `handoff` exported.
|
|
219
|
+
- Not a session store. Every context is fresh; nothing survives `close`, and `handoff` output is
|
|
220
|
+
meant to be deleted.
|
|
221
|
+
- Not a fingerprint randomiser. Guessing a profile that matches nobody is worse than sending a
|
|
222
|
+
real Firefox.
|
|
223
|
+
|
|
157
224
|
## Development
|
|
158
225
|
|
|
159
226
|
```bash
|
|
160
227
|
pip install -e '.[dev]'
|
|
161
|
-
pytest -q
|
|
162
|
-
mypy src
|
|
228
|
+
pytest -q # 45 tests, no network
|
|
229
|
+
mypy src # strict
|
|
230
|
+
python tools/push_via_api.py --repo <owner>/<name> --dry-run # push when github.com:443 is reset
|
|
163
231
|
```
|
|
164
232
|
|
|
165
|
-
The tests encode the bugs this rewrite exists to prevent: a clip that split UTF-8 sequences,
|
|
166
|
-
|
|
167
|
-
and a runaway browser left behind when the screenshot
|
|
233
|
+
The tests encode the bugs this rewrite exists to prevent: a clip that split UTF-8 sequences, a
|
|
234
|
+
URL compare that ignored the trailing slash, `sameSite: "Default"` rejected by Playwright, a
|
|
235
|
+
`cleanup` that only deleted expired files, and a runaway browser left behind when the screenshot
|
|
236
|
+
threw.
|
|
168
237
|
|
|
169
238
|
## Licence
|
|
170
239
|
|
|
171
|
-
MIT. The engine (`ruyijs`) is a separate project under AGPL-3.0; foxfetch only calls it
|
|
240
|
+
MIT. The engine (`ruyijs`) is a separate project under AGPL-3.0; foxfetch only calls it — no
|
|
241
|
+
ruyijs code is bundled.
|
foxfetch-0.1.1/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# foxfetch
|
|
2
|
+
|
|
3
|
+
**Read a page the way a browser does — only when plain HTTP is not enough.**
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/foxfetch/)
|
|
6
|
+
[](https://pypi.org/project/foxfetch/)
|
|
7
|
+
[](https://www.npmjs.com/package/dsh-foxfetch)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://modelcontextprotocol.io)
|
|
10
|
+
[](INSTALL.md)
|
|
11
|
+
|
|
12
|
+
foxfetch drives a real Firefox engine (SpiderMonkey + Necko, no window, no renderer) to run a
|
|
13
|
+
site's own JavaScript: pass a bot check, read a DOM that only exists after the scripts run, find
|
|
14
|
+
the signature and the real API host. When a screenshot or a click is needed, it hands the
|
|
15
|
+
identity it earned to Chromium.
|
|
16
|
+
|
|
17
|
+
It speaks the Model Context Protocol, so one service serves every agent host — Pi, Claude Code,
|
|
18
|
+
Codex, DeepSeek Harness.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install foxfetch
|
|
22
|
+
python -m foxfetch doctor
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## The rule that saves the most time
|
|
28
|
+
|
|
29
|
+
| Situation | Use |
|
|
30
|
+
|---|---|
|
|
31
|
+
| Static HTML, JSON endpoints, RSS | **plain HTTP** — do not call foxfetch |
|
|
32
|
+
| Content appears after JS runs | `run` |
|
|
33
|
+
| 403 / Cloudflare / DataDome / Kasada | `probe`, then `run` |
|
|
34
|
+
| Someone needs to *see* the page | `handoff` → the generated Playwright script |
|
|
35
|
+
|
|
36
|
+
`probe` answers the first two questions with evidence, so the choice is not a guess:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
probe("https://shop.example/item")
|
|
40
|
+
→ verdict: blocked
|
|
41
|
+
evidence: HTTP 403, DataDome (matched 'datadome'), 512 bytes, 0 visible text
|
|
42
|
+
suggestion: use run — the engine's TLS and JS profile match a real Firefox
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Most pages do not need the engine. Reaching for it anyway costs ~90 MB of RAM and ~3 s per open,
|
|
46
|
+
and buys nothing on a document `curl` could have fetched.
|
|
47
|
+
|
|
48
|
+
## Tools
|
|
49
|
+
|
|
50
|
+
| Tool | What it does |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `probe` | Classify a URL: `plain_http` / `needs_engine` / `blocked`, with the evidence |
|
|
53
|
+
| `run` | Evaluate JavaScript in the engine; returns the value, console and request log |
|
|
54
|
+
| `net` | Read the request log and console of a live context |
|
|
55
|
+
| `handoff` | Export cookies (including HttpOnly), localStorage, UA; write a Playwright script |
|
|
56
|
+
| `close` | Close one context (by id or origin) or all of them |
|
|
57
|
+
| `cleanup` | Delete every artifact except the ones in `keep`, close contexts, sweep temp scratch dirs |
|
|
58
|
+
| `status` | Live contexts, artifact usage, environment check |
|
|
59
|
+
|
|
60
|
+
## Contexts
|
|
61
|
+
|
|
62
|
+
One engine world per origin, kept alive between calls so a multi-step flow is several small
|
|
63
|
+
calls instead of one giant script:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
run("window.step = 1", url="https://x.test") # opens the page
|
|
67
|
+
run("window.step + 1") # → 2, same document
|
|
68
|
+
run("fetch('/api/me').then(r => r.text())",
|
|
69
|
+
advance_ms=800, read="window.__last") # carries the cookies earned above
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
A context dies on `close`, after `FOXFETCH_IDLE_SECONDS` (default 60) of silence, or when the
|
|
73
|
+
pool exceeds `FOXFETCH_MAX_CONTEXTS` (default 2) — the least recently used goes first.
|
|
74
|
+
|
|
75
|
+
## Install
|
|
76
|
+
|
|
77
|
+
Two pieces, always two: the **service** (all the logic, from PyPI) and a **host entry** (how
|
|
78
|
+
your agent finds it). The service is the same everywhere; only the wiring differs.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install foxfetch # or: python -m pip install --upgrade foxfetch
|
|
82
|
+
python -m foxfetch doctor # exits non-zero and prints fixes when something is missing
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`doctor` reports Python, `ruyijs`, `mcp`, Chromium and the artifact directory:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
{ "ok": true,
|
|
89
|
+
"python": { "version": "3.14.6", "ok": true },
|
|
90
|
+
"ruyijs": { "version": "0.4.5", "ok": true },
|
|
91
|
+
"mcp": { "version": "1.30.0", "ok": true },
|
|
92
|
+
"chromium": { "found": true, "path": "…/chrome-headless-shell.exe" },
|
|
93
|
+
"fixes": [] }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Chromium is optional: without it `handoff` still exports the identity, it just cannot write the
|
|
97
|
+
screenshot script.
|
|
98
|
+
|
|
99
|
+
Then pick your host — **one entry per host, never two**, or the model sees the same seven tools
|
|
100
|
+
twice:
|
|
101
|
+
|
|
102
|
+
| Host | Where the entry goes |
|
|
103
|
+
|---|---|
|
|
104
|
+
| **Pi** | `~/.pi/agent/mcp.json` → `mcpServers.foxfetch` |
|
|
105
|
+
| **Claude Code** | `claude mcp add foxfetch -- python -m foxfetch serve` |
|
|
106
|
+
| **Codex** | `~/.codex/config.toml` → `[mcp_servers.foxfetch]` |
|
|
107
|
+
| **DeepSeek Harness** | `pnpm add dsh-foxfetch` in the profile, then add it to `dsh.profile.bundles` |
|
|
108
|
+
| anything else | a stdio server: `python` + `["-m", "foxfetch", "serve"]` |
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
// Pi / Claude Code / Codex — the same shape everywhere
|
|
112
|
+
{
|
|
113
|
+
"mcpServers": {
|
|
114
|
+
"foxfetch": {
|
|
115
|
+
"command": "python",
|
|
116
|
+
"args": ["-m", "foxfetch", "serve"],
|
|
117
|
+
"timeout": 180
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Every step, per host, with the exact commands and a verification call: [INSTALL.md](INSTALL.md).**
|
|
124
|
+
[SETUP.md](SETUP.md) is the version written for an agent doing the install on a fresh machine
|
|
125
|
+
(it detects which hosts exist instead of asking).
|
|
126
|
+
|
|
127
|
+
The DSH plugin holds no logic; upgrading `foxfetch` on PyPI upgrades what the plugin can do.
|
|
128
|
+
|
|
129
|
+
## Verify it works
|
|
130
|
+
|
|
131
|
+
Ask the host, not a shell:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
foxfetch_run(js="navigator.userAgent", url="https://example.com")
|
|
135
|
+
→ Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:160.0) Gecko/20100101 Firefox/160.0
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`Python-urllib` or `HeadlessChrome` in that string means the call never reached the engine.
|
|
139
|
+
|
|
140
|
+
## Configuration
|
|
141
|
+
|
|
142
|
+
| Variable | Default | Meaning |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| `FOXFETCH_HOME` | `%LOCALAPPDATA%\foxfetch` | Artifact root (credentials pass through it) |
|
|
145
|
+
| `FOXFETCH_MAX_CONTEXTS` | 2 | Live engine contexts before LRU eviction |
|
|
146
|
+
| `FOXFETCH_IDLE_SECONDS` | 60 | Silence before a context is killed |
|
|
147
|
+
| `FOXFETCH_TIMEOUT_MS` | 30000 | Default navigation budget |
|
|
148
|
+
| `FOXFETCH_MAX_BYTES` | 65536 | Output cap before spilling to a file |
|
|
149
|
+
| `FOXFETCH_ARTIFACT_TTL` | 86400 | Seconds before an artifact is deleted automatically |
|
|
150
|
+
| `FOXFETCH_ARTIFACT_MAX` | 67108864 | Artifact directory byte budget |
|
|
151
|
+
| `FOXFETCH_REMIND_AFTER` | 600 | Seconds before tool results start mentioning pending artifacts (0 disables) |
|
|
152
|
+
| `FOXFETCH_PY` | — | Interpreter the DSH plugin should start |
|
|
153
|
+
|
|
154
|
+
## Safety
|
|
155
|
+
|
|
156
|
+
`handoff` writes **live credentials** — cookies including the HttpOnly ones page script cannot
|
|
157
|
+
read. They land under `FOXFETCH_HOME`, owner-only, and expire after `FOXFETCH_ARTIFACT_TTL`.
|
|
158
|
+
Call `cleanup` when the task is delivered, and pass `keep=[...]` for the screenshot or token the
|
|
159
|
+
user still needs to look at.
|
|
160
|
+
|
|
161
|
+
You do not have to remember on your own: **every tool response carries the artifact state**, and
|
|
162
|
+
once a file is older than `FOXFETCH_REMIND_AFTER` (default 600 s) the response grows a `reminder`
|
|
163
|
+
saying how many files are still on disk and that they may hold credentials. The field vanishes
|
|
164
|
+
the moment `cleanup` runs, so a stale reminder is a visible bug, not a silent one.
|
|
165
|
+
|
|
166
|
+
## What it is not
|
|
167
|
+
|
|
168
|
+
- Not a screenshot tool, not a clicker, not a layout engine — Chromium does that, once it has
|
|
169
|
+
the identity `handoff` exported.
|
|
170
|
+
- Not a session store. Every context is fresh; nothing survives `close`, and `handoff` output is
|
|
171
|
+
meant to be deleted.
|
|
172
|
+
- Not a fingerprint randomiser. Guessing a profile that matches nobody is worse than sending a
|
|
173
|
+
real Firefox.
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pip install -e '.[dev]'
|
|
179
|
+
pytest -q # 45 tests, no network
|
|
180
|
+
mypy src # strict
|
|
181
|
+
python tools/push_via_api.py --repo <owner>/<name> --dry-run # push when github.com:443 is reset
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The tests encode the bugs this rewrite exists to prevent: a clip that split UTF-8 sequences, a
|
|
185
|
+
URL compare that ignored the trailing slash, `sameSite: "Default"` rejected by Playwright, a
|
|
186
|
+
`cleanup` that only deleted expired files, and a runaway browser left behind when the screenshot
|
|
187
|
+
threw.
|
|
188
|
+
|
|
189
|
+
## Licence
|
|
190
|
+
|
|
191
|
+
MIT. The engine (`ruyijs`) is a separate project under AGPL-3.0; foxfetch only calls it — no
|
|
192
|
+
ruyijs code is bundled.
|
|
@@ -4,6 +4,9 @@ This file is written for an **agent executing an installation on a new machine**
|
|
|
4
4
|
the steps in order; each one has an acceptance check. If a check fails, take its failure branch
|
|
5
5
|
instead of moving on.
|
|
6
6
|
|
|
7
|
+
For a human reading this, use [INSTALL.md](INSTALL.md): same steps, written as click-and-paste
|
|
8
|
+
per host.
|
|
9
|
+
|
|
7
10
|
After this document, the machine must be able to: run a site's own JavaScript in a real Firefox
|
|
8
11
|
engine, and hand that identity to Chromium for a screenshot.
|
|
9
12
|
|
|
@@ -16,19 +19,21 @@ checks and record the answers:
|
|
|
16
19
|
|
|
17
20
|
```powershell
|
|
18
21
|
[ordered]@{
|
|
19
|
-
dsh = (Test-Path "$env:USERPROFILE\.dsh
|
|
20
|
-
(Test-Path "$env:ProgramFiles\Deepseek Harness\DeepSeek Harness.exe")
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
other = $false # opencode, gemini, zcode, workbuddy …: check for their config dirs
|
|
22
|
+
dsh = (Get-Command dsh -ErrorAction SilentlyContinue) -or (Test-Path "$env:USERPROFILE\.dsh") -or
|
|
23
|
+
(Test-Path "$env:ProgramFiles\Deepseek Harness\DeepSeek Harness.exe")
|
|
24
|
+
pi = (Get-Command pi -ErrorAction SilentlyContinue) -or (Test-Path "$env:USERPROFILE\.pi\agent")
|
|
25
|
+
claude = (Get-Command claude -ErrorAction SilentlyContinue) -or (Test-Path "$env:USERPROFILE\.claude")
|
|
26
|
+
codex = (Get-Command codex -ErrorAction SilentlyContinue) -or (Test-Path "$env:USERPROFILE\.codex\config.toml")
|
|
27
|
+
other = $false # opencode, gemini, zcode, workbuddy …: check their own config dirs
|
|
26
28
|
}
|
|
27
29
|
```
|
|
28
30
|
|
|
31
|
+
`~/.dsh` existing is enough to call DSH present — the harness may be installed anywhere, and the
|
|
32
|
+
profile directory under it is what the plugin needs.
|
|
33
|
+
|
|
29
34
|
```bash
|
|
30
35
|
# same thing on Linux/macOS
|
|
31
|
-
|
|
36
|
+
{ command -v dsh >/dev/null || [ -d ~/.dsh ]; } && echo dsh
|
|
32
37
|
command -v pi >/dev/null && test -d ~/.pi/agent && echo pi
|
|
33
38
|
command -v claude >/dev/null && test -d ~/.claude && echo claude
|
|
34
39
|
test -f ~/.codex/config.toml && echo codex
|
|
@@ -96,25 +101,45 @@ PY
|
|
|
96
101
|
## 3. Host: DSH (native plugin)
|
|
97
102
|
|
|
98
103
|
The plugin is a thin forwarder: it starts `python -m foxfetch serve` once and reshapes results
|
|
99
|
-
for the DSH UI. No logic lives in JavaScript
|
|
104
|
+
for the DSH UI. No logic lives in JavaScript — upgrading `foxfetch` on PyPI upgrades what the
|
|
105
|
+
plugin can do. It is published as `dsh-foxfetch` on npm.
|
|
100
106
|
|
|
101
107
|
```powershell
|
|
102
108
|
$profile = "$env:USERPROFILE\.dsh\profiles\desktop"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
|
|
110
|
+
# 1. install the plugin from npm (no clone, versioned, updatable)
|
|
111
|
+
Push-Location $profile
|
|
112
|
+
pnpm add dsh-foxfetch
|
|
113
|
+
Pop-Location
|
|
114
|
+
|
|
115
|
+
# 2. register the bundle (keep the existing entries)
|
|
106
116
|
$pkg = Get-Content "$profile\package.json" -Raw | ConvertFrom-Json
|
|
107
|
-
$pkg.
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
if ($pkg.dsh.profile.bundles -notcontains "dsh-foxfetch") {
|
|
118
|
+
$pkg.dsh.profile.bundles += "dsh-foxfetch"
|
|
119
|
+
}
|
|
110
120
|
$pkg | ConvertTo-Json -Depth 20 | Set-Content "$profile\package.json"
|
|
111
|
-
|
|
112
|
-
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`pnpm` ships inside DSH; if it is not on PATH use the bundled one:
|
|
124
|
+
|
|
125
|
+
```powershell
|
|
126
|
+
$dsh = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
|
|
127
|
+
$node = Join-Path $dsh "node\bin\node.exe"
|
|
128
|
+
$pnpm = Join-Path $dsh "pnpm\bin\pnpm.cjs"
|
|
129
|
+
& $node $pnpm add dsh-foxfetch
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Working on the plugin itself?** Link a clone instead of the published version:
|
|
133
|
+
|
|
134
|
+
```powershell
|
|
135
|
+
git clone https://github.com/zhuchongba-01/foxfetch "$env:USERPROFILE\.dsh\plugins\dsh-foxfetch"
|
|
136
|
+
# in the profile's package.json dependencies:
|
|
137
|
+
# "dsh-foxfetch": "link:C:/Users/<you>/.dsh/plugins/dsh-foxfetch"
|
|
113
138
|
```
|
|
114
139
|
|
|
115
140
|
**Acceptance:** after restarting DSH, the tool list shows `foxfetch_probe`, `foxfetch_run`,
|
|
116
|
-
`foxfetch_net`, `foxfetch_handoff`, `foxfetch_cleanup`, `foxfetch_status` —
|
|
117
|
-
`mcp__foxfetch__*` entries.
|
|
141
|
+
`foxfetch_net`, `foxfetch_handoff`, `foxfetch_close`, `foxfetch_cleanup`, `foxfetch_status` —
|
|
142
|
+
and **no** `mcp__foxfetch__*` entries.
|
|
118
143
|
|
|
119
144
|
## 4. Host: MCP clients
|
|
120
145
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# dsh-foxfetch
|
|
2
|
+
|
|
3
|
+
DeepSeek Harness plugin for **[foxfetch](https://pypi.org/project/foxfetch/)** — read a page
|
|
4
|
+
through a real Firefox engine when plain HTTP is not enough.
|
|
5
|
+
|
|
6
|
+
This package is only the DSH entry point (about 350 lines of JavaScript). It holds **no
|
|
7
|
+
logic**: it starts `python -m foxfetch serve` once and forwards every tool call over the
|
|
8
|
+
Model Context Protocol, reshaping the result for the DSH UI.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install foxfetch # the service — all the logic lives in Python
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Then, inside your DSH profile:
|
|
17
|
+
|
|
18
|
+
```powershell
|
|
19
|
+
cd "$env:USERPROFILE\.dsh\profiles\desktop"
|
|
20
|
+
pnpm add dsh-foxfetch
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Add the bundle to `~/.dsh/profiles/desktop/package.json` and restart DSH:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"dsh": {
|
|
28
|
+
"profile": {
|
|
29
|
+
"bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-foxfetch"]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`pnpm` not on PATH? DSH ships its own:
|
|
36
|
+
|
|
37
|
+
```powershell
|
|
38
|
+
$dsh = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
|
|
39
|
+
$node = Join-Path $dsh "node\bin\node.exe"
|
|
40
|
+
$pnpm = Join-Path $dsh "pnpm\bin\pnpm.cjs"
|
|
41
|
+
& $node $pnpm add dsh-foxfetch
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Restart DSH and the tools appear: `foxfetch_probe`, `foxfetch_run`, `foxfetch_net`,
|
|
45
|
+
`foxfetch_handoff`, `foxfetch_close`, `foxfetch_cleanup`, `foxfetch_status`.
|
|
46
|
+
|
|
47
|
+
Verify from the host, not a shell:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
foxfetch_run(js="navigator.userAgent", url="https://example.com")
|
|
51
|
+
→ Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:160.0) Gecko/20100101 Firefox/160.0
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`Python-urllib` or `HeadlessChrome` there means the call never reached the engine.
|
|
55
|
+
|
|
56
|
+
## Do not install twice
|
|
57
|
+
|
|
58
|
+
Install **either** this plugin **or** an MCP entry for the same service — never both. Two
|
|
59
|
+
entries expose the same seven tools twice (`foxfetch_run` and `mcp__foxfetch__run`) and the
|
|
60
|
+
model has to guess which one to call.
|
|
61
|
+
|
|
62
|
+
For Pi, Claude Code, Codex and other MCP clients, configure the service directly instead:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{ "mcpServers": { "foxfetch": { "command": "python", "args": ["-m", "foxfetch", "serve"] } } }
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Requirements
|
|
69
|
+
|
|
70
|
+
- Python 3.10+ with `foxfetch` installed (`pip install foxfetch`)
|
|
71
|
+
- `FOXFETCH_PY` when several interpreters exist and `python` is not the right one
|
|
72
|
+
- Chromium via Playwright only if you need screenshots: `npx playwright install chromium`
|
|
73
|
+
|
|
74
|
+
`foxfetch_status` reports which of these are missing.
|
|
75
|
+
|
|
76
|
+
## Licence
|
|
77
|
+
|
|
78
|
+
MIT. The engine (`ruyijs`) is a separate AGPL-3.0 project that foxfetch calls.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# dsh-
|
|
2
|
-
# Install this plugin OR an MCP entry for the same service, never both.
|
|
3
|
-
- insert:
|
|
4
|
-
- id: tool-foxfetch
|
|
5
|
-
name: 'dsh-
|
|
1
|
+
# dsh-foxfetch bundle patch: mount the foxfetch tools.
|
|
2
|
+
# Install this plugin OR an MCP entry for the same service, never both.
|
|
3
|
+
- insert:
|
|
4
|
+
- id: tool-foxfetch
|
|
5
|
+
name: 'dsh-foxfetch'
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-foxfetch",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "DSH plugin for foxfetch: read a page through a real Firefox engine (pass bot checks, run the page's own JavaScript), then hand the identity to Chromium for a screenshot. Forwards to the Python service over MCP.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"index.js",
|
|
10
|
+
"cordis.patch.yml",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"dsh",
|
|
15
|
+
"dsh-plugin",
|
|
16
|
+
"dsh-plugins",
|
|
17
|
+
"deepseek-harness",
|
|
18
|
+
"foxfetch",
|
|
19
|
+
"mcp",
|
|
20
|
+
"ruyijs",
|
|
21
|
+
"firefox",
|
|
22
|
+
"anti-bot",
|
|
23
|
+
"web-scraping"
|
|
24
|
+
],
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/zhuchongba-01/foxfetch.git",
|
|
28
|
+
"directory": "dsh"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/zhuchongba-01/foxfetch/tree/master/dsh",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/zhuchongba-01/foxfetch/issues"
|
|
33
|
+
},
|
|
34
|
+
"dsh": {
|
|
35
|
+
"bundle": {
|
|
36
|
+
"patch": "./cordis.patch.yml"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "foxfetch"
|
|
7
|
-
version = "0.1.
|
|
8
|
-
description = "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."
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.10"
|
|
11
|
-
license = { file = "LICENSE" }
|
|
12
|
-
keywords = ["mcp", "ruyijs", "firefox", "anti-bot", "scraping", "playwright", "agent"]
|
|
13
|
-
classifiers = [
|
|
14
|
-
"Programming Language :: Python :: 3",
|
|
15
|
-
"License :: OSI Approved :: MIT License",
|
|
16
|
-
"Environment :: Console",
|
|
17
|
-
"Intended Audience :: Developers",
|
|
18
|
-
"Topic :: Internet :: WWW/HTTP :: Browsers",
|
|
19
|
-
"Operating System :: Microsoft :: Windows",
|
|
20
|
-
"Operating System :: POSIX :: Linux",
|
|
21
|
-
]
|
|
22
|
-
# `mcp` stays below 2: 2.x renamed FastMCP to MCPServer and the import path here
|
|
23
|
-
# would raise ModuleNotFoundError on a fresh machine.
|
|
24
|
-
dependencies = [
|
|
25
|
-
"mcp>=1.30,<2",
|
|
26
|
-
"ruyijs>=0.4.5",
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
[project.urls]
|
|
30
|
-
Homepage = "https://github.com/zhuchongba-01/foxfetch"
|
|
31
|
-
Repository = "https://github.com/zhuchongba-01/foxfetch"
|
|
32
|
-
Issues = "https://github.com/zhuchongba-01/foxfetch/issues"
|
|
33
|
-
Changelog = "https://github.com/zhuchongba-01/foxfetch/commits/master"
|
|
34
|
-
|
|
35
|
-
[project.optional-dependencies]
|
|
36
|
-
dev = ["pytest>=8", "mypy>=1.10"]
|
|
37
|
-
|
|
38
|
-
[project.scripts]
|
|
39
|
-
foxfetch = "foxfetch.cli:main"
|
|
40
|
-
|
|
41
|
-
[tool.hatch.build.targets.wheel]
|
|
42
|
-
packages = ["src/foxfetch"]
|
|
43
|
-
|
|
44
|
-
[tool.mypy]
|
|
45
|
-
python_version = "3.10"
|
|
46
|
-
strict = true
|
|
47
|
-
warn_unreachable = true
|
|
48
|
-
|
|
49
|
-
[tool.pytest.ini_options]
|
|
50
|
-
testpaths = ["tests"]
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "foxfetch"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "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."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
keywords = ["mcp", "ruyijs", "firefox", "anti-bot", "scraping", "playwright", "agent"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Topic :: Internet :: WWW/HTTP :: Browsers",
|
|
19
|
+
"Operating System :: Microsoft :: Windows",
|
|
20
|
+
"Operating System :: POSIX :: Linux",
|
|
21
|
+
]
|
|
22
|
+
# `mcp` stays below 2: 2.x renamed FastMCP to MCPServer and the import path here
|
|
23
|
+
# would raise ModuleNotFoundError on a fresh machine.
|
|
24
|
+
dependencies = [
|
|
25
|
+
"mcp>=1.30,<2",
|
|
26
|
+
"ruyijs>=0.4.5",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/zhuchongba-01/foxfetch"
|
|
31
|
+
Repository = "https://github.com/zhuchongba-01/foxfetch"
|
|
32
|
+
Issues = "https://github.com/zhuchongba-01/foxfetch/issues"
|
|
33
|
+
Changelog = "https://github.com/zhuchongba-01/foxfetch/commits/master"
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = ["pytest>=8", "mypy>=1.10"]
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
foxfetch = "foxfetch.cli:main"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.wheel]
|
|
42
|
+
packages = ["src/foxfetch"]
|
|
43
|
+
|
|
44
|
+
[tool.mypy]
|
|
45
|
+
python_version = "3.10"
|
|
46
|
+
strict = true
|
|
47
|
+
warn_unreachable = true
|
|
48
|
+
|
|
49
|
+
[tool.pytest.ini_options]
|
|
50
|
+
testpaths = ["tests"]
|
foxfetch-0.1.0/README.md
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
# foxfetch
|
|
2
|
-
|
|
3
|
-
**Read a page the way a browser does — only when plain HTTP is not enough.**
|
|
4
|
-
|
|
5
|
-
foxfetch drives a real Firefox engine (SpiderMonkey + Necko, no window, no renderer) to run
|
|
6
|
-
a site's own JavaScript: pass a bot check, read a DOM that only exists after the scripts run,
|
|
7
|
-
find the signature and the real API host. When a screenshot or a click is needed, it hands
|
|
8
|
-
the identity it earned to Chromium.
|
|
9
|
-
|
|
10
|
-
It speaks the Model Context Protocol, so one service serves every agent host — Pi, Claude
|
|
11
|
-
Code, Codex, DeepSeek Harness.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## The rule that saves the most time
|
|
16
|
-
|
|
17
|
-
| Situation | Use |
|
|
18
|
-
|---|---|
|
|
19
|
-
| Static HTML, JSON endpoints, RSS | **plain HTTP** — do not call foxfetch |
|
|
20
|
-
| Content appears after JS runs | `run` |
|
|
21
|
-
| 403 / Cloudflare / DataDome / Kasada | `probe`, then `run` |
|
|
22
|
-
| Someone needs to *see* the page | `handoff` → the generated Playwright script |
|
|
23
|
-
|
|
24
|
-
`probe` answers the first two questions with evidence, so the choice is not a guess:
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
probe("https://shop.example/item")
|
|
28
|
-
→ verdict: blocked
|
|
29
|
-
evidence: HTTP 403, DataDome (matched 'datadome'), 512 bytes, 0 visible text
|
|
30
|
-
suggestion: use run — the engine's TLS and JS profile match a real Firefox
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Most pages do not need the engine. Reaching for it anyway costs ~90 MB of RAM and ~3 s per
|
|
34
|
-
open, and buys nothing on a document `curl` could have fetched.
|
|
35
|
-
|
|
36
|
-
## Tools
|
|
37
|
-
|
|
38
|
-
| Tool | What it does |
|
|
39
|
-
|---|---|
|
|
40
|
-
| `probe` | Classify a URL: `plain_http` / `needs_engine` / `blocked`, with the evidence |
|
|
41
|
-
| `run` | Evaluate JavaScript in the engine; returns the value, console and request log |
|
|
42
|
-
| `net` | Read the request log and console of a live context |
|
|
43
|
-
| `handoff` | Export cookies (including HttpOnly), localStorage, UA; write a Playwright script |
|
|
44
|
-
| `close` | Close one context (by id or origin) or all of them |
|
|
45
|
-
| `cleanup` | Delete every artifact except the ones in `keep`, close contexts, sweep temp scratch dirs |
|
|
46
|
-
| `status` | Live contexts, artifact usage, environment check |
|
|
47
|
-
|
|
48
|
-
## Contexts
|
|
49
|
-
|
|
50
|
-
One engine world per origin, kept alive between calls so a multi-step flow is several small
|
|
51
|
-
calls instead of one giant script:
|
|
52
|
-
|
|
53
|
-
```python
|
|
54
|
-
run("window.step = 1", url="https://x.test") # opens the page
|
|
55
|
-
run("window.step + 1") # → 2, same document
|
|
56
|
-
run("fetch('/api/me').then(r => r.text())",
|
|
57
|
-
advance_ms=800, read="window.__last") # carries the cookies earned above
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
A context dies on `close`, after `FOXFETCH_IDLE_SECONDS` (default 60) of silence, or when the
|
|
61
|
-
pool exceeds `FOXFETCH_MAX_CONTEXTS` (default 2) — the least recently used goes first.
|
|
62
|
-
|
|
63
|
-
## Install
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
pip install foxfetch
|
|
67
|
-
python -m foxfetch doctor # python, ruyijs, mcp, chromium, artifacts
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Then wire it into a host — see [SETUP.md](SETUP.md) for the per-host steps. The short version:
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
# Pi, Claude Code, Codex and other MCP clients
|
|
74
|
-
php -r '' 2>/dev/null; # (no shell hook needed) — add an mcpServers entry:
|
|
75
|
-
# "command": "python", "args": ["-m", "foxfetch", "serve"]
|
|
76
|
-
|
|
77
|
-
# DeepSeek Harness: install the plugin in dsh/, which forwards to the same service
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Chromium is optional: without it `handoff` still exports the identity, it just cannot write
|
|
81
|
-
the screenshot script.
|
|
82
|
-
|
|
83
|
-
## Configuration
|
|
84
|
-
|
|
85
|
-
| Variable | Default | Meaning |
|
|
86
|
-
|---|---|---|
|
|
87
|
-
| `FOXFETCH_HOME` | `%LOCALAPPDATA%\foxfetch` | Artifact root (credentials pass through it) |
|
|
88
|
-
| `FOXFETCH_MAX_CONTEXTS` | 2 | Live engine contexts before LRU eviction |
|
|
89
|
-
| `FOXFETCH_IDLE_SECONDS` | 60 | Silence before a context is killed |
|
|
90
|
-
| `FOXFETCH_TIMEOUT_MS` | 30000 | Default navigation budget |
|
|
91
|
-
| `FOXFETCH_MAX_BYTES` | 65536 | Output cap before spilling to a file |
|
|
92
|
-
| `FOXFETCH_ARTIFACT_TTL` | 86400 | Seconds before an artifact is deleted automatically |
|
|
93
|
-
| `FOXFETCH_REMIND_AFTER` | 600 | Seconds before tool results start mentioning pending artifacts (0 disables) |
|
|
94
|
-
| `FOXFETCH_PY` | — | Interpreter the DSH plugin should use |
|
|
95
|
-
|
|
96
|
-
## Safety
|
|
97
|
-
|
|
98
|
-
`handoff` writes **live credentials** — cookies including the HttpOnly ones page script cannot
|
|
99
|
-
read. They land under `FOXFETCH_HOME`, owner-only, and expire after `FOXFETCH_ARTIFACT_TTL`.
|
|
100
|
-
Call `cleanup` when the task is delivered, and pass `keep=[...]` for the screenshot or token
|
|
101
|
-
the user still needs to look at.
|
|
102
|
-
|
|
103
|
-
You do not have to remember on your own: **every tool response carries the artifact state**, and
|
|
104
|
-
once a file is older than `FOXFETCH_REMIND_AFTER` (default 600 s) the response grows a `reminder`
|
|
105
|
-
saying how many files are still on disk and that they may hold credentials. The field vanishes
|
|
106
|
-
the moment `cleanup` runs, so a stale reminder is a visible bug, not a silent one.
|
|
107
|
-
|
|
108
|
-
## Development
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
pip install -e '.[dev]'
|
|
112
|
-
pytest -q
|
|
113
|
-
mypy src
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
The tests encode the bugs this rewrite exists to prevent: a clip that split UTF-8 sequences,
|
|
117
|
-
a URL compare that ignored the trailing slash, `sameSite: "Default"` rejected by Playwright,
|
|
118
|
-
and a runaway browser left behind when the screenshot threw.
|
|
119
|
-
|
|
120
|
-
## Licence
|
|
121
|
-
|
|
122
|
-
MIT. The engine (`ruyijs`) is a separate project under AGPL-3.0; foxfetch only calls it.
|
foxfetch-0.1.0/dsh/package.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-tool-foxfetch",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"description": "DSH entry for foxfetch: Firefox-engine page fetching, forwarded to the Python service over MCP.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "index.js",
|
|
8
|
-
"files": ["index.js", "cordis.patch.yml"],
|
|
9
|
-
"peerDependencies": {
|
|
10
|
-
"@deepseek-ai/cordis": "^4.0.1"
|
|
11
|
-
},
|
|
12
|
-
"dsh": {
|
|
13
|
-
"bundle": {
|
|
14
|
-
"patch": "./cordis.patch.yml"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"engines": {
|
|
18
|
-
"node": ">=18"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|