bilibili-mcp
Provides tools for interacting with Bilibili, including search and discovery, video details and playback URLs, subtitles and danmaku, comments, user profiles and relations, account-scoped reads such as history and favorites, articles, live rooms, and optional confirmation-protected write actions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@bilibili-mcp search Bilibili for Python tutorials and show the top results"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Bilibili MCP Agent
一个可安装到本地 Agent 宿主的 Bilibili Model Context Protocol(MCP)服务器。它把 Bilibili 的搜索、视频、字幕、弹幕、评论、用户、账号、收藏、动态、专栏和直播能力整理成结构化工具,并提供显式确认的互动写入工具。
This repository is a portable local plugin package. It contains no account cookies, session tokens, gateway keys, browser profiles, build artifacts, or machine-specific paths.
Included capabilities
42 MCP tools across 11 categories.
Public discovery: search, hot searches, popular videos, rankings, regions.
Video data: details, pages, statistics, related videos, tags, play URLs.
Subtitles and danmaku: subtitle tracks, subtitle text, XML danmaku.
Comments and users: comment pages, replies, public profiles, uploads, relations.
Personal reads: current account, history, watch later, favorites, feed.
Articles and live rooms: article metadata, areas, rooms, room status, play URLs.
Seven write tools, disabled by default and protected by per-call confirmation.
Chromium browser-cookie import through a one-time loopback pairing flow.
The complete machine-readable catalog is in capabilities.json.
Related MCP server: Bilibili MCP Server
Requirements
Python 3.12 or newer.
uvonPATH.A Chromium-based browser is only needed for the optional cookie import flow.
Run as an Agent plugin
The root plugin.json and mcp.json are the Agent
Plugins 1.0 manifests. Import the repository or package into a local plugin
host that supports stdio MCP servers. The configured command is portable:
uv run --frozen --project ${PLUGIN_ROOT} bilibili-mcpDependencies are installed from uv.lock. Plugin hosts expand PLUGIN_ROOT
and PLUGIN_DATA; the virtual environment is created in the host's writable
plugin data directory, so the plugin files can remain read-only.
Use with any stdio MCP client
Add this server to a client that accepts mcpServers configuration and has
uvx and Git on PATH:
{
"mcpServers": {
"bilibili": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/only3412/bilibili-mcp-agent@v0.1.0",
"bilibili-mcp"
]
}
}
}The client starts the server on demand. No API key or login is needed for public tools; import your own Bilibili session separately for personal tools. Clients with other configuration formats can use the same command and args.
Install locally
Windows PowerShell:
.\scripts\install.ps1macOS/Linux:
./scripts/install.shThe helpers create a repository-local virtual environment and install the editable package. The environment is ignored by Git.
Import a Bilibili session
The server can use public endpoints without login. For account-scoped tools, start the one-time browser pairing flow:
.\scripts\login-import.ps1Then load the generated unpacked extension from the private directory shown by
the command, open Bilibili in the same browser profile, and click Import.
The extension sends cookies only to the local pairing port. The server calls
Bilibili's nav endpoint to verify the session before replacing the previous
private session file.
The private store defaults to:
Windows: %LOCALAPPDATA%\BilibiliMCP\credentials.local.json
Unix: ~/.local/share/BilibiliMCP/credentials.local.jsonOverride it with BILIBILI_MCP_AUTH_FILE. The generated api_key is only a
local gateway key for the optional loopback HTTP transport; it is not a
Bilibili API key and is never included in this repository.
Check status without printing cookie or key values:
uv run --project . bilibili-mcp auth statusStart the server manually
stdio (the default Agent transport):
uv run --project . bilibili-mcpLoopback Streamable HTTP:
.\scripts\run.ps1 -HttpThe HTTP endpoint is http://127.0.0.1:17891/mcp and requires the generated
local Bearer key. It is deliberately bound to loopback and is not a public
remote MCP endpoint.
Enable the seven write tools only when needed:
.\scripts\run.ps1 -EnableWritesEach write call still requires confirm: true and a valid bili_jct in the
private session. The repository does not ship or request a credential.
Development and verification
uv sync --frozen
uv run --frozen python -m unittest discover -s tests -v
uv run --frozen python -m compileall src
uv run --frozen python scripts/export-capabilities.py
uv buildThe test suite uses local doubles and does not send Bilibili write requests.
Scope and attribution
This is an independent client-side MCP adapter. Bilibili names and endpoints belong to their respective owners. Use it only where your account and the service allow the requested operation, and follow the platform's current terms and rate limits.
License
MIT. See LICENSE.
Available Tools
42 toolsbilibili_article_infoCRead-onlyIdempotent
[专栏] 读取专栏文章公开信息。
Inputs: id (required).
bilibili_auth_statusARead-only
只返回本地会话状态和账号,不返回Cookie或key;verify=true会实时校验B站登录。
Inputs: verify.
bilibili_capabilitiesCRead-only
按分类查询本MCP工具、接口与参数约束。
Inputs: category.
bilibili_comment_addBDestructive
[互动写入] 发布一条评论/回复;视频oid为aid,回复需root和parent。
Inputs: oid (required), confirm (required), message (required), root, +2 more.
bilibili_comment_deleteBDestructive
[互动写入] 删除当前账号自己的指定评论。
Inputs: oid (required), rpid (required), confirm (required), type.
bilibili_comment_repliesCRead-onlyIdempotent
[评论] 读取指定根评论下的回复。
Inputs: oid (required), root (required), pn, ps, +1 more.
bilibili_commentsBRead-onlyIdempotent
[评论] 读取视频/专栏主评论;oid使用视频aid,type=1为视频、12为专栏。
Inputs: oid (required), pn, ps, sort, +1 more.
bilibili_danmakuCRead-onlyIdempotent
[字幕与弹幕] 读取分P公开XML弹幕,最多返回limit条。
Inputs: oid (required), limit.
bilibili_dynamic_detailCRead-onlyIdempotent
[动态] 读取指定动态内容。
Inputs: id (required).
bilibili_favorite_foldersBRead-onlyIdempotent
[收藏] 列出收藏夹;不传up_mid时使用当前已绑定账号。
Inputs: up_mid.
bilibili_favorite_itemsCRead-onlyIdempotent
[收藏] 分页读取可见收藏夹中的视频。
Inputs: media_id (required), pn, ps, tid, +2 more.
bilibili_live_areasBRead-onlyIdempotent
[直播] 读取直播分区树。
Inputs: no named parameters.
bilibili_live_playurlCRead-onlyIdempotent
[直播] 取得当前可见直播流地址。
Inputs: room_id (required), qn, codec, format, +2 more.
bilibili_live_room_infoCRead-onlyIdempotent
[直播] 读取直播间信息和直播状态。
Inputs: room_id (required).
bilibili_live_roomsCRead-onlyIdempotent
[直播] 按直播分区读取直播间列表。
Inputs: parent_area_id (required), page, area_id, page_size, +1 more.
bilibili_meBRead-onlyIdempotent
[账号] 使用当前已绑定会话核验登录并读取本人资料。
Inputs: no named parameters.
bilibili_my_feedBRead-onlyIdempotent
[动态] 读取当前登录用户关注动态;后续分页传offset。
Inputs: type, offset.
bilibili_my_historyARead-onlyIdempotent
[账号] 分页读取本人观看历史;首次max/view_at=0,后续沿用响应cursor。
Inputs: ps, max, view_at, business.
bilibili_my_watch_laterBRead-onlyIdempotent
[账号] 读取本人稍后再看列表。
Inputs: no named parameters.
bilibili_popularCRead-onlyIdempotent
[发现] 读取热门视频列表。
Inputs: pn, ps.
bilibili_rankingBRead-onlyIdempotent
[发现] 按分区读取排行榜;rid=0为全站。
Inputs: rid, type.
bilibili_region_onlineCRead-onlyIdempotent
[发现] 读取分区在线/投稿统计。
Inputs: no named parameters.
bilibili_searchBRead-onlyIdempotent
[发现] 分类搜索视频、UP主、直播间、专栏和影视。返回分页原始结构;标题可能含高亮HTML。
Inputs: keyword (required), page, tids, order, +2 more.
bilibili_search_hotCRead-onlyIdempotent
[发现] 读取实时搜索热词。
Inputs: limit.
bilibili_subtitlesCRead-onlyIdempotent
[字幕与弹幕] 查询分P字幕轨道;部分AI字幕依赖登录态及平台可见性。
Inputs: cid (required), bvid (required).
bilibili_subtitle_textCRead-onlyIdempotent
[字幕与弹幕] 读取字幕接口返回的hdslb字幕JSON,合并时间戳文本。
Inputs: url (required).
bilibili_user_feedCRead-onlyIdempotent
[动态] 读取指定UP主公开动态。
Inputs: host_mid (required), offset.
bilibili_user_followBDestructive
[互动写入] 关注/取消关注UP主;act=1关注、2取消。
Inputs: act (required), fid (required), confirm (required), re_src.
bilibili_user_followingsCRead-onlyIdempotent
[用户] 分页读取用户公开关注列表;平台会限制可见范围。
Inputs: vmid (required), pn, ps.
bilibili_user_infoBRead-onlyIdempotent
[用户] 读取UP主公开资料,自动附加WBI签名。
Inputs: mid (required).
bilibili_user_relation_statsBRead-onlyIdempotent
[用户] 读取用户关注数、粉丝数等关系统计。
Inputs: vmid (required).
bilibili_user_videosCRead-onlyIdempotent
[用户] 读取UP主视频投稿列表,自动附加WBI签名。
Inputs: mid (required), pn, ps, tid, +1 more.
bilibili_video_favoriteBDestructive
[互动写入] 将视频加入/移出指定收藏夹,夹ID以逗号分隔。
Inputs: rid (required), confirm (required), type, add_media_ids, +1 more.
bilibili_video_infoBRead-onlyIdempotent
[视频] 读取视频标题、简介、UP主、aid、cid、分P与统计。
Inputs: bvid (required).
bilibili_video_likeADestructive
[互动写入] 点赞/取消点赞视频;like=1点赞、2取消。
Inputs: aid (required), like (required), confirm (required).
bilibili_video_pagesBRead-onlyIdempotent
[视频] 读取视频各分P的cid、标题与时长。
Inputs: bvid (required).
bilibili_video_playurlBRead-onlyIdempotent
[视频] 取得当前会话可播放的临时媒体地址与清晰度;地址有时效。
Inputs: cid (required), bvid (required), qn, fnval, +1 more.
bilibili_video_statBRead-onlyIdempotent
[视频] 读取视频播放、弹幕、评论、收藏、投币与点赞计数,从当前详情接口提取stat。
Inputs: bvid (required).
bilibili_video_tagsCRead-onlyIdempotent
[视频] 读取视频标签。
Inputs: bvid (required).
bilibili_watch_later_addBDestructive
[互动写入] 将视频加入稍后再看。
Inputs: aid (required), confirm (required).
bilibili_watch_later_deleteCDestructive
[互动写入] 从稍后再看移除指定aid,逗号分隔。
Inputs: avids (required), confirm (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 42 tools
Categories and resource-oriented names make most tools easy to distinguish, including public-versus-self user tools and read-versus-write interactions. The main ambiguity is bilibili_video_info overlapping with bilibili_video_pages and bilibili_video_stat because the info tool also exposes video parts and statistics.
Every tool uses the bilibili_ prefix and snake_case, with generally predictable resource qualifiers and suffixes such as _info, _add, and _delete. Feed/dynamic terminology and a few noun-only discovery names introduce minor variation, but there are no disruptive convention changes.
At 42 tools, the surface is well beyond the recommended range and creates a substantial discovery and selection burden. Bilibili's breadth justifies many endpoints, but some narrowly split metadata and statistics tools could potentially be consolidated.
For its read-centric scope, workflows are strong: discovery connects to video, user, and live details, playback, subtitles, comments, and account collections, while core engagement writes are present. Coverage is more selective for management and publishing, with gaps such as favorite-folder creation/deletion, content upload, and broader history or account controls.
Maintenance
Related MCP Connectors
Bilibili videos for AI agents: search, creators, trending, stats, tags and danmaku comments.
Bilibili (B站) data without login: video stats, comments, danmaku, creators, trending, hot searches.
Bilibili public video, article, dynamic, creator, comments, reactions, and transcript tools.
660+ data tools for agents: TikTok, Douyin, Instagram, YouTube, X, weather, GitHub. Pay per call.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Bilibili (哔哩哔哩) through its API, supporting video search and recommendations, user search, dynamic feeds, video collections, and danmaku retrieval through natural language.5-
- AlicenseNot gradedqualityBmaintenanceAn MCP server that enables users to search Bilibili videos, access trending rankings, and retrieve detailed information about videos, content creators, and anime schedules. It allows AI applications to interact directly with Bilibili content via simple API interfaces.102 npm198MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to directly operate Bilibili, providing 27 tools for login, search, content publishing, data analysis, and interaction.197MIT
- AlicenseAqualityBmaintenanceEnables agents to search, explore trending content, retrieve video metadata and hot comments, and obtain subtitle transcripts for summarisation on Bilibili, with an anonymous tier and an optional account tier for personalized feeds.104MIT