Skip to main content
Glama
fysh1010
by fysh1010

Bilibili MCP Server

一个用于解析哔哩哔哩(Bilibili)视频的 Model Context Protocol (MCP) 服务器,支持视频信息提取、下载链接获取和合集解析等功能。

功能特性

  • ✅ 解析 Bilibili 视频链接(支持 b23.tv 短链接)

  • ✅ 获取视频详细信息(标题、封面、简介、用户信息等)

  • ✅ 获取视频下载链接(1080P 画质)

  • ✅ 支持合集视频解析

  • ✅ 获取合集视频列表

Related MCP server: Bilibili-Api

安装

方式一:使用 npx(推荐)

无需安装,直接运行:

{
  "mcpServers": {
    "bilibili": {
      "command": "npx",
      "args": ["-y", "mcp-server-bilibili"]
    }
  }
}

方式二:全局安装

npm install -g mcp-server-bilibili

然后在配置文件中使用:

{
  "mcpServers": {
    "bilibili": {
      "command": "mcp-server-bilibili"
    }
  }
}

方式三:从源码运行

# 克隆仓库
git clone https://github.com/fysh1010/bilibili-mcp.git
cd bilibili-mcp

# 安装依赖
npm install

# 构建
npm run build

然后在配置文件中使用:

{
  "mcpServers": {
    "bilibili": {
      "command": "node",
      "args": ["E:\\path\\to\\bilibili-mcp\\build\\index.js"]
    }
  }
}

配置 Claude Desktop

Windows

  1. 打开 Claude Desktop 配置文件:

    %APPDATA%\Claude\claude_desktop_config.json
  2. 添加以下配置:

{
  "mcpServers": {
    "bilibili": {
      "command": "npx",
      "args": ["-y", "mcp-server-bilibili"]
    }
  }
}
  1. 重启 Claude Desktop

macOS

  1. 打开 Claude Desktop 配置文件:

    ~/Library/Application Support/Claude/claude_desktop_config.json
  2. 添加以下配置:

{
  "mcpServers": {
    "bilibili": {
      "command": "npx",
      "args": ["-y", "mcp-server-bilibili"]
    }
  }
}
  1. 重启 Claude Desktop

Linux

  1. 打开 Claude Desktop 配置文件:

    ~/.config/Claude/claude_desktop_config.json
  2. 添加以下配置:

{
  "mcpServers": {
    "bilibili": {
      "command": "npx",
      "args": ["-y", "mcp-server-bilibili"]
    }
  }
}
  1. 重启 Claude Desktop

可用工具

1. parse_bilibili_video

解析 Bilibili 视频链接,获取完整信息。

参数:

  • url (必填): Bilibili 视频链接,支持 b23.tv 短链接

示例:

请解析这个 Bilibili 视频:https://b23.tv/XhtfoyZ

返回数据:

{
  "code": 200,
  "msg": "解析成功!",
  "data": {
    "title": "视频标题",
    "cover": "封面图片URL",
    "description": "视频简介",
    "url": "视频下载链接",
    "user": {
      "name": "UP主名称",
      "avatar": "UP主头像URL"
    },
    "videos": [
      {
        "title": "视频标题",
        "duration": 视频时长(秒),
        "durationFormat": "04:45:58",
        "url": "视频下载链接",
        "index": 1
      }
    ],
    "totalVideos": 2
  }
}

2. get_bilibili_video_info

获取 Bilibili 视频的详细信息。

参数:

  • url (必填): Bilibili 视频链接

示例:

获取这个视频的详细信息:https://b23.tv/XhtfoyZ

3. get_bilibili_download_urls

获取 Bilibili 视频的下载链接列表。

参数:

  • url (必填): Bilibili 视频链接

示例:

获取这个视频的下载链接:https://b23.tv/XhtfoyZ

4. get_bilibili_basic_info

获取 Bilibili 视频的基本信息。

参数:

  • url (必填): Bilibili 视频链接

示例:

获取这个视频的基本信息:https://b23.tv/XhtfoyZ

5. get_bilibili_collection

获取 Bilibili 合集中的所有视频列表信息。

参数:

  • url (必填): Bilibili 视频链接(合集链接)

示例:

获取这个合集的所有视频:https://b23.tv/XhtfoyZ

使用示例

示例 1:解析单个视频

用户输入:

帮我解析这个 Bilibili 视频:https://b23.tv/XhtfoyZ

Claude 会自动调用:

  • parse_bilibili_video 工具

返回结果: 视频的完整信息,包括标题、封面、下载链接、UP主信息等。

示例 2:获取下载链接

用户输入:

获取这个视频的下载链接:https://b23.tv/XhtfoyZ

Claude 会自动调用:

  • get_bilibili_download_urls 工具

返回结果: 视频下载链接列表,包括合集中的所有视频。

示例 3:查看合集视频

用户输入:

这个合集有哪些视频?https://b23.tv/XhtfoyZ

Claude 会自动调用:

  • get_bilibili_collection 工具

返回结果: 合集中的所有视频列表,包括每个视频的标题和时长。

测试

使用 MCP Inspector 测试工具:

npm run inspector

这会启动一个交互式测试界面,您可以测试所有可用的工具。

开发

项目结构

bilibili-mcp/
├── src/
│   ├── BilibiliApi.ts    # Bilibili API 封装层
│   └── index.ts          # MCP 服务器主入口
├── build/                # 编译输出目录
├── package.json          # 项目配置
├── tsconfig.json         # TypeScript 配置
└── README.md            # 项目说明

构建项目

npm run build

监听模式开发

npm run watch

API 说明

本 MCP Server 使用第三方 API:https://api.bugpk.com/api/bilibili

支持的特性:

  • ✅ 解析 Bilibili 短视频

  • ✅ 画质为 1080P

  • ✅ 支持合集视频

  • ✅ 支持 b23.tv 短链接

注意事项

  1. 视频链接格式:支持完整的 Bilibili 链接和 b23.tv 短链接

  2. 画质限制:当前仅支持 1080P 画质

  3. API 限制:使用第三方 API,可能会有调用频率限制

  4. 版权说明:请遵守 Bilibili 的用户协议和版权规定,仅用于个人学习和研究目的

故障排除

问题:无法连接到 MCP Server

解决方案:

  1. 检查 Claude Desktop 配置文件是否正确

  2. 确认网络连接正常

  3. 查看 Claude Desktop 日志获取详细错误信息

问题:解析视频失败

解决方案:

  1. 确认视频链接格式正确

  2. 检查视频是否为公开视频

  3. 确认第三方 API 服务是否正常

问题:npx 命令执行缓慢

解决方案:

  • 使用全局安装方式:npm install -g mcp-server-bilibili

  • 或者从源码运行

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!

联系方式

致谢

Available Tools

5 tools
get_bilibili_basic_infoB

获取 Bilibili 视频的基本信息,包括标题、封面、简介、用户信息等

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesBilibili 视频链接

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations are absent, so the description carries the full burden of behavioral disclosure. It lists output fields but does not explicitly state read-only nature, side effects, authentication needs, or error behaviors. The verb "获取" implies read-only but is not explicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is direct and informative, front-loading the action and primary resource. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool with no output schema, the description covers the basic purpose and output fields. However, it does not disambiguate from sibling tools or explain the return format fully, making it only partially complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100% for the single 'url' parameter. The tool description adds no extra parameter meaning beyond what the schema already provides, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool gets basic Bilibili video info, listing specific fields (title, cover, description, user info). However, it does not distinguish from the similarly named sibling 'get_bilibili_video_info', so it lacks differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool vs. alternatives such as parse_bilibili_video or get_bilibili_video_info. There are no exclusions, prerequisites, or alternative references.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_bilibili_collectionB

获取 Bilibili 合集中的所有视频列表信息

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesBilibili 视频链接(合集链接)

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose behavioral traits such as output format, pagination limits, authentication requirements, or side effects. It simply describes a read operation without additional context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that communicates the core purpose without unnecessary words. It is front-loaded and easy to understand.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one parameter and no output schema, the description is minimally viable but lacks details about the return format, potential limitations, or prerequisites. The absence of annotations and output schema means the description should carry more weight, but it remains somewhat incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description covers 100% of the single parameter (url) by explicitly stating it is a Bilibili collection link. The tool description adds no extra semantic meaning beyond what the schema already provides, so a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool retrieves all video list information from a Bilibili collection. It uses a specific verb (获取/get) and resource (Bilibili 合集), distinguishing it from sibling tools that focus on single video parsing, info, or download URLs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like get_bilibili_video_info or parse_bilibili_video. The description only states what the tool does, without any exclusions or context for choosing it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_bilibili_download_urlsA

获取 Bilibili 视频的下载链接列表,支持合集视频

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesBilibili 视频链接

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full behavioral burden. It only states the action and a feature, but does not disclose authentication requirements, return format, potential large responses for collections, error handling, or any side effects. This is a minimal disclosure that leaves significant behavioral unknowns.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence that front-loads the primary action. It avoids unnecessary fluff and every phrase adds value, making it appropriately concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple one-parameter schema and no output schema, the description gives the basic purpose but omits details about the returned download link list (e.g., format, quality options, ordering) and error behavior. It meets the minimum viable standard but has clear gaps for an agent to use it confidently without further inference.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for the 'url' parameter, which is described as 'Bilibili 视频链接'. The tool description adds the collection video support, but does not clarify whether the URL must be a collection URL or how collection handling affects the parameter. Baseline is 3 because the schema handles parameter meaning, but no extra semantic depth is added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: '获取 Bilibili 视频的下载链接列表' (get the list of download links for Bilibili videos). It uses a specific verb and resource, and mentions support for collection videos, which distinguishes it from sibling tools focused on parsing, info, or basic info.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage (to retrieve download links) and notes support for collection videos, but does not explicitly state when to use this tool versus siblings like get_bilibili_video_info or get_bilibili_collection. No exclusions or alternatives are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_bilibili_video_infoA

获取 Bilibili 视频的详细信息,包括标题、封面、简介、用户信息、视频列表等

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesBilibili 视频链接

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description must carry the full burden of behavioral disclosure. It describes what information is retrieved (title, cover, etc.) and, by using '获取' (get), implies a read-only operation with no side effects. However, it does not mention error behaviors, authentication requirements, rate limits, or any potential side effects. The transparency is adequate for a simple info retrieval but lacks deeper behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that front-loads the main action ('获取 Bilibili 视频的详细信息') and then provides a list of example data fields. Every word earns its place, with no redundancy or fillers. It is appropriately sized for a tool with one parameter and simple purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity (1 parameter, no output schema, no annotations), the description is fairly complete. It lists key return elements (title, cover, introduction, user info, video list) with an 'etc.' to indicate more. It differentiates from siblings like 'basic info' and 'download URLs', providing enough context for an agent to understand the tool's place. A minor gap is the lack of explicit return format, but the field list offers sufficient clarity for this simple tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already describes the only parameter 'url' with 'Bilibili 视频链接' (Bilibili video link), achieving 100% schema description coverage. The description does not add extra meaning about the parameter format, constraints, or how the URL should be crafted. Since the schema fully covers the parameter, the added value from the description is minimal, aligning with the baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '获取 Bilibili 视频的详细信息' (Get detailed Bilibili video information) and enumerates specific data fields (title, cover, description, user info, video list). This makes it distinct from siblings like 'get_bilibili_basic_info' (basic info) and 'get_bilibili_download_urls' (download URLs), establishing a unique resource and granularity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'detailed information' in contrast to sibling 'basic info', but it does not explicitly state when to use this tool versus alternatives or provide exclusions. There is no direct guidance on prerequisites or conditions, making the usage guidance implicit rather than explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

parse_bilibili_videoC

解析 Bilibili 视频链接,获取视频的完整信息,包括标题、封面、视频链接、用户信息、合集视频列表等

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesBilibili 视频链接,支持 b23.tv 短链接和完整链接

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It does not state that the tool is read-only, makes network requests, or any rate limits or side effects. The description only says it 'parses' and 'gets' information, leaving key behavioral aspects undisclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that front-loads the main purpose and lists key output fields. It contains no redundant information, though it could benefit from a more structured breakdown.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, so the description must explain return values. It mentions several important fields (title, cover, video link, user info, collection playlist) but doesn't detail the structure or any edge cases. Given the tool's low complexity, this is adequate but leaves room for improvement.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already provides 100% coverage for the single 'url' parameter, including support for b23.tv short links and full links. The description doesn't add extra meaning beyond what the schema offers, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it parses Bilibili video links and retrieves complete video information, listing specific fields like title, cover, video link, user info, and collection video list. It distinguishes itself as a comprehensive parser, but doesn't explicitly name sibling tools as alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus sibling tools like get_bilibili_video_info or get_bilibili_collection. The description lacks any context about preferred use cases or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updatesv0.1.0
    • First observedget_bilibili_basic_info
    • First observedget_bilibili_collection
    • First observedget_bilibili_download_urls
    • First observedget_bilibili_video_info
    • First observedparse_bilibili_video

TDQS

B3.2/5.0

Scored across 5 tools

Disambiguation2/5

The tools parse_bilibili_video, get_bilibili_video_info, and get_bilibili_basic_info all return overlapping video information (title, cover, user info), making it unclear which one an agent should select. The remaining two tools are distinct, but the majority of the surface has ambiguous boundaries.

Naming Consistency4/5

All tool names follow a consistent verb_bilibili_noun pattern with snake_case, which is good. The only minor deviation is the use of both 'parse' and 'get' as verbs, but the overall pattern remains predictable and readable.

Tool Count4/5

Five tools is a reasonable number for a video information server, fitting well within the ideal 3-15 range. However, the functional overlap among three of the tools suggests the count could be trimmed without losing capability.

Completeness4/5

The server covers the key read operations expected for Bilibili video content: basic info, detailed info, download URLs, and collection listing. Minor gaps exist, such as the lack of search or user profile tools, but these are not critical for the apparent purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    A Bilibili MCP Server that can retrieve subtitles, danmaku (bullet comments), and comments information from videos using the video URL.
    3
    20
    MIT
  • A
    license
    C
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server that provides services for the bilibili.com API, supporting functions such as obtaining user information and video search.
    3
    1
    Apache 2.0
  • A
    license
    Not graded
    quality
    F
    maintenance
    An 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.
    47 npm
    192
    MIT