@xzxzzx/bilibili-mcp 1.2.0 → 1.3.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 +51 -23
- package/README_EN.md +46 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
用claude code(glm4.7模型)做的总结B站视频的MCP(经过antigravity里的claude,gemini模型修改bug)(提取字幕与评论)
|
|
8
8
|
|
|
9
|
+
> [!TIP]
|
|
10
|
+
> ⚠️ **快速开始**:使用前请务必配置您的 B 站 Cookie,否则将无法提取视频字幕与评论。详见 [**⚙️ 凭证配置**](#️-凭证配置)。
|
|
11
|
+
|
|
9
12
|
View this document in [English](./README_EN.md).
|
|
10
13
|
|
|
11
14
|
---
|
|
@@ -14,6 +17,7 @@ View this document in [English](./README_EN.md).
|
|
|
14
17
|
|
|
15
18
|
- [Bilibili MCP Tool](#bilibili-mcp-tool)
|
|
16
19
|
- [📑 目录](#-目录)
|
|
20
|
+
- [⚡ 快速预检](#-快速预检)
|
|
17
21
|
- [🌟 功能特性](#-功能特性)
|
|
18
22
|
- [1. 视频总结 (`get_video_info`)](#1-视频总结-get_video_info)
|
|
19
23
|
- [2. 评论总结 (`get_video_comments`)](#2-评论总结-get_video_comments)
|
|
@@ -32,8 +36,10 @@ View this document in [English](./README_EN.md).
|
|
|
32
36
|
- [🪐 Antigravity (Google 官方 IDE)](#-antigravity-google-官方-ide)
|
|
33
37
|
- [📦 OpenCode](#-opencode)
|
|
34
38
|
- [⚙️ 凭证配置](#️-凭证配置)
|
|
35
|
-
- [
|
|
36
|
-
- [
|
|
39
|
+
- [🔑 第一步:获取 Bilibili Cookie](#-第一步获取-bilibili-cookie)
|
|
40
|
+
- [📝 第二步:应用凭证](#-第二步应用凭证)
|
|
41
|
+
- [方式 A:使用 CLI 向导(推荐,适用于全局安装)](#方式-a使用-cli-向导推荐适用于全局安装)
|
|
42
|
+
- [方式 B:手动配置环境变量(适用于本地开发或 Docker)](#方式-b手动配置环境变量适用于本地开发或-docker)
|
|
37
43
|
- [🔒 安全须知](#-安全须知)
|
|
38
44
|
- [💡 工具使用示例](#-工具使用示例)
|
|
39
45
|
- [🛡️ API 限流机制](#️-api-限流机制)
|
|
@@ -43,6 +49,16 @@ View this document in [English](./README_EN.md).
|
|
|
43
49
|
|
|
44
50
|
---
|
|
45
51
|
|
|
52
|
+
## ⚡ 快速预检
|
|
53
|
+
|
|
54
|
+
> [!IMPORTANT]
|
|
55
|
+
> **本工具需要 Bilibili 凭证 (Cookie) 才能发挥完整功能。**
|
|
56
|
+
> 如果没有正确配置凭证,您可能无法获取视频字幕、评论
|
|
57
|
+
|
|
58
|
+
在开始安装前,请确保您已经了解[如何获取并配置 Cookie](#️-凭证配置)。
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
46
62
|
## 🌟 功能特性
|
|
47
63
|
|
|
48
64
|
### 1. 视频总结 (`get_video_info`)
|
|
@@ -279,41 +295,53 @@ OpenCode 用户可以通过编辑配置文件接入:
|
|
|
279
295
|
|
|
280
296
|
---
|
|
281
297
|
|
|
298
|
+
---
|
|
299
|
+
|
|
282
300
|
## ⚙️ 凭证配置
|
|
283
301
|
|
|
284
|
-
|
|
302
|
+
为了获取更完整的评论数据、绕过匿名访问限制并确保工具稳定运行,**必须**配置 B 站 Cookie。
|
|
303
|
+
|
|
304
|
+
### 🔑 第一步:获取 Bilibili Cookie
|
|
285
305
|
|
|
286
|
-
|
|
287
|
-
|
|
306
|
+
1. 在电脑浏览器登录 [bilibili.com](https://www.bilibili.com)
|
|
307
|
+
2. 按 `F12` 打开开发者工具(或在页面右键选择“检查”)。
|
|
308
|
+
3. 切换到 **Application (应用)** 选项卡 -> 在左侧菜单找到 **Cookies** -> 点击 `https://www.bilibili.com`。
|
|
309
|
+
4. 在右侧列表中找到以下三个关键变量,并记录它们的 **Value**:
|
|
310
|
+
- `SESSDATA`
|
|
311
|
+
- `bili_jct` (即 CSRF Token)
|
|
312
|
+
- `DedeUserID` (您的用户数字 ID)
|
|
313
|
+
|
|
314
|
+
> [!TIP]
|
|
315
|
+
> 如果您在 `Application` 找不到,也可以查看 `Network` (网络) 选项卡中的任意一个请求,在 `Headers` -> `Cookie` 字段中也能找到这些值。
|
|
316
|
+
|
|
317
|
+
### 📝 第二步:应用凭证
|
|
318
|
+
|
|
319
|
+
您可以针对不同的使用习惯选择以下任一方式:
|
|
320
|
+
|
|
321
|
+
#### 方式 A:使用 CLI 向导(推荐,适用于全局安装)
|
|
322
|
+
如果您全局安装了 npm 包(`npm i -g @xzxzzx/bilibili-mcp`),直接运行:
|
|
288
323
|
```bash
|
|
289
324
|
bilibili-mcp config
|
|
290
325
|
```
|
|
291
|
-
交互向导将引导您输入凭证并安全保存在**本地**配置目录(`~/.bilibili-mcp/config.json
|
|
326
|
+
交互向导将引导您输入凭证并安全保存在**本地**配置目录(`~/.bilibili-mcp/config.json`)中。
|
|
292
327
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
在项目根目录创建 `.env` 文件(或在 shell 中设置),手动填入以下变量:
|
|
328
|
+
#### 方式 B:手动配置环境变量(适用于本地开发或 Docker)
|
|
329
|
+
在项目根目录创建 `.env` 文件,手动填入以下变量:
|
|
296
330
|
|
|
297
331
|
| 变量名 | 说明 |
|
|
298
332
|
| :--- | :--- |
|
|
299
|
-
| **BILIBILI_SESSDATA** |
|
|
300
|
-
| **BILIBILI_BILI_JCT** |
|
|
301
|
-
| **BILIBILI_DEDEUSERID** |
|
|
302
|
-
|
|
303
|
-
<details>
|
|
304
|
-
<summary>💡 点击查看如何获取 Bilibili Cookie</summary>
|
|
333
|
+
| **BILIBILI_SESSDATA** | `SESSDATA` 的值 |
|
|
334
|
+
| **BILIBILI_BILI_JCT** | `bili_jct` 的值 |
|
|
335
|
+
| **BILIBILI_DEDEUSERID** | `DedeUserID` 的值 |
|
|
305
336
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
3. 切换到 **Application (应用)** 选项卡 -> 在左侧菜单找到 **Cookies** -> 点击 `https://www.bilibili.com`。
|
|
309
|
-
4. 在右侧列表中找到 `SESSDATA`、`bili_jct` 和 `buvid3`,复制其对应的 **Value** 即可。
|
|
310
|
-
</details>
|
|
337
|
+
> [!WARNING]
|
|
338
|
+
> `.env` 文件仅供本地加载,**切勿提交到 Git 或公开仓库**。
|
|
311
339
|
|
|
312
340
|
#### 🔒 安全须知
|
|
313
341
|
|
|
314
|
-
-
|
|
315
|
-
- **配置隔离**:`.env` 文件已被 `.gitignore`
|
|
316
|
-
- **时效性**:Cookie
|
|
342
|
+
- **隐私保护**:您的凭证信息仅存储在您的本地设备上。本工具**绝不会**将其上传至除 Bilibili 官方 API 以外的任何第三方服务器。
|
|
343
|
+
- **配置隔离**:`.env` 文件已被 `.gitignore` 排除。
|
|
344
|
+
- **时效性**:Cookie 具有时效性。若遇到 `412` 或权限错误,请尝试更新 Cookie。
|
|
317
345
|
|
|
318
346
|
---
|
|
319
347
|
|
package/README_EN.md
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
A Bilibili video auxiliary MCP tool built based on mainstream AI development tools like Claude Code, Cursor, Trae, and Google Antigravity. It aims to quickly extract core video information, highlights, and popular comments through Large Language Model capabilities, helping you process audio and video content efficiently.
|
|
8
8
|
|
|
9
|
+
> [!TIP]
|
|
10
|
+
> ⚠️ **Quick Start**: Please make sure to configure your Bilibili Cookies before use, otherwise video subtitles and comments cannot be extracted. See [**⚙️ Credential Configuration**](#⚙️-credential-configuration).
|
|
11
|
+
|
|
9
12
|
View this document in [简体中文](./README.md).
|
|
10
13
|
|
|
11
14
|
---
|
|
@@ -32,6 +35,16 @@ View this document in [简体中文](./README.md).
|
|
|
32
35
|
|
|
33
36
|
---
|
|
34
37
|
|
|
38
|
+
## ⚡ Pre-check
|
|
39
|
+
|
|
40
|
+
> [!IMPORTANT]
|
|
41
|
+
> **This tool requires Bilibili Credentials (Cookies) to function fully.**
|
|
42
|
+
> Without proper credentials, you may face issues retrieving subtitles, popular comments, or encounter frequent API rate limiting.
|
|
43
|
+
|
|
44
|
+
Before proceeding with installation, please ensure you are familiar with [How to obtain and configure Cookies](#⚙️-credential-configuration).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
35
48
|
## 🌟 Features
|
|
36
49
|
|
|
37
50
|
### 1. Video Summarization (`get_video_info`)
|
|
@@ -258,39 +271,52 @@ Edit the config file:
|
|
|
258
271
|
|
|
259
272
|
---
|
|
260
273
|
|
|
274
|
+
---
|
|
275
|
+
|
|
261
276
|
## ⚙️ Credential Configuration
|
|
262
277
|
|
|
263
|
-
|
|
278
|
+
To retrieve full comment data, bypass anonymous access limits, and ensure stability, you **must** configure Bilibili Cookies.
|
|
279
|
+
|
|
280
|
+
### 🔑 Step 1: Obtain Bilibili Cookies
|
|
281
|
+
|
|
282
|
+
1. Log in to [bilibili.com](https://www.bilibili.com) in your desktop browser.
|
|
283
|
+
2. Press `F12` to open Developer Tools (or right-click and select "Inspect").
|
|
284
|
+
3. Go to the **Application** tab -> Find **Cookies** in the left menu -> Click `https://www.bilibili.com`.
|
|
285
|
+
4. Locate the following three key variables and record their **Value**:
|
|
286
|
+
- `SESSDATA`
|
|
287
|
+
- `bili_jct` (also known as CSRF Token)
|
|
288
|
+
- `DedeUserID` (your numerical User ID)
|
|
289
|
+
|
|
290
|
+
> [!TIP]
|
|
291
|
+
> If you can't find them in the `Application` tab, check the `Network` tab for any request, and look for the `Cookie` field under `Headers`.
|
|
264
292
|
|
|
265
|
-
###
|
|
266
|
-
|
|
293
|
+
### 📝 Step 2: Apply Credentials
|
|
294
|
+
|
|
295
|
+
Choose one of the following methods based on your preference:
|
|
296
|
+
|
|
297
|
+
#### Method A: CLI Wizard (Recommended, for global installations)
|
|
298
|
+
If installed via npm (`npm i -g @xzxzzx/bilibili-mcp`), run:
|
|
267
299
|
```bash
|
|
268
300
|
bilibili-mcp config
|
|
269
301
|
```
|
|
270
|
-
|
|
302
|
+
The interactive wizard will guide you through entering credentials and save them **locally** (`~/.bilibili-mcp/config.json`).
|
|
271
303
|
|
|
272
|
-
|
|
273
|
-
Create a `.env` file in the project root
|
|
304
|
+
#### Method B: Manual Environment Variables (for local development or Docker)
|
|
305
|
+
Create a `.env` file in the project root and enter the following variables:
|
|
274
306
|
|
|
275
307
|
| Variable | Description |
|
|
276
308
|
| :--- | :--- |
|
|
277
|
-
| **BILIBILI_SESSDATA** |
|
|
278
|
-
| **BILIBILI_BILI_JCT** |
|
|
279
|
-
| **BILIBILI_DEDEUSERID** |
|
|
280
|
-
|
|
281
|
-
<details>
|
|
282
|
-
<summary>💡 How to get Bilibili Cookies</summary>
|
|
309
|
+
| **BILIBILI_SESSDATA** | Value of `SESSDATA` |
|
|
310
|
+
| **BILIBILI_BILI_JCT** | Value of `bili_jct` |
|
|
311
|
+
| **BILIBILI_DEDEUSERID** | Value of `DedeUserID` |
|
|
283
312
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
3. Go to **Application** tab -> **Cookies** -> `https://www.bilibili.com`.
|
|
287
|
-
4. Copy values for `SESSDATA`, `bili_jct`, and `DedeUserID`.
|
|
288
|
-
</details>
|
|
313
|
+
> [!WARNING]
|
|
314
|
+
> The `.env` file is for local use only. **Never commit it to Git or any public repository.**
|
|
289
315
|
|
|
290
316
|
#### 🔒 Security Notice
|
|
291
|
-
- **
|
|
292
|
-
- **
|
|
293
|
-
- **Expiration**: Cookies expire
|
|
317
|
+
- **Privacy**: Your credentials are only stored on your local device. This tool **never** uploads them to any third-party server besides official Bilibili APIs.
|
|
318
|
+
- **Isolation**: The `.env` file is excluded by `.gitignore`.
|
|
319
|
+
- **Expiration**: Cookies expire over time. If you encounter `412` or permission errors, try updating your cookies.
|
|
294
320
|
|
|
295
321
|
---
|
|
296
322
|
|