Skip to main content Switch to mobile version bilibili-watch-mcp 0.1.1 MCP server that turns Bilibili videos into agent-readable materials: subtitle text, danmaku, keyframe contact sheets, hi-res frames
pip install bilibili-watch-mcp Copy PIP instructions
An MCP server that turns Bilibili videos into agent-readable materials: subtitle text, danmaku (bullet comments), sprite keyframe contact sheets, and optional hi-res frames. Built for tool-using agents (Claude Code, Cline, etc.) that need to understand a video, not download it.
Bilibili 视频 → agent 可读材料 的 MCP server:字幕全文、弹幕、进度条关键帧拼图、可选高清抽帧。给 Claude Code 这类工具型 agent 提供"看懂视频"的能力。
Most Bilibili MCP servers only expose search/metadata. The ones that expose subtitles depend on bilibili-api-python, which was taken down by a legal notice in 2026 and is unmaintained. This project's fetching is built on yt-dlp (actively maintained, quick to follow Bilibili's anti-bot changes) plus two signature-free endpoints for danmaku and sprite sheets — no dead dependencies.
The sprite contact sheet trick: one request returns Bilibili's own progress-bar preview thumbnails covering the whole video — no login, no video download. Good for coarse "where am I in this video" localization. Hi-res frames (854px) make on-screen code / slide text readable.
video accepts a BV id or a full URL. AI-generated subtitles require the account cookie (see BILI_SESSDATA below); CC subtitles and everything else work login-free.
pip install bilibili-watch-mcp # or: uvx bilibili-watch-mcp Runtime dependencies (requests, yt-dlp, imageio-ffmpeg, mcp) are pulled in automatically. No ffmpeg installation needed — imageio-ffmpeg ships a static binary.
Configure your client
claude mcp add bilibili-watch -- bilibili-watch-mcp Or .mcp.json / claude_desktop_config.json:
{ "mcpServers": { "bilibili-watch": { "command": "bilibili-watch-mcp", "env": { "BILI_SESSDATA": "", "BILI_WATCH_OUT": "./bili_watch_out" } } } } Authentication (AI subtitles & better search)
Two ways to provide the Bilibili session cookie (SESSDATA), tried in order:
Automatic — via a debug-enabled browser (recommended). Since Chrome 136, the default profile cannot be opened with a debugging port, so use a dedicated profile. Start Chrome once, log in to Bilibili in that window; the session persists in the profile:
chrome.exe --user-data-dir="%USERPROFILE%\bili-watch-auth" --remote-debugging-port=9222 https://www.bilibili.com The server auto-detects 127.0.0.1:9222 and pulls SESSDATA over CDP on demand. Cookie values live in memory only — never written to disk, never echoed. If the debug browser is closed, tools fall back to login-free mode (danmaku/sprites/≤1080p still work; AI subtitles don't).
Manual — environment variable. Set BILI_SESSDATA to the cookie value from your browser's DevTools.
Note: yt-dlp cannot fetch Bilibili's AI-generated subtitles even when authenticated, so this server additionally pulls them from the player API directly (requires login state) and converts them to .srt.
Environment variables:
How an agent should use the output
watch_video returns a text report with:
subtitle text inline — compact form: one line per minute with a [mm:ss] timestamp, about a quarter of the raw srt size. For lecture/slide videos this alone is usually 90% of the content. Read it first.
sprite contact sheet paths — one or a few JPGs, each a 10x10 grid of thumbnails evenly covering the whole video. Cell k ≈ k × duration / total cells. Use for coarse time localization.
frames paths (if with_frames) — uniform_*.jpg with a timestamp table, and scene_*.jpg at detected scene cuts. 854px wide; on-screen text (slides, code) is readable. Read these with your file/image tool.
Lecture / tutorial → search_videos → watch_video(bvid) → read subtitle text.
Hands-on coding demo → watch_video(bvid, with_frames=true) → locate the segment on sprite sheets → read nearby frames/*.jpg.
Personal, low-volume use only. This project talks to Bilibili as a guest client; abusive request rates will get your IP rate-limited (-352 / HTTP 412) and may put your account at risk if you attach BILI_SESSDATA.
Not affiliated with or endorsed by Bilibili. You are responsible for complying with their terms of service and local law. Bilibili has been actively sending legal notices to third-party API projects since 2026 — this project deliberately keeps its footprint minimal (yt-dlp + two signature-free endpoints) but cannot promise that never changes.
给 agent 用的 B站视频理解 MCP。search_videos 免登录搜视频,watch_video 一键取字幕全文(直接返回文本)+ 弹幕 + 进度条关键帧拼图(粗定位画面)+ 可选高清抽帧(854px,PPT/代码可读,实操演示类用 with_frames=True)。取料底座是 yt-dlp(活跃维护、跟进B站风控),弹幕和拼图走两个免签名接口,不依赖任何已关停的第三方 SDK。
登录态(AI字幕/提高搜索成功率)推荐自动方式:开一个带调试端口的专用 Chrome 窗口并登录一次(chrome.exe --user-data-dir="%USERPROFILE%\bili-watch-auth" --remote-debugging-port=9222 https://www.bilibili.com),server 会自动经 CDP 取 SESSDATA(只在内存、不落盘);调试窗口关掉则自动降级为免登录模式。也可手动设 BILI_SESSDATA 环境变量。注意 yt-dlp 拿不到 B站 AI 字幕,本工具会登录态直连播放器接口补拉并转成 srt。仅供个人低频使用,请尊重平台条款。
Released: Nov 29, 2026
Both files in this release have provenance metadata.
View provenance details
mcp bilibili yt-dlp video-understanding agent
Release files for bilibili-watch-mcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 36.5 kB
Release files / bilibili_watch_mcp-0.1.1.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Release files / bilibili_watch_mcp-0.1.1-py3-none-any.whl
Security for bilibili-watch-mcp 0.1.1
Both files in this release have been uploaded with provenance metadata.
With provenance bilibili_watch_mcp-0.1.1.tar.gz Nov 29, 2026
Attestation for bilibili_watch_mcp-0.1.1.tar.gz
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Nov 29, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from fc0d8e6











