@xzxzzx/bilibili-mcp 1.10.1 → 1.11.0

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.
Files changed (142) hide show
  1. package/README.md +172 -54
  2. package/README_EN.md +177 -54
  3. package/assets/readme/hero-en.svg +68 -92
  4. package/assets/readme/hero-overview.png +0 -0
  5. package/assets/readme/hero.svg +68 -92
  6. package/assets/readme/install-flow-en.svg +108 -0
  7. package/assets/readme/install-flow.svg +108 -0
  8. package/dist/asr/installer.d.ts +44 -0
  9. package/dist/asr/installer.d.ts.map +1 -0
  10. package/dist/asr/installer.js +455 -0
  11. package/dist/asr/installer.js.map +1 -0
  12. package/dist/asr/state.d.ts +45 -0
  13. package/dist/asr/state.d.ts.map +1 -0
  14. package/dist/asr/state.js +228 -0
  15. package/dist/asr/state.js.map +1 -0
  16. package/dist/asr/transcription.d.ts +45 -0
  17. package/dist/asr/transcription.d.ts.map +1 -0
  18. package/dist/asr/transcription.js +556 -0
  19. package/dist/asr/transcription.js.map +1 -0
  20. package/dist/bilibili/chapters.d.ts.map +1 -1
  21. package/dist/bilibili/chapters.js +5 -5
  22. package/dist/bilibili/chapters.js.map +1 -1
  23. package/dist/bilibili/comments.d.ts.map +1 -1
  24. package/dist/bilibili/comments.js +69 -9
  25. package/dist/bilibili/comments.js.map +1 -1
  26. package/dist/bilibili/favorites.d.ts +4 -0
  27. package/dist/bilibili/favorites.d.ts.map +1 -1
  28. package/dist/bilibili/favorites.js +30 -6
  29. package/dist/bilibili/favorites.js.map +1 -1
  30. package/dist/bilibili/fingerprint.d.ts.map +1 -1
  31. package/dist/bilibili/fingerprint.js +74 -29
  32. package/dist/bilibili/fingerprint.js.map +1 -1
  33. package/dist/bilibili/http.d.ts +11 -4
  34. package/dist/bilibili/http.d.ts.map +1 -1
  35. package/dist/bilibili/http.js +106 -51
  36. package/dist/bilibili/http.js.map +1 -1
  37. package/dist/bilibili/metadata.d.ts.map +1 -1
  38. package/dist/bilibili/metadata.js +5 -4
  39. package/dist/bilibili/metadata.js.map +1 -1
  40. package/dist/bilibili/navigation.d.ts.map +1 -1
  41. package/dist/bilibili/navigation.js +3 -2
  42. package/dist/bilibili/navigation.js.map +1 -1
  43. package/dist/bilibili/playback.d.ts +20 -0
  44. package/dist/bilibili/playback.d.ts.map +1 -0
  45. package/dist/bilibili/playback.js +148 -0
  46. package/dist/bilibili/playback.js.map +1 -0
  47. package/dist/bilibili/search.d.ts.map +1 -1
  48. package/dist/bilibili/search.js +15 -11
  49. package/dist/bilibili/search.js.map +1 -1
  50. package/dist/bilibili/subtitle.d.ts +1 -1
  51. package/dist/bilibili/subtitle.d.ts.map +1 -1
  52. package/dist/bilibili/subtitle.js +127 -106
  53. package/dist/bilibili/subtitle.js.map +1 -1
  54. package/dist/bilibili/types.d.ts +1 -1
  55. package/dist/bilibili/types.d.ts.map +1 -1
  56. package/dist/bilibili/video-api.d.ts +12 -10
  57. package/dist/bilibili/video-api.d.ts.map +1 -1
  58. package/dist/bilibili/video-api.js +204 -7
  59. package/dist/bilibili/video-api.js.map +1 -1
  60. package/dist/bilibili/wbi.d.ts +6 -1
  61. package/dist/bilibili/wbi.d.ts.map +1 -1
  62. package/dist/bilibili/wbi.js +145 -68
  63. package/dist/bilibili/wbi.js.map +1 -1
  64. package/dist/cli.d.ts +30 -1
  65. package/dist/cli.d.ts.map +1 -1
  66. package/dist/cli.js +228 -115
  67. package/dist/cli.js.map +1 -1
  68. package/dist/index.js +2 -2
  69. package/dist/index.js.map +1 -1
  70. package/dist/security/limits.d.ts +31 -0
  71. package/dist/security/limits.d.ts.map +1 -0
  72. package/dist/security/limits.js +33 -0
  73. package/dist/security/limits.js.map +1 -0
  74. package/dist/security/operation-context.d.ts +7 -0
  75. package/dist/security/operation-context.d.ts.map +1 -0
  76. package/dist/security/operation-context.js +45 -0
  77. package/dist/security/operation-context.js.map +1 -0
  78. package/dist/security/pinned-https.d.ts +14 -0
  79. package/dist/security/pinned-https.d.ts.map +1 -0
  80. package/dist/security/pinned-https.js +228 -0
  81. package/dist/security/pinned-https.js.map +1 -0
  82. package/dist/server/bounded-stdio-transport.d.ts +35 -0
  83. package/dist/server/bounded-stdio-transport.d.ts.map +1 -0
  84. package/dist/server/bounded-stdio-transport.js +126 -0
  85. package/dist/server/bounded-stdio-transport.js.map +1 -0
  86. package/dist/server/error-response.d.ts +7 -0
  87. package/dist/server/error-response.d.ts.map +1 -1
  88. package/dist/server/error-response.js +34 -4
  89. package/dist/server/error-response.js.map +1 -1
  90. package/dist/server/tool-handlers.d.ts +1 -7
  91. package/dist/server/tool-handlers.d.ts.map +1 -1
  92. package/dist/server/tool-handlers.js +46 -22
  93. package/dist/server/tool-handlers.js.map +1 -1
  94. package/dist/server/tool-schemas.d.ts.map +1 -1
  95. package/dist/server/tool-schemas.js +19 -14
  96. package/dist/server/tool-schemas.js.map +1 -1
  97. package/dist/server.js +5 -4
  98. package/dist/server.js.map +1 -1
  99. package/dist/utils/bounded-response.d.ts +3 -0
  100. package/dist/utils/bounded-response.d.ts.map +1 -0
  101. package/dist/utils/bounded-response.js +63 -0
  102. package/dist/utils/bounded-response.js.map +1 -0
  103. package/dist/utils/bounded-text.d.ts +17 -0
  104. package/dist/utils/bounded-text.d.ts.map +1 -0
  105. package/dist/utils/bounded-text.js +132 -0
  106. package/dist/utils/bounded-text.js.map +1 -0
  107. package/dist/utils/cache.d.ts +9 -0
  108. package/dist/utils/cache.d.ts.map +1 -1
  109. package/dist/utils/cache.js +82 -2
  110. package/dist/utils/cache.js.map +1 -1
  111. package/dist/utils/error-guidance.d.ts +2 -2
  112. package/dist/utils/error-guidance.d.ts.map +1 -1
  113. package/dist/utils/error-guidance.js +117 -15
  114. package/dist/utils/error-guidance.js.map +1 -1
  115. package/dist/utils/errors.d.ts +14 -0
  116. package/dist/utils/errors.d.ts.map +1 -1
  117. package/dist/utils/errors.js +26 -0
  118. package/dist/utils/errors.js.map +1 -1
  119. package/dist/utils/logger.d.ts +1 -4
  120. package/dist/utils/logger.d.ts.map +1 -1
  121. package/dist/utils/logger.js +54 -17
  122. package/dist/utils/logger.js.map +1 -1
  123. package/dist/utils/retry.d.ts +4 -5
  124. package/dist/utils/retry.d.ts.map +1 -1
  125. package/dist/utils/retry.js +25 -10
  126. package/dist/utils/retry.js.map +1 -1
  127. package/dist/utils/sanitization.d.ts.map +1 -1
  128. package/dist/utils/sanitization.js +2 -1
  129. package/dist/utils/sanitization.js.map +1 -1
  130. package/dist/utils/update-check.d.ts +2 -9
  131. package/dist/utils/update-check.d.ts.map +1 -1
  132. package/dist/utils/update-check.js +91 -4
  133. package/dist/utils/update-check.js.map +1 -1
  134. package/dist/utils/validation.d.ts +1 -1
  135. package/dist/utils/validation.d.ts.map +1 -1
  136. package/dist/utils/validation.js +30 -26
  137. package/dist/utils/validation.js.map +1 -1
  138. package/docs/client-setup.en.md +63 -11
  139. package/docs/client-setup.md +61 -11
  140. package/docs/tool-reference.en.md +34 -5
  141. package/docs/tool-reference.md +34 -5
  142. package/package.json +3 -3
package/README.md CHANGED
@@ -1,7 +1,3 @@
1
- <p align="center">
2
- <img src="./assets/readme/hero.svg" width="100%" alt="Bilibili MCP:自动读取当前账号的全部收藏夹,并通过 next_cursor 逐页遍历视频">
3
- </p>
4
-
5
1
  # Bilibili MCP
6
2
 
7
3
  <p align="center">
@@ -10,82 +6,209 @@
10
6
  <a href="https://www.gnu.org/licenses/gpl-3.0"><img src="https://img.shields.io/badge/License-GPLv3-blue.svg" alt="GPL-3.0 license"></a>
11
7
  </p>
12
8
 
13
- <p align="center">
14
- 让 Codex、Claude、Cursor 等 AI 客户端从 Bilibili 主题或当前账号的收藏夹出发,获得可继续调用的 BVID、字幕上下文和可直达播放时刻的证据链接。
15
- </p>
9
+ Bilibili MCP 是一个本地 MCP server,让 AI Agent 读取 Bilibili 内容:读取字幕与评论,按主题搜索视频,遍历自己账号的收藏夹。即使视频没有字幕,通过 `setup` 安装本地 ASR 模型后也能读到它的文字内容。
16
10
 
17
11
  <p align="center">
18
12
  <a href="./README_EN.md">English</a> ·
19
- <a href="./docs/client-setup.md">全部 Agent / 客户端配置</a> ·
13
+ <a href="./docs/client-setup.md">客户端配置指南</a> ·
20
14
  <a href="./docs/tool-reference.md">工具参考</a> ·
15
+ <a href="#本地-asr可选">本地 ASR(可选)</a> ·
21
16
  <a href="./CHANGELOG.md">更新日志</a> ·
22
- <a href="https://www.npmjs.com/package/@xzxzzx/bilibili-mcp">npm</a> ·
23
17
  <a href="https://github.com/XZXZZX-Ai/bilibili-mcp/releases/latest">最新 Release</a>
24
18
  </p>
25
19
 
26
- ## 两个入口,一条证据链
20
+ <p align="center">
21
+ <img src="./assets/readme/hero-overview.png" width="100%" alt="搜索到的视频经过本地 MCP server 处理,产出带时间点的字幕、章节、评论和收藏夹结果">
22
+ </p>
23
+
24
+ <p align="center"><sub>搜索候选 → 本地 MCP → 字幕定位 · 章节 · 评论 · 收藏夹</sub></p>
27
25
 
28
- - **从我的收藏夹开始**:首次调用无需 Folder ID;Agent 每次读取一个最多 20 条的上游页面,并把返回的 `next_cursor` 原样用于下一次调用,直到响应不再包含它。
29
- - **从一个主题开始**:按关键词返回最多 10 个普通视频候选,不自动抓取候选的字幕或评论。
30
- - **拿到 BVID 之后**:继续读取字幕、元数据、章节或热门评论;关键词命中可返回直达播放时刻的 `timestamp_url`。
26
+ ## 它能做什么
31
27
 
32
- > [!NOTE]
33
- > **真实验收链路:**搜索视频 → 选择 `BV1Eb411u7Fw` 的 P4 → 在字幕中搜索“函数” → 返回上下文与可直达的 [`?p=4&t=1.12`](https://www.bilibili.com/video/BV1Eb411u7Fw/?p=4&t=1.12) 证据链接。视频搜索、收藏夹分页和转录的成功结果都同时提供兼容文本与 MCP `structuredContent`。
28
+ - **读字幕与评论**:读取字幕全文,或用关键词搜索原话——每条命中附带上下文、时间点和可直接跳转的 B 站时刻链接;阅读按热度(默认)或时间排序的评论与回复,含时间戳的评论会被优先保留。
29
+ - **读单个视频**:查看标题、作者、播放量等元数据,以及分 P 结构和章节。
30
+ - **找到视频**:按主题搜索 B 站,得到按平台综合排序、带标题、UP 主、时长和 BVID 的候选列表。
31
+ - **浏览收藏夹**:遍历当前登录账号创建、且 Bilibili 当前可见的全部收藏夹,逐页读取其中的视频。
32
+ - **无字幕时本地转录**:对确认没有字幕的视频,可显式选择用本机 ASR(faster-whisper)转录,得到与字幕相同结构的转录结果。默认关闭,可在 `setup` 时选择下载 ASR 模型,详见[本地 ASR(可选)](#本地-asr可选)。
33
+
34
+ ## 快速开始
35
+
36
+ ### 让 Agent 辅助安装(推荐)
37
+
38
+ 把以下提示词完整复制给 Agent:它会完成自己擅长的事(确认客户端、写入 server 配置、检查登录状态),所有涉及 Cookie 的环节都会暂停,交由你本人在本地终端完成。
39
+
40
+ ```text
41
+ 请帮我安装 Bilibili MCP server:@xzxzzx/bilibili-mcp。
42
+
43
+ 1. 先确认我当前使用的 MCP 客户端,无法确定时请询问我,不要猜测。
44
+ 同时运行 node --version 确认 Node.js 为 20 或更高;未安装或版本过低时,先引导我安装或升级。
45
+ 2. 打开 https://github.com/XZXZZX-Ai/bilibili-mcp/blob/master/docs/client-setup.md,
46
+ 找到与当前客户端匹配的配置小节,添加本地 stdio server:
47
+ - server 名称:bilibili-mcp
48
+ - command:npx
49
+ - args:["-y", "@xzxzzx/bilibili-mcp@latest"]
50
+ 3. 不要要求、接收、收集或显示我的 Cookie 值,也不要自行将其写入聊天或客户端配置中。
51
+ 4. 暂停并引导我本人在本地终端运行:
52
+ npx -y @xzxzzx/bilibili-mcp@latest setup
53
+ npx -y @xzxzzx/bilibili-mcp@latest check
54
+ npx -y @xzxzzx/bilibili-mcp@latest doctor --json
55
+ doctor --json 只检查本机配置状态,不能代替后面的实时登录验证。
56
+ setup 会询问是否安装可选的本地 ASR 模型,选否即可。
57
+ 5. 让我重启或重连客户端。你无法代替我完成这一步时,请明确让我操作。
58
+ 6. 重连后调用 MCP 工具 check_bilibili_credentials。
59
+ 只有 configured: true 且 logged_in: true 才报告成功。
60
+ - configured: false 或 needs_credentials → 让我运行 npx -y @xzxzzx/bilibili-mcp@latest setup
61
+ - logged_in: false → 让我运行 npx -y @xzxzzx/bilibili-mcp@latest config 强制重配,然后重连再检查
62
+ - MCP server 不可用 → 检查客户端配置并重连
63
+ 7. 验证成功后:调用一次 search_bilibili_videos(任选主题,如"离散数学"),
64
+ 能返回视频列表即说明 Agent 已可读取 Bilibili。
65
+ ```
66
+
67
+ ### 手动安装
68
+
69
+ **前置条件:**[Node.js](https://nodejs.org/) 20+
70
+
71
+ 不想用 Agent 辅助时,按下面四步完成同样的流程:
72
+
73
+ 1. **确认环境** — 在终端运行 `node --version` 和 `npx --version`,确保 Node.js 为 v20 或更高版本。
74
+ 2. **添加服务** — 在 MCP 客户端中新增 stdio server:`command` 设为 `npx`,`args` 设为 `-y`, `@xzxzzx/bilibili-mcp@latest`。具体操作见[客户端配置指南](./docs/client-setup.md#客户端配置)。
75
+ 3. **本地配置** — 在终端运行 `npx -y @xzxzzx/bilibili-mcp@latest setup` 配置凭证,再运行 `npx -y @xzxzzx/bilibili-mcp@latest check` 确认凭证已加载。`npx -y @xzxzzx/bilibili-mcp@latest doctor --json` 可获取不含秘密的本机配置状态。
76
+
77
+ 输入不回显,Cookie 只进入本地隐藏提示符,不要粘贴到 Agent 聊天或客户端配置里。凭证字段怎么找:见[从浏览器获取凭证字段](./docs/client-setup.md#从浏览器获取凭证字段)。`setup` 还会询问是否安装可选的本地 ASR 模型(默认否),见[本地 ASR(可选)](#本地-asr可选)。
78
+ 4. **验证登录** — 重连客户端后,让 Agent 调用 MCP 工具 `check_bilibili_credentials` 确认 `configured: true` 且 `logged_in: true`。`doctor --json` 只检查本机状态,不能代替这一步的实时登录验证。验证成功后,再让 Agent 调用一次 `search_bilibili_videos`(任选主题),能返回视频列表即安装完成。
79
+
80
+ <p align="center">
81
+ <img src="./assets/readme/install-flow.svg" width="100%" alt="安装流程:环境 → 接入 → 凭证 → 验证 → 成功,手动与 Agent 辅助安装共用同一骨架">
82
+ </p>
83
+
84
+ 凭证保存在 `~/.bilibili-mcp/config.json`(Windows:`%USERPROFILE%\.bilibili-mcp\config.json`),不保证操作系统级加密。登录失败时的排查路径见[客户端配置指南](./docs/client-setup.md#凭证配置与验证)。
34
85
 
35
- ## 先让 Agent 帮你接入
86
+ ## 使用示例
36
87
 
37
- Agent 安装提示词、全部客户端配置位置、CLI / JSON / TOML 示例、Cookie 配置与登录验证,都集中在唯一完整入口:
88
+ ### 读取视频的字幕与评论
38
89
 
39
- ### [打开 Agent / 客户端安装指南 →](./docs/client-setup.md)
90
+ ```text
91
+ 读取 BV1Eb411u7Fw 的字幕,带时间戳返回;
92
+ 再获取这个视频最热门的评论和回复。
93
+ ```
94
+
95
+ Agent 返回带时间戳的字幕文本,以及热门评论与回复;含时间戳的评论会被优先保留。
96
+
97
+ ### 按主题搜索视频
98
+
99
+ ```text
100
+ 搜索 B 站上关于"离散数学"的视频,按 B 站综合排序列出 5 个候选,
101
+ 包含标题、UP 主、时长和 BVID;先不要读取字幕。
102
+ ```
103
+
104
+ Agent 返回 5 个候选,各带标题、UP 主、时长和 BVID。选中候选后,把 BVID 直接交给转录、元数据、章节或评论工具。
40
105
 
41
- 安装完成后,可以直接测试收藏夹遍历:
106
+ ### 在转录中定位原话和时刻
42
107
 
43
108
  ```text
44
- 读取我当前登录账号创建的全部收藏夹。每次拿到 next_cursor 就继续调用,
45
- 直到响应不再包含 next_cursor;按收藏夹列出视频标题和 BVID,不要生成笔记。
109
+ 读取 BV1Eb411u7Fw 的 P4 字幕,搜索"函数",
110
+ 返回命中上下文、时间点和可以直接打开的 B 站链接。
46
111
  ```
47
112
 
48
- ## 10 个工具,分成三层
113
+ 每条命中附带原文上下文、时间点和可直达的 B 站时刻链接。
114
+
115
+ > [!NOTE]
116
+ > **已验证的验收链路:**搜索视频 → 选择 `BV1Eb411u7Fw` 的 P4 → 在字幕中搜索 `函数` → 返回上下文与可直达的 [`?p=4&t=1.12`](https://www.bilibili.com/video/BV1Eb411u7Fw/?p=4&t=1.12) 证据链接。Bilibili 可能移除或变更该示例视频。
117
+
118
+ ### 遍历全部收藏夹
119
+
120
+ <p align="center">
121
+ <img src="./assets/readme/hero.svg" width="100%" alt="收藏夹遍历流程:收藏夹 → 读一页 → next_cursor → 完成,分页循环直到 next_cursor 不再出现">
122
+ </p>
123
+
124
+ ```text
125
+ 遍历我当前登录账号创建且 Bilibili 当前可见的全部收藏夹。持续跟随
126
+ next_cursor 直到结束;按收藏夹列出成功读取的视频标题和 B 站视频 ID(BVID),
127
+ 并报告 skipped_count。
128
+ ```
49
129
 
50
- ### 发现入口
130
+ 每次 MCP 调用最多读取一个 20 条的上游页面;Agent 使用返回的 `next_cursor` 继续调用,直到该字段不再出现。最终按收藏夹输出成功读取的标题与 BVID 列表,以及被跳过的条目计数。
51
131
 
52
- `search_bilibili_videos` · `list_bilibili_favorite_videos`
132
+ ### 给没有字幕的视频做本地转录
53
133
 
54
- 从主题或当前账号的全部收藏夹获得 BVID。
134
+ ```text
135
+ 这个视频没有字幕。请调用 get_video_transcript 并把 fallback_to_asr 设为 true,
136
+ 用本地 ASR 转录当前这一 P,返回带时间戳的文本。
137
+ ```
55
138
 
56
- ### 内容证据
139
+ 前提是已经通过 `setup` 安装了模型且 `doctor --json` 报告 `asr.status: ready`,否则会返回 `ASR_NOT_READY` 并附带安装指引。原生字幕始终优先:只有确认没有可用字幕时才会启动一次本地转录,结果返回 `data_source: "asr"`,并复用与字幕相同的时间戳、区间过滤、关键词搜索和时刻链接。详见[本地 ASR](#本地-asr可选)。
57
140
 
58
- `get_video_transcript` · `get_video_info` · `get_video_metadata` · `get_video_chapters` · `get_video_comments`
141
+ ## 本地 ASR(可选)
59
142
 
60
- 读取字幕、时间定位、视频信息、章节和观众反馈。
143
+ 有些视频没有任何字幕。安装本地 ASR 模型后,`get_video_transcript` 可以在你显式开启 `fallback_to_asr` 时,对已解析的这一 P 做一次本地转录。
61
144
 
62
- ### 本机助手
145
+ **安装:**凭证配置完成后,`setup` 会询问是否安装本地 ASR 模型(默认否 `[y/N]`,需要 Python 3.9+)。可选模型:
63
146
 
64
- `get_credential_setup_instructions` · `check_bilibili_credentials` · `check_mcp_update`
147
+ | 模型 | 大小 | 说明 |
148
+ |---|---|---|
149
+ | tiny | ~78 MB | 最小占用 |
150
+ | base | ~148 MB | 折中选择 |
151
+ | small | ~486 MB | 推荐,Enter 默认选中 |
65
152
 
66
- 安全配置凭证、确认登录并检查版本。
153
+ Runtime 固定为 `faster-whisper==1.2.1`,模型存放在用户目录 `~/.bilibili-mcp/asr/`,通过 CPU INT8 加载验证后才算就绪,不需要系统 FFmpeg;同一目录仅保留一个活跃模型。`doctor --json` 的 `asr.status` 和 `asr.model` 报告就绪状态与已选模型(纯信息字段,不影响凭证退出状态)。
67
154
 
68
- 完整参数、JSON 示例、结构化错误和请求控制见[工具参考](./docs/tool-reference.md)。
155
+ **边界:**本地转录始终被约束在安全范围内——显式选择、资源受限、Cookie 隔离:
69
156
 
70
- ## 设计重点
157
+ - 原生 B 站字幕始终优先;只有确认无字幕、且你显式传了 `fallback_to_asr: true` 才启动转录。
158
+ - MCP 调用不会下载或切换模型;模型只通过 `setup` 安装。
159
+ - 一次只运行一个转录任务;单 P 时长上限 2 小时、音频上限 128 MiB、转录超时 30 分钟。
160
+ - 临时音频在成功、失败、超时等所有路径上都会被清理。
161
+ - Cookie 只发给 B 站官方接口,绝不发给 CDN 或本地 Python 子进程。
162
+ - 凭证、HTTP、限流等错误照常返回,不会被伪装成"没有字幕"。
71
163
 
72
- - **Bilibili 原生**:保留多 P、平台章节、热门评论和收藏夹成员关系,不把项目扩成通用下载器。
73
- - **证据优先**:字幕支持语言偏好、时间戳、时间区间与关键词上下文;命中项可以直接打开对应播放时刻。
74
- - **按需调用**:收藏夹工具只返回 Folder 上下文和视频条目,不自动生成笔记,也不预取字幕、评论或章节。
75
- - **凭证留在本机**:状态工具不会返回 `SESSDATA`、`bili_jct`、`DedeUserID` 或完整 Cookie。
164
+ `ASR_NOT_READY`、`ASR_BUSY`、`ASR_TRANSCRIPTION_TIMEOUT` 等错误码的完整语义见[工具参考](./docs/tool-reference.md)。
76
165
 
77
- ## 行为边界
166
+ ## 工具参考
78
167
 
79
- - “全部收藏夹”指当前登录账号创建、且 Bilibili API 当前可见的 Folder;遍历是实时 best-effort,不是快照。
80
- - 每次收藏夹调用最多读取一个 20 条上游页面。Agent 必须持续跟随 `next_cursor`;失效或无法安全规范化的条目会计入 `skipped_count`。
81
- - 视频搜索和收藏夹发现都要求有效登录凭证,不提供匿名降级。
82
- - `get_video_transcript` 默认在无字幕时返回 `SUBTITLE_UNAVAILABLE`;只有显式设置 `fallback_to_description: true` 才会退回简介,时间定位与关键词搜索不会静默退回简介。
83
- - 章节只使用 Bilibili 创作者或平台数据;项目不会绕过付费、会员、地区、私密、下架或其他访问限制。
84
- - 所有请求由用户本机发起;本项目是第三方工具,不是 Bilibili 官方服务。
168
+ | 目标 | 工具 |
169
+ |---|---|
170
+ | 只有主题,还没有视频链接 | `search_bilibili_videos` |
171
+ | 从我的收藏夹开始读取 | `list_bilibili_favorite_videos` |
172
+ | 快速获取字幕优先的视频上下文 | `get_video_info` |
173
+ | 完整转录、关键词定位,或无字幕时本地 ASR | `get_video_transcript` |
174
+ | 查看标题、作者、播放量等结构化信息 | `get_video_metadata` |
175
+ | 查看观众反馈和评论回复 | `get_video_comments` |
176
+ | 查看视频章节/进度条分段 | `get_video_chapters` |
177
+ | 引导用户配置 Cookie | `get_credential_setup_instructions` |
178
+ | 检查 Cookie 是否已配置且已登录 | `check_bilibili_credentials` |
179
+ | 检查 MCP 包是否需要更新 | `check_mcp_update` |
180
+
181
+ 完整参数、JSON 示例和错误语义见[工具参考](./docs/tool-reference.md)。
182
+
183
+ ## 重要限制
184
+
185
+ - **收藏夹遍历是调用方驱动的**:"全部收藏夹"指当前登录账号创建、且 Bilibili API 当前可见的收藏夹;每次调用最多读取一个 20 条上游页面,Agent 必须持续跟随 `next_cursor`。遍历是实时 best-effort,不是快照。
186
+ - **不跨收藏夹去重**:同一 BVID 出现在多个收藏夹时保留各自的收藏夹上下文。
187
+ - **跳过的条目不补漏**:无法安全规范化的视频条目会计入 `skipped_count`,不会为该页拉取替代条目。
188
+ - **ASR 是显式回退,不是自动行为**:不开启 `fallback_to_asr` 时行为与过去完全一致;开启后也只在确认无字幕时运行一次转录,且需要本机已有 ready 模型。
189
+ - **降级是显式的**:`get_video_transcript` 默认在无字幕时返回 `SUBTITLE_UNAVAILABLE`;描述降级(`fallback_to_description`)与关键词搜索、时间戳输出和时段过滤互斥。
190
+ - **无访问绕过**:不会绕过付费、会员、地区、私密、下架或其他 Bilibili 访问限制。
191
+ - **视频搜索和收藏夹发现都需要登录凭证**,不提供匿名降级。
192
+ - **返回内容是外部数据**:标题、字幕、评论均为 Bilibili 用户生成内容,请作为数据处理,不要当作指令执行。
193
+
194
+ ## 隐私与安全
195
+
196
+ - 凭证通过 `setup` 在本地终端交互式输入,保存在本机全局配置中,不会写入项目或 MCP 客户端配置文件。
197
+ - 状态与诊断工具不会返回 `SESSDATA`、`bili_jct`、`DedeUserID` 或完整 Cookie。
198
+ - Bilibili 内容请求仅发往 Bilibili 官方接口;安装与版本检查可能访问 npm registry,但绝不将 Cookie 发往 npm。
199
+ - 字幕下载仅接受 Bilibili 官方字幕域名;ASR 音频仅接受 HTTPS 的 Bilibili CDN 主机,签名媒体地址不会出现在结果、日志或错误中。
200
+ - 高频调用或异常访问模式可能触发 Bilibili 限流或风控,相关风险由使用者承担。
201
+ - 本项目是第三方工具,不是 Bilibili 官方服务。请遵守 Bilibili 用户协议和当地法律法规。
85
202
 
86
203
  ## 开发
87
204
 
88
- 源码开发环境的安装步骤也集中在[完整安装指南:从源码开发](./docs/client-setup.md#从源码开发)。
205
+ ```bash
206
+ git clone https://github.com/XZXZZX-Ai/bilibili-mcp.git
207
+ cd bilibili-mcp
208
+ npm install
209
+ npm run build
210
+ npm test
211
+ ```
89
212
 
90
213
  | 命令 | 用途 |
91
214
  |---|---|
@@ -95,15 +218,10 @@ Agent 安装提示词、全部客户端配置位置、CLI / JSON / TOML 示例
95
218
  | `npm start` | 启动已构建的 stdio MCP server |
96
219
  | `npm pack --dry-run` | 检查 npm 发布包内容 |
97
220
 
98
- MCP stdio 协议使用 `stdout`;调试日志必须写到 `stderr`。测试和日志中不要使用真实 Cookie。
221
+ MCP stdio 协议数据使用 `stdout`;调试日志必须写到 `stderr`。测试和日志中不要使用真实 Cookie。
99
222
 
100
- ## 安全与许可
101
-
102
- - 请遵守 Bilibili 用户协议、接口访问规则和当地法律法规,不要用于大规模抓取、商业剥削、绕过权限或其他滥用场景。
103
- - 高频调用、异常访问模式或 Cookie 泄露可能触发限流、风控或账号异常,相关风险由使用者承担。
104
- - 本项目仅向 Bilibili 官方接口发送 Bilibili 凭证,不会把 Cookie 上传到第三方服务;本地配置文件不承诺系统级加密。
105
- - 本项目基于 [GNU General Public License v3.0](./LICENSE) 开源。
106
-
107
- ## 反馈
223
+ ## 帮助与许可
108
224
 
109
225
  遇到问题或有功能建议,请提交 [GitHub Issue](https://github.com/XZXZZX-Ai/bilibili-mcp/issues);一般讨论可前往 [GitHub Discussions](https://github.com/XZXZZX-Ai/bilibili-mcp/discussions)。
226
+
227
+ 本项目基于 [GNU General Public License v3.0](./LICENSE) 开源。
package/README_EN.md CHANGED
@@ -1,7 +1,3 @@
1
- <p align="center">
2
- <img src="./assets/readme/hero-en.svg" width="100%" alt="Bilibili MCP: traverse every Favorite Folder page by page by following next_cursor">
3
- </p>
4
-
5
1
  # Bilibili MCP
6
2
 
7
3
  <p align="center">
@@ -10,83 +6,215 @@
10
6
  <a href="https://www.gnu.org/licenses/gpl-3.0"><img src="https://img.shields.io/badge/License-GPLv3-blue.svg" alt="GPL-3.0 license"></a>
11
7
  </p>
12
8
 
13
- <p align="center">
14
- Let Codex, Claude, Cursor, and other AI clients start from a Bilibili topic or the current account's Favorite Folders, then retrieve reusable BVIDs, transcript context, and evidence links that open at the exact playback time.
15
- </p>
9
+ Bilibili MCP is a local MCP server that lets AI agents read Bilibili: transcripts and comments, video search by topic, and a walk through your account's Favorite Folders. Even videos without subtitles become readable once you install the local ASR model.
16
10
 
17
11
  <p align="center">
18
12
  <a href="./README.md">简体中文</a> ·
19
- <a href="./docs/client-setup.en.md">All agent / client setups</a> ·
13
+ <a href="./docs/client-setup.en.md">Client setup guide</a> ·
20
14
  <a href="./docs/tool-reference.en.md">Tool reference</a> ·
15
+ <a href="#local-asr-optional">Local ASR (optional)</a> ·
21
16
  <a href="./CHANGELOG_EN.md">Changelog</a> ·
22
- <a href="https://www.npmjs.com/package/@xzxzzx/bilibili-mcp">npm</a> ·
23
17
  <a href="https://github.com/XZXZZX-Ai/bilibili-mcp/releases/latest">Latest release</a>
24
18
  </p>
25
19
 
26
- ## Two entrances, one evidence path
20
+ <p align="center">
21
+ <img src="./assets/readme/hero-overview.png" width="100%" alt="Searched videos pass through the local MCP server and yield timestamped transcripts, chapters, comments, and Favorite Folder results">
22
+ </p>
23
+
24
+ <p align="center"><sub>Search candidates → local MCP → transcript search · chapters · comments · favorites</sub></p>
27
25
 
28
- - **Start from my Favorites:** the first call needs no Folder ID. The Agent reads one upstream page of at most 20 rows, passes each returned `next_cursor` into the next call, and stops only when that field is absent.
29
- - **Start from a topic:** receive up to 10 normal-video candidates without automatically fetching candidate transcripts or comments.
30
- - **After obtaining a BVID:** retrieve its transcript, metadata, chapters, or popular comments. Keyword matches can include a direct `timestamp_url`.
26
+ ## What it does
31
27
 
32
- > [!NOTE]
33
- > **Verified workflow:** search → select Part 4 of `BV1Eb411u7Fw` → search its transcript for “函数” → receive bounded context and a direct [`?p=4&t=1.12`](https://www.bilibili.com/video/BV1Eb411u7Fw/?p=4&t=1.12) evidence link. Successful Video Search, Favorites-page, and transcript calls all provide compatible text plus MCP `structuredContent`.
28
+ - **Read transcripts and comments** — pull the full transcript or search it for keywords, every match carrying context, a timestamp, and a direct Bilibili link to that moment; read hot- (default) or time-sorted comments and replies, with timestamped comments kept with priority.
29
+ - **Read a single video** — fetch metadata such as title, creator, and play counts, plus the multi-part structure and chapters.
30
+ - **Find videos** — search Bilibili by topic and get candidates in Bilibili's platform order, each with title, creator, duration, and BVID.
31
+ - **Browse favorites** — traverse every Favorite Folder your logged-in account created and Bilibili currently shows, page by page.
32
+ - **Transcribe subtitle-less videos locally** — for videos confirmed to have no subtitles, opt in to a local faster-whisper transcription that returns the same transcript shape as subtitles. Off by default; you can choose to download an ASR model during `setup`. See [Local ASR (optional)](#local-asr-optional).
33
+
34
+ ## Get started
35
+
36
+ ### Install with Agent assistance (recommended)
37
+
38
+ Copy the full prompt below to your Agent. It handles everything it safely can — identifying your client, writing the server configuration, and checking login state — and pauses for you whenever a step touches your Cookie:
39
+
40
+ ```text
41
+ Please help me install the Bilibili MCP server: @xzxzzx/bilibili-mcp.
42
+
43
+ 1. First identify which MCP client I'm using. Ask me if you can't tell — don't guess.
44
+ Also run node --version to confirm Node.js is 20 or newer; if missing or older, guide me to install or upgrade first.
45
+ 2. Open https://github.com/XZXZZX-Ai/bilibili-mcp/blob/master/docs/client-setup.en.md,
46
+ find the matching client section, and add a local stdio server:
47
+ - server name: bilibili-mcp
48
+ - command: npx
49
+ - args: ["-y", "@xzxzzx/bilibili-mcp@latest"]
50
+ 3. Never request, receive, collect, or display my Cookie values, and never write
51
+ them into chat or client config yourself.
52
+ 4. Stop and guide me to run these in my own local terminal:
53
+ npx -y @xzxzzx/bilibili-mcp@latest setup
54
+ npx -y @xzxzzx/bilibili-mcp@latest check
55
+ npx -y @xzxzzx/bilibili-mcp@latest doctor --json
56
+ doctor --json checks local configuration only; it does not replace the live login verification below.
57
+ setup will ask about installing the optional local ASR model; choosing no is fine.
58
+ 5. Ask me to restart or reconnect the client. When you can't do it for me,
59
+ tell me explicitly to do it myself.
60
+ 6. After reconnect, call the MCP tool check_bilibili_credentials.
61
+ Only report success when configured: true and logged_in: true.
62
+ - configured: false or needs_credentials → have me run npx -y @xzxzzx/bilibili-mcp@latest setup
63
+ - logged_in: false → have me run npx -y @xzxzzx/bilibili-mcp@latest config to force
64
+ reconfiguration, then reconnect and recheck
65
+ - MCP server unavailable → review client config and reconnect
66
+ 7. After verification succeeds: call search_bilibili_videos once (any topic, e.g.
67
+ "discrete mathematics"). A returned video list confirms the Agent can read Bilibili.
68
+ ```
69
+
70
+ ### Install manually
71
+
72
+ **Prerequisite:** [Node.js](https://nodejs.org/) 20+
73
+
74
+ Prefer to do it yourself? The same flow takes four steps:
75
+
76
+ 1. **Check your environment** — run `node --version` and `npx --version` in a terminal to confirm Node.js is v20 or later.
77
+ 2. **Add the server** — add a stdio server in your MCP client: `command` set to `npx`, `args` set to `-y`, `@xzxzzx/bilibili-mcp@latest`. Per-client steps live in the [client setup guide](./docs/client-setup.en.md#client-configuration).
78
+ 3. **Configure locally** — run `npx -y @xzxzzx/bilibili-mcp@latest setup` in your terminal to configure credentials, then `npx -y @xzxzzx/bilibili-mcp@latest check` to confirm they load. `npx -y @xzxzzx/bilibili-mcp@latest doctor --json` reports the secret-free local configuration state.
79
+
80
+ Input is not echoed; Cookie values go only into hidden local prompts — never paste them into Agent chat or client configuration. Where to find each field: [Finding credential fields in your browser](./docs/client-setup.en.md#finding-credential-fields-in-your-browser). `setup` also asks whether to install an optional local ASR model (default no); see [Local ASR (optional)](#local-asr-optional).
81
+ 4. **Verify the login** — after reconnecting the client, have your Agent call the MCP tool `check_bilibili_credentials` and confirm `configured: true` and `logged_in: true`. `doctor --json` only inspects local state; it does not replace this live login check. Once verification passes, have the Agent call `search_bilibili_videos` once (any topic); a returned video list means the installation is complete.
82
+
83
+ <p align="center">
84
+ <img src="./assets/readme/install-flow-en.svg" width="100%" alt="Installation flow: Runtime → Connect → Credentials → Verify → Success — one skeleton shared by manual and Agent-assisted installs">
85
+ </p>
86
+
87
+ Credentials are stored at `~/.bilibili-mcp/config.json` (Windows: `%USERPROFILE%\.bilibili-mcp\config.json`). Operating-system-level encryption is not guaranteed. For login-failure troubleshooting, see the [client setup guide](./docs/client-setup.en.md#credential-setup-and-verification).
34
88
 
35
- ## Let an Agent set it up
89
+ ## Usage examples
36
90
 
37
- The copyable Agent prompt, every client configuration location, CLI / JSON / TOML examples, Cookie setup, and login verification live in one complete source:
91
+ ### Read a video's transcripts and comments
38
92
 
39
- ### [Open the Agent / client installation guide →](./docs/client-setup.en.md)
93
+ ```text
94
+ Read the transcript of BV1Eb411u7Fw with timestamps,
95
+ then pull its most popular comments and replies.
96
+ ```
97
+
98
+ The Agent returns timestamped transcript lines, then hot comments with replies; comments containing timestamps are kept with priority.
99
+
100
+ ### Search for videos by topic
101
+
102
+ ```text
103
+ Search Bilibili for videos about "discrete mathematics". List 5 candidates
104
+ in Bilibili's overall platform order, with title, creator, duration, and
105
+ BVID. Do not fetch transcripts yet.
106
+ ```
107
+
108
+ The agent returns 5 candidates with title, creator, duration, and BVID. After choosing a candidate, pass its BVID straight to the transcript, metadata, chapter, or comment tools.
40
109
 
41
- After installation, test the complete Favorites traversal:
110
+ ### Find exact lines and moments in a transcript
42
111
 
43
112
  ```text
44
- Read every Favorite Folder created by my currently logged-in account.
45
- Whenever a response contains next_cursor, keep calling with it until that field
46
- is absent. Group the video titles and BVIDs by Folder; do not generate notes.
113
+ Read Part 4 of BV1Eb411u7Fw and search its transcript for the Chinese keyword
114
+ "函数". Return the matching context, time, and a Bilibili link to that moment.
47
115
  ```
48
116
 
49
- ## Ten tools in three layers
117
+ Each hit comes with the surrounding text, a timestamp, and a direct Bilibili moment link.
118
+
119
+ > [!NOTE]
120
+ > **Verified workflow:** search → select Part 4 of `BV1Eb411u7Fw` → search its transcript for `函数` → receive bounded context and a direct [`?p=4&t=1.12`](https://www.bilibili.com/video/BV1Eb411u7Fw/?p=4&t=1.12) evidence link. Bilibili may remove or change this example video.
121
+
122
+ ### Traverse every visible Favorite Folder
123
+
124
+ <p align="center">
125
+ <img src="./assets/readme/hero-en.svg" width="100%" alt="Favorites traversal flow: Folders → Read page → next_cursor → Complete, looping until next_cursor stops appearing">
126
+ </p>
127
+
128
+ ```text
129
+ Traverse every Favorite Folder created by my currently logged-in account and
130
+ currently visible through Bilibili. Keep following next_cursor until complete.
131
+ Group successfully read video titles and Bilibili video IDs (BVIDs) by Folder,
132
+ and report skipped_count.
133
+ ```
50
134
 
51
- ### Discovery
135
+ Each MCP call reads at most one upstream page of 20 rows. The Agent continues with the returned `next_cursor` until that field is absent. The final answer lists successfully read titles and BVIDs per folder, plus the skipped-entry count.
52
136
 
53
- `search_bilibili_videos` · `list_bilibili_favorite_videos`
137
+ ### Transcribe a video that has no subtitles
54
138
 
55
- Obtain BVIDs from a topic or every created Favorite Folder on the current account.
139
+ ```text
140
+ This video has no subtitles. Call get_video_transcript with fallback_to_asr
141
+ set to true and transcribe the current Part with local ASR. Return timestamped
142
+ text.
143
+ ```
56
144
 
57
- ### Content evidence
145
+ This requires a model installed through `setup` and `doctor --json` reporting `asr.status: ready`; otherwise the call returns `ASR_NOT_READY` with setup guidance. Native subtitles always win: a local transcription starts only when subtitles are confirmed unavailable, returns `data_source: "asr"`, and reuses the same timestamps, range filters, keyword search, and moment links. See [Local ASR](#local-asr-optional).
58
146
 
59
- `get_video_transcript` · `get_video_info` · `get_video_metadata` · `get_video_chapters` · `get_video_comments`
147
+ ## Local ASR (optional)
60
148
 
61
- Retrieve transcripts, timestamps, Video information, chapters, and viewer feedback.
149
+ Some videos ship without any subtitle. Once you install a local ASR model, `get_video_transcript` can run one bounded local transcription of the resolved Part when you explicitly pass `fallback_to_asr`.
62
150
 
63
- ### Local helpers
151
+ **Installation:** after credentials are configured, `setup` asks whether to install a local ASR model (defaults to No `[y/N]`, requires Python 3.9+). Available models:
64
152
 
65
- `get_credential_setup_instructions` · `check_bilibili_credentials` · `check_mcp_update`
153
+ | Model | Size | Notes |
154
+ |---|---|---|
155
+ | tiny | ~78 MB | smallest footprint |
156
+ | base | ~148 MB | middle ground |
157
+ | small | ~486 MB | recommended, selected on Enter |
66
158
 
67
- Configure credentials safely, verify login, and check the package version.
159
+ The runtime is pinned to `faster-whisper==1.2.1`. Models live under `~/.bilibili-mcp/asr/`, are verified by a CPU INT8 load before being marked ready, and do not require system FFmpeg; only one active model is kept per directory. `doctor --json` reports readiness and the selected model via `asr.status` and `asr.model` (informational fields that never affect credential exit codes).
68
160
 
69
- See the [tool reference](./docs/tool-reference.en.md) for complete parameters, JSON examples, structured errors, and request controls.
161
+ **Boundaries:** local transcription stays within safe bounds — opt-in, resource-capped, Cookie-isolated:
70
162
 
71
- ## Design priorities
163
+ - Native Bilibili subtitles always win; transcription starts only on confirmed no-subtitle states with an explicit `fallback_to_asr: true`.
164
+ - MCP calls never download or switch models; models install only through `setup`.
165
+ - One transcription at a time; per-Part duration capped at 2 hours, audio at 128 MiB, transcription timeout at 30 minutes.
166
+ - Temporary audio is removed on every success, failure, and timeout path.
167
+ - The Cookie goes only to official Bilibili APIs — never to CDN hosts or the local Python child process.
168
+ - Credential, HTTP, and throttling errors surface as-is; they are never disguised as "no subtitles".
72
169
 
73
- - **Bilibili-native:** preserve multi-Part Videos, platform Chapters, popular comments, and Favorite Membership instead of becoming a generic downloader.
74
- - **Evidence-first:** select a language, add timestamps, filter a time range, or search bounded transcript context; matches can open at the exact playback time.
75
- - **On demand:** Favorites discovery returns Folder context and Video rows only. It does not generate notes or prefetch transcripts, comments, or Chapters.
76
- - **Credentials stay local:** status tools never return `SESSDATA`, `bili_jct`, `DedeUserID`, or a complete Cookie.
170
+ For the full semantics of error codes such as `ASR_NOT_READY`, `ASR_BUSY`, and `ASR_TRANSCRIPTION_TIMEOUT`, see the [tool reference](./docs/tool-reference.en.md).
77
171
 
78
- ## Behavior boundaries
172
+ ## Tool reference
79
173
 
80
- - “Every Favorite Folder” means Folders created by the currently logged-in account and currently visible through the Bilibili API. Traversal is live best effort, not a snapshot.
81
- - Each Favorites call reads at most one upstream 20-row page. The Agent must keep following `next_cursor`; removed or unsafe-to-normalize rows are counted in `skipped_count`.
82
- - Video Search and Favorites discovery require valid logged-in credentials and do not fall back to anonymous requests.
83
- - `get_video_transcript` returns `SUBTITLE_UNAVAILABLE` by default when no subtitle exists. Description fallback requires explicit `fallback_to_description: true`; timed output and keyword search never silently use a description.
84
- - Chapters come only from Bilibili creator/platform data. The project does not bypass paid, member-only, regional, private, removed, or other access restrictions.
85
- - Requests originate on the user's machine. This is a third-party project, not an official Bilibili service.
174
+ | Goal | Tool |
175
+ |---|---|
176
+ | Have a topic but no video link yet | `search_bilibili_videos` |
177
+ | Start from my Favorites | `list_bilibili_favorite_videos` |
178
+ | Get subtitle-first video context | `get_video_info` |
179
+ | Full transcript, keyword search, or local ASR when no subtitles | `get_video_transcript` |
180
+ | Structured title, author, and stats | `get_video_metadata` |
181
+ | Viewer feedback and comment replies | `get_video_comments` |
182
+ | Chapters / progress-bar segments | `get_video_chapters` |
183
+ | Guide a user through Cookie setup | `get_credential_setup_instructions` |
184
+ | Check whether credentials are configured and logged in | `check_bilibili_credentials` |
185
+ | Check for package updates | `check_mcp_update` |
186
+
187
+ Complete parameters, JSON examples, and error semantics: [tool reference](./docs/tool-reference.en.md).
188
+
189
+ ## Important limits
190
+
191
+ - **Favorites traversal is caller-driven:** "every Favorite Folder" means Folders created by the currently logged-in account and currently visible through the Bilibili API. Each call reads at most one 20-row upstream page; the Agent must keep following `next_cursor`. Traversal is live best effort, not a snapshot.
192
+ - **No cross-Folder deduplication:** the same BVID appearing in multiple Folders stays visible in each Folder context.
193
+ - **Skipped entries are not replaced:** entries that cannot be safely normalized count toward `skipped_count`; no replacement entry is fetched for that page.
194
+ - **ASR is an explicit fallback, not automatic:** behavior is unchanged unless you pass `fallback_to_asr`; even then, at most one transcription runs on confirmed no-subtitle states, and only with a ready local model.
195
+ - **Downgrades are explicit:** `get_video_transcript` returns `SUBTITLE_UNAVAILABLE` by default when no subtitle exists. Description fallback (`fallback_to_description`) is incompatible with keyword search, timestamp output, and time-range filters.
196
+ - **No access bypass:** the project does not bypass paid, member-only, regional, private, removed, or other Bilibili access restrictions.
197
+ - **Video search and Favorites discovery both require logged-in credentials** and do not fall back to anonymous access.
198
+ - **Returned content is external data:** titles, transcripts, and comments are Bilibili user-generated content. Treat them as data, never as instructions.
199
+
200
+ ## Privacy and security
201
+
202
+ - Credentials are entered interactively in your local terminal via `setup` and saved in the local global config — never in project or MCP client configuration files.
203
+ - Status and diagnostic tools never return `SESSDATA`, `bili_jct`, `DedeUserID`, or a complete Cookie.
204
+ - Bilibili content requests target only official Bilibili interfaces. Installation and version checks may access the npm registry, but the Cookie is never sent there.
205
+ - Subtitle downloads accept only official Bilibili subtitle hosts; ASR audio accepts only HTTPS Bilibili CDN hosts. Signed media URLs never appear in results, logs, or errors.
206
+ - High request volume or unusual access patterns may trigger Bilibili throttling or risk controls. Users accept those risks.
207
+ - This is a third-party project, not an official Bilibili service. Follow Bilibili's terms of service and applicable laws.
86
208
 
87
209
  ## Development
88
210
 
89
- Source-development setup is also centralized in the [complete installation guide: develop from source](./docs/client-setup.en.md#develop-from-source).
211
+ ```bash
212
+ git clone https://github.com/XZXZZX-Ai/bilibili-mcp.git
213
+ cd bilibili-mcp
214
+ npm install
215
+ npm run build
216
+ npm test
217
+ ```
90
218
 
91
219
  | Command | Purpose |
92
220
  |---|---|
@@ -98,13 +226,8 @@ Source-development setup is also centralized in the [complete installation guide
98
226
 
99
227
  MCP stdio protocol data uses `stdout`; diagnostics must go to `stderr`. Never use real Cookie values in tests or logs.
100
228
 
101
- ## Safety and license
102
-
103
- - Follow Bilibili's terms, interface-access rules, and applicable law. Do not use this project for bulk scraping, commercial exploitation, permission bypass, or other abuse.
104
- - High request volume, unusual access patterns, or leaked Cookies may trigger throttling, risk controls, or account issues. Users accept those risks.
105
- - The project sends Bilibili credentials only to official Bilibili interfaces and does not upload Cookies to third-party services. Local credential files do not promise operating-system-level encryption.
106
- - This project is licensed under the [GNU General Public License v3.0](./LICENSE).
107
-
108
- ## Feedback
229
+ ## Help and license
109
230
 
110
231
  For bugs and feature requests, open a [GitHub Issue](https://github.com/XZXZZX-Ai/bilibili-mcp/issues). Use [GitHub Discussions](https://github.com/XZXZZX-Ai/bilibili-mcp/discussions) for general questions.
232
+
233
+ This project is licensed under the [GNU General Public License v3.0](./LICENSE).