Content
# 🎬 Bili_VideoRead_MCP
> ~~Let AI also watch Bilibili~~ Feed Bilibili videos to your AI, extract subtitles and metadata with one click, and output Markdown for LLM to digest.
Your AI assistant (Claude, ChatGPT, Cherry Studio…) no longer needs to stare at Bilibili links. Just throw a BV number into it, and it will automatically pull subtitles, titles, UP hosts, and playback volumes, organizing them into structured Markdown that your AI can read and summarize, refine, translate, and create secondary content - **leave the coin tossing to humans and video watching to AI** ⚡
Please give a ⭐ Star to support, and the author will be more motivated to update and maintain!
## ✨ Feature Introduction
| Feature | Introduction |
|------|--------|
| 🔗 Link Recognition | BV/AV number, complete link, short link `b23.tv` all supported |
| 📋 Metadata Extraction | Title, UP host, duration, playback volume... none left behind |
| 💬 Subtitle Extraction | Prioritize Chinese AI subtitles, automatic fallback, requires login status |
| 📄 Markdown Output | Structured hierarchy, AI can see at a glance, direct conversation |
## 🚀 Quick Start
### Installation
```bash
pip install -e .
# or use uv:
uv pip install -e .
```
### Obtain Bilibili Cookie (required 🙏)
Bilibili AI subtitle interface requires login status. Only two fields are needed to pass:
1. Open [bilibili.com](https://www.bilibili.com) and **login**
2. Press `F12` → top click **Application** → left click **Cookies** → `bilibili.com`
3. Find `SESSDATA` in the table, **double-click Value** to copy (value similar to `abc%2Cdef`)
4. Similarly, copy `bili_jct`
### Connect to MCP Client
Take **Cherry Studio** as an example:
```json
{
"mcpServers": {
"videoread": {
"command": "python",
"args": ["-m", "videoread_mcp"],
"env": {
"BILIBILI_SESSDATA": "your SESSDATA",
"BILIBILI_BILI_JCT": "your bili_jct"
}
}
}
}
```
> 💡 Also supports complete Cookie: replace two lines of env with `"BILIBILI_COOKIE": "complete Cookie string"` .
Claude Desktop / VS Code Copilot similarly, configure `env` + restart.
### Start Using
Configuration complete → restart client → directly throw link in conversation:
> Help me summarize what this video talks about: https://www.bilibili.com/video/BV1xx411x7xx
AI automatically calls `extract_bilibili_video` to get subtitles and outputs a summary in seconds.
## 🛠️ MCP Tools
### `extract_bilibili_video`
| Parameter | Type | Required | Default | Description |
|------|------|------|------|------|
| `url` | string | ✅ | — | Bilibili video link (BV/AV/short link all supported) |
| `include_timestamps` | boolean | ❌ | `false` | Whether to include `[00:01]` timestamps in subtitles |
**Return**: Structured Markdown, including video information table + full subtitles.
## 🏗️ Project Structure
```
Bili_VideoRead_MCP/
├── pyproject.toml
├── README.md ← you're here
├── src/videoread_mcp/
│ ├── server.py ← MCP Server (tool registration & stdio startup)
│ ├── extractor.py ← core: yt-dlp + Bilibili WBI signature + Cookie authentication
│ ├── formatter.py ← metadata + subtitles → Markdown
│ ├── __init__.py
│ └── __main__.py
└── tests/
└── test_extractor.py ← 17 unit tests ✅
```
## 🔧 Tech Stack
| Dependency | Role |
|------|------|
| [MCP SDK](https://github.com/modelcontextprotocol/python-sdk) | MCP protocol stdio communication |
| [yt-dlp](https://github.com/yt-dlp/yt-dlp) | Video metadata extraction + browser Cookie loading |
| [httpx](https://www.python-httpx.org/) | Bilibili API direct connection (WBI signature + Cookie) |
| Python ≥ 3.10 | 🐍 |
## 📌 Notes
- Cookie **will expire**, and one day subtitles suddenly can't be obtained → re-copy `SESSDATA` and `bili_jct`
- This tool **does not download videos**, **does not call danmaku**, pure subtitles + metadata
- Only for learning and communication, please comply with Bilibili's relevant agreements 🫡
## 📄 License
MIT