Bilibili MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "BILIBILI_COOKIE=${BILIBILI_COOKIE}" bilibili-mcp -- npx -y @xzxzzx/bilibili-mcp
Required:BILIBILI_COOKIE
README.md

Equip your AI assistant with Bilibili video subtitles and comments.

Bilibili MCP Tool

✨ **为你的 AI 助手装上 B 站的眼睛**:一键提取视频字幕与热门评论,助力高效信息总结 🚀

✨ **Equip your AI assistant with "Bilibili Eyes"**: One-click extraction of video subtitles and popular comments for efficient information summarization 🚀

🌐 English Documentation (English read me version here)
📜 更新日志 (Changelog)

[!TIP] ⚠️ 提示:使用前请务必配置您的 B 站 Cookie,否则将无法提取视频字幕与评论。详见 **⚙️ 凭证配置**(凭证只会保存在本地,不会上传到任何地方)。

⚠️ Notice: Please make sure to configure your Bilibili Cookies before use, otherwise video subtitles and comments cannot be extracted. See **⚙️ Credential Configuration** (Cookies are only stored locally and will not be uploaded anywhere).


📑 目录


⚡ 快速预检

[!IMPORTANT] 本工具需要 Bilibili 凭证 (Cookie) 才能发挥完整功能。 如果没有正确配置凭证,您可能无法获取视频字幕、评论

在开始安装前,请确保您已经了解如何获取并配置 Cookie


🌟 功能特性

1. 视频总结 (`get_video_info`)

  • 优先获取视频的 CC 或 AI 字幕
  • 无字幕时自动降级为视频标题、简介和标签
  • 支持多语言字幕选择(默认优先简体中文)
  • 可手动指定偏好字幕语言(如 en, zh-Hant 等)

2. 评论总结 (`get_video_comments`)

  • 获取视频热门评论,辅助判断视频真实口碑
  • 自动过滤表情占位符(如 [doge])以保持文本整洁
  • 优先保留包含时间戳的评论(如 05:20),方便定位高能片段
  • 支持两种详细程度:
    • brief: 10 条热门评论速览
    • detailed: 50 条热门评论 + 高赞连带回复

3. 🛡️ 稳健性增强

  • Cookie 过期智能检测:当字幕获取为空时自动验证登录状态,区分“无字幕视频”与“凭证失效”,并抛出明确的 COOKIE_EXPIRED 错误,避免静默降级。

📋 环境要求

  • Node.js: v18.0.0 或更高版本
  • Bilibili 账号凭证 (Cookie)

🚀 安装方式

🖱️ Cursor

Cursor 同样原生支持 MCP,你可以通过图形界面快速添加:

  1. 打开 Cursor 设置:Cursor Settings > Features > MCP Servers
  2. 点击 + Add New MCP Server
  3. 填写以下信息:
    • Name: bilibili-mcp (或任意你喜欢的名字)
    • Type: 选择 command
    • Command: npx -y @xzxzzx/bilibili-mcp (如果 Windows 遇到路径问题,可尝试 cmd /k npx -y @xzxzzx/bilibili-mcp
  4. 点击 Add 保存。配置完成后,可能需要点击列表旁的刷新按钮来加载工具库。

提示:高级用户也可直接在项目根目录创建 .cursor/mcp.json 配置文件。

Claude Code

方法一:通过 CLI 命令快速安装(推荐)

直接在终端运行以下命令:

claude mcp add bilibili-mcp --command "npx" --args "-y" --args "@xzxzzx/bilibili-mcp"

完成后重启 Claude Code 即可使用。

方法二:通过配置文件手动添加(高级)
  1. 打开 Claude Code 配置文件(通常在 ~/.claude.json
  2. mcpServers 节点下添加:
{
  "mcpServers": {
    "bilibili-mcp": {
      "command": "npx",
      "args": ["-y", "@xzxzzx/bilibili-mcp"]
    }
  }
}
  1. 保存后重启 Claude Code。

Claude Desktop (桌面客户端)

Claude Desktop 支持通过全局配置文件接入 MCP 服务器:

方法一:通过配置文件手动添加
  1. 打开 Claude Desktop 配置文件:
    • Windows 路径:%APPDATA%\Claude\claude_desktop_config.json
    • macOS 路径:~/Library/Application Support/Claude/claude_desktop_config.json
    • 提示:您也可以在 Claude Desktop 的 Settings -> Developer 中点击 Edit Config 直接打开该文件。
  2. mcpServers 节点下添

Tools (2)

get_video_infoExtracts video subtitles, title, description, and tags for summarization.
get_video_commentsRetrieves popular video comments with support for different detail levels.

Environment Variables

BILIBILI_COOKIErequiredBilibili account cookie required for accessing subtitles and comments.

Configuration

claude_desktop_config.json
{"mcpServers": {"bilibili-mcp": {"command": "npx", "args": ["-y", "@xzxzzx/bilibili-mcp"]}}}

Try it

Summarize the key points from this Bilibili video: [URL]
What are the top 10 comments on this video? [URL]
Extract the subtitles from this Bilibili video and provide a detailed summary.
Are there any high-energy moments mentioned in the comments for this video? [URL]

Frequently Asked Questions

What are the key features of Bilibili MCP Server?

Extracts CC or AI-generated video subtitles. Retrieves popular video comments with filtering for cleaner text. Supports multi-language subtitle selection. Automatic fallback to video metadata when subtitles are unavailable. Intelligent cookie expiration detection.

What can I use Bilibili MCP Server for?

Quickly summarizing long educational or technical Bilibili videos. Analyzing audience sentiment through popular video comments. Extracting specific timestamps or high-energy moments from comment sections. Efficiently processing video content without watching the full duration.

How do I install Bilibili MCP Server?

Install Bilibili MCP Server by running: npx -y @xzxzzx/bilibili-mcp

What MCP clients work with Bilibili MCP Server?

Bilibili MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Bilibili MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare