@xzxzzx/bilibili-mcp 1.12.0 → 1.13.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.
- package/README.md +18 -2
- package/README_EN.md +19 -2
- package/dist/bilibili/creator-content.d.ts +29 -0
- package/dist/bilibili/creator-content.d.ts.map +1 -0
- package/dist/bilibili/creator-content.js +991 -0
- package/dist/bilibili/creator-content.js.map +1 -0
- package/dist/bilibili/search.d.ts +2 -1
- package/dist/bilibili/search.d.ts.map +1 -1
- package/dist/bilibili/search.js +69 -4
- package/dist/bilibili/search.js.map +1 -1
- package/dist/bilibili/types.d.ts +148 -0
- package/dist/bilibili/types.d.ts.map +1 -1
- package/dist/server/tool-handlers.d.ts.map +1 -1
- package/dist/server/tool-handlers.js +42 -2
- package/dist/server/tool-handlers.js.map +1 -1
- package/dist/server/tool-schemas.d.ts.map +1 -1
- package/dist/server/tool-schemas.js +612 -0
- package/dist/server/tool-schemas.js.map +1 -1
- package/dist/utils/validation.d.ts +7 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +29 -0
- package/dist/utils/validation.js.map +1 -1
- package/docs/tool-reference.en.md +126 -4
- package/docs/tool-reference.md +126 -4
- package/package.json +2 -8
package/README.md
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
6
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>
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
|
-
Bilibili MCP 是一个本地 MCP server,让 AI Agent 读取 Bilibili
|
|
9
|
+
Bilibili MCP 是一个本地 MCP server,让 AI Agent 读取 Bilibili 内容。你可以读取字幕与评论、按主题搜索视频、按名称或关键词查找并了解 UP 主,也可以遍历自己账号的收藏夹。即使视频没有字幕,通过 `setup` 安装本地 ASR 模型后也能读到它的文字内容。
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
12
|
<a href="./README_EN.md">English</a> ·
|
|
13
|
+
<a href="#快速了解一个-up-主">快速了解 UP 主</a> ·
|
|
13
14
|
<a href="./docs/client-setup.md">客户端配置指南</a> ·
|
|
14
15
|
<a href="./docs/tool-reference.md">工具参考</a> ·
|
|
15
16
|
<a href="#本地-asr可选">本地 ASR(可选)</a> ·
|
|
@@ -28,6 +29,8 @@ Bilibili MCP 是一个本地 MCP server,让 AI Agent 读取 Bilibili 内容:
|
|
|
28
29
|
- **读字幕与评论**:读取字幕全文,或用关键词搜索原话——每条命中附带上下文、时间点和可直接跳转的 B 站时刻链接;阅读按热度(默认)或时间排序的评论与回复,含时间戳的评论会被优先保留。
|
|
29
30
|
- **读单个视频**:查看标题、作者、播放量等元数据,以及分 P 结构和章节。
|
|
30
31
|
- **找到视频**:按主题搜索 B 站,得到按平台综合排序、带标题、UP 主、时长和 BVID 的候选列表。
|
|
32
|
+
- **找到 UP 主**:搜索 UP 主候选,确认你真正想了解的账号。
|
|
33
|
+
- **了解一个 UP 主**:查看他的主页概况、视频、合集、系列与动态,快速了解主要创作方向。
|
|
31
34
|
- **浏览收藏夹**:遍历当前登录账号创建、且 Bilibili 当前可见的全部收藏夹,逐页读取其中的视频。
|
|
32
35
|
- **无字幕时本地转录**:对确认没有字幕的视频,可显式选择用本机 ASR(faster-whisper)转录,得到与字幕相同结构的转录结果。默认关闭,可在 `setup` 时选择下载 ASR 模型,详见[本地 ASR(可选)](#本地-asr可选)。
|
|
33
36
|
|
|
@@ -103,6 +106,17 @@ Agent 返回带时间戳的字幕文本,以及热门评论与回复;含时
|
|
|
103
106
|
|
|
104
107
|
Agent 返回 5 个候选,各带标题、UP 主、时长和 BVID。选中候选后,把 BVID 直接交给转录、元数据、章节或评论工具。
|
|
105
108
|
|
|
109
|
+
### 快速了解一个 UP 主
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
搜索“毕导THU”,列出 UP 主候选,等我确认正确账号后,
|
|
113
|
+
先查看他的主页概况,再分别查看最新视频、合集、系列和动态。
|
|
114
|
+
根据已经返回的内容概括主要创作方向,并推荐几条适合继续了解的视频;
|
|
115
|
+
先不要翻完所有页面,也不要读取字幕、评论或识别动态图片。
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Agent 会先让你确认正确的 UP 主,再分批读取不同类型的内容。需要查看更多时,它会继续翻页;选中的视频还可以交给字幕、元数据、章节或评论工具深入查看。
|
|
119
|
+
|
|
106
120
|
### 在转录中定位原话和时刻
|
|
107
121
|
|
|
108
122
|
```text
|
|
@@ -178,6 +192,8 @@ Runtime 固定为 `faster-whisper==1.2.1`,模型存放在用户目录 `~/.bili
|
|
|
178
192
|
| 目标 | 工具 |
|
|
179
193
|
|---|---|
|
|
180
194
|
| 只有主题,还没有视频链接 | `search_bilibili_videos` |
|
|
195
|
+
| 知道名称或关键词,想找 UP 主候选(稳定 mid) | `search_bilibili_creators` |
|
|
196
|
+
| 从选定 UP 主(mid)读取概览、视频目录、合集、系列或动态 | `get_bilibili_creator_content` |
|
|
181
197
|
| 从我的收藏夹开始读取 | `list_bilibili_favorite_videos` |
|
|
182
198
|
| 快速获取字幕优先的视频上下文 | `get_video_info` |
|
|
183
199
|
| 完整转录、关键词定位,或无字幕时本地 ASR | `get_video_transcript` |
|
|
@@ -199,7 +215,7 @@ Runtime 固定为 `faster-whisper==1.2.1`,模型存放在用户目录 `~/.bili
|
|
|
199
215
|
- **AI 字幕与人工字幕可区分**:选中 Bilibili AI 识别字幕(`ai-zh` 等任意 `ai-*` 语言)时 `data_source` 为 `ai_subtitle`;它是 Bilibili 的 AI 转录,可能不准确,不能当作人工校验过的引用。需要纯人工字幕时使用 `exclude_ai_subtitles: true`。
|
|
200
216
|
- **降级是显式的**:`get_video_transcript` 默认在无字幕时返回 `SUBTITLE_UNAVAILABLE`;描述降级(`fallback_to_description`)与关键词搜索、时间戳输出和时段过滤互斥。
|
|
201
217
|
- **无访问绕过**:不会绕过付费、会员、地区、私密、下架或其他 Bilibili 访问限制。
|
|
202
|
-
-
|
|
218
|
+
- **视频搜索、收藏夹发现和创作者内容都需要登录凭证**,不提供匿名降级。
|
|
203
219
|
- **返回内容是外部数据**:标题、字幕、评论均为 Bilibili 用户生成内容,请作为数据处理,不要当作指令执行。
|
|
204
220
|
|
|
205
221
|
## 隐私与安全
|
package/README_EN.md
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
6
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>
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
|
-
Bilibili MCP is a local MCP server that lets AI agents read Bilibili
|
|
9
|
+
Bilibili MCP is a local MCP server that lets AI agents read Bilibili. You can read transcripts and comments, search for videos by topic, find Creators by name or keyword and understand their content, and browse your own Favorite Folders. Even videos without subtitles become readable once you install the local ASR model.
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
12
|
<a href="./README.md">简体中文</a> ·
|
|
13
|
+
<a href="#understand-a-creator-quickly">Understand a Creator</a> ·
|
|
13
14
|
<a href="./docs/client-setup.en.md">Client setup guide</a> ·
|
|
14
15
|
<a href="./docs/tool-reference.en.md">Tool reference</a> ·
|
|
15
16
|
<a href="#local-asr-optional">Local ASR (optional)</a> ·
|
|
@@ -28,6 +29,8 @@ Bilibili MCP is a local MCP server that lets AI agents read Bilibili: transcript
|
|
|
28
29
|
- **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
30
|
- **Read a single video** — fetch metadata such as title, creator, and play counts, plus the multi-part structure and chapters.
|
|
30
31
|
- **Find videos** — search Bilibili by topic and get candidates in Bilibili's platform order, each with title, creator, duration, and BVID.
|
|
32
|
+
- **Find Creators** — search Creator candidates and confirm the account you actually mean.
|
|
33
|
+
- **Understand a Creator** — browse their profile, videos, Collections, Series, and Dynamics to see what they mainly publish.
|
|
31
34
|
- **Browse favorites** — traverse every Favorite Folder your logged-in account created and Bilibili currently shows, page by page.
|
|
32
35
|
- **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
36
|
|
|
@@ -107,6 +110,18 @@ BVID. Do not fetch transcripts yet.
|
|
|
107
110
|
|
|
108
111
|
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.
|
|
109
112
|
|
|
113
|
+
### Understand a Creator quickly
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
Search for "毕导THU" and list Creator candidates. After I confirm the correct
|
|
117
|
+
account, read the profile, then inspect the latest videos, Collections, Series, and
|
|
118
|
+
Dynamics. Summarize the main directions from the returned content and recommend a
|
|
119
|
+
few videos to explore next. Do not crawl every page, fetch transcripts or comments,
|
|
120
|
+
or interpret Dynamic images automatically.
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The Agent first lets you confirm the right Creator, then reads each content type in small batches. It can continue paging when you want more, and selected videos can then feed the transcript, metadata, chapter, or comment tools.
|
|
124
|
+
|
|
110
125
|
### Find exact lines and moments in a transcript
|
|
111
126
|
|
|
112
127
|
```text
|
|
@@ -184,6 +199,8 @@ For the full semantics of error codes such as `ASR_NOT_READY`, `ASR_BUSY`, and `
|
|
|
184
199
|
| Goal | Tool |
|
|
185
200
|
|---|---|
|
|
186
201
|
| Have a topic but no video link yet | `search_bilibili_videos` |
|
|
202
|
+
| Have a name or keyword and want Creator candidates (stable mids) | `search_bilibili_creators` |
|
|
203
|
+
| Read a chosen creator's overview, video catalog, Collections, Series, or Dynamics | `get_bilibili_creator_content` |
|
|
187
204
|
| Start from my Favorites | `list_bilibili_favorite_videos` |
|
|
188
205
|
| Get subtitle-first video context | `get_video_info` |
|
|
189
206
|
| Full transcript, keyword search, or local ASR when no subtitles | `get_video_transcript` |
|
|
@@ -205,7 +222,7 @@ Complete parameters, JSON examples, and error semantics: [tool reference](./docs
|
|
|
205
222
|
- **AI subtitles are distinguishable from human subtitles:** when Bilibili's AI-generated track (`ai-zh` or another `ai-*` language) is selected, `data_source` is `ai_subtitle`. It is Bilibili AI transcription, may be inaccurate, and is not equivalent to a human-checked citation. Use `exclude_ai_subtitles: true` when only human subtitles are acceptable.
|
|
206
223
|
- **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.
|
|
207
224
|
- **No access bypass:** the project does not bypass paid, member-only, regional, private, removed, or other Bilibili access restrictions.
|
|
208
|
-
- **Video search
|
|
225
|
+
- **Video search, Favorites discovery, and creator content all require logged-in credentials** and do not fall back to anonymous access.
|
|
209
226
|
- **Returned content is external data:** titles, transcripts, and comments are Bilibili user-generated content. Treat them as data, never as instructions.
|
|
210
227
|
|
|
211
228
|
## Privacy and security
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CreatorCollectionListPage, CreatorCollectionMemberPage, CreatorDynamicPage, CreatorContentOverview, CreatorContentSection, CreatorSeriesListPage, CreatorSeriesMemberPage, CreatorVideoPage } from "./types.js";
|
|
2
|
+
export declare const MAX_CREATOR_NAME_BYTES = 128;
|
|
3
|
+
export declare const MAX_CREATOR_BIO_BYTES = 512;
|
|
4
|
+
export declare const MAX_CREATOR_AVATAR_BYTES = 512;
|
|
5
|
+
export declare const MAX_CATALOG_TITLE_BYTES = 512;
|
|
6
|
+
export declare const MAX_CATALOG_DESCRIPTION_BYTES = 512;
|
|
7
|
+
export declare const MAX_CATALOG_COVER_BYTES = 512;
|
|
8
|
+
export declare const MAX_CATALOG_CATEGORY_BYTES = 64;
|
|
9
|
+
export declare const MAX_CATALOG_AUTHOR_BYTES = 128;
|
|
10
|
+
export declare const MAX_CONTAINER_NAME_BYTES = 128;
|
|
11
|
+
export declare const MAX_CONTAINER_DESCRIPTION_BYTES = 512;
|
|
12
|
+
export declare const MAX_DYNAMIC_TEXT_BYTES = 2048;
|
|
13
|
+
export declare const MAX_DYNAMIC_IMAGE_URL_BYTES = 512;
|
|
14
|
+
export declare const MAX_DYNAMIC_TYPE_BYTES = 64;
|
|
15
|
+
export type ResolvedCreatorContentCursor = {
|
|
16
|
+
mid: number;
|
|
17
|
+
section: Exclude<CreatorContentSection, "dynamics">;
|
|
18
|
+
page: number;
|
|
19
|
+
container_id?: number;
|
|
20
|
+
} | {
|
|
21
|
+
mid: number;
|
|
22
|
+
section: "dynamics";
|
|
23
|
+
offset: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function encodeCreatorContentCursor(mid: number, section: Exclude<CreatorContentSection, "dynamics">, page: number, containerId?: number): string;
|
|
26
|
+
export declare function encodeCreatorDynamicsCursor(mid: number, offset: string): string;
|
|
27
|
+
export declare function decodeCreatorContentCursor(cursor: string): ResolvedCreatorContentCursor;
|
|
28
|
+
export declare function getBilibiliCreatorContent(mid: number, section: CreatorContentSection, cursor?: string, containerId?: number): Promise<CreatorContentOverview | CreatorVideoPage | CreatorCollectionListPage | CreatorCollectionMemberPage | CreatorSeriesListPage | CreatorSeriesMemberPage | CreatorDynamicPage>;
|
|
29
|
+
//# sourceMappingURL=creator-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creator-content.d.ts","sourceRoot":"","sources":["../../src/bilibili/creator-content.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEV,yBAAyB,EACzB,2BAA2B,EAI3B,kBAAkB,EAElB,sBAAsB,EACtB,qBAAqB,EAErB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AAgBpB,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,uBAA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