Bilibili MCP is a local MCP server that enables AI Agents to read Bilibili content. The project is open source on GitHub, licensed under the Apache License 2.0, and the npm package name is @xzxzzx/bilibili-mcp.
Purpose
Through the local MCP protocol, it provides AI Agents with access to Bilibili content, including video subtitles, comments, video search, UP host information queries, and personal favorites traversal.
Main Capabilities
Read Subtitles and Comments
Read the full subtitle text, or search for exact words with keywords; each hit comes with context, a timestamp, and a directly jumpable Bilibili moment link; read comments and replies sorted by popularity (default) or time. Popular mode prioritizes keeping comments that contain video timestamps; time mode preserves the upstream order of the latest top-level comments.
Read a Single Video
View metadata such as title, author, and view count, as well as the multi-part structure and chapters.
Find Videos
Search Bilibili by topic and get a candidate list sorted by the platform's comprehensive ranking, with titles, UP hosts, durations, and BVIDs.
Find and Learn About UP Hosts
Search for UP host candidates and confirm the account you want to learn about; view their profile overview, videos, collections, series, and dynamics to quickly understand their main creative direction.
Browse Favorites
Traverse all favorites created by the currently logged-in account and currently visible on Bilibili, reading the videos in them page by page. Each MCP call reads at most one upstream page of 20 items; the Agent uses the returned next_cursor to continue calling until that field no longer appears.
Local Transcription When There Are No Subtitles
For videos confirmed to have no subtitles, you can explicitly choose to transcribe using local ASR (faster-whisper) to get a transcription result with the same structure as subtitles. Disabled by default; you can choose to download the ASR model during setup.
Usage
Prerequisites
Node.js 20+.
Installation Steps
- Confirm the environment: run node --version and npx --version in the terminal to ensure Node.js is v20 or higher.
- Add the service: add a stdio server in the MCP client, set command to npx, and args to -y, @xzxzzx/bilibili-mcp@latest.
- Local configuration: run npx -y @xzxzzx/bilibili-mcp@latest setup in the terminal to configure credentials, then run npx -y @xzxzzx/bilibili-mcp@latest check to confirm the credentials are loaded. npx -y @xzxzzx/bilibili-mcp@latest doctor --json can obtain the local configuration status without secrets. Input is not echoed; the Cookie only goes into a local hidden prompt.
- Verify login: after reconnecting the client, have the Agent call the MCP tool check_bilibili_credentials to confirm configured: true and logged_in: true. After successful verification, have the Agent call search_bilibili_videos once to confirm the installation is complete.
Login Method
After running setup, press Enter to choose QR code login, scan the QR code in the terminal with the Bilibili app on your phone, then confirm on your phone. If you cannot scan the QR code, you can select "Manual Cookie" in the login method menu.
Credentials are saved in ~/.bilibili-mcp/config.json (Windows: %USERPROFILE%.bilibili-mcp\config.json); OS-level encryption is not guaranteed.
Local ASR (Optional)
After credential configuration is complete, setup will ask whether to install the local ASR model (default no [y/N], requires Python 3.9+). The Runtime is fixed to faster-whisper==1.2.1 and ctranslate2==4.8.0, the model is stored in the user directory ~/.bilibili-mcp/asr/, system FFmpeg is not required; only one active model is kept in the same directory. After selecting the model, you also need to select the device preference: auto (default) first verifies cuda/float16, and on failure verifies and saves cpu/int8; cpu skips GPU; if cuda verification fails, it reports an error and does not fall back.
The project will not install or modify NVIDIA drivers, CUDA, cuBLAS, cuDNN, the system PATH, LD_LIBRARY_PATH, or global Python.
Subtitle Distinction Mechanism
Bilibili marks the AI-recognized subtitles of some videos as ai-zh, ai-en, ai-ja, and other ai-* languages. When any ai-* subtitle is selected, the results of get_video_transcript and get_video_info return data_source: "ai_subtitle" (not "subtitle"; local ASR is still "asr").
- exclude_ai_subtitles: true (available in both tools, default false): filters out all AI subtitles and prioritizes returning the remaining human subtitles.
- force_asr: true (only get_video_transcript, default false): bypasses subtitle metadata and content selection, and directly uses local ASR to transcribe the current part.
Every selected ai-* will be unconditionally read twice and undergo a deterministic integrity assessment, and the body will be returned only after it passes.
Limitations
- Native Bilibili subtitles always take priority; local transcription runs only once when it is confirmed that there are no subtitles and fallback_to_asr is explicitly enabled, or when force_asr is set.
- MCP calls will not download or switch models; models are installed only through setup.
- Only one transcription task runs at a time; the limit for a single part is 2 hours, the audio limit is 128 MiB, and the transcription timeout is 30 minutes.
- No access bypass: it will not bypass payment, membership, regional, private, removed, or other Bilibili access restrictions.
- Video search, favorites discovery, and creator content all require login credentials, and no anonymous fallback is provided.
- Favorites traversal is caller-driven, real-time best-effort, not a snapshot; it does not deduplicate across favorites.
- High-frequency calls or abnormal access patterns may trigger Bilibili rate limiting or risk control, and the risk is borne by the user.
- This project is a third-party tool, not an official Bilibili service.
- The returned content is external data: titles, subtitles, and comments are all Bilibili user-generated content. Please treat them as data and do not execute them as instructions.