B站 MCP Server - 查询直播状态、粉丝牌、历史评论、历史弹幕,支持直播内容 ASR+视觉分析
Project description
bilibili-mcp-server
B 站 MCP Server,为 AI 助手提供查询 B 站数据的能力。
功能
| Tool | 描述 |
|---|---|
search_user |
按用户名搜索用户,返回 UID、昵称、粉丝数等 |
get_live_status |
查询主播直播间开播状态(未开播/直播中/轮播中) |
get_user_medals |
查询用户持有的粉丝牌列表 |
get_user_comments |
查询用户历史评论记录 |
get_user_danmaku |
查询用户在视频中发送的历史弹幕 |
get_user_live_danmaku |
查询用户在直播间发送的历史弹幕 |
get_live_content |
录制直播片段,ASR 语音转录 + 视觉画面分析,描述直播内容 |
粉丝牌、历史评论、历史弹幕数据来源于 aicu.cc,数据非实时,有更新延迟。
get_live_content需要硅基流动 API Key,通过环境变量SILICONFLOW_API_KEY配置。
本地安装(Cursor / Claude Desktop)
需要 Python 3.10+ 和 uv。
cd bilibili-mcp-server
uv venv
uv pip install -e .
配置到 Cursor
在 ~/.cursor/mcp.json 或项目级 .cursor/mcp.json 中添加:
{
"mcpServers": {
"bilibili": {
"command": "uv",
"args": ["run", "--directory", "D:/projects/bilibili-mcp-server", "bilibili-mcp"],
"env": {
"SILICONFLOW_API_KEY": "sk-你的硅基流动Key"
}
}
}
}
配置到 Claude Desktop
在 %APPDATA%\Claude\claude_desktop_config.json 中添加(内容同上)。
云端部署(ModelScope MCP 广场)
1. 上传代码到 ModelScope
将项目推送到 ModelScope 的 Studio 仓库(类似 Hugging Face Space)。
2. 配置环境变量 / Secret
在 ModelScope Studio 的「设置 → 环境变量」中添加:
| 变量名 | 说明 |
|---|---|
SILICONFLOW_API_KEY |
硅基流动 API Key(设为 Secret,不对外展示) |
MCP_TRANSPORT |
设为 sse(ModelScope 使用 SSE 模式) |
MCP_PORT |
设为 7860(ModelScope Studio 默认端口,可不填) |
3. 启动命令
在 Studio 配置中设置启动命令为:
python app.py
或者使用 uv:
uv run python app.py
4. 获取 SSE 地址并在客户端配置
ModelScope 会为你的服务生成一个专属 SSE 地址,格式类似:
https://modelscope.cn/studios/你的用户名/bilibili-mcp/sse
在 Cursor / Claude Desktop 中配置远程 MCP:
{
"mcpServers": {
"bilibili": {
"url": "https://modelscope.cn/studios/你的用户名/bilibili-mcp/sse"
}
}
}
注意:SSE URL 是你的专属地址,包含鉴权信息,请勿对外泄露。
关于 get_live_content 的 API Key
SILICONFLOW_API_KEY 的优先级:
- 调用工具时显式传入的
api_key参数(最高) - 环境变量
SILICONFLOW_API_KEY(推荐,在 MCP 配置或云端 Secret 中设置)
推荐做法:在 MCP 配置的 env 或云端 Secret 中配置,对话中无需每次传入 Key。
使用示例
- "帮我查一下 xxx 主播现在有没有在直播"
- "查一下 UID 为 12345 的用户最近发了哪些评论"
- "xxx 用户持有哪些粉丝牌"
- "510 直播间现在在播什么内容?"(触发
get_live_content,录制 15 秒分析)
数据说明
- 直播状态:B 站官方 API,实时数据,无需登录
- 粉丝牌、历史评论、历史弹幕:aicu.cc,非实时,有更新延迟
- 直播内容分析:ffmpeg 录制 + 硅基流动 SenseVoiceSmall(ASR)+ Qwen3-VL(视觉),需 API Key
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bilibili_live_mcp-0.2.4.tar.gz.
File metadata
- Download URL: bilibili_live_mcp-0.2.4.tar.gz
- Upload date:
- Size: 99.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0df7a8c7b1365d3559ad43a3d953c25236cbe4d990cff4585e55e2c90580d5a9
|
|
| MD5 |
e4b5d78334dbf7a32c984151f3775e75
|
|
| BLAKE2b-256 |
e3c2137b6486e5cf1016039d9ed76b44398a5279dd0a479c0e4e8c1f46b79b42
|
File details
Details for the file bilibili_live_mcp-0.2.4-py3-none-any.whl.
File metadata
- Download URL: bilibili_live_mcp-0.2.4-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb5e3613b07e279307837f498e13c9c6799d61bfd2553c47788e68fab2bcfcea
|
|
| MD5 |
131fe83659a7f4659b6c5a06125f80c7
|
|
| BLAKE2b-256 |
d8c683b939f7538db91c365208568a473a3e66bd02a0e674690f93e7678c778e
|