bilibili-mcp-server
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-server search for 'Minecraft' 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
B 站的 MCP 服务。提供视频搜索、评论管理、弹幕字幕、用户信息、动态专栏、扫码登录、直播截图视觉分析等功能,共 31 个工具。
工具列表
类别 | 工具 | 数量 |
评论 |
| 3 |
搜索 |
| 2 |
视频 |
| 5 |
用户 |
| 7 |
内容 |
| 3 |
消息 |
| 2 |
直播 |
| 2 |
登录 |
| 2 |
系统 |
| 1 |
下载 |
| 3 |
弹幕 |
| 1 |
Related MCP server: BiliStalkerMCP
快速开始
环境要求
Node.js 22+
B 站账号(用于需要登录的操作)
ffmpeg(仅视频下载工具需要;macOS:
brew install ffmpeg,Windows:choco install ffmpeg,Linux:apt install ffmpeg)
安装
# 直接运行
npx bilibili-mcp-server
# 或全局安装
npm install -g bilibili-mcp-server
bilibili-mcp-server配置
支持环境变量或项目目录下的 .env 文件:
# 必填 - 从浏览器开发者工具 → Application → Cookies → bilibili.com 获取
export BILIBILI_SESSDATA=你的sessdata
export BILIBILI_BILI_JCT=你的bili_jct
export BILIBILI_DEDE_USER_ID=你的uid
# 可选 - Cookie 自动刷新
# 获取方式: bilibili.com → F12 → Console → 输入:
# console.log(localStorage.getItem('ac_time_value'))
export BILIBILI_REFRESH_TOKEN=你的refresh_token
# 可选 - 完整 Cookie(热搜等功能需要)
# export BILIBILI_FULL_COOKIE="buvid3=xxx; buvid4=xxx; _uuid=xxx; ..."
# 可选
export BILIBILI_AUTO_REFRESH=true
export BILIBILI_COOKIE_FILE=/path/to/cookie.json
export BILIBILI_DETECT_FILE=/path/to/detect.jsonMCP 客户端配置
{
"mcpServers": {
"bilibili": {
"command": "npx",
"args": ["-y", "bilibili-mcp-server"],
"env": {
"BILIBILI_SESSDATA": "你的sessdata",
"BILIBILI_BILI_JCT": "你的bili_jct",
"BILIBILI_DEDE_USER_ID": "你的uid"
}
}
}
}扫码登录
不想手动复制 Cookie 的话,可以调扫码登录:
调
bilibili_login获取二维码手机 B 站 App 扫码
调
bilibili_login_check检测登录状态登录成功自动保存 Cookie
工具说明
登录与认证
工具 | 功能 | 参数 |
| 生成扫码登录二维码 | - |
| 轮询扫码状态,登录成功自动保存 |
|
| 手动触发 Cookie 刷新 | - |
评论管理
工具 | 功能 | 参数 |
| 发布评论或回复 |
|
| 删除自己的评论 |
|
| 点赞/取消赞 |
|
视频与搜索
工具 | 功能 | 参数 |
| 搜索视频 |
|
| 视频详情 |
|
| 获取评论列表 |
|
| 获取字幕 |
|
| 获取弹幕 |
|
| 热门视频 |
|
| 热搜关键词 | - |
用户
工具 | 功能 | 参数 |
| 用户信息 |
|
| UP 主视频列表 |
|
| 收藏夹 |
|
动态与专栏
工具 | 功能 | 参数 |
| UP 主最新动态 |
|
| 专栏文章详情 |
|
| UP 主专栏列表 |
|
关注管理
工具 | 功能 | 参数 |
| 关注 UP 主 |
|
| 取消关注 |
|
| 关注列表 |
|
| 粉丝列表 |
|
关注/取关操作会被 B 站风控监控,不建议短时间内大量操作。
弹幕
工具 | 功能 | 参数 |
| 发送弹幕 |
|
弹幕发送是高风控操作,建议每天不超过 5 条。
下载
工具 | 功能 | 参数 |
| 下载视频(需 ffmpeg) |
|
| 下载专栏为 Markdown |
|
| 查看已下载列表 |
|
视频下载会自动下载 DASH 音视频并用 ffmpeg 合并为 mp4。默认保存到
./bilibili-downloads/。
消息通知
工具 | 功能 | 参数 |
| 检测新回复 |
|
| 查看未读通知 | - |
直播
工具 | 功能 | 参数 |
| 查询直播间信息 |
|
| 截取直播间当前画面(视觉分析) |
|
bilibili_live_screenshot会把关键帧截图作为图片返回给模型,让具备视觉能力的 AI 分析直播内容。如模型无视觉能力,仅返回文字元数据。
项目结构
src/
├── index.ts
├── env.ts
├── config.ts
├── api/
│ ├── http.ts
│ ├── bilibili.ts
│ ├── wbi.ts
│ ├── cookie.ts
│ ├── login.ts
│ └── danmaku.ts
├── tools/
│ ├── comment.ts
│ ├── video.ts
│ ├── user.ts
│ ├── content.ts
│ ├── message.ts
│ ├── login.ts
│ └── live.ts
└── types/
└── index.ts开发
npm install
npm run dev # 开发模式
npm run build # 构建
npm test # 测试许可证
MIT
Available Tools
21 toolsbilibili_article_infoB
获取 B站 专栏文章的详细内容,包含标题、正文、发布时间、作者、数据统计等
Inputs: cvid (required).
bilibili_detect_repliesA
检测 B站视频/评论下的新回复,列出上次检查之后的新内容。不自动回复,需要人工确认后操作。
Inputs: max, videoId.
bilibili_download_listA
查看已下载的文件列表(按时间倒序)
Inputs: outputDir.
bilibili_hotC
获取 B站当前热门视频列表,包含播放量、弹幕数、点赞数等数据
Inputs: max, page.
bilibili_live_infoB
查询 B站 UP 主的直播间信息。输入 uid(用户 ID),返回直播状态(是否开播)、直播间标题、人气值(热度)、关注数、直播分类、弹幕热词等。注意:人气值是热度指标,非真实观看人数
Inputs: uid (required).
bilibili_loginA
生成 B站 扫码登录二维码。返回二维码图片(Base64)和 login_key,将 login_key 传给 bilibili_login_check 检查登录状态
Inputs: no named parameters.
bilibili_login_checkA
检查 B站 扫码登录状态。调用 bilibili_login 获取二维码后,传入返回的 loginKey 进行轮询检查。扫码成功后自动保存 Cookie
Inputs: loginKey (required), maxRetries.
bilibili_notificationsA
查看 B站未读消息概览,包含回复、@提及、点赞等通知
Inputs: no named parameters.
bilibili_refresh_cookieA
手动触发 B站 Cookie 刷新。检查当前 Cookie 状态,如需要则执行完整的 6 步刷新流程(含 RSA 加密、refresh_csrf 获取、刷新、确认更新)
Inputs: no named parameters.
bilibili_replyC
在 B站视频下发布评论或回复他人评论
Inputs: message (required), videoId (required), type, rootRpid, +1 more.
bilibili_searchA
搜索 B站视频。⚠️ 注意:B站 totalrank 算法不按时间排,系列剧集最新一集可能不在第 1 页。如要查某 UP 主最新视频,建议先用搜索找到 UP主 uid,再调用 bilibili_user_videos 工具
Inputs: keyword (required), page, order, duration.
bilibili_search_hotA
获取 B站热搜关键词列表
Inputs: no named parameters.
bilibili_send_danmakuA
向视频发送一条弹幕。B 站对此操作有极严格的风控,新账号或操作频繁的账号可能直接被风控拦截。建议每天不超过 5 条。
Inputs: cid (required), message (required), videoId (required), progress (required), +2 more.
bilibili_user_articlesB
获取指定 UP 主发布的专栏文章列表,包含阅读数、发布时间等
Inputs: uid (required), max.
bilibili_user_dynamicsA
获取指定 UP 主的最新动态(包括视频投稿、转发、图文等)
Inputs: uid (required), max.
bilibili_user_followersB
查询指定用户的粉丝列表(谁关注了 TA)
Inputs: uid (required), page, pageSize.
bilibili_user_infoA
获取 B站用户信息,包含昵称、签名、等级、粉丝数、关注数、直播间信息等
Inputs: uid (required).
bilibili_video_commentsA
获取 B站视频的评论列表,包含评论内容、作者信息、点赞数等
Inputs: videoId (required), max.
bilibili_video_danmakuB
获取 B站视频的弹幕列表,包含弹幕内容、出现时间、类型、颜色等
Inputs: videoId (required), segment.
bilibili_video_downloadA
下载 B 站视频到本地。自动下载视频+音频并用 ffmpeg 合并为 MP4。要求系统已安装 ffmpeg。⚠️ 仅供个人备份使用,请勿传播。
Inputs: videoId (required), cid, quality, outputDir.
bilibili_video_infoB
获取 B站视频的详细信息,包含标题、简介、播放量、弹幕数、评论数、点赞数、投币数、收藏数、分享数等
Inputs: videoId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
Most tools target distinct resources (videos, users, articles, live, auth), making selection generally clear. Minor ambiguity exists between bilibili_hot vs bilibili_search_hot and bilibili_notifications vs bilibili_detect_replies, but descriptions resolve the differences.
All tools share the bilibili_ prefix, but the pattern is mixed: some are resource_noun (video_info, user_followers), some are verb-only (search, hot, reply), and pairing is inconsistent (video_download vs download_list, search_hot vs hot). Still readable, but not a uniform verb_noun convention.
21 tools is on the heavy side, but the server covers a broad Bilibili surface including auth, videos, users, articles, live, and downloads. Each tool has a concrete purpose, so the count feels slightly over a lean scope rather than bloated.
Coverage is solid for read operations and basic interactions (comments, danmaku, downloads), and auth is fully handled. Notable gaps exist: bilibili_search explicitly references a bilibili_user_videos tool that does not exist, and there are no like/coin/favorite, follow/unfollow, or comment moderation tools, leaving some workflows incomplete.
Maintenance
Related MCP Connectors
MCP server aggregating hot-search boards from 8 Chinese platforms (Weibo, Zhihu, Bilibili, Douyin).
MCP server for real-time Chinese internet hot-search and trending boards across major platforms.
MCP server for Hailuo (MiniMax) AI video generation
Hosted MCP server for DataLikers — Instagram & TikTok data API. 51 tools: Instagram user search by demographics (gender/age/race/country/city), profiles, bulk lookup, engagement, posts & reels, comments, hashtags, locations, stories, highlights, music, business accounts, top users; TikTok users, videos, comments, hashtags, playlists and top charts. Streamable HTTP, Bearer API key. Free tier: 100 requests on signup at https://datalikers.com/p/1by27bwg
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.102 npm198MIT
- AlicenseNot gradedqualityBmaintenanceBiliStalkerMCP is a Bilibili MCP server designed to analyze a specific Bilibili user by providing tools to retrieve user profiles, videos, dynamics, articles, and followings.126 PyPI11MIT
- AlicenseBqualityDmaintenanceA MCP server providing 22 tools to interact with Bilibili API, enabling video info, search, user profile, comments, rankings, and messaging with login support for write operations.224GPL 3.0
- 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