foxfetch 0.1.0__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.0/.gitignore +10 -0
- foxfetch-0.1.0/LICENSE +24 -0
- foxfetch-0.1.0/PKG-INFO +171 -0
- foxfetch-0.1.0/README.md +122 -0
- foxfetch-0.1.0/SETUP.md +179 -0
- foxfetch-0.1.0/dsh/cordis.patch.yml +5 -0
- foxfetch-0.1.0/dsh/index.js +352 -0
- foxfetch-0.1.0/dsh/package.json +20 -0
- foxfetch-0.1.0/pyproject.toml +50 -0
- foxfetch-0.1.0/src/foxfetch/__init__.py +5 -0
- foxfetch-0.1.0/src/foxfetch/__main__.py +3 -0
- foxfetch-0.1.0/src/foxfetch/cli.py +80 -0
- foxfetch-0.1.0/src/foxfetch/config.py +56 -0
- foxfetch-0.1.0/src/foxfetch/contexts.py +235 -0
- foxfetch-0.1.0/src/foxfetch/doctor.py +217 -0
- foxfetch-0.1.0/src/foxfetch/engine.py +502 -0
- foxfetch-0.1.0/src/foxfetch/probe.py +187 -0
- foxfetch-0.1.0/src/foxfetch/server.py +160 -0
- foxfetch-0.1.0/src/foxfetch/shapes.py +172 -0
- foxfetch-0.1.0/tests/conftest.py +6 -0
- foxfetch-0.1.0/tests/test_contexts.py +118 -0
- foxfetch-0.1.0/tests/test_engine.py +78 -0
- foxfetch-0.1.0/tests/test_probe.py +99 -0
- foxfetch-0.1.0/tests/test_shapes.py +78 -0
- foxfetch-0.1.0/tools/push_via_api.py +223 -0
foxfetch-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 foxfetch contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Note: `ruyijs`, the Firefox engine this package drives, is a separate project
|
|
24
|
+
under AGPL-3.0. foxfetch only imports and calls it; no ruyijs code is bundled.
|
foxfetch-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: foxfetch
|
|
3
|
+
Version: 0.1.0
|
|
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 a page the way a browser does — only when plain HTTP is not enough.**
|
|
53
|
+
|
|
54
|
+
foxfetch drives a real Firefox engine (SpiderMonkey + Necko, no window, no renderer) to run
|
|
55
|
+
a site's own JavaScript: pass a bot check, read a DOM that only exists after the scripts run,
|
|
56
|
+
find the signature and the real API host. When a screenshot or a click is needed, it hands
|
|
57
|
+
the identity it earned to Chromium.
|
|
58
|
+
|
|
59
|
+
It speaks the Model Context Protocol, so one service serves every agent host — Pi, Claude
|
|
60
|
+
Code, Codex, DeepSeek Harness.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## The rule that saves the most time
|
|
65
|
+
|
|
66
|
+
| Situation | Use |
|
|
67
|
+
|---|---|
|
|
68
|
+
| Static HTML, JSON endpoints, RSS | **plain HTTP** — do not call foxfetch |
|
|
69
|
+
| Content appears after JS runs | `run` |
|
|
70
|
+
| 403 / Cloudflare / DataDome / Kasada | `probe`, then `run` |
|
|
71
|
+
| Someone needs to *see* the page | `handoff` → the generated Playwright script |
|
|
72
|
+
|
|
73
|
+
`probe` answers the first two questions with evidence, so the choice is not a guess:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
probe("https://shop.example/item")
|
|
77
|
+
→ verdict: blocked
|
|
78
|
+
evidence: HTTP 403, DataDome (matched 'datadome'), 512 bytes, 0 visible text
|
|
79
|
+
suggestion: use run — the engine's TLS and JS profile match a real Firefox
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Most pages do not need the engine. Reaching for it anyway costs ~90 MB of RAM and ~3 s per
|
|
83
|
+
open, and buys nothing on a document `curl` could have fetched.
|
|
84
|
+
|
|
85
|
+
## Tools
|
|
86
|
+
|
|
87
|
+
| Tool | What it does |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `probe` | Classify a URL: `plain_http` / `needs_engine` / `blocked`, with the evidence |
|
|
90
|
+
| `run` | Evaluate JavaScript in the engine; returns the value, console and request log |
|
|
91
|
+
| `net` | Read the request log and console of a live context |
|
|
92
|
+
| `handoff` | Export cookies (including HttpOnly), localStorage, UA; write a Playwright script |
|
|
93
|
+
| `close` | Close one context (by id or origin) or all of them |
|
|
94
|
+
| `cleanup` | Delete every artifact except the ones in `keep`, close contexts, sweep temp scratch dirs |
|
|
95
|
+
| `status` | Live contexts, artifact usage, environment check |
|
|
96
|
+
|
|
97
|
+
## Contexts
|
|
98
|
+
|
|
99
|
+
One engine world per origin, kept alive between calls so a multi-step flow is several small
|
|
100
|
+
calls instead of one giant script:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
run("window.step = 1", url="https://x.test") # opens the page
|
|
104
|
+
run("window.step + 1") # → 2, same document
|
|
105
|
+
run("fetch('/api/me').then(r => r.text())",
|
|
106
|
+
advance_ms=800, read="window.__last") # carries the cookies earned above
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
A context dies on `close`, after `FOXFETCH_IDLE_SECONDS` (default 60) of silence, or when the
|
|
110
|
+
pool exceeds `FOXFETCH_MAX_CONTEXTS` (default 2) — the least recently used goes first.
|
|
111
|
+
|
|
112
|
+
## Install
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install foxfetch
|
|
116
|
+
python -m foxfetch doctor # python, ruyijs, mcp, chromium, artifacts
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Then wire it into a host — see [SETUP.md](SETUP.md) for the per-host steps. The short version:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Pi, Claude Code, Codex and other MCP clients
|
|
123
|
+
php -r '' 2>/dev/null; # (no shell hook needed) — add an mcpServers entry:
|
|
124
|
+
# "command": "python", "args": ["-m", "foxfetch", "serve"]
|
|
125
|
+
|
|
126
|
+
# DeepSeek Harness: install the plugin in dsh/, which forwards to the same service
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Chromium is optional: without it `handoff` still exports the identity, it just cannot write
|
|
130
|
+
the screenshot script.
|
|
131
|
+
|
|
132
|
+
## Configuration
|
|
133
|
+
|
|
134
|
+
| Variable | Default | Meaning |
|
|
135
|
+
|---|---|---|
|
|
136
|
+
| `FOXFETCH_HOME` | `%LOCALAPPDATA%\foxfetch` | Artifact root (credentials pass through it) |
|
|
137
|
+
| `FOXFETCH_MAX_CONTEXTS` | 2 | Live engine contexts before LRU eviction |
|
|
138
|
+
| `FOXFETCH_IDLE_SECONDS` | 60 | Silence before a context is killed |
|
|
139
|
+
| `FOXFETCH_TIMEOUT_MS` | 30000 | Default navigation budget |
|
|
140
|
+
| `FOXFETCH_MAX_BYTES` | 65536 | Output cap before spilling to a file |
|
|
141
|
+
| `FOXFETCH_ARTIFACT_TTL` | 86400 | Seconds before an artifact is deleted automatically |
|
|
142
|
+
| `FOXFETCH_REMIND_AFTER` | 600 | Seconds before tool results start mentioning pending artifacts (0 disables) |
|
|
143
|
+
| `FOXFETCH_PY` | — | Interpreter the DSH plugin should use |
|
|
144
|
+
|
|
145
|
+
## Safety
|
|
146
|
+
|
|
147
|
+
`handoff` writes **live credentials** — cookies including the HttpOnly ones page script cannot
|
|
148
|
+
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
|
+
the user still needs to look at.
|
|
151
|
+
|
|
152
|
+
You do not have to remember on your own: **every tool response carries the artifact state**, and
|
|
153
|
+
once a file is older than `FOXFETCH_REMIND_AFTER` (default 600 s) the response grows a `reminder`
|
|
154
|
+
saying how many files are still on disk and that they may hold credentials. The field vanishes
|
|
155
|
+
the moment `cleanup` runs, so a stale reminder is a visible bug, not a silent one.
|
|
156
|
+
|
|
157
|
+
## Development
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
pip install -e '.[dev]'
|
|
161
|
+
pytest -q
|
|
162
|
+
mypy src
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The tests encode the bugs this rewrite exists to prevent: a clip that split UTF-8 sequences,
|
|
166
|
+
a URL compare that ignored the trailing slash, `sameSite: "Default"` rejected by Playwright,
|
|
167
|
+
and a runaway browser left behind when the screenshot threw.
|
|
168
|
+
|
|
169
|
+
## Licence
|
|
170
|
+
|
|
171
|
+
MIT. The engine (`ruyijs`) is a separate project under AGPL-3.0; foxfetch only calls it.
|
foxfetch-0.1.0/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
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/SETUP.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# SETUP — instructions for the agent doing the install
|
|
2
|
+
|
|
3
|
+
This file is written for an **agent executing an installation on a new machine**. Work through
|
|
4
|
+
the steps in order; each one has an acceptance check. If a check fails, take its failure branch
|
|
5
|
+
instead of moving on.
|
|
6
|
+
|
|
7
|
+
After this document, the machine must be able to: run a site's own JavaScript in a real Firefox
|
|
8
|
+
engine, and hand that identity to Chromium for a screenshot.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 0. Detect the hosts — do not ask the user
|
|
13
|
+
|
|
14
|
+
The user does not know which entry to install, and guessing is worse than detecting. Run the
|
|
15
|
+
checks and record the answers:
|
|
16
|
+
|
|
17
|
+
```powershell
|
|
18
|
+
[ordered]@{
|
|
19
|
+
dsh = (Test-Path "$env:USERPROFILE\.dsh\profiles\desktop\package.json") -or
|
|
20
|
+
(Test-Path "$env:ProgramFiles\Deepseek Harness\DeepSeek Harness.exe") -or
|
|
21
|
+
(Test-Path "D:\Program Files\Deepseek Harness\DeepSeek Harness.exe")
|
|
22
|
+
pi = (Test-Path "$env:USERPROFILE\.pi\agent") -or (Get-Command pi -ErrorAction SilentlyContinue)
|
|
23
|
+
claude = (Test-Path "$env:USERPROFILE\.claude") -or (Get-Command claude -ErrorAction SilentlyContinue)
|
|
24
|
+
codex = (Test-Path "$env:USERPROFILE\.codex\config.toml") -or (Get-Command codex -ErrorAction SilentlyContinue)
|
|
25
|
+
other = $false # opencode, gemini, zcode, workbuddy …: check for their config dirs
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# same thing on Linux/macOS
|
|
31
|
+
test -f ~/.dsh/profiles/desktop/package.json && echo dsh
|
|
32
|
+
command -v pi >/dev/null && test -d ~/.pi/agent && echo pi
|
|
33
|
+
command -v claude >/dev/null && test -d ~/.claude && echo claude
|
|
34
|
+
test -f ~/.codex/config.toml && echo codex
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 1. Install the service (always, exactly once)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install foxfetch
|
|
41
|
+
python -m foxfetch doctor
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Acceptance:** `python -m foxfetch doctor` exits 0 and prints `"ok": true`.
|
|
45
|
+
`warnings` may mention Chromium — that is not fatal.
|
|
46
|
+
|
|
47
|
+
**Failure branches:**
|
|
48
|
+
|
|
49
|
+
| Doctor says | Do |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `ruyijs` missing or < 0.4.5 | `pip install -U 'ruyijs>=0.4.5'` |
|
|
52
|
+
| `mcp` >= 2.x | `pip install 'mcp>=1.30,<2'` — 2.x renamed `FastMCP` and this server will not import |
|
|
53
|
+
| Chromium not found | optional: `npx playwright install chromium`. Skip unless the user needs screenshots |
|
|
54
|
+
|
|
55
|
+
Never edit the package to work around a version: fix the environment.
|
|
56
|
+
|
|
57
|
+
## 2. Choose one entry **per host** — not one entry overall
|
|
58
|
+
|
|
59
|
+
A machine may run several hosts. Install each host's best entry; never install two entries
|
|
60
|
+
**into the same host**.
|
|
61
|
+
|
|
62
|
+
| Detected host | Install | Why |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| **dsh** | the plugin in `dsh/` | DSH has a native plugin API: typed tool cards, parameter rendering, no name collisions |
|
|
65
|
+
| **pi** | `mcpServers` entry in `~/.pi/agent/mcp.json` | Pi speaks MCP |
|
|
66
|
+
| **claude** | `claude mcp add foxfetch -- python -m foxfetch serve` | Claude Code speaks MCP |
|
|
67
|
+
| **codex** | `[mcp_servers.foxfetch]` in `~/.codex/config.toml` | Codex speaks MCP |
|
|
68
|
+
| **other** | print the config snippet `{"command":"python","args":["-m","foxfetch","serve"]}` for the user to paste | no universal registry |
|
|
69
|
+
|
|
70
|
+
### The one hard rule
|
|
71
|
+
|
|
72
|
+
> **One entry per host.** A host with both the plugin and an MCP entry exposes the same seven
|
|
73
|
+
> tools twice (`foxfetch_run` and `mcp__foxfetch__run`), and the model has to guess.
|
|
74
|
+
|
|
75
|
+
Before installing, check for an existing entry and remove it:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Pi
|
|
79
|
+
python - <<'PY'
|
|
80
|
+
import json, pathlib
|
|
81
|
+
p = pathlib.Path.home() / ".pi/agent/mcp.json"
|
|
82
|
+
print(json.loads(p.read_text()) if p.exists() else "no pi config")
|
|
83
|
+
PY
|
|
84
|
+
|
|
85
|
+
# Claude
|
|
86
|
+
claude mcp list
|
|
87
|
+
|
|
88
|
+
# DSH: a plugin listed in the profile's package.json dsh.profile.bundles
|
|
89
|
+
python - <<'PY'
|
|
90
|
+
import json, pathlib
|
|
91
|
+
p = pathlib.Path.home() / ".dsh/profiles/desktop/package.json"
|
|
92
|
+
print(json.loads(p.read_text()).get("dsh", {}) if p.exists() else "no dsh profile")
|
|
93
|
+
PY
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 3. Host: DSH (native plugin)
|
|
97
|
+
|
|
98
|
+
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.
|
|
100
|
+
|
|
101
|
+
```powershell
|
|
102
|
+
$profile = "$env:USERPROFILE\.dsh\profiles\desktop"
|
|
103
|
+
# 1. clone next to the other dev plugins
|
|
104
|
+
git clone <repo-url> "$env:USERPROFILE\.dsh\plugins\dsh-tool-foxfetch"
|
|
105
|
+
# 2. register it in the profile
|
|
106
|
+
$pkg = Get-Content "$profile\package.json" -Raw | ConvertFrom-Json
|
|
107
|
+
$pkg.dependencies | Add-Member -Force -NotePropertyName "dsh-tool-foxfetch" `
|
|
108
|
+
-NotePropertyValue "link:C:/Users/$env:USERNAME/.dsh/plugins/dsh-tool-foxfetch"
|
|
109
|
+
$pkg.dsh.profile.bundles += "dsh-tool-foxfetch"
|
|
110
|
+
$pkg | ConvertTo-Json -Depth 20 | Set-Content "$profile\package.json"
|
|
111
|
+
# 3. install and restart the harness
|
|
112
|
+
Push-Location $profile; pnpm install; Pop-Location
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Acceptance:** after restarting DSH, the tool list shows `foxfetch_probe`, `foxfetch_run`,
|
|
116
|
+
`foxfetch_net`, `foxfetch_handoff`, `foxfetch_cleanup`, `foxfetch_status` — and **no**
|
|
117
|
+
`mcp__foxfetch__*` entries.
|
|
118
|
+
|
|
119
|
+
## 4. Host: MCP clients
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"mcpServers": {
|
|
124
|
+
"foxfetch": {
|
|
125
|
+
"command": "python",
|
|
126
|
+
"args": ["-m", "foxfetch", "serve"],
|
|
127
|
+
"description": "Firefox-engine page fetching: pass bot checks, run the page's own JS, hand identity to Chromium."
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Use the **absolute** interpreter path when several Pythons exist:
|
|
134
|
+
|
|
135
|
+
```powershell
|
|
136
|
+
(Get-Command python).Source
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Acceptance:** the client lists `foxfetch` with 7 tools. In Pi that is `pi mcp list`.
|
|
140
|
+
|
|
141
|
+
## 5. Final check — from the host, not from a shell
|
|
142
|
+
|
|
143
|
+
Ask the host to call `foxfetch_status`. It must return `ok: true` and name the ruyijs version.
|
|
144
|
+
Then run the one end-to-end call that proves the wiring:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
foxfetch_run(js="navigator.userAgent", url="https://example.com")
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Acceptance:** the result contains `Firefox/160.0` (or whatever the installed ruyijs reports).
|
|
151
|
+
A user agent that says `Python-urllib` or `HeadlessChrome` means the call did not reach the
|
|
152
|
+
engine — fix that before reporting success.
|
|
153
|
+
|
|
154
|
+
Then close what you opened:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
foxfetch_cleanup(scope="all")
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The response no longer carries `artifacts_pending` once cleanup ran; if it still does, cleanup
|
|
161
|
+
did not fully succeed — read `removed_files` and retry before reporting success.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Failure handling
|
|
166
|
+
|
|
167
|
+
| Symptom | Cause | Fix |
|
|
168
|
+
|---|---|---|
|
|
169
|
+
| `cannot start the Python service` | `pip install` went to a different interpreter | set `FOXFETCH_PY` to the absolute path used by `pip` |
|
|
170
|
+
| `ModuleNotFoundError: mcp.server.fastmcp` | `mcp` 2.x installed | `pip install 'mcp>=1.30,<2'` |
|
|
171
|
+
| `no live context for that origin` | the context idled out or was evicted | pass `url` again |
|
|
172
|
+
| `navigation produced an empty document` | the page needs longer, or a real browser | raise `timeout_ms`, or use `handoff` + Chromium |
|
|
173
|
+
| tools appear twice | two entries in one host | remove one (step 2) |
|
|
174
|
+
|
|
175
|
+
## Cleanup after the install
|
|
176
|
+
|
|
177
|
+
Delete anything the install created outside the package and the host config: cloned repos in a
|
|
178
|
+
temp path, `pip` build directories, downloaded browsers you decided against. The service keeps
|
|
179
|
+
nothing in the plugin directory.
|