Skip to main content

bilibili-mcp

An MCP server that lets any AI client (Claude, Cursor, ...) read public Bilibili data: video info, subtitles, danmaku, and search. It's a thin wrapper over the mature bilibili-api library — all WBI signing, cookies, and anti-abuse handling are delegated to it.

Reads public data only. Video info and search work as a guest (no login). Subtitles are gated behind login by Bilibili itself, so the subtitle tool needs your own SESSDATA cookie (see below). For personal/research use at a reasonable request rate.

Tools

Tool Description
get_video_info(bvid) Title, uploader, play/like/coin counts, duration, publish date, description. Accepts a BV id or a full video URL. Guest, no login.
get_video_subtitle(bvid, lang="zh-CN", with_timestamp=False) Full subtitle/transcript text — great for "summarize this video". Requires login (BILI_SESSDATA, see below); returns clear guidance if no cookie is set, and a clear message when a video simply has no subtitles.
get_video_danmaku(bvid, limit=200, with_timestamp=False) All danmaku (弹幕, on-screen bullet comments), ordered by appearance time — great for asking the AI what memes viewers spam, the overall mood, or which moments are "高能". Guest, no login.
get_danmaku_hotwords(bvid, top=20, segments=5) Aggregates danmaku into a top repeated-comment ranking plus the highest-density "高能" time segments — a quick read on what viewers spam and which moments spike. Guest, no login.
get_video_comments(bvid, sort="hot", limit=20) Top-level video comments (username, likes, content), sorted by likes (hot) or newest (time) — great for summarizing reception or finding debate. Guest, no login.
search_videos(keyword, page=1, limit=10) Search videos by keyword. Guest, no login.

Install

The PyPI package is bilibili-data-mcp (the import module is bilibili_mcp).

Option A — uvx (recommended, no clone, no manual venv)

If you have uv, just point your MCP client at the package — uvx downloads it from PyPI, builds an isolated environment, and runs it automatically:

{
  "mcpServers": {
    "bilibili": {
      "command": "uvx",
      "args": ["bilibili-data-mcp"]
    }
  }
}

To pin a version, use "args": ["bilibili-data-mcp@0.2.0"]. The same config works for any MCP client (Claude Desktop, Cursor, ...) via its claude_desktop_config.json / equivalent.

Option B — from source (development)

git clone https://github.com/haotongliu58-sudo/bilibili-mcp
cd bilibili-mcp
python -m venv .venv
.venv\Scripts\python.exe -m pip install -e .

Then point your MCP client at the built executable:

{
  "mcpServers": {
    "bilibili": {
      "command": "C:\\path\\to\\bilibili-mcp\\.venv\\Scripts\\bilibili-data-mcp.exe"
    }
  }
}

Subtitles & login (BILI_SESSDATA)

Bilibili restricts subtitle data to logged-in users, so get_video_subtitle needs your own SESSDATA cookie. Without it, info and search still work; the subtitle tool just returns a short note telling you to set the cookie.

To enable subtitles, get the SESSDATA value from your browser cookies on bilibili.com (DevTools → Application → Cookies) and pass it as an environment variable to the server:

{
  "mcpServers": {
    "bilibili": {
      "command": "uvx",
      "args": ["bilibili-data-mcp"],
      "env": { "BILI_SESSDATA": "your_sessdata_value_here" }
    }
  }
}

The cookie is read locally and used only to call Bilibili's API directly from your machine — it is never uploaded anywhere. Optional companions (rarely needed for read-only subtitle access): BILI_BILI_JCT, BILI_BUVID3, BILI_DEDEUSERID.

Proxy

By default the server ignores the system proxy and connects directly (Bilibili is a domestic CN site; routing through an overseas proxy node breaks requests). If you are outside mainland China and need a proxy to reach Bilibili, set BILI_USE_PROXY=1 in the server's environment.

License

MIT

Metadata

Release files for bilibili-data-mcp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bilibili-data-mcp 0.2.0
File Size Uploaded
bilibili_data_mcp-0.2.0.tar.gz 32.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bilibili-data-mcp 0.2.0
File Interpreter ABI Platform
bilibili_data_mcp-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.8 kB

Release files / bilibili_data_mcp-0.2.0.tar.gz

Download URL bilibili_data_mcp-0.2.0.tar.gz
Size 32.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4a0d1995285ac588e6cfeb3b43b91cc705a96548730ad7062d2adbd5d762793f
BLAKE2b-256 checksum
How to use checksums
3a61eb44686a3ad7c7e6d38e4c78be629edfddb13bfa4b22833992cb76e4cbdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / bilibili_data_mcp-0.2.0-py3-none-any.whl

Download URL bilibili_data_mcp-0.2.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3e6d81189e63e9c493845b73eb3abf8bbab5660207a6932033cd00f8e80626e
BLAKE2b-256 checksum
How to use checksums
863ff5a9b82996831ea924ca017890c650e41b784699fad5a7918b1d17cbaf36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page