@xzxzzx/bilibili-mcp 1.2.0 → 1.3.1
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 +74 -23
- package/README_EN.md +100 -37
- 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)
|
|
@@ -23,6 +27,7 @@ View this document in [English](./README_EN.md).
|
|
|
23
27
|
- [Claude Code](#claude-code)
|
|
24
28
|
- [方法一:通过 CLI 命令快速安装(推荐)](#方法一通过-cli-命令快速安装推荐)
|
|
25
29
|
- [方法二:通过配置文件手动添加(高级)](#方法二通过配置文件手动添加高级)
|
|
30
|
+
- [Claude Desktop (桌面客户端)](#claude-desktop-桌面客户端)
|
|
26
31
|
- [方法三:通过 npm 全局安装](#方法三通过-npm-全局安装)
|
|
27
32
|
- [🏗️ Trae (字节跳动官方 IDE)](#️-trae-字节跳动官方-ide)
|
|
28
33
|
- [🌊 Windsurf (Codeium 官方 IDE)](#-windsurf-codeium-官方-ide)
|
|
@@ -32,8 +37,10 @@ View this document in [English](./README_EN.md).
|
|
|
32
37
|
- [🪐 Antigravity (Google 官方 IDE)](#-antigravity-google-官方-ide)
|
|
33
38
|
- [📦 OpenCode](#-opencode)
|
|
34
39
|
- [⚙️ 凭证配置](#️-凭证配置)
|
|
35
|
-
- [
|
|
36
|
-
- [
|
|
40
|
+
- [🔑 第一步:获取 Bilibili Cookie](#-第一步获取-bilibili-cookie)
|
|
41
|
+
- [📝 第二步:应用凭证](#-第二步应用凭证)
|
|
42
|
+
- [方式 A:使用 CLI 向导(推荐,适用于全局安装)](#方式-a使用-cli-向导推荐适用于全局安装)
|
|
43
|
+
- [方式 B:手动配置环境变量(适用于本地开发或 Docker)](#方式-b手动配置环境变量适用于本地开发或-docker)
|
|
37
44
|
- [🔒 安全须知](#-安全须知)
|
|
38
45
|
- [💡 工具使用示例](#-工具使用示例)
|
|
39
46
|
- [🛡️ API 限流机制](#️-api-限流机制)
|
|
@@ -43,6 +50,16 @@ View this document in [English](./README_EN.md).
|
|
|
43
50
|
|
|
44
51
|
---
|
|
45
52
|
|
|
53
|
+
## ⚡ 快速预检
|
|
54
|
+
|
|
55
|
+
> [!IMPORTANT]
|
|
56
|
+
> **本工具需要 Bilibili 凭证 (Cookie) 才能发挥完整功能。**
|
|
57
|
+
> 如果没有正确配置凭证,您可能无法获取视频字幕、评论
|
|
58
|
+
|
|
59
|
+
在开始安装前,请确保您已经了解[如何获取并配置 Cookie](#️-凭证配置)。
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
46
63
|
## 🌟 功能特性
|
|
47
64
|
|
|
48
65
|
### 1. 视频总结 (`get_video_info`)
|
|
@@ -113,6 +130,28 @@ claude mcp add bilibili-mcp --command "npx" --args "-y" --args "@xzxzzx/bilibili
|
|
|
113
130
|
```
|
|
114
131
|
3. 保存后重启 Claude Code。
|
|
115
132
|
|
|
133
|
+
### Claude Desktop (桌面客户端)
|
|
134
|
+
|
|
135
|
+
Claude Desktop 支持通过全局配置文件接入 MCP 服务器:
|
|
136
|
+
|
|
137
|
+
1. 打开 Claude Desktop 配置文件:
|
|
138
|
+
- Windows 路径:`%APPDATA%\Claude\claude_desktop_config.json`
|
|
139
|
+
- macOS 路径:`~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
140
|
+
- *提示:您也可以在 Claude Desktop 的 **Settings** -> **Developer** 中点击 **Edit Config** 直接打开该文件。*
|
|
141
|
+
2. 在 `mcpServers` 节点下添加:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"mcpServers": {
|
|
146
|
+
"bilibili-mcp": {
|
|
147
|
+
"command": "npx",
|
|
148
|
+
"args": ["-y", "@xzxzzx/bilibili-mcp"]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
3. 保存文件并从侧边栏重启或重新开启对话。
|
|
154
|
+
|
|
116
155
|
#### 方法三:通过 npm 全局安装
|
|
117
156
|
|
|
118
157
|
安装后可直接使用命令行工具管理配置:
|
|
@@ -279,41 +318,53 @@ OpenCode 用户可以通过编辑配置文件接入:
|
|
|
279
318
|
|
|
280
319
|
---
|
|
281
320
|
|
|
321
|
+
---
|
|
322
|
+
|
|
282
323
|
## ⚙️ 凭证配置
|
|
283
324
|
|
|
284
|
-
|
|
325
|
+
为了获取更完整的评论数据、绕过匿名访问限制并确保工具稳定运行,**必须**配置 B 站 Cookie。
|
|
326
|
+
|
|
327
|
+
### 🔑 第一步:获取 Bilibili Cookie
|
|
328
|
+
|
|
329
|
+
1. 在电脑浏览器登录 [bilibili.com](https://www.bilibili.com)
|
|
330
|
+
2. 按 `F12` 打开开发者工具(或在页面右键选择“检查”)。
|
|
331
|
+
3. 切换到 **Application (应用)** 选项卡 -> 在左侧菜单找到 **Cookies** -> 点击 `https://www.bilibili.com`。
|
|
332
|
+
4. 在右侧列表中找到以下三个关键变量,并记录它们的 **Value**:
|
|
333
|
+
- `SESSDATA`
|
|
334
|
+
- `bili_jct` (即 CSRF Token)
|
|
335
|
+
- `DedeUserID` (您的用户数字 ID)
|
|
336
|
+
|
|
337
|
+
> [!TIP]
|
|
338
|
+
> 如果您在 `Application` 找不到,也可以查看 `Network` (网络) 选项卡中的任意一个请求,在 `Headers` -> `Cookie` 字段中也能找到这些值。
|
|
339
|
+
|
|
340
|
+
### 📝 第二步:应用凭证
|
|
285
341
|
|
|
286
|
-
|
|
287
|
-
|
|
342
|
+
您可以针对不同的使用习惯选择以下任一方式:
|
|
343
|
+
|
|
344
|
+
#### 方式 A:使用 CLI 向导(推荐,适用于全局安装)
|
|
345
|
+
如果您全局安装了 npm 包(`npm i -g @xzxzzx/bilibili-mcp`),直接运行:
|
|
288
346
|
```bash
|
|
289
347
|
bilibili-mcp config
|
|
290
348
|
```
|
|
291
|
-
交互向导将引导您输入凭证并安全保存在**本地**配置目录(`~/.bilibili-mcp/config.json
|
|
292
|
-
|
|
293
|
-
### 方式 B:手动配置环境变量
|
|
349
|
+
交互向导将引导您输入凭证并安全保存在**本地**配置目录(`~/.bilibili-mcp/config.json`)中。
|
|
294
350
|
|
|
295
|
-
|
|
351
|
+
#### 方式 B:手动配置环境变量(适用于本地开发或 Docker)
|
|
352
|
+
在项目根目录创建 `.env` 文件,手动填入以下变量:
|
|
296
353
|
|
|
297
354
|
| 变量名 | 说明 |
|
|
298
355
|
| :--- | :--- |
|
|
299
|
-
| **BILIBILI_SESSDATA** |
|
|
300
|
-
| **BILIBILI_BILI_JCT** |
|
|
301
|
-
| **BILIBILI_DEDEUSERID** |
|
|
356
|
+
| **BILIBILI_SESSDATA** | `SESSDATA` 的值 |
|
|
357
|
+
| **BILIBILI_BILI_JCT** | `bili_jct` 的值 |
|
|
358
|
+
| **BILIBILI_DEDEUSERID** | `DedeUserID` 的值 |
|
|
302
359
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
1. 在电脑浏览器登录 [bilibili.com](https://www.bilibili.com)
|
|
307
|
-
2. 按 `F12` 打开开发者工具(或在页面右键选择“检查”)。
|
|
308
|
-
3. 切换到 **Application (应用)** 选项卡 -> 在左侧菜单找到 **Cookies** -> 点击 `https://www.bilibili.com`。
|
|
309
|
-
4. 在右侧列表中找到 `SESSDATA`、`bili_jct` 和 `buvid3`,复制其对应的 **Value** 即可。
|
|
310
|
-
</details>
|
|
360
|
+
> [!WARNING]
|
|
361
|
+
> `.env` 文件仅供本地加载,**切勿提交到 Git 或公开仓库**。
|
|
311
362
|
|
|
312
363
|
#### 🔒 安全须知
|
|
313
364
|
|
|
314
|
-
-
|
|
315
|
-
- **配置隔离**:`.env` 文件已被 `.gitignore`
|
|
316
|
-
- **时效性**:Cookie
|
|
365
|
+
- **隐私保护**:您的凭证信息仅存储在您的本地设备上。本工具**绝不会**将其上传至除 Bilibili 官方 API 以外的任何第三方服务器。
|
|
366
|
+
- **配置隔离**:`.env` 文件已被 `.gitignore` 排除。
|
|
367
|
+
- **时效性**:Cookie 具有时效性。若遇到 `412` 或权限错误,请尝试更新 Cookie。
|
|
317
368
|
|
|
318
369
|
---
|
|
319
370
|
|
package/README_EN.md
CHANGED
|
@@ -6,29 +6,57 @@
|
|
|
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)(Cookies are only stored locally and will not be uploaded anywhere).
|
|
11
|
+
|
|
9
12
|
View this document in [简体中文](./README.md).
|
|
10
13
|
|
|
11
14
|
---
|
|
12
15
|
|
|
13
16
|
## 📑 Table of Contents
|
|
14
17
|
|
|
15
|
-
- [
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- [
|
|
28
|
-
- [
|
|
29
|
-
- [
|
|
30
|
-
- [
|
|
31
|
-
- [
|
|
18
|
+
- [Bilibili MCP Tool](#bilibili-mcp-tool)
|
|
19
|
+
- [📑 Table of Contents](#-table-of-contents)
|
|
20
|
+
- [⚡ Pre-check](#-pre-check)
|
|
21
|
+
- [🌟 Features](#-features)
|
|
22
|
+
- [1. Video Summarization (`get_video_info`)](#1-video-summarization-get_video_info)
|
|
23
|
+
- [2. Comment Summarization (`get_video_comments`)](#2-comment-summarization-get_video_comments)
|
|
24
|
+
- [📋 Requirements](#-requirements)
|
|
25
|
+
- [🚀 Installation](#-installation)
|
|
26
|
+
- [🖱️ Cursor](#️-cursor)
|
|
27
|
+
- [Claude Code](#claude-code)
|
|
28
|
+
- [Method 1: Fast Installation via CLI (Recommended)](#method-1-fast-installation-via-cli-recommended)
|
|
29
|
+
- [Method 2: Manual Addition via Config File](#method-2-manual-addition-via-config-file)
|
|
30
|
+
- [Claude Desktop](#claude-desktop)
|
|
31
|
+
- [Method 3: Global npm Installation](#method-3-global-npm-installation)
|
|
32
|
+
- [🏗️ Trae (Official IDE by ByteDance)](#️-trae-official-ide-by-bytedance)
|
|
33
|
+
- [🌊 Windsurf (Official IDE by Codeium)](#-windsurf-official-ide-by-codeium)
|
|
34
|
+
- [⚡ Zed](#-zed)
|
|
35
|
+
- [♊ Gemini CLI (Official Google CLI)](#-gemini-cli-official-google-cli)
|
|
36
|
+
- [⌨️ Codex CLI (Official OpenAI CLI)](#️-codex-cli-official-openai-cli)
|
|
37
|
+
- [🪐 Antigravity (Official Google IDE)](#-antigravity-official-google-ide)
|
|
38
|
+
- [📦 OpenCode](#-opencode)
|
|
39
|
+
- [⚙️ Credential Configuration](#️-credential-configuration)
|
|
40
|
+
- [🔑 Step 1: Obtain Bilibili Cookies](#-step-1-obtain-bilibili-cookies)
|
|
41
|
+
- [📝 Step 2: Apply Credentials](#-step-2-apply-credentials)
|
|
42
|
+
- [Method A: CLI Wizard (Recommended, for global installations)](#method-a-cli-wizard-recommended-for-global-installations)
|
|
43
|
+
- [Method B: Manual Environment Variables (for local development or Docker)](#method-b-manual-environment-variables-for-local-development-or-docker)
|
|
44
|
+
- [🔒 Security Notice](#-security-notice)
|
|
45
|
+
- [💡 Usage Examples](#-usage-examples)
|
|
46
|
+
- [🛡️ API Rate Limiting](#️-api-rate-limiting)
|
|
47
|
+
- [🛠️ Development Guide](#️-development-guide)
|
|
48
|
+
- [⚖️ Safety and Disclaimer](#️-safety-and-disclaimer)
|
|
49
|
+
- [License](#license)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## ⚡ Pre-check
|
|
54
|
+
|
|
55
|
+
> [!IMPORTANT]
|
|
56
|
+
> **This tool requires Bilibili Credentials (Cookies) to function fully.**
|
|
57
|
+
> Without proper credentials, you may face issues retrieving subtitles, popular comments, or encounter frequent API rate limiting.
|
|
58
|
+
|
|
59
|
+
Before proceeding with installation, please ensure you are familiar with [How to obtain and configure Cookies](#⚙️-credential-configuration).
|
|
32
60
|
|
|
33
61
|
---
|
|
34
62
|
|
|
@@ -102,6 +130,28 @@ Restart Claude Code after completion.
|
|
|
102
130
|
```
|
|
103
131
|
3. Save and restart Claude Code.
|
|
104
132
|
|
|
133
|
+
### Claude Desktop
|
|
134
|
+
|
|
135
|
+
Claude Desktop supports MCP servers via a global configuration file:
|
|
136
|
+
|
|
137
|
+
1. Open the Claude Desktop configuration file:
|
|
138
|
+
- Windows Path: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
139
|
+
- macOS Path: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
140
|
+
- *Tip: You can also open this file by clicking **Edit Config** in **Settings** -> **Developer** within Claude Desktop.*
|
|
141
|
+
2. Add the following to the `mcpServers` node:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"mcpServers": {
|
|
146
|
+
"bilibili-mcp": {
|
|
147
|
+
"command": "npx",
|
|
148
|
+
"args": ["-y", "@xzxzzx/bilibili-mcp"]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
3. Save the file and restart Claude Desktop or start a new conversation to load the tools.
|
|
154
|
+
|
|
105
155
|
#### Method 3: Global npm Installation
|
|
106
156
|
|
|
107
157
|
Manage configuration via the CLI tool after installation:
|
|
@@ -258,39 +308,52 @@ Edit the config file:
|
|
|
258
308
|
|
|
259
309
|
---
|
|
260
310
|
|
|
311
|
+
---
|
|
312
|
+
|
|
261
313
|
## ⚙️ Credential Configuration
|
|
262
314
|
|
|
263
|
-
|
|
315
|
+
To retrieve full comment data, bypass anonymous access limits, and ensure stability, you **must** configure Bilibili Cookies.
|
|
316
|
+
|
|
317
|
+
### 🔑 Step 1: Obtain Bilibili Cookies
|
|
318
|
+
|
|
319
|
+
1. Log in to [bilibili.com](https://www.bilibili.com) in your desktop browser.
|
|
320
|
+
2. Press `F12` to open Developer Tools (or right-click and select "Inspect").
|
|
321
|
+
3. Go to the **Application** tab -> Find **Cookies** in the left menu -> Click `https://www.bilibili.com`.
|
|
322
|
+
4. Locate the following three key variables and record their **Value**:
|
|
323
|
+
- `SESSDATA`
|
|
324
|
+
- `bili_jct` (also known as CSRF Token)
|
|
325
|
+
- `DedeUserID` (your numerical User ID)
|
|
326
|
+
|
|
327
|
+
> [!TIP]
|
|
328
|
+
> 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
329
|
|
|
265
|
-
###
|
|
266
|
-
|
|
330
|
+
### 📝 Step 2: Apply Credentials
|
|
331
|
+
|
|
332
|
+
Choose one of the following methods based on your preference:
|
|
333
|
+
|
|
334
|
+
#### Method A: CLI Wizard (Recommended, for global installations)
|
|
335
|
+
If installed via npm (`npm i -g @xzxzzx/bilibili-mcp`), run:
|
|
267
336
|
```bash
|
|
268
337
|
bilibili-mcp config
|
|
269
338
|
```
|
|
270
|
-
|
|
339
|
+
The interactive wizard will guide you through entering credentials and save them **locally** (`~/.bilibili-mcp/config.json`).
|
|
271
340
|
|
|
272
|
-
|
|
273
|
-
Create a `.env` file in the project root
|
|
341
|
+
#### Method B: Manual Environment Variables (for local development or Docker)
|
|
342
|
+
Create a `.env` file in the project root and enter the following variables:
|
|
274
343
|
|
|
275
344
|
| Variable | Description |
|
|
276
345
|
| :--- | :--- |
|
|
277
|
-
| **BILIBILI_SESSDATA** |
|
|
278
|
-
| **BILIBILI_BILI_JCT** |
|
|
279
|
-
| **BILIBILI_DEDEUSERID** |
|
|
280
|
-
|
|
281
|
-
<details>
|
|
282
|
-
<summary>💡 How to get Bilibili Cookies</summary>
|
|
346
|
+
| **BILIBILI_SESSDATA** | Value of `SESSDATA` |
|
|
347
|
+
| **BILIBILI_BILI_JCT** | Value of `bili_jct` |
|
|
348
|
+
| **BILIBILI_DEDEUSERID** | Value of `DedeUserID` |
|
|
283
349
|
|
|
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>
|
|
350
|
+
> [!WARNING]
|
|
351
|
+
> The `.env` file is for local use only. **Never commit it to Git or any public repository.**
|
|
289
352
|
|
|
290
353
|
#### 🔒 Security Notice
|
|
291
|
-
- **
|
|
292
|
-
- **
|
|
293
|
-
- **Expiration**: Cookies expire
|
|
354
|
+
- **Privacy**: Your credentials are only stored on your local device. This tool **never** uploads them to any third-party server besides official Bilibili APIs.
|
|
355
|
+
- **Isolation**: The `.env` file is excluded by `.gitignore`.
|
|
356
|
+
- **Expiration**: Cookies expire over time. If you encounter `412` or permission errors, try updating your cookies.
|
|
294
357
|
|
|
295
358
|
---
|
|
296
359
|
|