bilibili-mcp
Provides tools for interacting with Bilibili, enabling video information retrieval, user management, search, comments, rankings, and messaging through the Bilibili API.
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 for 'honkai impact 3' videos"
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 Server
基于 bilibili-api-python 库的 MCP (Model Context Protocol) 服务器,提供完整的 Bilibili API 工具调用能力。
特性
22个实用工具,覆盖视频、用户、搜索、评论、排行榜、消息等核心功能
使用 stdio 传输方式,与 Claude Desktop 无缝集成
支持环境变量配置登录凭证,安全便捷
统一的响应格式,易于处理
完整的类型注解和参数验证
Related MCP server: bilibili-mcp-server
配置
环境变量
复制 .env.example 为 .env 并填写:
# Bilibili 登录凭证(可选,用于需要登录的操作)
BILI_SESSDATA=your_sessdata
BILI_JCT=your_bili_jct
BILI_BUVID3=your_buvid3获取登录凭证:
登录 Bilibili 网页版
打开浏览器开发者工具 (F12) → Application/应用 → Cookies
复制
SESSDATA,bili_jct,buvid3的值
Claude Desktop 配置
在 Claude Desktop 配置文件 claude_desktop_config.json 中添加:
uvx 方式配置(推荐)
{
"mcpServers": {
"bilibili": {
"command": "uvx",
"args": ["--from", "bilibili-mcp-python", "bilibili-mcp"],
"env": {
"BILI_SESSDATA": "your_sessdata",
"BILI_JCT": "your_bili_jct",
"BILI_BUVID3": "your_buvid3"
}
}
}
}工具详解
视频模块(Video)
视频相关操作,包含信息获取、互动、弹幕等功能。
工具名 | 功能 | 关键参数 | 需登录 |
| 获取视频完整信息 |
| 否 |
| 点赞/投币/收藏/三连 |
| 是 |
| 获取下载链接和清晰度 |
| 否 |
| 获取弹幕列表 |
| 否 |
| 发送弹幕 |
| 是 |
| 获取AI视频总结 |
| 是 |
使用示例:
# 获取视频信息
bilibili_video_get_info(bvid="BV1xx411c7mD")
# 给视频三连
bilibili_video_interact(bvid="BV1xx411c7mD", action="triple")
# 发送弹幕(视频第10秒处)
bilibili_video_send_danmaku(
bvid="BV1xx411c7mD",
message="精彩!",
progress=10000, # 毫秒
color="ff0000"
)用户模块(User)
用户信息查询和关系管理。
工具名 | 功能 | 关键参数 | 需登录 |
| 获取用户完整信息 |
| 否 |
| 获取用户发布的内容 |
| 否 |
| 关注/取关/拉黑/移除粉丝 |
| 是 |
| 获取关注列表 |
| 是 |
| 获取粉丝列表 |
| 是 |
content_type 类型说明:
video- 视频(支持关键词搜索)article- 专栏文章album- 相簿bangumi- 追番列表
使用示例:
# 获取UP主信息
bilibili_user_get_info(uid=208259)
# 获取用户的所有视频
bilibili_user_get_contents(uid=208259, content_type="video")
# 关注用户
bilibili_user_modify_relation(uid=208259, action="follow")搜索模块(Search)
全网内容搜索和热门发现。
工具名 | 功能 | 关键参数 | 需登录 |
| 统一搜索 |
| 否 |
| 获取热门搜索词 | 无 | 否 |
search_type 类型说明:
all- 综合搜索video- 视频user- 用户article- 专栏live- 直播
使用示例:
# 搜索视频
bilibili_search(keyword="Python教程", search_type="video")
# 搜索用户
bilibili_search(keyword="老番茄", search_type="user")
# 获取热搜榜
bilibili_get_hot_search()评论模块(Comment)
视频、动态、专栏的评论管理。
工具名 | 功能 | 关键参数 | 需登录 |
| 获取评论列表(懒加载) |
| 否 |
| 发送评论/回复 |
| 是 |
| 点赞/点踩/删除/获取子评论 |
| 是 |
type_ 类型说明:
video- 视频(oid为aid)dynamic- 动态(oid为动态id)article- 专栏(oid为cv号)
使用示例:
# 获取视频评论(首次)
bilibili_comment_get(oid=170001, type_="video", mode="main")
# 回复评论(root为评论ID)
bilibili_comment_send(
oid=170001,
type_="video",
text="说得好!",
root=12345678
)
# 点赞评论
bilibili_comment_operate(oid=170001, rpid=12345678, action="like")排行榜模块(Rank)
各类排行榜和热门视频获取。
工具名 | 功能 | 关键参数 | 需登录 |
| 获取分区排行榜 |
| 否 |
| 获取热门视频 |
| 否 |
rank_type 排行榜类型:
类型值 | 说明 | 类型值 | 说明 |
| 全站榜 |
| 游戏 |
| 番剧 |
| 音乐 |
| 电影 |
| 动画 |
| 纪录片 |
| 娱乐 |
| 国创 |
| 生活 |
| 科技数码 |
| 美食 |
| 知识 |
| 运动 |
| 舞蹈 |
| 鬼畜 |
| 原创 |
| 新人 |
... | 还有更多 |
使用示例:
# 获取全站排行榜
bilibili_get_rank(rank_type="all")
# 获取游戏区三日榜
bilibili_get_rank(rank_type="game", day=3)
# 获取热门视频
bilibili_get_hot(page=1, page_size=20)消息会话模块(Session)
私信、互动消息和系统通知管理。
工具名 | 功能 | 关键参数 | 需登录 |
| 获取会话列表/聊天记录 |
| 是 |
| 发送私信 |
| 是 |
| 获取互动消息 |
| 是 |
| 获取通知/未读统计 |
| 是 |
interaction_type 互动类型:
replies- 收到的回复likes- 收到的赞at- @我的消息
notification_type 通知类型:
unread- 未读消息统计system- 系统消息settings- 消息设置
使用示例:
# 获取会话列表
bilibili_session_list()
# 获取与某用户的聊天记录
bilibili_session_list(talker_id=208259)
# 发送私信
bilibili_session_send(receiver_id=208259, content="你好!")
# 获取收到的赞
bilibili_session_interactions(interaction_type="likes")
# 获取未读消息数
bilibili_session_notifications(notification_type="unread")响应格式
所有工具返回统一的 JSON 格式:
{
"success": true,
"code": 0,
"message": "ok",
"data": { ... }
}字段 | 类型 | 说明 |
| boolean | 是否成功 |
| int | 状态码,0表示成功 |
| string | 状态描述或错误信息 |
| any | 实际返回数据 |
工具权限速查
无需登录(只读操作)
视频信息、弹幕、下载链接
用户信息、用户公开内容
搜索、热搜、排行榜、热门视频
评论列表
需要登录(写入操作)
视频互动(点赞/投币/收藏/三连)
发送弹幕、获取AI总结
关注/取关/拉黑等用户关系操作
发送评论、评论互动
所有消息会话相关操作
Available Tools
22 toolsbilibili_comment_getA
获取评论列表(新版懒加载模式)
Args: oid: 对象ID(视频aid/动态id/文章cv号) type_: 评论类型 mode: 获取模式 (main-主列表, hot-热门) offset: 偏移量,首次请求为空字符串,后续请求使用上次返回的 next_offset
Returns: 评论列表,包含 cursor 字段用于获取下一页
Inputs: oid (required), mode, type_, offset.
bilibili_comment_operateA
评论操作:点赞/取消点赞/点踩/取消点踩/删除/获取子评论
Args: oid: 对象ID(视频aid/动态id/文章cv号) rpid: 评论ID action: 操作类型 type_: 评论类型 page_index: 页码索引,从1开始(action=get_sub_comments时有效) page_size: 每页评论数,最大20(action=get_sub_comments时有效)
Returns: 操作结果
Inputs: oid (required), rpid (required), action (required), type_, +2 more.
bilibili_comment_sendB
发送评论/回复
Args: oid: 对象ID(视频aid/动态id/文章cv号) text: 评论内容 type_: 评论类型 root: 根评论ID(回复评论时填写) parent: 父评论ID(回复评论时填写,通常与root相同)
Returns: 发送结果
Inputs: oid (required), text (required), root, type_, +1 more.
bilibili_get_hotB
获取热门视频
Args: page: 页码(从 1 开始) page_size: 每页视频数(默认 20)
Returns: 热门视频列表
Inputs: page, page_size.
bilibili_get_hot_searchA
获取热门搜索词
Returns: 热门搜索词列表
Inputs: no named parameters.
bilibili_get_rankB
获取排行榜
Args: rank_type: 排行榜类型(all=全站,bangumi=番剧,movie=电影,documentary=纪录片, guochuang_anime=国产动画,guochuang=国创,game=游戏,music=音乐, douga=动画,ent=娱乐,life=生活,technology=科技,cinephile=影视, fashion=时尚,knowledge=知识,food=美食,sports=运动,car=汽车, dance=舞蹈,kichiku=鬼畜,animal=动物,tv=电视剧,variety=综艺, original=原创,rookie=新人) day: 时间范围(仅对 PGC 类型有效:番剧/电影/纪录片等),3=三日榜,7=周榜
Returns: 排行榜列表
Inputs: day, rank_type.
bilibili_searchB
统一搜索(综合/视频/用户/专栏/直播)
Args: keyword: 搜索关键词 search_type: 搜索类型 page_num: 页码,从1开始 page_size: 每页数量
Returns: 搜索结果
Inputs: keyword (required), page_num, page_size, search_type.
bilibili_session_interactionsB
获取互动消息(回复/点赞/@)
Args: interaction_type: 互动类型 - replies: 收到的回复 - likes: 收到的赞 - at: 收到的@消息 last_id: 最后一个ID,用于翻页 last_time: 最后一个消息的时间戳,用于翻页
Returns: 互动消息列表
Inputs: last_id, last_time, interaction_type.
bilibili_session_listA
获取会话列表或聊天记录
如果不提供 talker_id,则获取会话列表; 如果提供 talker_id,则获取与该用户的聊天记录。
Args: talker_id: 会话对象UID(不填则获取会话列表) session_type: 会话类型 1:私聊, 2:通知, 3:应援团, 4:全部(默认,仅列表有效) begin_seqno: 起始Seqno用于翻页,默认0获取最新消息(仅聊天记录有效)
Returns: 会话列表或聊天记录
Inputs: talker_id, begin_seqno, session_type.
bilibili_session_notificationsB
获取通知和设置信息
Args: notification_type: 通知类型 - unread: 未读消息数量统计(默认) - system: 系统消息列表 - settings: 消息设置
Returns: 通知或设置信息
Inputs: notification_type.
bilibili_session_sendA
发送私信文本消息
Args: receiver_id: 接收者 UID content: 消息内容(纯文本)
Returns: 发送结果
Inputs: content (required), receiver_id (required).
bilibili_user_get_contentsA
获取用户内容(视频/专栏/相簿/追番/动态)
Args: uid: 用户UID content_type: 内容类型 (video-视频, article-专栏, album-相簿, bangumi-追番) page_num: 页码,从1开始 page_size: 每页数量,最大50 keyword: 搜索关键词(仅video类型有效) offset: 动态分页偏移量(仅dynamic类型有效),为空时从第一条动态开始
Returns: 内容列表,dynamic类型返回结果中包含 next_offset 用于下次请求
Inputs: uid (required), offset, keyword, page_num, +2 more.
bilibili_user_get_followersA
获取用户粉丝列表
Args: uid: 用户UID page_num: 页码,从1开始 page_size: 每页数量,默认20 order: 排序方式 (desc-倒序, asc-正序)
Returns: 粉丝列表,注意:非自己只能查看前5页
Inputs: uid (required), order, page_num, page_size.
bilibili_user_get_followingsA
获取用户关注列表
Args: uid: 用户UID page_num: 页码,从1开始 page_size: 每页数量,默认20 order: 排序方式 (desc-倒序, asc-正序)
Returns: 关注列表,注意:非自己只能查看前5页
Inputs: uid (required), order, page_num, page_size.
bilibili_user_get_infoC
获取用户完整信息
Args: uid: 用户UID
Returns: 用户基础信息、关系统计、UP主数据
Inputs: uid (required).
bilibili_user_modify_relationA
修改用户关系:关注/取关/拉黑/取消拉黑/移除粉丝
Args: uid: 目标用户UID action: 关系操作类型
Returns: 操作结果
Inputs: uid (required), action (required).
bilibili_video_get_ai_conclusionA
获取视频AI总结
Args: bvid: 视频的BV号
Returns: AI生成的视频总结内容
Inputs: bvid (required).
bilibili_video_get_danmakuA
获取视频弹幕列表
Args: bvid: 视频的BV号 page_num: 分P序号,从0开始 from_seg: 起始弹幕分段,默认0 to_seg: 结束弹幕分段,默认None表示不限制
Returns: 弹幕列表
Inputs: bvid (required), to_seg, from_seg, page_num.
bilibili_video_get_download_infoA
获取视频下载链接和播放器信息
Args: bvid: 视频的BV号 page_num: 分P序号,从0开始
Returns: 包含下载链接、清晰度列表、播放器配置等信息
Inputs: bvid (required), page_num.
bilibili_video_get_infoA
获取视频完整信息(包括基础信息、统计数据、分P列表、标签)
Args: bvid: 视频的BV号,如 BV1xx411c7mD
Returns: 视频完整信息,包含 title, desc, stat, pages, tags 等
Inputs: bvid (required).
bilibili_video_interactA
视频互动:点赞/投币/收藏/三连
Args: bvid: 视频的BV号 action: 互动类型 (like-点赞, coin-投币, favorite-收藏, triple-三连) cancel: 是否取消操作(仅对like/favorite有效) coin_num: 投币数量(1或2,action=coin时有效) media_id: 收藏夹ID(action=favorite时有效,不填则使用默认收藏夹)
Returns: 操作结果
Inputs: bvid (required), action (required), cancel, coin_num, +1 more.
bilibili_video_send_danmakuA
发送弹幕
Args: bvid: 视频的BV号 message: 弹幕内容 page_num: 分P序号,从0开始 progress: 发送时间(毫秒),0表示开头 color: 颜色(十六进制),默认ffffff(白色) font_size: 字体大小 (18-小, 25-普通, 36-大) mode: 弹幕模式 (1-滚动, 4-底部, 5-顶部)
Returns: 发送结果
Inputs: bvid (required), message (required), mode, color, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Most tools target distinct resources and actions. The only potential overlap is between bilibili_get_hot, bilibili_get_rank, and bilibili_get_hot_search, but they return different content types. bilibili_comment_operate's get_sub_comments action overlaps somewhat with bilibili_comment_get, but this is a minor issue.
The naming pattern is mixed: many tools use bilibili_<domain>_<verb>_<noun>, but some like bilibili_get_hot, bilibili_get_rank, and bilibili_search omit the domain. Verb choices also vary (get, send, modify, interact, operate), and session tools use nouns like 'notifications' and 'interactions'. Still, all names are snake_case and readable.
At 22 tools, the set is on the heavier side but within a reasonable range for a platform like Bilibili. The number covers multiple domains (videos, users, comments, sessions, search, rankings) without being excessive. It feels slightly heavy but not bloated.
The tool set covers most core Bilibili workflows: reading video/user/comment data, interacting via likes/follows/danmaku/comments/private messages, and accessing search and rankings. Missing operations like video upload/delete or profile editing are minor and not typically needed for an MCP server.
Maintenance
Related MCP Connectors
MCP server for China Railway 12306 ticket availability: schedules and seats by Chinese station name.
MCP server for China Railway 12306 ticket availability: schedules and seats by Chinese station name.
MCP server for Hailuo (MiniMax) AI video generation
MCP server aggregating hot-search boards from 8 Chinese platforms (Weibo, Zhihu, Bilibili, Douyin).
Related MCP Servers
- 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.110 npm198MIT
- AlicenseBqualityCmaintenanceBilibili MCP server enabling video search, comment management, danmaku, user info, dynamics, live streaming analysis, and more via 31 tools.316,226 npm11MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server for interacting with Bilibili, enabling AI assistants to search videos, fetch comments and subtitles, publish content, and manage interactions. It also adds private message reading, stable TV login, and an automated comment workflow requiring human confirmation.MIT
- AlicenseAqualityDmaintenanceA compliance-first MCP server for Bilibili that provides read-only access to authorized user and video data through the official open platform API.61MIT