# bilibili-mcp-server [Health: Active]

**Category:** 🌐 Social Media  
**Repository:** https://github.com/Iseenope/bilibili-mcp-server  
**GitHub Stars:** 7  
**npm Downloads (last month):** 16302  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/bilibili-mcp-server-2

## Description
B站 MCP 服务 — 哔哩哔哩 API 的 Model Context Protocol 封装，提供视频搜索、弹幕、字幕、评论、直播、用户信息、专栏等 22 个工具

## Tools
Capabilities this server exposes over MCP:

- **bilibili_reply** — 在 B站视频下发布评论或回复他人评论
- **bilibili_delete_comment** — 删除自己在 B站的评论
- **bilibili_like_comment** — 给 B站评论点赞或取消点赞
- **bilibili_video_comments** — 获取 B站视频的评论列表，包含评论内容、作者信息、点赞数等
- **bilibili_search** — 搜索 B站视频。⚠️ 注意：B站 totalrank 算法不按时间排，系列剧集最新一集可能不在第 1 页。如要查某 UP 主最新视频，建议先用搜索找到 UP主 uid，再调用 bilibili_user_videos 工具
- **bilibili_video_info** — 获取 B站视频的详细信息，包含标题、简介、播放量、弹幕数、评论数、点赞数、投币数、收藏数、分享数等
- **bilibili_video_subtitle** — 获取 B站视频的字幕文本（AI 语音转文字），返回带时间轴的字幕内容
- **bilibili_video_danmaku** — 获取 B站视频的弹幕列表，包含弹幕内容、出现时间、类型、颜色等
- **bilibili_hot** — 获取 B站当前热门视频列表，包含播放量、弹幕数、点赞数等数据
- **bilibili_search_hot** — 获取 B站热搜关键词列表
- **bilibili_send_danmaku** — 向视频发送一条弹幕。B 站对此操作有极严格的风控，新账号或操作频繁的账号可能直接被风控拦截。建议每天不超过 5 条。
- **bilibili_user_videos** — 获取指定 UP 主的视频列表，按发布时间排序
- **bilibili_user_info** — 获取 B站用户信息，包含昵称、签名、等级、粉丝数、关注数、直播间信息等
- **bilibili_user_favorites** — 获取用户的收藏夹列表及内容
- **bilibili_detect_replies** — 检测 B站视频/评论下的新回复，列出上次检查之后的新内容。不自动回复，需要人工确认后操作。
- **bilibili_refresh_cookie** — 手动触发 B站 Cookie 刷新。检查当前 Cookie 状态，如需要则执行完整的 6 步刷新流程（含 RSA 加密、refresh_csrf 获取、刷新、确认更新）
- **bilibili_notifications** — 查看 B站未读消息概览，包含回复、@提及、点赞等通知
- **bilibili_login** — 生成 B站 扫码登录二维码。返回二维码图片（Base64）和 login_key，将 login_key 传给 bilibili_login_check 检查登录状态
- **bilibili_login_check** — 检查 B站 扫码登录状态。调用 bilibili_login 获取二维码后，传入返回的 loginKey 进行轮询检查。扫码成功后自动保存 Cookie
- **bilibili_user_dynamics** — 获取指定 UP 主的最新动态（包括视频投稿、转发、图文等）
- **bilibili_article_info** — 获取 B站 专栏文章的详细内容，包含标题、正文、发布时间、作者、数据统计等
- **bilibili_user_articles** — 获取指定 UP 主发布的专栏文章列表，包含阅读数、发布时间等
- **bilibili_live_info** — 查询 B站 UP 主的直播间信息。输入 uid（用户 ID），返回直播状态（是否开播）、直播间标题、人气值（热度）、关注数、直播分类、弹幕热词等。注意：人气值是热度指标，非真实观看人数
- **bilibili_live_screenshot** — 获取直播间的当前画面截图，返回给具备视觉能力的模型分析。返回内容包括：1) 直播间元数据（标题/人气/UP主等）；2) 关键帧截图（keyframe）。如模型无视觉能力，仅文字信息可用，AI 应提示"无法查看图像"。
- **bilibili_user_follow** — 关注指定 UP 主。需登录态，行为会被 B 站风控监控，不建议短时间内大量关注
- **bilibili_user_unfollow** — 取消关注指定 UP 主
- **bilibili_user_followings** — 查询指定用户的关注列表（TA 关注了谁）
- **bilibili_user_followers** — 查询指定用户的粉丝列表（谁关注了 TA）
- **bilibili_video_download** — 下载 B 站视频到本地。自动下载视频+音频并用 ffmpeg 合并为 MP4。要求系统已安装 ffmpeg。⚠️ 仅供个人备份使用，请勿传播。
- **bilibili_article_download** — 下载 B 站专栏为 Markdown 文件（可选择是否下载图片）。
- **bilibili_download_list** — 查看已下载的文件列表（按时间倒序）

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "bilibili-mcp-server": {
    "command": "npx",
    "args": ["-y","bilibili-mcp-server"],
    "env": {
      "BILIBILI_SESSDATA": "",
      "BILIBILI_BILI_JCT": "",
      "BILIBILI_DEDE_USER_ID": ""
    }
  }
}
```

**Requires environment variables:** `BILIBILI_SESSDATA`, `BILIBILI_BILI_JCT`, `BILIBILI_DEDE_USER_ID` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What bilibili-mcp-server does

bilibili-mcp-server exposes Bilibili functions through the Model Context Protocol. Its 31 tools cover public content discovery, account-aware actions, creator activity, live rooms, notifications, authentication, and local downloads.

For video workflows, it can search Bilibili, inspect video statistics and metadata, retrieve comments and danmaku, and return AI-generated subtitle text with timestamps. Search results use Bilibili’s ranking behavior rather than a strict publication-time order, so finding a creator’s newest uploads is better handled by locating the creator’s UID first and then calling the creator video-list tool.

Creator and account tools provide user profiles, uploaded videos, favorites, dynamics, articles, following lists, followers, notifications, and new-reply detection. Write operations include publishing or deleting comments, liking comments, following or unfollowing creators, and sending danmaku.

## How it works

The package starts as an MCP process over the command line. An MCP client launches it with `npx -y bilibili-mcp-server` or invokes the globally installed command, then calls individual tools with their documented parameters.

Authentication can use Bilibili Cookie values supplied through environment variables or a `.env` file. Alternatively, an agent can call `bilibili_login` to obtain a QR-code image and login key, have the account scan the code in the Bilibili mobile app, and poll with `bilibili_login_check`. Successful QR login saves the resulting Cookie. Cookie refresh can be triggered with `bilibili_refresh_cookie` when a refresh token is configured.

The live screenshot tool returns room metadata and a keyframe for models that can process images. Text-only models can use the accompanying metadata but cannot interpret the picture. Video downloads retrieve separate video and audio streams and use ffmpeg to combine them into an MP4; article downloads save content as Markdown and can optionally include images.

## Setup and configuration

Node.js 22 or newer is required. Install ffmpeg separately if video downloads are needed. The package can be run directly:

```bash
npx bilibili-mcp-server
```

Or install it globally with npm and run `bilibili-mcp-server`.

Set these required values using the shell environment or a project-level `.env` file:

- `BILIBILI_SESSDATA`
- `BILIBILI_BILI_JCT`
- `BILIBILI_DEDE_USER_ID`

Optional settings include `BILIBILI_REFRESH_TOKEN` for automatic Cookie renewal, `BILIBILI_FULL_COOKIE` for functions such as hot-search access, `BILIBILI_AUTO_REFRESH`, `BILIBILI_COOKIE_FILE`, and `BILIBILI_DETECT_FILE`. The Cookie fields can be obtained from Bilibili’s browser developer tools. The refresh token is available from the Bilibili site’s stored `ac_time_value` value.

A client configuration passes the command and credentials in the MCP server’s `env` object. QR login is available when manually copying Cookie values is undesirable.

## Tools and capabilities

- Search videos and hot-search terms; inspect popular videos.
- Read video details, comments, subtitles, and danmaku.
- Publish, delete, and like comments.
- Read user profiles, videos, favorites, dynamics, articles, followings, and followers.
- Follow or unfollow creators and monitor replies or unread notifications.
- Query live-room status and return a current screenshot.
- Send danmaku, refresh authentication, and perform QR login.
- Download videos, articles, and a list of completed downloads.

## Limitations and notes

Bilibili may apply strict risk controls to account actions. The project advises limiting danmaku sending to five messages per day and avoiding bursts of follow or unfollow operations. Downloaded content is intended for personal backup and should not be redistributed. The live-room popularity value represents a heat metric rather than verified viewer count. Video downloads require ffmpeg, and image interpretation from live screenshots requires a vision-capable model.

_Full upstream README: https://allmcps.com/mcp/bilibili-mcp-server-2/readme_

