foxfetch 0.1.7__tar.gz → 0.2.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.
@@ -1,7 +1,7 @@
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
3
+ > The same content lives in [README.md](README.md) (简体中文, the default) and
4
+ > [README.en.md](README.en.md) (English), which is what most people want. This file is the longer reference: it keeps the
5
5
  > doctor output, the interpreter-path note and the troubleshooting table in one place.
6
6
 
7
7
  Two pieces, always two:
@@ -134,24 +134,16 @@ DSH has a native plugin API, and the plugin is published on npm. It holds **no l
134
134
  starts the service once and reshapes results for the DSH UI.
135
135
 
136
136
  ```powershell
137
- $profile = "$env:USERPROFILE\.dsh\profiles\desktop"
138
-
139
- # 1. install the plugin into the profile
140
- Push-Location $profile
141
- pnpm add dsh-foxfetch
142
- Pop-Location
143
-
144
- # 2. register the bundle (keep the entries already there)
145
- $pkg = Get-Content "$profile\package.json" -Raw | ConvertFrom-Json
146
- if ($pkg.dsh.profile.bundles -notcontains "dsh-foxfetch") {
147
- $pkg.dsh.profile.bundles += "dsh-foxfetch"
148
- }
149
- $pkg | ConvertTo-Json -Depth 20 | Set-Content "$profile\package.json"
150
-
151
- # 3. restart DSH
137
+ pip install foxfetch # the service (step 1, if not done yet)
138
+ foxfetch dsh-install # the plugin, and the two JSON lines it needs
152
139
  ```
153
140
 
154
- `~/.dsh/profiles/desktop/package.json` should end up looking like this:
141
+ `foxfetch dsh-install` locates the profile (honours `DSH_HOME`), runs
142
+ `pnpm add dsh-foxfetch` (falling back to the pnpm bundled with DSH, then to `npm install`), and
143
+ writes the dependency plus the bundle entry into `package.json`. `--dry-run` shows the change
144
+ without writing anything, `--skip-pnpm` only patches the JSON.
145
+
146
+ The resulting `~/.dsh/profiles/desktop/package.json`:
155
147
 
156
148
  ```json
157
149
  {
@@ -172,18 +164,21 @@ $pkg | ConvertTo-Json -Depth 20 | Set-Content "$profile\package.json"
172
164
  }
173
165
  ```
174
166
 
175
- **`pnpm` is not on PATH?** DSH ships its own:
167
+ **No profile directory yet?** Start DSH once, quit it, then run the command — the profile is
168
+ created on first launch and a hand-made one would be overwritten.
169
+
170
+ Doing it by hand instead (any package manager):
176
171
 
177
172
  ```powershell
178
- $dsh = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
179
- $node = Join-Path $dsh "node\bin\node.exe"
180
- $pnpm = Join-Path $dsh "pnpm\bin\pnpm.cjs"
181
- & $node $pnpm add dsh-foxfetch
173
+ $profile = "$env:USERPROFILE\.dsh\profiles\desktop"
174
+ Push-Location $profile
175
+ pnpm add dsh-foxfetch
176
+ Pop-Location
177
+ # then add "dsh-foxfetch" to dsh.profile.bundles by hand and restart DSH
182
178
  ```
183
179
 
184
180
  **Editing the plugin itself?** Link a checkout instead of the published package — replace the
185
- dependency with `"dsh-foxfetch": "link:C:/Users/<you>/.dsh/plugins/dsh-foxfetch"` after
186
- `git clone https://github.com/zhuchongba-01/foxfetch` anywhere you like.
181
+ dependency with `"dsh-foxfetch": "link:C:/Users/<you>/foxfetch/dsh"` after cloning the repo.
187
182
 
188
183
  ### Anything else (opencode, gemini, zcode, custom)
189
184
 
@@ -0,0 +1,365 @@
1
+ Metadata-Version: 2.5
2
+ Name: foxfetch
3
+ Version: 0.2.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
+ **普通 HTTP 抓不到的页面,用真 Firefox 引擎跑一遍再读。**
53
+
54
+ [简体中文](README.md) · [English](README.en.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
+ 在真 Firefox 引擎里跑页面,用来过风控;需要截图时把身份交给 Chromium。
62
+
63
+ ## 安装
64
+
65
+ ```bash
66
+ pip install foxfetch
67
+ ```
68
+
69
+ **DSH(DeepSeek Harness)安装指令** —— 一条就够:
70
+
71
+ ```powershell
72
+ foxfetch dsh-install
73
+ ```
74
+
75
+ 它会把插件装进 DSH profile、并自动改好 `package.json`(依赖 + `dsh.profile.bundles`)。
76
+ 完事重启 DSH 即可。加 `--dry-run` 只看不改。
77
+
78
+ **其余软件安装指令** —— 只写配置,不用装包:
79
+
80
+ ```bash
81
+ pi mcp add foxfetch -- python -m foxfetch serve # Pi
82
+ claude mcp add foxfetch -- python -m foxfetch serve # Claude Code
83
+ ```
84
+
85
+ Codex 和其它 MCP 客户端见[下文](#详细安装)。
86
+
87
+ ## 验证
88
+
89
+ ```bash
90
+ python -m foxfetch doctor # 应输出 "ok": true
91
+ ```
92
+
93
+ 然后让你的 agent 调用:
94
+
95
+ ```
96
+ foxfetch_run(js="navigator.userAgent", url="https://example.com")
97
+ ```
98
+
99
+ 答案里必须出现 `Firefox/160.0`。如果出现 `Python-urllib` 或 `HeadlessChrome`,说明 agent 没连上
100
+ 引擎 —— 这个问题不解决,后面全是假的。
101
+
102
+ > **一个宿主只装一个入口。** 同一个 agent 里不要既加 MCP 条目又装 DSH 插件,否则会出现两套
103
+ > 同样的 7 个工具(`foxfetch_run` 和 `mcp__foxfetch__run`)。
104
+
105
+ ## 为什么需要它
106
+
107
+ `curl` 拿回来 403,无头 Chrome 被指纹识别拦掉。foxfetch 在**真 Firefox 引擎**(SpiderMonkey +
108
+ Necko,无窗口、不渲染)里执行站点自己的 JavaScript,所以 TLS 握手和 JS 环境都是真浏览器的,
109
+ 而且这个环境在调用之间保持存活。需要截图或点击时,`handoff` 把挣到的身份导出来,交给 Chromium
110
+ 完成剩下的活。
111
+
112
+ ## 详细安装
113
+
114
+ ### 前置要求
115
+
116
+ 这里涉及**两个平台**,注意区分:
117
+
118
+ - **服务** —— 一个 Python 包,`pip install foxfetch`,所有宿主共用。
119
+ - **宿主入口** —— 各家机制不同:Pi / Claude Code / Codex 是 MCP 配置条目,DSH 是 npm 插件。
120
+
121
+ - **Python 3.10+** —— 就这一条。Chromium 是可选的(只有截图才需要)。
122
+ - 引擎 `ruyijs`(44 MB 的 wheel)会作为依赖自动装上。
123
+
124
+ `doctor` 报错时,直接跑它给出的命令。实际会遇到的三种:
125
+
126
+ | `doctor` 说 | 修复 |
127
+ |---|---|
128
+ | `ruyijs` 缺失或 `< 0.4.5` | `pip install -U "ruyijs>=0.4.5"` |
129
+ | `mcp` 是 2.x | `pip install "mcp>=1.30,<2"` —— 2.x 把 `FastMCP` 改名了,本服务 import 不到 |
130
+ | `chromium: found: false` | 可选:`npx playwright install chromium` |
131
+
132
+ **用哪个 Python?** agent 必须启动**和 `pip install` 同一个**解释器:
133
+
134
+ ```powershell
135
+ (Get-Command python).Source # Windows
136
+ which python3 # macOS / Linux
137
+ ```
138
+
139
+ ```bash
140
+ # 如果不是纯 `python`,配置里写绝对路径:
141
+ # "command": "C:/Users/you/AppData/Local/Programs/Python/Python314/python.exe"
142
+ ```
143
+
144
+ ### Pi
145
+
146
+ 命令行一条搞定:
147
+
148
+ ```bash
149
+ pi mcp add foxfetch -- python -m foxfetch serve
150
+ ```
151
+
152
+ 或者自己写 `~/.pi/agent/mcp.json`:
153
+
154
+ ```json
155
+ {
156
+ "mcpServers": {
157
+ "foxfetch": {
158
+ "command": "python",
159
+ "args": ["-m", "foxfetch", "serve"],
160
+ "timeout": 180
161
+ }
162
+ }
163
+ }
164
+ ```
165
+
166
+ 验证:`pi mcp list` → 应该显示 `foxfetch: connected, 7 tools`。
167
+ 已经在跑的 Pi 会话里,输入 `/reload` 即可加载。
168
+
169
+ ### Claude Code
170
+
171
+ ```bash
172
+ claude mcp add foxfetch -- python -m foxfetch serve
173
+ claude mcp list
174
+ ```
175
+
176
+ ### Codex
177
+
178
+ 把这段追加到 `~/.codex/config.toml`,然后重启 Codex:
179
+
180
+ ```toml
181
+ [mcp_servers.foxfetch]
182
+ command = "python"
183
+ args = ["-m", "foxfetch", "serve"]
184
+ ```
185
+
186
+ ### DeepSeek Harness(DSH)
187
+
188
+ ```powershell
189
+ pip install foxfetch
190
+ foxfetch dsh-install
191
+ ```
192
+
193
+ `dsh-install` 做的事:
194
+
195
+ 1. 找到 profile 目录(`%USERPROFILE%\.dsh\profiles\desktop`,可用 `DSH_HOME` 覆盖)
196
+ 2. 跑 `pnpm add dsh-foxfetch`(pnpm 不在就用 DSH 自带的;都没有则退回 `npm install`)
197
+ 3. 把 `"dsh-foxfetch"` 写进 `package.json` 的 `dependencies` 和 `dsh.profile.bundles`
198
+ 4. 打印重启提示;**不会**自动启动 DSH
199
+
200
+ 改完的 `package.json` 应该长这样:
201
+
202
+ ```json
203
+ {
204
+ "name": "dsh-profile-desktop",
205
+ "private": true,
206
+ "dependencies": {
207
+ "dsh-foxfetch": "^0.1.1"
208
+ },
209
+ "dsh": {
210
+ "profile": {
211
+ "bundles": [
212
+ "@deepseek-ai/dsh-base",
213
+ "@deepseek-ai/dsh-web-app",
214
+ "dsh-foxfetch"
215
+ ]
216
+ }
217
+ }
218
+ }
219
+ ```
220
+
221
+ **profile 目录不存在?** 先启动一次 DSH(等主窗口出现)再退出,然后重跑这条命令 ——
222
+ DSH 首次启动时才生成 profile,手建会被它覆盖。
223
+
224
+ **想改插件源码?** 把这个依赖换成 `"dsh-foxfetch": "link:C:/你的路径/foxfetch/dsh"`,
225
+ 再在那个目录跑一次 `pnpm install`。
226
+
227
+ 重启 DSH 后工具列表里应有 `foxfetch_probe`、`foxfetch_run`、`foxfetch_net`、
228
+ `foxfetch_handoff`、`foxfetch_close`、`foxfetch_cleanup`、`foxfetch_status`,并且**没有**
229
+ `mcp__foxfetch__*` 这类重复条目。
230
+
231
+ ### 其它 MCP 客户端
232
+
233
+ 大多数客户端吃同一段 stdio 配置:
234
+
235
+ ```json
236
+ {
237
+ "mcpServers": {
238
+ "foxfetch": {
239
+ "command": "python",
240
+ "args": ["-m", "foxfetch", "serve"]
241
+ }
242
+ }
243
+ }
244
+ ```
245
+
246
+ ---
247
+
248
+ ## 你会得到什么
249
+
250
+ 七个工具:
251
+
252
+ | 工具 | 作用 |
253
+ |---|---|
254
+ | `probe` | 判断一个 URL 该走哪一层:`plain_http` / `needs_engine` / `blocked`,**附判据** |
255
+ | `run` | 在引擎里执行 JS,返回结果 + console + 请求日志 |
256
+ | `net` | 读当前上下文的请求日志和 console,不发新请求 |
257
+ | `handoff` | 导出 cookie(含 HttpOnly)、localStorage、UA,并生成 Playwright 脚本 |
258
+ | `close` | 关掉某个上下文(按 id 或 origin),或全关 |
259
+ | `cleanup` | 删产物、关上下文、扫临时目录 |
260
+ | `status` | 活着的上下文、产物占用、环境自检 |
261
+
262
+ ### 用最便宜的那一层
263
+
264
+ | 情况 | 用什么 |
265
+ |---|---|
266
+ | 静态 HTML、JSON 接口、RSS | 普通 HTTP —— **别调 foxfetch** |
267
+ | 内容要等 JS 跑完才出现 | `run` |
268
+ | 403 / Cloudflare / DataDome / Kasada | 先 `probe`,再 `run` |
269
+ | 有人需要**看到**页面 | `handoff` → 生成的 Playwright 脚本 |
270
+
271
+ ```
272
+ probe("https://shop.example/item")
273
+ → verdict: blocked
274
+ evidence: HTTP 403, DataDome(命中 'datadome'), 512 字节, 可见文本 0
275
+ suggestion: 用 run —— 引擎的 TLS 与 JS 指纹跟真 Firefox 一致
276
+ ```
277
+
278
+ 引擎每次开页面要 ~90 MB 内存、~3 秒。如果 `curl` 就能拿到的页面,用它纯属浪费 —— 这就是
279
+ `probe` 存在的原因。
280
+
281
+ ### 上下文保持
282
+
283
+ 一个 origin 一个引擎世界,调用之间保持存活,所以多步流程是若干小调用,而不是一个巨型脚本:
284
+
285
+ ```python
286
+ run("window.step = 1", url="https://x.test") # 打开页面
287
+ run("window.step + 1") # → 2,同一个文档
288
+ run("fetch('/api/me').then(r => r.text())",
289
+ advance_ms=800, read="window.__last") # 带上前面挣到的 cookie
290
+ ```
291
+
292
+ 上下文会在这些情况下消失:`close`、静默超过 `FOXFETCH_IDLE_SECONDS`(默认 60 秒)、
293
+ 池子超过 `FOXFETCH_MAX_CONTEXTS`(默认 2 个,淘汰最久未用的)。
294
+
295
+ ---
296
+
297
+ ## 配置项
298
+
299
+ | 环境变量 | 默认值 | 含义 |
300
+ |---|---|---|
301
+ | `FOXFETCH_HOME` | `%LOCALAPPDATA%\foxfetch` | 产物目录(凭据会经过它) |
302
+ | `FOXFETCH_MAX_CONTEXTS` | 2 | 存活上下文上限,超了淘汰最久未用 |
303
+ | `FOXFETCH_IDLE_SECONDS` | 60 | 静默多久杀掉上下文 |
304
+ | `FOXFETCH_TIMEOUT_MS` | 30000 | 默认导航预算 |
305
+ | `FOXFETCH_MAX_BYTES` | 65536 | 输出上限,超了落盘 |
306
+ | `FOXFETCH_ARTIFACT_TTL` | 86400 | 产物自动过期的秒数 |
307
+ | `FOXFETCH_ARTIFACT_MAX` | 67108864 | 产物目录字节预算 |
308
+ | `FOXFETCH_REMIND_AFTER` | 600 | 超过多少秒开始提醒清理(0 = 关闭) |
309
+ | `FOXFETCH_PY` | — | DSH 插件启动用的解释器 |
310
+
311
+ ## 安全
312
+
313
+ `handoff` 写出的是**活的凭据** —— 包括页面 JS 读不到的 HttpOnly cookie。它们落在
314
+ `FOXFETCH_HOME` 下,权限仅本人可读,超过 `FOXFETCH_ARTIFACT_TTL` 自动删除。
315
+
316
+ 每次工具返回都会报告磁盘上还留着什么;某个文件超过 `FOXFETCH_REMIND_AFTER` 后,返回里会多出
317
+ 一个 `reminder`,叫 agent 调 `cleanup`,并用 `keep=[...]` 保住用户还要看的东西。跑完 cleanup
318
+ 这个字段立刻消失 —— 所以**残留的提醒就是明确的 bug**,不会静默发生。
319
+
320
+ ## 它不做什么
321
+
322
+ - 不截图、不点击、不排版 —— 那些交给 Chromium,前提是拿到 `handoff` 导出的身份。
323
+ - 不保存会话:每个上下文都是全新的,`close` 之后什么都不剩。
324
+ - 不做指纹随机化:随便猜一个和谁都不像的配置,比直接冒充真 Firefox 更容易被识别。
325
+
326
+ ## 开发
327
+
328
+ ```bash
329
+ pip install -e '.[dev]'
330
+ pytest -q # 45 个测试,不联网
331
+ mypy src # strict
332
+ ```
333
+
334
+ ```bash
335
+ # github.com:443 被重置但 api.github.com 通的时候,用 API 推送
336
+ python tools/push_via_api.py --repo <owner>/<name> --dry-run
337
+ ```
338
+
339
+ 测试里固化的就是这次重写要防的坑:按字节截断中文出 `�`、URL 尾斜杠比较不匹配、
340
+ `sameSite: "Default"` 被 Playwright 拒绝、`cleanup` 只删过期文件、截图抛异常时留下孤儿浏览器。
341
+
342
+ ## 排错
343
+
344
+ | 症状 | 原因 | 修法 |
345
+ |---|---|---|
346
+ | `cannot start the Python service`(DSH) | 插件找到了另一个解释器 | 把 `FOXFETCH_PY` 设成绝对路径 |
347
+ | `ModuleNotFoundError: mcp.server.fastmcp` | 装了 `mcp` 2.x | `pip install "mcp>=1.30,<2"` |
348
+ | `no live context for that origin` | 上下文空闲超时(60 秒)或被淘汰 | 再传一次 `url`,或保留 `context_id` |
349
+ | `navigation produced an empty document` | 页面慢,或需要真渲染器 | 调大 `timeout_ms`,或走 `handoff` + Chromium |
350
+ | 工具出现两遍 | 同一个宿主装了两个入口 | 删掉一个 |
351
+ | `pip install` 下到一半断 | 到 `files.pythonhosted.org` 的网络不稳 | 重试,或 `pip install --proxy http://127.0.0.1:7897 foxfetch` |
352
+
353
+ ## 卸载
354
+
355
+ ```bash
356
+ pip uninstall foxfetch
357
+ ```
358
+
359
+ 产物目录:Windows 是 `%LOCALAPPDATA%\foxfetch`,其他平台是 `~/.local/share/foxfetch`。
360
+ 然后删掉宿主里的入口 —— `mcpServers` 那段、`[mcp_servers.foxfetch]` 那个表,或者
361
+ `dsh-foxfetch` 依赖加 bundles 里那一行。
362
+
363
+ ## 许可
364
+
365
+ MIT。引擎 `ruyijs` 是另一个项目,AGPL-3.0;foxfetch 只是调用它,不包含任何 ruyijs 代码。
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Read pages that block plain HTTP — by running them in a real Firefox engine.**
4
4
 
5
- [English](README.md) · [简体中文](README.zh.md)
5
+ [简体中文](README.md) · [English](README.en.md)
6
6
 
7
7
  [![PyPI](https://img.shields.io/pypi/v/foxfetch?logo=pypi&label=PyPI)](https://pypi.org/project/foxfetch/)
8
8
  [![Python](https://img.shields.io/pypi/pyversions/foxfetch?logo=python&logoColor=white)](https://pypi.org/project/foxfetch/)
@@ -18,24 +18,24 @@ when a screenshot is needed.
18
18
  pip install foxfetch
19
19
  ```
20
20
 
21
- **DSH (DeepSeek Harness) install command:**
21
+ **DSH (DeepSeek Harness) install command** — one line:
22
22
 
23
23
  ```powershell
24
- cd "$env:USERPROFILE\.dsh\profiles\desktop"
25
- pnpm add dsh-foxfetch
24
+ foxfetch dsh-install
26
25
  ```
27
26
 
28
- Then add `"dsh-foxfetch"` to `dsh.profile.bundles` in that folder's `package.json` and restart
29
- DSH.
27
+ It installs the plugin into the DSH profile and edits `package.json` for you (dependency plus
28
+ `dsh.profile.bundles`). Restart DSH afterwards. Add `--dry-run` to see the change without
29
+ writing it.
30
30
 
31
- **Everything else install command:**
31
+ **Everything else install command** — config only, no package:
32
32
 
33
33
  ```bash
34
34
  pi mcp add foxfetch -- python -m foxfetch serve # Pi
35
35
  claude mcp add foxfetch -- python -m foxfetch serve # Claude Code
36
36
  ```
37
37
 
38
- Codex and other MCP clients need config only, no package — see [below](#detailed-install).
38
+ Codex and other MCP clients: see [below](#detailed-install).
39
39
 
40
40
  ## Verify
41
41
 
@@ -133,34 +133,21 @@ command = "python"
133
133
  args = ["-m", "foxfetch", "serve"]
134
134
  ```
135
135
 
136
- ### DeepSeek Harness
137
-
138
- DSH has a native plugin API, so it gets a real plugin instead of an MCP entry. The plugin holds
139
- no logic — it starts the same Python service and reshapes results for the DSH UI.
140
-
141
- > **DSH needs two installs, not one:** the service (`pip`, step 1) **and** the plugin (npm).
142
- > The plugin is only a forwarder; without the service it fails immediately with
143
- > `cannot start the Python service`.
136
+ ### DeepSeek Harness (DSH)
144
137
 
145
138
  ```powershell
146
- # 1. service (same as everyone else — do not skip this)
147
139
  pip install foxfetch
140
+ foxfetch dsh-install
141
+ ```
148
142
 
149
- # 2. plugin, into the DSH profile
150
- cd "$env:USERPROFILE\.dsh\profiles\desktop"
151
- pnpm add dsh-foxfetch
152
-
153
- # 3. register it (keep the entries already in the file)
154
- $pkg = Get-Content package.json -Raw | ConvertFrom-Json
155
- if ($pkg.dsh.profile.bundles -notcontains "dsh-foxfetch") {
156
- $pkg.dsh.profile.bundles += "dsh-foxfetch"
157
- }
158
- $pkg | ConvertTo-Json -Depth 20 | Set-Content package.json
143
+ `dsh-install` does this:
159
144
 
160
- # 4. restart DSH
161
- ```
145
+ 1. locates the profile (`%USERPROFILE%\.dsh\profiles\desktop`, overridable with `DSH_HOME`)
146
+ 2. runs `pnpm add dsh-foxfetch` (falls back to the pnpm DSH ships, then to `npm install`)
147
+ 3. writes `"dsh-foxfetch"` into `dependencies` **and** `dsh.profile.bundles` of `package.json`
148
+ 4. prints the restart note; it never starts DSH for you
162
149
 
163
- The result should look like this:
150
+ The resulting `package.json`:
164
151
 
165
152
  ```json
166
153
  {
@@ -181,18 +168,15 @@ The result should look like this:
181
168
  }
182
169
  ```
183
170
 
184
- `pnpm` not on PATH? DSH ships its own:
171
+ **No profile directory?** Start DSH once (wait for the main window), quit it, run the command
172
+ again — DSH creates the profile on first launch and would overwrite a hand-made one.
185
173
 
186
- ```powershell
187
- $dsh = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
188
- $node = Join-Path $dsh "node\bin\node.exe"
189
- $pnpm = Join-Path $dsh "pnpm\bin\pnpm.cjs"
190
- & $node $pnpm add dsh-foxfetch
191
- ```
174
+ **Editing the plugin?** Replace that dependency with
175
+ `"dsh-foxfetch": "link:C:/your/path/foxfetch/dsh"` and run `pnpm install` there.
192
176
 
193
177
  After restarting DSH the tool list shows `foxfetch_probe`, `foxfetch_run`, `foxfetch_net`,
194
178
  `foxfetch_handoff`, `foxfetch_close`, `foxfetch_cleanup`, `foxfetch_status` — and no
195
- `mcp__foxfetch__*` entries.
179
+ `mcp__foxfetch__*` duplicates.
196
180
 
197
181
  ### Any other MCP client
198
182
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **普通 HTTP 抓不到的页面,用真 Firefox 引擎跑一遍再读。**
4
4
 
5
- [English](README.md) · [简体中文](README.zh.md)
5
+ [简体中文](README.md) · [English](README.en.md)
6
6
 
7
7
  [![PyPI](https://img.shields.io/pypi/v/foxfetch?logo=pypi&label=PyPI)](https://pypi.org/project/foxfetch/)
8
8
  [![Python](https://img.shields.io/pypi/pyversions/foxfetch?logo=python&logoColor=white)](https://pypi.org/project/foxfetch/)
@@ -17,23 +17,23 @@
17
17
  pip install foxfetch
18
18
  ```
19
19
 
20
- **DSH(DeepSeek Harness)安装指令:**
20
+ **DSH(DeepSeek Harness)安装指令** —— 一条就够:
21
21
 
22
22
  ```powershell
23
- cd "$env:USERPROFILE\.dsh\profiles\desktop"
24
- pnpm add dsh-foxfetch
23
+ foxfetch dsh-install
25
24
  ```
26
25
 
27
- 再把 `"dsh-foxfetch"` 加进该目录 `package.json` 的 `dsh.profile.bundles`,重启 DSH。
26
+ 它会把插件装进 DSH profile、并自动改好 `package.json`(依赖 + `dsh.profile.bundles`)。
27
+ 完事重启 DSH 即可。加 `--dry-run` 只看不改。
28
28
 
29
- **其余软件安装指令:**
29
+ **其余软件安装指令** —— 只写配置,不用装包:
30
30
 
31
31
  ```bash
32
32
  pi mcp add foxfetch -- python -m foxfetch serve # Pi
33
33
  claude mcp add foxfetch -- python -m foxfetch serve # Claude Code
34
34
  ```
35
35
 
36
- Codex 和其它 MCP 客户端只写配置、不装包,见[下文](#详细安装)。
36
+ Codex 和其它 MCP 客户端见[下文](#详细安装)。
37
37
 
38
38
  ## 验证
39
39
 
@@ -134,33 +134,21 @@ command = "python"
134
134
  args = ["-m", "foxfetch", "serve"]
135
135
  ```
136
136
 
137
- ### DeepSeek Harness
138
-
139
- DSH 有原生插件机制,所以给它装插件而不是 MCP 条目。插件里**没有任何逻辑** —— 它启动同一个
140
- Python 服务,只负责把结果整理成 DSH 的卡片样式。
141
-
142
- > **DSH 要装两样,不是一样**:服务(`pip`,第 1 步)**加上**插件(npm)。
143
- > 插件只是转发壳,没有服务会立刻报 `cannot start the Python service`。
137
+ ### DeepSeek Harness(DSH)
144
138
 
145
139
  ```powershell
146
- # 1. 服务(和别的宿主一样 —— 这步不能跳)
147
140
  pip install foxfetch
141
+ foxfetch dsh-install
142
+ ```
148
143
 
149
- # 2. 插件,装进 DSH 的 profile
150
- cd "$env:USERPROFILE\.dsh\profiles\desktop"
151
- pnpm add dsh-foxfetch
152
-
153
- # 3. 登记(保留文件里已有的条目)
154
- $pkg = Get-Content package.json -Raw | ConvertFrom-Json
155
- if ($pkg.dsh.profile.bundles -notcontains "dsh-foxfetch") {
156
- $pkg.dsh.profile.bundles += "dsh-foxfetch"
157
- }
158
- $pkg | ConvertTo-Json -Depth 20 | Set-Content package.json
144
+ `dsh-install` 做的事:
159
145
 
160
- # 4. 重启 DSH
161
- ```
146
+ 1. 找到 profile 目录(`%USERPROFILE%\.dsh\profiles\desktop`,可用 `DSH_HOME` 覆盖)
147
+ 2. 跑 `pnpm add dsh-foxfetch`(pnpm 不在就用 DSH 自带的;都没有则退回 `npm install`)
148
+ 3. 把 `"dsh-foxfetch"` 写进 `package.json` 的 `dependencies` 和 `dsh.profile.bundles`
149
+ 4. 打印重启提示;**不会**自动启动 DSH
162
150
 
163
- 改完 `package.json` 应该长这样:
151
+ 改完的 `package.json` 应该长这样:
164
152
 
165
153
  ```json
166
154
  {
@@ -181,18 +169,15 @@ $pkg | ConvertTo-Json -Depth 20 | Set-Content package.json
181
169
  }
182
170
  ```
183
171
 
184
- **`pnpm` 不在 PATH 里?** DSH 自带一份:
172
+ **profile 目录不存在?** 先启动一次 DSH(等主窗口出现)再退出,然后重跑这条命令 ——
173
+ DSH 首次启动时才生成 profile,手建会被它覆盖。
185
174
 
186
- ```powershell
187
- $dsh = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
188
- $node = Join-Path $dsh "node\bin\node.exe"
189
- $pnpm = Join-Path $dsh "pnpm\bin\pnpm.cjs"
190
- & $node $pnpm add dsh-foxfetch
191
- ```
175
+ **想改插件源码?** 把这个依赖换成 `"dsh-foxfetch": "link:C:/你的路径/foxfetch/dsh"`,
176
+ 再在那个目录跑一次 `pnpm install`。
192
177
 
193
- 重启 DSH 后工具列表里应该有 `foxfetch_probe`、`foxfetch_run`、`foxfetch_net`、
194
- `foxfetch_handoff`、`foxfetch_close`、`foxfetch_cleanup`、`foxfetch_status` —— 并且**没有**
195
- `mcp__foxfetch__*` 这种重复条目。
178
+ 重启 DSH 后工具列表里应有 `foxfetch_probe`、`foxfetch_run`、`foxfetch_net`、
179
+ `foxfetch_handoff`、`foxfetch_close`、`foxfetch_cleanup`、`foxfetch_status`,并且**没有**
180
+ `mcp__foxfetch__*` 这类重复条目。
196
181
 
197
182
  ### 其它 MCP 客户端
198
183
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "foxfetch"
7
- version = "0.1.7"
7
+ version = "0.2.0"
8
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
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -42,7 +42,7 @@ foxfetch = "foxfetch.cli:main"
42
42
  include = [
43
43
  "src/foxfetch",
44
44
  "README.md",
45
- "README.zh.md",
45
+ "README.en.md",
46
46
  "INSTALL.md",
47
47
  ]
48
48
 
@@ -1,5 +1,5 @@
1
1
  """foxfetch: read pages through a real Firefox engine when plain HTTP is not enough."""
2
2
 
3
- __version__ = "0.1.7"
3
+ __version__ = "0.2.0"
4
4
 
5
5
  __all__ = ["__version__"]
@@ -27,6 +27,9 @@ def main(argv: list[str] | None = None) -> int:
27
27
  sub = parser.add_subparsers(dest="command")
28
28
 
29
29
  sub.add_parser("serve", help="start the MCP stdio server (default)")
30
+ dsh_parser = sub.add_parser("dsh-install", help="install the DSH plugin into the DSH profile")
31
+ dsh_parser.add_argument("--dry-run", action="store_true", help="show the change without writing")
32
+ dsh_parser.add_argument("--skip-pnpm", action="store_true", help="only patch package.json")
30
33
  sub.add_parser("doctor", help="check python, ruyijs, mcp, chromium and artifact usage")
31
34
  sub.add_parser("status", help="list live contexts and artifact usage")
32
35
 
@@ -53,6 +56,10 @@ def main(argv: list[str] | None = None) -> int:
53
56
 
54
57
  serve()
55
58
  return 0
59
+ if command == "dsh-install":
60
+ from .dsh_install import install
61
+
62
+ return install(dry_run=args.dry_run, skip_pnpm=args.skip_pnpm)
56
63
  if command == "doctor":
57
64
  report = run_doctor()
58
65
  _print(report)
@@ -0,0 +1,185 @@
1
+ """`foxfetch dsh-install`: put the DSH plugin in place without hand-editing JSON.
2
+
3
+ DSH loads plugins through its profile: a dependency in `package.json` plus a name in
4
+ `dsh.profile.bundles`. Both are two lines of JSON that are easy to get wrong (wrong array,
5
+ duplicate entry, `link:` path with backslashes), so this module does it and verifies the result.
6
+
7
+ It never starts DSH: the harness has to be restarted by the caller, because a running instance
8
+ holds the old profile in memory.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import json
14
+ import os
15
+ import shutil
16
+ import subprocess
17
+ import sys
18
+ from pathlib import Path
19
+ from typing import Any
20
+
21
+ PACKAGE = "dsh-foxfetch"
22
+ BUNDLE = "dsh-foxfetch"
23
+
24
+
25
+ def dsh_home() -> Path:
26
+ override = os.environ.get("DSH_HOME")
27
+ if override:
28
+ return Path(override).expanduser()
29
+ if os.name == "nt":
30
+ local = os.environ.get("LOCALAPPDATA")
31
+ roaming = os.environ.get("APPDATA")
32
+ candidate = Path(os.path.expanduser("~")) / ".dsh"
33
+ # DSH uses ~/.dsh on every platform; LOCALAPPDATA/APPDATA are only a fallback
34
+ if candidate.is_dir() or not (local or roaming):
35
+ return candidate
36
+ return candidate
37
+ return Path.home() / ".dsh"
38
+
39
+
40
+ def profile_dir() -> Path:
41
+ return dsh_home() / "profiles" / "desktop"
42
+
43
+
44
+ def find_pnpm() -> list[str] | None:
45
+ """pnpm on PATH, the copy DSH ships with its runtime, or npm as a last resort.
46
+
47
+ DSH's profile is a workspace package, so npm installs it fine; pnpm is preferred because
48
+ that is what the harness itself uses and it keeps one lockfile per profile.
49
+ """
50
+ direct = shutil.which("pnpm")
51
+ if direct:
52
+ return [direct]
53
+ runtimes = dsh_home() / "dsh-runtimes"
54
+ if runtimes.is_dir():
55
+ for runtime in sorted(runtimes.iterdir()):
56
+ deps = runtime / "dependencies"
57
+ node = deps / "node" / "bin" / ("node.exe" if os.name == "nt" else "node")
58
+ pnpm = deps / "pnpm" / "bin" / "pnpm.cjs"
59
+ if node.is_file() and pnpm.is_file():
60
+ return [str(node), str(pnpm)]
61
+ npm = shutil.which("npm")
62
+ if npm:
63
+ return [npm, "install"]
64
+ return None
65
+
66
+
67
+ def read_manifest(path: Path) -> dict[str, Any]:
68
+ try:
69
+ data: Any = json.loads(path.read_text(encoding="utf-8"))
70
+ if not isinstance(data, dict):
71
+ raise SystemExit(f"{path} does not contain a JSON object")
72
+ return data
73
+ except FileNotFoundError:
74
+ return {}
75
+ except json.JSONDecodeError as error:
76
+ raise SystemExit(f"{path} is not valid JSON: {error}") from error
77
+
78
+
79
+ def plan(manifest: dict[str, Any]) -> tuple[bool, bool]:
80
+ """(needs_dependency, needs_bundle) for the current manifest."""
81
+ dependencies = manifest.setdefault("dependencies", {}) if manifest else {}
82
+ needs_dep = PACKAGE not in dependencies
83
+ dsh_section = manifest.get("dsh") or {}
84
+ bundles = ((dsh_section.get("profile") or {}).get("bundles")) or []
85
+ needs_bundle = BUNDLE not in bundles
86
+ return needs_dep, needs_bundle
87
+
88
+
89
+ def patch_manifest(manifest: dict[str, Any], *, install: bool) -> dict[str, Any]:
90
+ """Add the dependency and the bundle entry, keeping everything else untouched."""
91
+ dependencies = manifest.setdefault("dependencies", {})
92
+ if PACKAGE not in dependencies:
93
+ # A version range, not a link: pnpm resolves it from the registry, so updates are a
94
+ # single `pnpm update`. Local development uses `link:` and is documented separately.
95
+ dependencies[PACKAGE] = "^0.1.1" if install else dependencies.get(PACKAGE, "^0.1.1")
96
+ dsh_section = manifest.setdefault("dsh", {})
97
+ profile = dsh_section.setdefault("profile", {})
98
+ bundles = profile.setdefault("bundles", [])
99
+ if BUNDLE not in bundles:
100
+ bundles.append(BUNDLE)
101
+ return manifest
102
+
103
+
104
+ def run_pnpm(command: list[str], cwd: Path, *, dry_run: bool) -> int:
105
+ printable = " ".join(command)
106
+ print(f" $ {printable}")
107
+ if dry_run:
108
+ return 0
109
+ result = subprocess.run(command, cwd=str(cwd), check=False)
110
+ return result.returncode
111
+
112
+
113
+ def _say(*parts: object) -> None:
114
+ print(*parts, flush=True)
115
+
116
+
117
+ def install(*, dry_run: bool = False, skip_pnpm: bool = False) -> int:
118
+ profile = profile_dir()
119
+ _say(f"foxfetch → DSH plugin")
120
+ _say(f" profile: {profile}")
121
+ if not profile.is_dir():
122
+ print(
123
+ " ✗ that profile does not exist yet.\n"
124
+ " Start DSH once (let the main window appear), quit it, then run this again:\n"
125
+ " DSH creates profiles/desktop on its first launch and would overwrite a hand-made one.",
126
+ file=sys.stderr,
127
+ )
128
+ return 2
129
+
130
+ manifest_path = profile / "package.json"
131
+ manifest = read_manifest(manifest_path)
132
+ needs_dep, needs_bundle = plan(manifest)
133
+ print(f" dependency {PACKAGE}: {'missing' if needs_dep else 'already there'}")
134
+ print(f" bundle entry: {'missing' if needs_bundle else 'already there'}")
135
+ if not needs_dep and not needs_bundle:
136
+ print(" ✓ nothing to do; restart DSH if you have not since installing")
137
+ return 0
138
+
139
+ pnpm = find_pnpm()
140
+ if needs_dep and not skip_pnpm:
141
+ if pnpm is None:
142
+ print(
143
+ " ✗ pnpm not found (neither on PATH nor in ~/.dsh/dsh-runtimes).\n"
144
+ f" Install it, then run: pnpm add {PACKAGE}",
145
+ file=sys.stderr,
146
+ )
147
+ return 3
148
+ if pnpm[1:] == ["install"]:
149
+ command = [pnpm[0], "install", PACKAGE]
150
+ else:
151
+ command = [*pnpm, "add", PACKAGE]
152
+ code = run_pnpm(command, profile, dry_run=dry_run)
153
+ if code != 0:
154
+ print(f" ✗ pnpm add failed with exit {code}", file=sys.stderr)
155
+ return code
156
+
157
+ patched = patch_manifest(manifest, install=True)
158
+ if dry_run:
159
+ print(" would write package.json:")
160
+ print(json.dumps(patched, indent=2, ensure_ascii=False))
161
+ else:
162
+ manifest_path.write_text(json.dumps(patched, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
163
+ print(f" ✓ wrote {manifest_path.name}")
164
+
165
+ print()
166
+ print(" next: restart DSH, then ask it for `foxfetch_status`.")
167
+ print(" expected tools: foxfetch_probe, foxfetch_run, foxfetch_net, foxfetch_handoff,")
168
+ print(" foxfetch_close, foxfetch_cleanup, foxfetch_status")
169
+ print(" if the tools do not appear, check that ~/.dsh/profiles/desktop/node_modules/"
170
+ f"{PACKAGE} exists")
171
+ return 0
172
+
173
+
174
+ def main(argv: list[str] | None = None) -> int:
175
+ import argparse
176
+
177
+ parser = argparse.ArgumentParser(prog="foxfetch dsh-install", description=__doc__)
178
+ parser.add_argument("--dry-run", action="store_true", help="show the change without touching anything")
179
+ parser.add_argument("--skip-pnpm", action="store_true", help="only patch package.json")
180
+ args = parser.parse_args(argv)
181
+ return install(dry_run=args.dry_run, skip_pnpm=args.skip_pnpm)
182
+
183
+
184
+ if __name__ == "__main__":
185
+ raise SystemExit(main())
foxfetch-0.1.7/PKG-INFO DELETED
@@ -1,386 +0,0 @@
1
- Metadata-Version: 2.5
2
- Name: foxfetch
3
- Version: 0.1.7
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
- Runs a page in a real Firefox engine to get past bot checks, then hands the identity to Chromium
62
- when a screenshot is needed.
63
-
64
- ## Install
65
-
66
- ```bash
67
- pip install foxfetch
68
- ```
69
-
70
- **DSH (DeepSeek Harness) install command:**
71
-
72
- ```powershell
73
- cd "$env:USERPROFILE\.dsh\profiles\desktop"
74
- pnpm add dsh-foxfetch
75
- ```
76
-
77
- Then add `"dsh-foxfetch"` to `dsh.profile.bundles` in that folder's `package.json` and restart
78
- DSH.
79
-
80
- **Everything else install command:**
81
-
82
- ```bash
83
- pi mcp add foxfetch -- python -m foxfetch serve # Pi
84
- claude mcp add foxfetch -- python -m foxfetch serve # Claude Code
85
- ```
86
-
87
- Codex and other MCP clients need config only, no package — see [below](#detailed-install).
88
-
89
- ## Verify
90
-
91
- ```bash
92
- python -m foxfetch doctor # expect "ok": true
93
- ```
94
-
95
- Then ask your agent:
96
-
97
- ```
98
- foxfetch_run(js="navigator.userAgent", url="https://example.com")
99
- ```
100
-
101
- It must answer with `Firefox/160.0`. If it says `Python-urllib` or `HeadlessChrome`, the agent is
102
- not reaching the engine — nothing else will work until that is fixed.
103
-
104
- > **One entry per host.** Never add both an MCP entry and the DSH plugin to the same agent: you
105
- > would get the same seven tools twice (`foxfetch_run` and `mcp__foxfetch__run`).
106
-
107
- ## Why this exists
108
-
109
- `curl` gets a 403. Headless Chrome gets fingerprinted. foxfetch runs the site's own JavaScript in
110
- a real Firefox engine (SpiderMonkey + Necko, no window, no renderer), so the TLS handshake and
111
- the JS environment are those of a real browser — and it keeps that world alive between calls.
112
- When a screenshot or a click is needed, `handoff` exports the identity it earned so Chromium can
113
- finish the job.
114
-
115
- ## Detailed install
116
-
117
- ### Requirements
118
-
119
- There are two platforms involved, and it matters:
120
-
121
- - **the service** — one Python package, `pip install foxfetch`, shared by every host.
122
- - **the host entry** — a different mechanism per host: an MCP config entry for Pi / Claude
123
- Code / Codex, an npm plugin for DSH.
124
-
125
- - **Python 3.10+** — that is all. Chromium is optional (screenshots only).
126
- - The `ruyijs` engine (44 MB wheel) comes in automatically as a dependency.
127
-
128
- If `doctor` reports a problem, run the command it prints. The three that happen:
129
-
130
- | `doctor` says | Fix |
131
- |---|---|
132
- | `ruyijs` missing or `< 0.4.5` | `pip install -U "ruyijs>=0.4.5"` |
133
- | `mcp` is 2.x | `pip install "mcp>=1.30,<2"` — 2.x renamed `FastMCP`; this server cannot import it |
134
- | `chromium: found: false` | optional: `npx playwright install chromium` |
135
-
136
- **Which Python?** The agent must start the same interpreter that `pip install` used:
137
-
138
- ```powershell
139
- (Get-Command python).Source # Windows
140
- which python3 # macOS / Linux
141
- ```
142
-
143
- ```bash
144
- # If it is not plain `python`, put the absolute path in the config:
145
- # "command": "C:/Users/you/AppData/Local/Programs/Python/Python314/python.exe"
146
- ```
147
-
148
- ### Pi
149
-
150
- `pi mcp add foxfetch -- python -m foxfetch serve`
151
-
152
- Or write `~/.pi/agent/mcp.json` yourself:
153
-
154
- ```json
155
- {
156
- "mcpServers": {
157
- "foxfetch": {
158
- "command": "python",
159
- "args": ["-m", "foxfetch", "serve"],
160
- "timeout": 180
161
- }
162
- }
163
- }
164
- ```
165
-
166
- Verify: `pi mcp list` → `foxfetch: connected, 7 tools`.
167
- Inside a running Pi session, `/reload` picks it up.
168
-
169
- ### Claude Code
170
-
171
- `claude mcp add foxfetch -- python -m foxfetch serve`
172
-
173
- Verify: `claude mcp list`.
174
-
175
- ### Codex
176
-
177
- Append to `~/.codex/config.toml`, then restart Codex:
178
-
179
- ```toml
180
- [mcp_servers.foxfetch]
181
- command = "python"
182
- args = ["-m", "foxfetch", "serve"]
183
- ```
184
-
185
- ### DeepSeek Harness
186
-
187
- DSH has a native plugin API, so it gets a real plugin instead of an MCP entry. The plugin holds
188
- no logic — it starts the same Python service and reshapes results for the DSH UI.
189
-
190
- > **DSH needs two installs, not one:** the service (`pip`, step 1) **and** the plugin (npm).
191
- > The plugin is only a forwarder; without the service it fails immediately with
192
- > `cannot start the Python service`.
193
-
194
- ```powershell
195
- # 1. service (same as everyone else — do not skip this)
196
- pip install foxfetch
197
-
198
- # 2. plugin, into the DSH profile
199
- cd "$env:USERPROFILE\.dsh\profiles\desktop"
200
- pnpm add dsh-foxfetch
201
-
202
- # 3. register it (keep the entries already in the file)
203
- $pkg = Get-Content package.json -Raw | ConvertFrom-Json
204
- if ($pkg.dsh.profile.bundles -notcontains "dsh-foxfetch") {
205
- $pkg.dsh.profile.bundles += "dsh-foxfetch"
206
- }
207
- $pkg | ConvertTo-Json -Depth 20 | Set-Content package.json
208
-
209
- # 4. restart DSH
210
- ```
211
-
212
- The result should look like this:
213
-
214
- ```json
215
- {
216
- "name": "dsh-profile-desktop",
217
- "private": true,
218
- "dependencies": {
219
- "dsh-foxfetch": "^0.1.1"
220
- },
221
- "dsh": {
222
- "profile": {
223
- "bundles": [
224
- "@deepseek-ai/dsh-base",
225
- "@deepseek-ai/dsh-web-app",
226
- "dsh-foxfetch"
227
- ]
228
- }
229
- }
230
- }
231
- ```
232
-
233
- `pnpm` not on PATH? DSH ships its own:
234
-
235
- ```powershell
236
- $dsh = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
237
- $node = Join-Path $dsh "node\bin\node.exe"
238
- $pnpm = Join-Path $dsh "pnpm\bin\pnpm.cjs"
239
- & $node $pnpm add dsh-foxfetch
240
- ```
241
-
242
- After restarting DSH the tool list shows `foxfetch_probe`, `foxfetch_run`, `foxfetch_net`,
243
- `foxfetch_handoff`, `foxfetch_close`, `foxfetch_cleanup`, `foxfetch_status` — and no
244
- `mcp__foxfetch__*` entries.
245
-
246
- ### Any other MCP client
247
-
248
- Most clients take the same stdio block:
249
-
250
- ```json
251
- {
252
- "mcpServers": {
253
- "foxfetch": {
254
- "command": "python",
255
- "args": ["-m", "foxfetch", "serve"]
256
- }
257
- }
258
- }
259
- ```
260
-
261
- ---
262
-
263
- ## What you get
264
-
265
- Seven tools:
266
-
267
- | Tool | What it does |
268
- |---|---|
269
- | `probe` | Classify a URL — `plain_http` / `needs_engine` / `blocked` — with the evidence |
270
- | `run` | Evaluate JavaScript in the engine; returns the value, console and request log |
271
- | `net` | Read the request log and console of a live context |
272
- | `handoff` | Export cookies (incl. HttpOnly), localStorage, UA; write a Playwright script |
273
- | `close` | Close one context (by id or origin) or all of them |
274
- | `cleanup` | Delete artifacts, close contexts, sweep temp scratch dirs |
275
- | `status` | Live contexts, artifact usage, environment check |
276
-
277
- ### Use the cheapest layer
278
-
279
- | Situation | Use |
280
- |---|---|
281
- | Static HTML, JSON endpoints, RSS | plain HTTP — **do not call foxfetch** |
282
- | Content appears only after JS runs | `run` |
283
- | 403 / Cloudflare / DataDome / Kasada | `probe`, then `run` |
284
- | Someone needs to *see* the page | `handoff` → the generated Playwright script |
285
-
286
- ```
287
- probe("https://shop.example/item")
288
- → verdict: blocked
289
- evidence: HTTP 403, DataDome (matched 'datadome'), 512 bytes, 0 visible text
290
- suggestion: use run — the engine's TLS and JS profile match a real Firefox
291
- ```
292
-
293
- The engine costs ~90 MB of RAM and ~3 s per open. On a page `curl` could have fetched, that buys
294
- nothing — hence `probe`.
295
-
296
- ### Contexts
297
-
298
- One engine world per origin, kept alive between calls, so a multi-step flow is several small
299
- calls instead of one giant script:
300
-
301
- ```python
302
- run("window.step = 1", url="https://x.test") # opens the page
303
- run("window.step + 1") # → 2, same document
304
- run("fetch('/api/me').then(r => r.text())",
305
- advance_ms=800, read="window.__last") # carries the cookies earned above
306
- ```
307
-
308
- A context dies on `close`, after `FOXFETCH_IDLE_SECONDS` (default 60) of silence, or when the pool
309
- exceeds `FOXFETCH_MAX_CONTEXTS` (default 2) — least recently used first.
310
-
311
- ---
312
-
313
- ## Configuration
314
-
315
- | Variable | Default | Meaning |
316
- |---|---|---|
317
- | `FOXFETCH_HOME` | `%LOCALAPPDATA%\foxfetch` | Artifact root (credentials pass through it) |
318
- | `FOXFETCH_MAX_CONTEXTS` | 2 | Live contexts before LRU eviction |
319
- | `FOXFETCH_IDLE_SECONDS` | 60 | Silence before a context is killed |
320
- | `FOXFETCH_TIMEOUT_MS` | 30000 | Default navigation budget |
321
- | `FOXFETCH_MAX_BYTES` | 65536 | Output cap before spilling to a file |
322
- | `FOXFETCH_ARTIFACT_TTL` | 86400 | Seconds before an artifact is deleted |
323
- | `FOXFETCH_ARTIFACT_MAX` | 67108864 | Artifact directory byte budget |
324
- | `FOXFETCH_REMIND_AFTER` | 600 | Seconds before responses start reminding about pending artifacts (0 disables) |
325
- | `FOXFETCH_PY` | — | Interpreter the DSH plugin starts |
326
-
327
- ## Safety
328
-
329
- `handoff` writes **live credentials** — cookies including the HttpOnly ones page script cannot
330
- read. They land under `FOXFETCH_HOME`, owner-only, and expire after `FOXFETCH_ARTIFACT_TTL`.
331
-
332
- Every tool response reports what is still on disk, and once a file is older than
333
- `FOXFETCH_REMIND_AFTER` the response grows a `reminder` telling the agent to call `cleanup` and to
334
- pass `keep=[...]` for anything the user still needs to look at. The field disappears the moment
335
- cleanup runs, so a stale reminder is a visible bug rather than a silent one.
336
-
337
- ## What it is not
338
-
339
- - Not a screenshot tool, not a clicker, not a layout engine — Chromium does that, once it has the
340
- identity `handoff` exported.
341
- - Not a session store: every context is fresh, nothing survives `close`.
342
- - Not a fingerprint randomiser: guessing a profile that matches nobody is worse than sending a
343
- real Firefox.
344
-
345
- ## Development
346
-
347
- ```bash
348
- pip install -e '.[dev]'
349
- pytest -q # 45 tests, no network
350
- mypy src # strict
351
- ```
352
-
353
- ```bash
354
- # when github.com:443 is reset but api.github.com answers, push through the API
355
- python tools/push_via_api.py --repo <owner>/<name> --dry-run
356
- ```
357
-
358
- The tests encode the bugs this rewrite exists to prevent: a clip that split UTF-8 sequences, a URL
359
- compare that ignored the trailing slash, `sameSite: "Default"` rejected by Playwright, a `cleanup`
360
- that only deleted expired files, and a runaway browser left behind when the screenshot threw.
361
-
362
- ## Troubleshooting
363
-
364
- | Symptom | Cause | Fix |
365
- |---|---|---|
366
- | `cannot start the Python service` (DSH) | the plugin found a different interpreter | set `FOXFETCH_PY` to the absolute path |
367
- | `ModuleNotFoundError: mcp.server.fastmcp` | `mcp` 2.x installed | `pip install "mcp>=1.30,<2"` |
368
- | `no live context for that origin` | context idled out (60 s) or was evicted | pass `url` again, or keep `context_id` |
369
- | `navigation produced an empty document` | slow page, or one that needs a real renderer | raise `timeout_ms`, or use `handoff` + Chromium |
370
- | tools appear twice | two entries in one host | remove one |
371
- | `pip install` stops mid-download | flaky network to `files.pythonhosted.org` | retry, or `pip install --proxy http://127.0.0.1:7897 foxfetch` |
372
-
373
- ## Uninstall
374
-
375
- ```bash
376
- pip uninstall foxfetch
377
- ```
378
-
379
- Artifacts: `%LOCALAPPDATA%\foxfetch` (Windows) or `~/.local/share/foxfetch`. Then delete the host
380
- entry — the `mcpServers` block, the `[mcp_servers.foxfetch]` table, or the `dsh-foxfetch`
381
- dependency plus its bundle line.
382
-
383
- ## Licence
384
-
385
- MIT. The engine (`ruyijs`) is a separate project under AGPL-3.0; foxfetch only calls it — no
386
- ruyijs code is bundled.
File without changes
File without changes
File without changes
File without changes