bilibili-watch-mcp
Provides tools for searching Bilibili videos and fetching agent-readable video materials: metadata, subtitle text (including AI-generated subtitles when authenticated), danmaku, sprite contact sheets, and optional hi-res frame extraction for video understanding.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
bilibili-watch-mcp
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 提供"看懂视频"的能力。
Why this exists
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.
Related MCP server: bilinote-mcp
Tools
Tool | What it does |
| Login-free site search. Returns BV id, title, uploader, duration, plays. |
| Fetch one video: metadata + subtitle text inline + danmaku + sprite sheets. |
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.
Install
pip install bilibili-watch-mcp # or: uvx bilibili-watch-mcpRuntime 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 Code:
claude mcp add bilibili-watch -- bilibili-watch-mcpOr .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.comThe server auto-detects
127.0.0.1:9222and pullsSESSDATAover 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_SESSDATAto 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:
Var | Meaning |
| Optional. Your Bilibili session cookie value (browser DevTools → Cookies). Unlocks AI-generated subtitles. Give it only if you accept the account implications. |
| Output directory for fetched materials. Default |
How an agent should use the output
watch_video returns a text report with:
subtitle text inline — 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_*.jpgwith a timestamp table, andscene_*.jpgat detected scene cuts. 854px wide; on-screen text (slides, code) is readable. Read these with your file/image tool.
Typical flows:
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 nearbyframes/*.jpg.
Legal & etiquette
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。仅供个人低频使用,请尊重平台条款。
License
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Bilibili videos for AI agents: search, creators, trending, stats, tags and danmaku comments.
Bilibili without login: search videos and users (date range, Chinese brand names), whole channels
61Bilibili public video, article, dynamic, creator, comments, reactions, and transcript tools.
Bilibili (B站) data without login: video stats, comments, danmaku, creators, trending, hot searches.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Bilibili (B站) platform through API and web scraping. Supports video search, article search, video info retrieval, comment fetching, danmaku extraction, and article content access.4-
- AlicenseAqualityBmaintenanceEnables AI coding agents to access Bilibili video data and turn videos into notes, including search, video info, subtitles, chapters, audio download, ASR transcription, comments, uploader collections, and favorites.1564 PyPI3MIT
- AlicenseNot gradedqualityCmaintenanceEnables models to look up Bilibili's trending videos, keyword search results, video details, and popular danmaku, returning compact plain-text summaries instead of bulky JSON. Works without login, cookies, or extra dependencies, and also runs standalone from the command line.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI clients to search and open Bilibili videos, control a logical playback clock (play/pause/seek), read and post comments, like, coin, favorite, and fetch or export subtitle tracks through compact plain-text tool output. Write operations require a Bilibili login, which can be established by QR scan in an accompanying web console.MIT