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 digestion.
Your AI assistant (Claude, ChatGPT, Cherry Studio, etc.) no longer needs to stare at Bilibili links. Just throw a BV number into the tool, and it will automatically pull subtitles, titles, UP information, and playback volume, organizing them into structured Markdown that your AI can read and summarize, refine, translate, and create secondary content from—**let humans handle tipping, and let AI handle video watching** ⚡
Please give a ⭐ Star to support the author and provide more motivation for updates and maintenance!
---
## ✨ Feature Introduction
| Feature | Introduction |
|------|--------|
| 🔗 Link Recognition | BV/AV numbers, full links, and short links `b23.tv` are all supported |
| 📋 Metadata Extraction | Titles, UP information, duration, playback volume, and more—nothing is missed |
| 💬 Subtitle Extraction | Prioritizes Chinese AI subtitles, with automatic fallback, requiring login status |
| 📄 Markdown Output | Structured and layered, allowing AI to quickly understand and engage in conversation |
---
## 🚀 Quick Start
### Installation
```bash
pip install -e .
# or use uv:
uv pip install -e .
```
### Obtain Bilibili Cookie (required 🙏)
Bilibili's AI subtitle interface requires a login status. You only need two fields to get through:
1. Open [bilibili.com](https://www.bilibili.com) and **login**
2. Press `F12` → click **Application** at the top → click **Cookies** on the left → `bilibili.com`
3. Find `SESSDATA` in the table, **double-click the Value** to copy (the value is similar to `abc%2Cdef`)
4. Similarly, copy `bili_jct`
### Connect to MCP Client
Using **Cherry Studio** as an example:
```json
{
"mcpServers": {
"videoread": {
"command": "C:\\Users\\22136\\AppData\\Local\\Programs\\Python\\Python312\\python.exe",
"args": ["-m", "videoread_mcp"],
"env": {
"BILIBILI_SESSDATA": "your SESSDATA",
"BILIBILI_BILI_JCT": "your bili_jct"
}
}
}
}
```
> 💡 It also supports the complete Cookie: replace the two lines of env with `"BILIBILI_COOKIE": "complete Cookie string"` .
Claude Desktop / VS Code Copilot works similarly; just configure `env` and restart.
### Get Started
After configuration is complete → restart the client → directly throw a link into the conversation:
> Summarize this video: https://www.bilibili.com/video/BV1xx411x7xx
The AI will automatically call `extract_bilibili_video` to get subtitles and produce a summary in seconds.
---
## 🛠️ MCP Tools
### `extract_bilibili_video`
| Parameter | Type | Required | Default | Description |
|------|------|------|------|------|
| `url` | string | ✅ | — | Bilibili video link (BV/AV/short links are all supported) |
| `include_timestamps` | boolean | ❌ | `false` | Whether to include timestamps `[00:01]` in subtitles |
**Returns**: Structured Markdown containing 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/) | Direct connection to Bilibili API (WBI signature + Cookie) |
| Python ≥ 3.10 | 🐍 |
---
## 📌 Notes
- Cookies **expire**, so if subtitles suddenly can't be obtained, re-copy `SESSDATA` and `bili_jct`
- This tool **does not download videos**, **does not fetch comments**, and only handles subtitles + metadata
- For learning and communication purposes only; please comply with Bilibili's relevant agreements 🫡
---
## 📄 License
MIT