MCP ExplorerExplorer

Bilibili Mcp

@SpacervalLamon a month ago
1 MIT
FreeCommunity
AI Systems
Bilibili MCP Server for accessing API features like content search and user info.

Overview

What is Bilibili Mcp

bilibili_mcp is a Model Context Protocol (MCP) server that provides access to Bilibili’s API functionalities, allowing users to interact with various features of the Bilibili platform.

Use cases

Use cases for bilibili_mcp include developing applications that search for videos based on keywords, retrieving detailed information about specific videos, accessing user profiles, and collecting comments for analysis.

How to use

To use bilibili_mcp, ensure you have Python 3.7 or higher installed. Install the necessary dependencies using ‘pip install bilibili-api mcp-server-fastmcp’, and then run the server with ‘python bilibili_mcp_server.py’.

Key features

Key features of bilibili_mcp include searching Bilibili content, retrieving video information, getting user information, and fetching video comments.

Where to use

bilibili_mcp can be used in applications that require integration with Bilibili’s content, such as video analysis tools, social media applications, or educational platforms that utilize Bilibili’s resources.

Content

Bilibili MCP Server

A Model Context Protocol (MCP) server that provides access to Bilibili’s API functionality.

Features

  • Search Bilibili content
  • Get video information
  • Get user information
  • Fetch video comments

Installation

  1. Ensure you have Python 3.7+ installed
  2. Install dependencies:
pip install bilibili-api mcp-server-fastmcp
  1. Run the server:
python bilibili_mcp_server.py

API Endpoints

General Search

@mcp.tool('general_search')
def general_search(keyword: str) -> dict

Searches Bilibili for the given keyword.

Example:

{
  "keyword": "python tutorial"
}

Video Information

@mcp.tool('video_info')
def video_info(aid: int) -> dict

Gets information about a video by its AID.

Example:

{
  "aid": 123456
}

User Information

@mcp.tool('user_info')
def user_info(uid: int) -> dict

Gets information about a user by their UID.

Example:

{
  "uid": 123456
}

Video Comments

@mcp.tool('video_comments')
def video_comments(aid: int, page: int = 1) -> dict

Gets comments for a video by AID and page number.

Example:

{
  "aid": 123456,
  "page": 1
}

Popular Videos

@mcp.tool('popular_videos')
def popular_videos() -> dict

Gets currently popular videos on Bilibili.

Example:

{}

Error Handling

All endpoints return:

  • Success: API response data
  • Error: Dictionary with “error” key containing error message

Common errors:

  • Invalid input parameters (ValueError)
  • API request failures
  • Network issues

Logging

The server logs all operations to stdout with timestamps. Logs include:

  • API calls with parameters
  • Successful responses
  • Error conditions

License

没有

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers