Bilibili Search MCP server

Enables search across Bilibili's Chinese video platform through a lightweight FastMCP interface that retrieves video content, user information, and other searchable data with optional authentication via session cookies.
Back to servers
Setup instructions
Provider
Hucci Huang
Release date
Mar 20, 2025
Language
Python
Stats
152 stars

This MCP server for Bilibili API enables interaction with Bilibili's platform through the Model Context Protocol, supporting various operations like searching for content, users, and retrieving video information.

Requirements

  • uv - A project management tool that makes dependency management convenient

Installation

  1. Clone the repository:
git clone https://github.com/username/bilibili-mcp-server.git
  1. Install dependencies using uv:
uv sync

Configuration

Configure the MCP server in your MCP client with the following settings:

{
  "mcpServers": {
    "bilibili": {
      "command": "uv",
      "args": [
        "--directory",
        "/your-project-path/bilibili-mcp-server",
        "run",
        "bilibili.py"
      ]
    }
  }
}

Make sure to replace /your-project-path/bilibili-mcp-server with the actual path to the cloned repository on your system.

Supported Operations

General Search

The general_search operation performs basic keyword searches on Bilibili.

User Search

The search_user operation is specifically designed for searching Bilibili users, with the ability to sort results by follower count.

Precise Search

The get_precise_results operation provides filtered search results with unnecessary information removed. It supports several search types:

  • User search (user): Precisely matches usernames, returning only exact matches
  • Video search (video)
  • Live stream search (live)
  • Article search (article)

Results include an exact_match field indicating whether an exact match was found.

Video Danmaku

The get_video_danmaku operation retrieves danmaku (comment) information for videos.

Usage Examples

To use the operations in your MCP client, reference the Bilibili server and specify the operation you want to perform. The exact syntax will depend on your specific MCP client implementation.

For example, to perform a user search, your client might use something like:

@bilibili search_user "username" --sort_by_followers

For precise search for videos:

@bilibili get_precise_results "search term" --type video

The server will process these commands and return the appropriate Bilibili API data according to the operation requested.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "bilibili" '{"command":"uv","args":["--directory","/your-project-path/bilibili-mcp-server","run","bilibili.py"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "bilibili": {
            "command": "uv",
            "args": [
                "--directory",
                "/your-project-path/bilibili-mcp-server",
                "run",
                "bilibili.py"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "bilibili": {
            "command": "uv",
            "args": [
                "--directory",
                "/your-project-path/bilibili-mcp-server",
                "run",
                "bilibili.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later