Skip to main content
Glama
README.md
# 小汐 Bili Whale · Codex 本地移植

**插件来源:[Alterssss/dsh-bili-whale](https://github.com/Alterssss/dsh-bili-whale),MIT,v0.4.5,commit `6aae11f94241c67271b6ab6dbecfe806224920a9`。** 保留原作者 LICENSE 与 NOTICE,详细来源及改动边界见 [UPSTREAM.md](UPSTREAM.md)。这是独立的 Codex 移植,不是上游官方版本。

把原项目“有偏好、有作息、会读 B 站、会记日记”的核心接到 Codex 本地 MCP。上游阅读工具原样保留,新增 MCP 适配、隔离数据目录、作息机会领取、去重与测试。无需单独的模型 API key;理解和推荐由当前 Codex 执行。

## 能做什么

- 匿名热门候选、热评;配置登录后搜索、简介/字幕/弹幕摘要与官方字幕。
- 人设、兴趣偏好、时区、每天可活动窗口、每日次数和每次视频数。
- 按 BV 号去重、本地观察日记;通过 Codex 官方 heartbeat 调度工作流。**本包默认未开启自动化。**
- 10 个 MCP 工具,所有 B 站接口均为读取;本地日记和作息账本可写。

未移植:DSH 设置 UI、DSH 会话唤醒服务、实时私信/直播监听、对外评论/私信/动态/关注/点赞/投币、自动抽帧工具。上游抽帧等源文件保留作参考,但不代表已接入或验证。文本摘要不等于实际看过画面。不能保证 B 站未公开接口永久可用。

## 安装到本机 Codex

需要 Node.js 20+,在本目录运行:

```powershell
npm ci --ignore-scripts
npm test
npm run setup
codex mcp add xiaoxi_bili_whale -- node "完整路径/server.mjs"
codex mcp get xiaoxi_bili_whale
```

也可运行本包 `install.ps1`,它会使用当前真实 Node 路径并只添加本 MCP;同名项已存在时停止,不覆盖其他服务器。注册后重载 MCP 或重启 Codex,再用 whale_status 验证工具发现。工具能启动与配置存在不等于当前聊天已经热加载工具。

可直接对 Codex 说:“用小汐 Bili Whale 找两条热门候选,读热评,记下有意思的点。”

## 登录与私有数据

默认私有目录为本项目 `data/`;可用环境变量 `XIAOXI_BILI_DATA` 指向自己的独立目录。它不会读取原 DSH 的 ~/.bili-ai 或 ~/.dsh,也不会复制作者人设或账号。

需要登录的功能:在自己的浏览器手动取得 B 站 Cookie,保存为一个本地文本文件,然后运行:

```powershell
npm run setup -- --cookie-file "D:/你的私有目录/bili-cookie.txt"
```

也接受 JSON `{"sessdata":"...","bili_jct":"...","buvid3":"..."}`。之后调用 whale_session 核实账号。不要把 Cookie 发给聊天、上传 GitHub 或放进共享文件夹;导入后自行删除中间 Cookie 文本。Windows 私有文件继承目录 ACL,建议使用仅本人可访问的位置。data/ 被 Git 忽略,发布 ZIP 排除它。

`data/config.json` 包含 persona、preferences、timezone、startHour、endHour、cyclesPerDay、videosPerCycle、enabled。默认每日北京时间 20–24 点一次、每次最多 3 条。次数在 claim 时消耗,失败不反复补跑。公开视频数由 agent 工作流遵守,手动阅读调用不受这一周期上限硬拦截。

自主激活见 [HEARTBEAT.md](HEARTBEAT.md):先配置并确认账户/匿名模式,再明确让 Codex 创建 heartbeat。本 MCP 自身不会后台常驻唤醒模型;电脑和 Codex 宿主调度需要可用。随时 `npm run setup -- --disable` 停止新周期,并暂停对应自动化。

## 验证

`npm test`:时区/窗口/日额度/换日、日记去重、原子领取、写操作白名单拒绝、真实 MCP stdio 初始化与工具发现、输入校验和无凭据错误。2026-10-21 本机验证 5/5 通过;匿名热门与真实视频热评读取成功。登录、官方字幕和定时实际唤醒尚未验证,因为未提供账户凭据且尚未启用自动化。

Codex MCP 接入依据:[官方 MCP 文档](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)。`plugin.json` / `mcp.json` 提供便携本地插件描述;实际安装路径使用已验证的 Codex CLI MCP 注册,不宣称已上架插件目录。

卸载:`codex mcp remove xiaoxi_bili_whale`。日记与凭据不会自动删除。

TDQS

B3.4/5.0

Scored across 10 tools

Disambiguation4/5

Each tool maps to a distinct resource or lifecycle step, and the descriptions carefully separate whale_status (local config/credential presence) from whale_session (actual login verification), which is the most likely confusion point. The only remaining overlap is whale_video, which bundles metadata, subtitles, and comment digest that whale_subtitles and whale_comments also expose individually, so an agent may pick the wrapper or the granular tool arbitrarily.

Naming Consistency5/5

Every tool uses a uniform whale_<noun> snake_case pattern (whale_status, whale_popular, whale_comments, whale_diary), including the compound whale_claim_cycle. No camelCase or mixed verb/noun style breaks the pattern, so names are predictable and scannable.

Tool Count4/5

Ten tools is a healthy scope for a browsing/observation agent, and each one covers a distinct step (status, claim, discovery, content read, record, review). The subtitles/comments split from the aggregate video tool is slightly granular but defensible given login and credential differences.

Completeness4/5

The surface covers the full loop: check state, claim a cycle, discover videos (popular/search), read content (video/subtitles/comments), and write/read observations. Minor gaps exist around managing recorded diary entries (no update or delete/prune) and no explicit view of remaining quota beyond whale_status, but these are workable.

Maintenance

ActivityMaintained
ResponsivenessNo issues