foxfetch 0.1.6__tar.gz → 0.1.8__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:
@@ -0,0 +1,380 @@
1
+ Metadata-Version: 2.5
2
+ Name: foxfetch
3
+ Version: 0.1.8
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
+ cd "$env:USERPROFILE\.dsh\profiles\desktop"
73
+ pnpm add dsh-foxfetch
74
+ ```
75
+
76
+ 再把 `"dsh-foxfetch"` 加进该目录 `package.json` 的 `dsh.profile.bundles`,重启 DSH。
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
187
+
188
+ DSH 有原生插件机制,所以给它装插件而不是 MCP 条目。插件里**没有任何逻辑** —— 它启动同一个
189
+ Python 服务,只负责把结果整理成 DSH 的卡片样式。
190
+
191
+ > **DSH 要装两样,不是一样**:服务(`pip`,第 1 步)**加上**插件(npm)。
192
+ > 插件只是转发壳,没有服务会立刻报 `cannot start the Python service`。
193
+
194
+ ```powershell
195
+ # 1. 服务(和别的宿主一样 —— 这步不能跳)
196
+ pip install foxfetch
197
+
198
+ # 2. 插件,装进 DSH 的 profile
199
+ cd "$env:USERPROFILE\.dsh\profiles\desktop"
200
+ pnpm add dsh-foxfetch
201
+
202
+ # 3. 登记(保留文件里已有的条目)
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. 重启 DSH
210
+ ```
211
+
212
+ 改完 `package.json` 应该长这样:
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` 不在 PATH 里?** DSH 自带一份:
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
+ 重启 DSH 后工具列表里应该有 `foxfetch_probe`、`foxfetch_run`、`foxfetch_net`、
243
+ `foxfetch_handoff`、`foxfetch_close`、`foxfetch_cleanup`、`foxfetch_status` —— 并且**没有**
244
+ `mcp__foxfetch__*` 这种重复条目。
245
+
246
+ ### 其它 MCP 客户端
247
+
248
+ 大多数客户端吃同一段 stdio 配置:
249
+
250
+ ```json
251
+ {
252
+ "mcpServers": {
253
+ "foxfetch": {
254
+ "command": "python",
255
+ "args": ["-m", "foxfetch", "serve"]
256
+ }
257
+ }
258
+ }
259
+ ```
260
+
261
+ ---
262
+
263
+ ## 你会得到什么
264
+
265
+ 七个工具:
266
+
267
+ | 工具 | 作用 |
268
+ |---|---|
269
+ | `probe` | 判断一个 URL 该走哪一层:`plain_http` / `needs_engine` / `blocked`,**附判据** |
270
+ | `run` | 在引擎里执行 JS,返回结果 + console + 请求日志 |
271
+ | `net` | 读当前上下文的请求日志和 console,不发新请求 |
272
+ | `handoff` | 导出 cookie(含 HttpOnly)、localStorage、UA,并生成 Playwright 脚本 |
273
+ | `close` | 关掉某个上下文(按 id 或 origin),或全关 |
274
+ | `cleanup` | 删产物、关上下文、扫临时目录 |
275
+ | `status` | 活着的上下文、产物占用、环境自检 |
276
+
277
+ ### 用最便宜的那一层
278
+
279
+ | 情况 | 用什么 |
280
+ |---|---|
281
+ | 静态 HTML、JSON 接口、RSS | 普通 HTTP —— **别调 foxfetch** |
282
+ | 内容要等 JS 跑完才出现 | `run` |
283
+ | 403 / Cloudflare / DataDome / Kasada | 先 `probe`,再 `run` |
284
+ | 有人需要**看到**页面 | `handoff` → 生成的 Playwright 脚本 |
285
+
286
+ ```
287
+ probe("https://shop.example/item")
288
+ → verdict: blocked
289
+ evidence: HTTP 403, DataDome(命中 'datadome'), 512 字节, 可见文本 0
290
+ suggestion: 用 run —— 引擎的 TLS 与 JS 指纹跟真 Firefox 一致
291
+ ```
292
+
293
+ 引擎每次开页面要 ~90 MB 内存、~3 秒。如果 `curl` 就能拿到的页面,用它纯属浪费 —— 这就是
294
+ `probe` 存在的原因。
295
+
296
+ ### 上下文保持
297
+
298
+ 一个 origin 一个引擎世界,调用之间保持存活,所以多步流程是若干小调用,而不是一个巨型脚本:
299
+
300
+ ```python
301
+ run("window.step = 1", url="https://x.test") # 打开页面
302
+ run("window.step + 1") # → 2,同一个文档
303
+ run("fetch('/api/me').then(r => r.text())",
304
+ advance_ms=800, read="window.__last") # 带上前面挣到的 cookie
305
+ ```
306
+
307
+ 上下文会在这些情况下消失:`close`、静默超过 `FOXFETCH_IDLE_SECONDS`(默认 60 秒)、
308
+ 池子超过 `FOXFETCH_MAX_CONTEXTS`(默认 2 个,淘汰最久未用的)。
309
+
310
+ ---
311
+
312
+ ## 配置项
313
+
314
+ | 环境变量 | 默认值 | 含义 |
315
+ |---|---|---|
316
+ | `FOXFETCH_HOME` | `%LOCALAPPDATA%\foxfetch` | 产物目录(凭据会经过它) |
317
+ | `FOXFETCH_MAX_CONTEXTS` | 2 | 存活上下文上限,超了淘汰最久未用 |
318
+ | `FOXFETCH_IDLE_SECONDS` | 60 | 静默多久杀掉上下文 |
319
+ | `FOXFETCH_TIMEOUT_MS` | 30000 | 默认导航预算 |
320
+ | `FOXFETCH_MAX_BYTES` | 65536 | 输出上限,超了落盘 |
321
+ | `FOXFETCH_ARTIFACT_TTL` | 86400 | 产物自动过期的秒数 |
322
+ | `FOXFETCH_ARTIFACT_MAX` | 67108864 | 产物目录字节预算 |
323
+ | `FOXFETCH_REMIND_AFTER` | 600 | 超过多少秒开始提醒清理(0 = 关闭) |
324
+ | `FOXFETCH_PY` | — | DSH 插件启动用的解释器 |
325
+
326
+ ## 安全
327
+
328
+ `handoff` 写出的是**活的凭据** —— 包括页面 JS 读不到的 HttpOnly cookie。它们落在
329
+ `FOXFETCH_HOME` 下,权限仅本人可读,超过 `FOXFETCH_ARTIFACT_TTL` 自动删除。
330
+
331
+ 每次工具返回都会报告磁盘上还留着什么;某个文件超过 `FOXFETCH_REMIND_AFTER` 后,返回里会多出
332
+ 一个 `reminder`,叫 agent 调 `cleanup`,并用 `keep=[...]` 保住用户还要看的东西。跑完 cleanup
333
+ 这个字段立刻消失 —— 所以**残留的提醒就是明确的 bug**,不会静默发生。
334
+
335
+ ## 它不做什么
336
+
337
+ - 不截图、不点击、不排版 —— 那些交给 Chromium,前提是拿到 `handoff` 导出的身份。
338
+ - 不保存会话:每个上下文都是全新的,`close` 之后什么都不剩。
339
+ - 不做指纹随机化:随便猜一个和谁都不像的配置,比直接冒充真 Firefox 更容易被识别。
340
+
341
+ ## 开发
342
+
343
+ ```bash
344
+ pip install -e '.[dev]'
345
+ pytest -q # 45 个测试,不联网
346
+ mypy src # strict
347
+ ```
348
+
349
+ ```bash
350
+ # github.com:443 被重置但 api.github.com 通的时候,用 API 推送
351
+ python tools/push_via_api.py --repo <owner>/<name> --dry-run
352
+ ```
353
+
354
+ 测试里固化的就是这次重写要防的坑:按字节截断中文出 `�`、URL 尾斜杠比较不匹配、
355
+ `sameSite: "Default"` 被 Playwright 拒绝、`cleanup` 只删过期文件、截图抛异常时留下孤儿浏览器。
356
+
357
+ ## 排错
358
+
359
+ | 症状 | 原因 | 修法 |
360
+ |---|---|---|
361
+ | `cannot start the Python service`(DSH) | 插件找到了另一个解释器 | 把 `FOXFETCH_PY` 设成绝对路径 |
362
+ | `ModuleNotFoundError: mcp.server.fastmcp` | 装了 `mcp` 2.x | `pip install "mcp>=1.30,<2"` |
363
+ | `no live context for that origin` | 上下文空闲超时(60 秒)或被淘汰 | 再传一次 `url`,或保留 `context_id` |
364
+ | `navigation produced an empty document` | 页面慢,或需要真渲染器 | 调大 `timeout_ms`,或走 `handoff` + Chromium |
365
+ | 工具出现两遍 | 同一个宿主装了两个入口 | 删掉一个 |
366
+ | `pip install` 下到一半断 | 到 `files.pythonhosted.org` 的网络不稳 | 重试,或 `pip install --proxy http://127.0.0.1:7897 foxfetch` |
367
+
368
+ ## 卸载
369
+
370
+ ```bash
371
+ pip uninstall foxfetch
372
+ ```
373
+
374
+ 产物目录:Windows 是 `%LOCALAPPDATA%\foxfetch`,其他平台是 `~/.local/share/foxfetch`。
375
+ 然后删掉宿主里的入口 —— `mcpServers` 那段、`[mcp_servers.foxfetch]` 那个表,或者
376
+ `dsh-foxfetch` 依赖加 bundles 里那一行。
377
+
378
+ ## 许可
379
+
380
+ 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,33 +18,24 @@ when a screenshot is needed.
18
18
  pip install foxfetch
19
19
  ```
20
20
 
21
- That is the service, and every host needs it. Then one of these two:
22
-
23
- | You use | Run this next |
24
- |---|---|
25
- | **DeepSeek Harness** (DSH) | `pnpm add dsh-foxfetch` inside `~/.dsh/profiles/desktop`, add it to `dsh.profile.bundles`, restart → [steps](#deepseek-harness) |
26
- | **Pi / Claude Code / Codex / other MCP client** | nothing to install, just a config entry → [steps](#pi) |
27
-
28
- ### DSH, both commands together
21
+ **DSH (DeepSeek Harness) install command:**
29
22
 
30
23
  ```powershell
31
- pip install foxfetch
32
24
  cd "$env:USERPROFILE\.dsh\profiles\desktop"
33
25
  pnpm add dsh-foxfetch
34
26
  ```
35
27
 
36
28
  Then add `"dsh-foxfetch"` to `dsh.profile.bundles` in that folder's `package.json` and restart
37
- DSH. Exact file content: [DSH steps](#deepseek-harness).
29
+ DSH.
38
30
 
39
- ### Everyone else, one config entry
31
+ **Everything else install command:**
40
32
 
41
33
  ```bash
42
- pi mcp add foxfetch -- python -m foxfetch serve # Pi
43
- claude mcp add foxfetch -- python -m foxfetch serve # Claude Code
34
+ pi mcp add foxfetch -- python -m foxfetch serve # Pi
35
+ claude mcp add foxfetch -- python -m foxfetch serve # Claude Code
44
36
  ```
45
37
 
46
- Codex takes a table in `~/.codex/config.toml` ([steps](#codex)); any other MCP client takes
47
- `command: python`, `args: ["-m", "foxfetch", "serve"]`.
38
+ Codex and other MCP clients need config only, no package — see [below](#detailed-install).
48
39
 
49
40
  ## Verify
50
41
 
@@ -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,33 +17,23 @@
17
17
  pip install foxfetch
18
18
  ```
19
19
 
20
- 这是服务本体,**所有宿主都要装**。然后按你用的软件二选一:
21
-
22
- | 你用 | 接着执行 |
23
- |---|---|
24
- | **DeepSeek Harness**(DSH) | 在 `~/.dsh/profiles/desktop` 里 `pnpm add dsh-foxfetch`,再把它加进 `dsh.profile.bundles`,重启 → [步骤](#deepseek-harness) |
25
- | **Pi / Claude Code / Codex / 其它 MCP 客户端** | 不用装包,只要写一段配置 → [步骤](#pi) |
26
-
27
- ### DSH:两条命令连起来
20
+ **DSH(DeepSeek Harness)安装指令:**
28
21
 
29
22
  ```powershell
30
- pip install foxfetch
31
23
  cd "$env:USERPROFILE\.dsh\profiles\desktop"
32
24
  pnpm add dsh-foxfetch
33
25
  ```
34
26
 
35
- 然后把 `"dsh-foxfetch"` 加进这个目录下 `package.json` 的 `dsh.profile.bundles`,重启 DSH。
36
- 完整文件内容见 [DSH 步骤](#deepseek-harness)。
27
+ 再把 `"dsh-foxfetch"` 加进该目录 `package.json` 的 `dsh.profile.bundles`,重启 DSH。
37
28
 
38
- ### 其它软件:只写一段配置
29
+ **其余软件安装指令:**
39
30
 
40
31
  ```bash
41
- pi mcp add foxfetch -- python -m foxfetch serve # Pi
42
- claude mcp add foxfetch -- python -m foxfetch serve # Claude Code
32
+ pi mcp add foxfetch -- python -m foxfetch serve # Pi
33
+ claude mcp add foxfetch -- python -m foxfetch serve # Claude Code
43
34
  ```
44
35
 
45
- Codex 是在 `~/.codex/config.toml` 里加表([步骤](#codex));其它 MCP 客户端用
46
- `command: python`、`args: ["-m", "foxfetch", "serve"]`。
36
+ Codex 和其它 MCP 客户端只写配置、不装包,见[下文](#详细安装)。
47
37
 
48
38
  ## 验证
49
39
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "foxfetch"
7
- version = "0.1.6"
7
+ version = "0.1.8"
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.6"
3
+ __version__ = "0.1.8"
4
4
 
5
5
  __all__ = ["__version__"]
foxfetch-0.1.6/PKG-INFO DELETED
@@ -1,395 +0,0 @@
1
- Metadata-Version: 2.5
2
- Name: foxfetch
3
- Version: 0.1.6
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
- That is the service, and every host needs it. Then one of these two:
71
-
72
- | You use | Run this next |
73
- |---|---|
74
- | **DeepSeek Harness** (DSH) | `pnpm add dsh-foxfetch` inside `~/.dsh/profiles/desktop`, add it to `dsh.profile.bundles`, restart → [steps](#deepseek-harness) |
75
- | **Pi / Claude Code / Codex / other MCP client** | nothing to install, just a config entry → [steps](#pi) |
76
-
77
- ### DSH, both commands together
78
-
79
- ```powershell
80
- pip install foxfetch
81
- cd "$env:USERPROFILE\.dsh\profiles\desktop"
82
- pnpm add dsh-foxfetch
83
- ```
84
-
85
- Then add `"dsh-foxfetch"` to `dsh.profile.bundles` in that folder's `package.json` and restart
86
- DSH. Exact file content: [DSH steps](#deepseek-harness).
87
-
88
- ### Everyone else, one config entry
89
-
90
- ```bash
91
- pi mcp add foxfetch -- python -m foxfetch serve # Pi
92
- claude mcp add foxfetch -- python -m foxfetch serve # Claude Code
93
- ```
94
-
95
- Codex takes a table in `~/.codex/config.toml` ([steps](#codex)); any other MCP client takes
96
- `command: python`, `args: ["-m", "foxfetch", "serve"]`.
97
-
98
- ## Verify
99
-
100
- ```bash
101
- python -m foxfetch doctor # expect "ok": true
102
- ```
103
-
104
- Then ask your agent:
105
-
106
- ```
107
- foxfetch_run(js="navigator.userAgent", url="https://example.com")
108
- ```
109
-
110
- It must answer with `Firefox/160.0`. If it says `Python-urllib` or `HeadlessChrome`, the agent is
111
- not reaching the engine — nothing else will work until that is fixed.
112
-
113
- > **One entry per host.** Never add both an MCP entry and the DSH plugin to the same agent: you
114
- > would get the same seven tools twice (`foxfetch_run` and `mcp__foxfetch__run`).
115
-
116
- ## Why this exists
117
-
118
- `curl` gets a 403. Headless Chrome gets fingerprinted. foxfetch runs the site's own JavaScript in
119
- a real Firefox engine (SpiderMonkey + Necko, no window, no renderer), so the TLS handshake and
120
- the JS environment are those of a real browser — and it keeps that world alive between calls.
121
- When a screenshot or a click is needed, `handoff` exports the identity it earned so Chromium can
122
- finish the job.
123
-
124
- ## Detailed install
125
-
126
- ### Requirements
127
-
128
- There are two platforms involved, and it matters:
129
-
130
- - **the service** — one Python package, `pip install foxfetch`, shared by every host.
131
- - **the host entry** — a different mechanism per host: an MCP config entry for Pi / Claude
132
- Code / Codex, an npm plugin for DSH.
133
-
134
- - **Python 3.10+** — that is all. Chromium is optional (screenshots only).
135
- - The `ruyijs` engine (44 MB wheel) comes in automatically as a dependency.
136
-
137
- If `doctor` reports a problem, run the command it prints. The three that happen:
138
-
139
- | `doctor` says | Fix |
140
- |---|---|
141
- | `ruyijs` missing or `< 0.4.5` | `pip install -U "ruyijs>=0.4.5"` |
142
- | `mcp` is 2.x | `pip install "mcp>=1.30,<2"` — 2.x renamed `FastMCP`; this server cannot import it |
143
- | `chromium: found: false` | optional: `npx playwright install chromium` |
144
-
145
- **Which Python?** The agent must start the same interpreter that `pip install` used:
146
-
147
- ```powershell
148
- (Get-Command python).Source # Windows
149
- which python3 # macOS / Linux
150
- ```
151
-
152
- ```bash
153
- # If it is not plain `python`, put the absolute path in the config:
154
- # "command": "C:/Users/you/AppData/Local/Programs/Python/Python314/python.exe"
155
- ```
156
-
157
- ### Pi
158
-
159
- `pi mcp add foxfetch -- python -m foxfetch serve`
160
-
161
- Or write `~/.pi/agent/mcp.json` yourself:
162
-
163
- ```json
164
- {
165
- "mcpServers": {
166
- "foxfetch": {
167
- "command": "python",
168
- "args": ["-m", "foxfetch", "serve"],
169
- "timeout": 180
170
- }
171
- }
172
- }
173
- ```
174
-
175
- Verify: `pi mcp list` → `foxfetch: connected, 7 tools`.
176
- Inside a running Pi session, `/reload` picks it up.
177
-
178
- ### Claude Code
179
-
180
- `claude mcp add foxfetch -- python -m foxfetch serve`
181
-
182
- Verify: `claude mcp list`.
183
-
184
- ### Codex
185
-
186
- Append to `~/.codex/config.toml`, then restart Codex:
187
-
188
- ```toml
189
- [mcp_servers.foxfetch]
190
- command = "python"
191
- args = ["-m", "foxfetch", "serve"]
192
- ```
193
-
194
- ### DeepSeek Harness
195
-
196
- DSH has a native plugin API, so it gets a real plugin instead of an MCP entry. The plugin holds
197
- no logic — it starts the same Python service and reshapes results for the DSH UI.
198
-
199
- > **DSH needs two installs, not one:** the service (`pip`, step 1) **and** the plugin (npm).
200
- > The plugin is only a forwarder; without the service it fails immediately with
201
- > `cannot start the Python service`.
202
-
203
- ```powershell
204
- # 1. service (same as everyone else — do not skip this)
205
- pip install foxfetch
206
-
207
- # 2. plugin, into the DSH profile
208
- cd "$env:USERPROFILE\.dsh\profiles\desktop"
209
- pnpm add dsh-foxfetch
210
-
211
- # 3. register it (keep the entries already in the file)
212
- $pkg = Get-Content package.json -Raw | ConvertFrom-Json
213
- if ($pkg.dsh.profile.bundles -notcontains "dsh-foxfetch") {
214
- $pkg.dsh.profile.bundles += "dsh-foxfetch"
215
- }
216
- $pkg | ConvertTo-Json -Depth 20 | Set-Content package.json
217
-
218
- # 4. restart DSH
219
- ```
220
-
221
- The result should look like this:
222
-
223
- ```json
224
- {
225
- "name": "dsh-profile-desktop",
226
- "private": true,
227
- "dependencies": {
228
- "dsh-foxfetch": "^0.1.1"
229
- },
230
- "dsh": {
231
- "profile": {
232
- "bundles": [
233
- "@deepseek-ai/dsh-base",
234
- "@deepseek-ai/dsh-web-app",
235
- "dsh-foxfetch"
236
- ]
237
- }
238
- }
239
- }
240
- ```
241
-
242
- `pnpm` not on PATH? DSH ships its own:
243
-
244
- ```powershell
245
- $dsh = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
246
- $node = Join-Path $dsh "node\bin\node.exe"
247
- $pnpm = Join-Path $dsh "pnpm\bin\pnpm.cjs"
248
- & $node $pnpm add dsh-foxfetch
249
- ```
250
-
251
- After restarting DSH the tool list shows `foxfetch_probe`, `foxfetch_run`, `foxfetch_net`,
252
- `foxfetch_handoff`, `foxfetch_close`, `foxfetch_cleanup`, `foxfetch_status` — and no
253
- `mcp__foxfetch__*` entries.
254
-
255
- ### Any other MCP client
256
-
257
- Most clients take the same stdio block:
258
-
259
- ```json
260
- {
261
- "mcpServers": {
262
- "foxfetch": {
263
- "command": "python",
264
- "args": ["-m", "foxfetch", "serve"]
265
- }
266
- }
267
- }
268
- ```
269
-
270
- ---
271
-
272
- ## What you get
273
-
274
- Seven tools:
275
-
276
- | Tool | What it does |
277
- |---|---|
278
- | `probe` | Classify a URL — `plain_http` / `needs_engine` / `blocked` — with the evidence |
279
- | `run` | Evaluate JavaScript in the engine; returns the value, console and request log |
280
- | `net` | Read the request log and console of a live context |
281
- | `handoff` | Export cookies (incl. HttpOnly), localStorage, UA; write a Playwright script |
282
- | `close` | Close one context (by id or origin) or all of them |
283
- | `cleanup` | Delete artifacts, close contexts, sweep temp scratch dirs |
284
- | `status` | Live contexts, artifact usage, environment check |
285
-
286
- ### Use the cheapest layer
287
-
288
- | Situation | Use |
289
- |---|---|
290
- | Static HTML, JSON endpoints, RSS | plain HTTP — **do not call foxfetch** |
291
- | Content appears only after JS runs | `run` |
292
- | 403 / Cloudflare / DataDome / Kasada | `probe`, then `run` |
293
- | Someone needs to *see* the page | `handoff` → the generated Playwright script |
294
-
295
- ```
296
- probe("https://shop.example/item")
297
- → verdict: blocked
298
- evidence: HTTP 403, DataDome (matched 'datadome'), 512 bytes, 0 visible text
299
- suggestion: use run — the engine's TLS and JS profile match a real Firefox
300
- ```
301
-
302
- The engine costs ~90 MB of RAM and ~3 s per open. On a page `curl` could have fetched, that buys
303
- nothing — hence `probe`.
304
-
305
- ### Contexts
306
-
307
- One engine world per origin, kept alive between calls, so a multi-step flow is several small
308
- calls instead of one giant script:
309
-
310
- ```python
311
- run("window.step = 1", url="https://x.test") # opens the page
312
- run("window.step + 1") # → 2, same document
313
- run("fetch('/api/me').then(r => r.text())",
314
- advance_ms=800, read="window.__last") # carries the cookies earned above
315
- ```
316
-
317
- A context dies on `close`, after `FOXFETCH_IDLE_SECONDS` (default 60) of silence, or when the pool
318
- exceeds `FOXFETCH_MAX_CONTEXTS` (default 2) — least recently used first.
319
-
320
- ---
321
-
322
- ## Configuration
323
-
324
- | Variable | Default | Meaning |
325
- |---|---|---|
326
- | `FOXFETCH_HOME` | `%LOCALAPPDATA%\foxfetch` | Artifact root (credentials pass through it) |
327
- | `FOXFETCH_MAX_CONTEXTS` | 2 | Live contexts before LRU eviction |
328
- | `FOXFETCH_IDLE_SECONDS` | 60 | Silence before a context is killed |
329
- | `FOXFETCH_TIMEOUT_MS` | 30000 | Default navigation budget |
330
- | `FOXFETCH_MAX_BYTES` | 65536 | Output cap before spilling to a file |
331
- | `FOXFETCH_ARTIFACT_TTL` | 86400 | Seconds before an artifact is deleted |
332
- | `FOXFETCH_ARTIFACT_MAX` | 67108864 | Artifact directory byte budget |
333
- | `FOXFETCH_REMIND_AFTER` | 600 | Seconds before responses start reminding about pending artifacts (0 disables) |
334
- | `FOXFETCH_PY` | — | Interpreter the DSH plugin starts |
335
-
336
- ## Safety
337
-
338
- `handoff` writes **live credentials** — cookies including the HttpOnly ones page script cannot
339
- read. They land under `FOXFETCH_HOME`, owner-only, and expire after `FOXFETCH_ARTIFACT_TTL`.
340
-
341
- Every tool response reports what is still on disk, and once a file is older than
342
- `FOXFETCH_REMIND_AFTER` the response grows a `reminder` telling the agent to call `cleanup` and to
343
- pass `keep=[...]` for anything the user still needs to look at. The field disappears the moment
344
- cleanup runs, so a stale reminder is a visible bug rather than a silent one.
345
-
346
- ## What it is not
347
-
348
- - Not a screenshot tool, not a clicker, not a layout engine — Chromium does that, once it has the
349
- identity `handoff` exported.
350
- - Not a session store: every context is fresh, nothing survives `close`.
351
- - Not a fingerprint randomiser: guessing a profile that matches nobody is worse than sending a
352
- real Firefox.
353
-
354
- ## Development
355
-
356
- ```bash
357
- pip install -e '.[dev]'
358
- pytest -q # 45 tests, no network
359
- mypy src # strict
360
- ```
361
-
362
- ```bash
363
- # when github.com:443 is reset but api.github.com answers, push through the API
364
- python tools/push_via_api.py --repo <owner>/<name> --dry-run
365
- ```
366
-
367
- The tests encode the bugs this rewrite exists to prevent: a clip that split UTF-8 sequences, a URL
368
- compare that ignored the trailing slash, `sameSite: "Default"` rejected by Playwright, a `cleanup`
369
- that only deleted expired files, and a runaway browser left behind when the screenshot threw.
370
-
371
- ## Troubleshooting
372
-
373
- | Symptom | Cause | Fix |
374
- |---|---|---|
375
- | `cannot start the Python service` (DSH) | the plugin found a different interpreter | set `FOXFETCH_PY` to the absolute path |
376
- | `ModuleNotFoundError: mcp.server.fastmcp` | `mcp` 2.x installed | `pip install "mcp>=1.30,<2"` |
377
- | `no live context for that origin` | context idled out (60 s) or was evicted | pass `url` again, or keep `context_id` |
378
- | `navigation produced an empty document` | slow page, or one that needs a real renderer | raise `timeout_ms`, or use `handoff` + Chromium |
379
- | tools appear twice | two entries in one host | remove one |
380
- | `pip install` stops mid-download | flaky network to `files.pythonhosted.org` | retry, or `pip install --proxy http://127.0.0.1:7897 foxfetch` |
381
-
382
- ## Uninstall
383
-
384
- ```bash
385
- pip uninstall foxfetch
386
- ```
387
-
388
- Artifacts: `%LOCALAPPDATA%\foxfetch` (Windows) or `~/.local/share/foxfetch`. Then delete the host
389
- entry — the `mcpServers` block, the `[mcp_servers.foxfetch]` table, or the `dsh-foxfetch`
390
- dependency plus its bundle line.
391
-
392
- ## Licence
393
-
394
- MIT. The engine (`ruyijs`) is a separate project under AGPL-3.0; foxfetch only calls it — no
395
- ruyijs code is bundled.
File without changes
File without changes
File without changes
File without changes
File without changes