- Bilibili Api Mcp Server
Bilibili Api Mcp Server
Bilibili API MCP Server
An MCP (Model Context Protocol) server for the Bilibili API, supporting a wide range of operations.
Requirements
- uv – A fast, all-in-one project and dependency manager for Python.
Usage
Option 1: Install from PyPI (Recommended)
Configure the server in any MCP client; it will be downloaded and started automatically.
{
"mcpServers": {
"bilibili": {
"type": "stdio",
"isActive": true,
"command": "uvx",
"args": [
"bilibili-api-mcp-server"
]
}
}
}
💡 Tip: You can copy
mcp-config.jsonfrom the project root as a ready-made configuration.
Option 2: Run Locally for Development
- Clone the repository:
git clone https://github.com/SMYB5431/bilibili-api-mcp-server.git
cd bilibili-api-mcp-server
- Install dependencies with
uv:
uv sync
- Configure the server in any MCP client:
{
"mcpServers": {
"bilibili": {
"command": "uvx",
"args": [
"--directory",
"/your-project-path/bilibili-api-mcp-server",
"run",
"bilibili.py"
]
}
}
}
Getting Started
Supported Operations
Basic Search
-
search_and_recommend_videos– Intelligent video search and recommendation.- Sorts results by “comprehensive” ranking.
- Automatically filters out classroom videos (cheese links).
- Returns the top 15 videos (configurable).
- Provides recommendation rationales based on search results.
- Analyzes video quality and popularity.
- Generates concise content summaries and recommendation reports.
-
search_user– Search for Bilibili users, sortable by follower count. -
get_user_id_by_name– Retrieve a user’s UID by username.- Default mode: returns only the UID for quick identification.
- Detailed mode: returns full user profile and exact-match status.
- Exact-match priority: prioritizes exact username matches.
- Robust error handling with clear messages.
User Content Retrieval
-
get_user_dynamics– Fetch the latest posts from a user.- Accepts username directly (e.g., “技术爬爬虾”).
- Configurable number of posts (default 10).
- Returns content, timestamp, and link for each post.
-
get_user_videos– Fetch the latest videos uploaded by a user.- Accepts username directly.
- Configurable number of videos (default 10).
- Returns title, BV ID, view count, duration, and other details.
-
get_user_collections– Retrieve a user’s public collections.- Accepts username directly.
- Returns collection title, video count, total views, and links.
-
get_collection_videos– List videos in a specific collection.- Accepts collection name or ID.
- Configurable number of videos (default 10).
- Returns detailed video information (title, views, likes, coins).
- Supports fuzzy matching on collection names.
-
search_collection_by_keyword– Search for videos containing a keyword within all collections of a user.- Returns matching collections and their video lists.
- Ideal for quickly locating topic-specific content.
Additional Features
get_video_danmaku– Retrieve danmaku (bullet comments) for a video.- Accepts video URL or BV ID.
- Automatically extracts BV ID from URL.
- Supports multi-part videos.
- Returns detailed video info and full danmaku data.
Disclaimer
This project uses publicly available content from the Bilibili creator “技术爬爬虾” for demonstration purposes only.
It is intended solely for educational and research use and complies with Bilibili’s Terms of Service.
For any copyright concerns, please contact the project maintainer.
License
MIT
Server Config
{
"mcpServers": {
"bilibili": {
"type": "stdio",
"isActive": true,
"command": "uvx",
"args": [
"bilibili-api-mcp-server"
]
}
}
}