Skip to main content
Glama
Bilibili Comments MCP

Bilibili Comments MCP

by 222wcnm

Bilibili-Comments-MCP

一个基于 Model Context Protocol (MCP) 的 B 站视频评论获取工具.

快速开始

配置客户端(如Claude Desktop客户端)

在 MCP 客户端的配置文件中添加:

{
  "mcpServers": {
    "bilibili-comments": {
      "command": "npx",
      "args": ["-y", "bilibili-comments-mcp"],
      "env": {
        "BILIBILI_SESSDATA": "your_bilibili_sessdata_here"
      }
    }
  }
}

Related MCP server: Bilibili API MCP Server

环境变量

配置方式

  • BILIBILI_SESSDATA:Bilibili Cookie 中的 SESSDATA 值。

    • 获取方式:登录 Bilibili 网站,打开浏览器开发者工具 (F12),在 Network (网络) 选项卡中刷新页面,找到任意一个 bilibili.com 的请求,在 Request Headers 中找到 Cookie,提取 SESSDATA=xxx 部分的值。

工具功能

get_video_comments

获取 B 站视频评论,支持分页、排序和楼中楼回复。

参数:

  • bvid / aid - 视频ID(二选一)

  • page - 页码,默认1

  • pageSize - 每页数量(1-20),默认20

  • sort - 排序:0按时间,1按热度

  • includeReplies - 是否包含楼中楼回复,默认true

  • outputFormat - 输出格式:markdown 或 json,默认markdown

  • cookie - B站Cookie(可选)

示例(Markdown格式):

{
  "bvid": "BV1xx411c7mD",
  "page": 1,
  "pageSize": 20,
  "sort": 1,
  "includeReplies": true,
  "outputFormat": "markdown"
}

示例(JSON格式):

{
  "bvid": "BV1xx411c7mD",
  "page": 1,
  "pageSize": 20,
  "sort": 0,
  "includeReplies": false,
  "outputFormat": "json"
}

get_dynamic_comments

获取 B 站动态评论,支持分页和楼中楼回复。

参数:

  • dynamic_id - 动态ID(必需)

  • page - 页码,默认1

  • pageSize - 每页数量(1-20),默认20

  • includeReplies - 是否包含楼中楼回复,默认true

  • outputFormat - 输出格式:markdown 或 json,默认markdown

  • cookie - B站Cookie(可选)

示例:

{
  "dynamic_id": "123456789",
  "page": 1,
  "pageSize": 10,
  "includeReplies": true,
  "outputFormat": "markdown"
}
  1. 登录 B 站网页版

  2. 打开开发者工具 (F12)

  3. 切换到 Network 标签

  4. 刷新页面,找到任意请求

  5. 复制 Request Headers 中的 Cookie 值

动态ID获取方法

  1. 在B站手机App中打开想要获取评论的动态

  2. 点击分享按钮

  3. 选择"复制链接"

  4. 链接格式通常为:https://t.bilibili.com/动态ID

  5. 提取链接中的数字部分作为dynamic_id参数

常见问题解决

动态评论获取失败

  • 错误代码-404: 动态不存在或已被删除,请检查dynamic_id是否正确

  • 错误代码-101: Cookie已过期,请重新获取并更新SESSDATA

  • 错误代码-403: 访问权限不足,某些动态可能需要登录才能查看评论

Available Tools

2 tools
get_dynamic_commentsA
Read-only

获取 B 站动态的评论内容,支持分页和楼中楼回复。注意:需要有效的 B 站 Cookie 才能正常工作。

Inputs: dynamic_id (required), page, pageSize, includeReplies, +2 more.

get_video_commentsA
Read-only

获取 B 站视频的评论内容,支持分页、排序和楼中楼回复。注意:需要有效的 B 站 Cookie 才能正常工作。

Inputs: bvid, aid, page, pageSize, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct purposes: one targets dynamic comments and the other targets video comments, with no overlap in functionality. The descriptions reinforce this by specifying different contexts (dynamic vs. video) while sharing similar features like pagination and nested replies.

    Naming Consistency5/5

    Both tools follow a consistent verb_noun pattern (get_dynamic_comments and get_video_comments), using the same verb 'get' and similar noun structures. This makes the naming predictable and easy to understand across the tool set.

    Tool Count2/5

    With only 2 tools, the server feels thin for a comments-focused domain, lacking operations like creating, updating, deleting, or searching comments. This minimal set may limit agent workflows, as it only supports retrieval without full CRUD coverage.

    Completeness2/5

    The tool set is severely incomplete for a comments domain, missing essential operations such as posting comments, replying to comments, or deleting comments. While retrieval is covered for dynamics and videos, there are significant gaps that will hinder agents from performing common comment-related tasks.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with Bilibili (哔哩哔哩) through its API, supporting video search and recommendations, user search, dynamic feeds, video collections, and danmaku retrieval through natural language.
      5
      -
    • A
      license
      B
      quality
      B
      maintenance
      Enables reading public Bilibili video information — keyword search, UP profiles and uploads, video details and parts, comments and replies, danmaku, subtitles, and frame snapshots — through an MCP interface, with optional Bilibili login for authenticated features such as comments and subtitles.
      16
      104 PyPI
      3
      Apache 2.0