Bilibili MCP Server: Profiles, Metadata, Search API
Fetch Bilibili profiles, video metadata, and search results with the MCP server for fast, flexible API access to users, videos, and more.
npx -y @wangshunnn/bilibili-mcp-serverOverview
The Bilibili MCP Server exposes Bilibili user profiles, video metadata, and search results through a Model Context Protocol (MCP) compatible server process. It wraps commonly used Bilibili API endpoints into a small, fast local server that MCP-enabled agents (for example, Claude desktop or other MCP clients) can call as tools. This makes it easy to augment language models with fresh user/video data and search results without embedding web scraping logic inside the model.
The server is distributed as an npm package and can be started with npx or run from a local clone. It returns structured JSON for common developer workflows: lookup a user by mid, fetch detailed video metadata by bvid, and run keyword searches to discover matching videos. The project is ideal when you need on-demand Bilibili context for LLM assistants, indexing pipelines, or media apps.
Features
- Fetch Bilibili user/profile information by mid (UID)
- Retrieve video metadata by bvid (Bilibili video ID)
- Search videos by keyword queries and return structured results
- MCP-compatible server process — works with Claude desktop and other MCP clients
- Lightweight npm package for quick local or container deployment
Repository: https://github.com/wangshunnn/bilibili-mcp-server NPM: https://www.npmjs.com/package/@wangshunnn/bilibili-mcp-server
Installation / Configuration
Install and run directly with npx (recommended):
# start the MCP server process directly via npx
Run from a local clone (development):
# clone the repo
# install dependencies (pnpm is recommended)
# build for production
# or run in dev mode
# run the built server
Example Claude Desktop MCP config (use npx method):
Or point to a local built file:
After saving the config and restarting your MCP client, the Bilibili MCP server will appear as a tool provider.
Available Tools / Resources
The server exposes a small set of tools tailored for Bilibili queries. Each tool returns JSON objects suitable for prompt augmentation or programmatic consumption.
| Tool name | Input | Output (typical fields) |
|---|---|---|
| get_user_by_mid | mid (string or number) | { mid, name, face, sign, level, fans, official } |
| get_video_by_bvid | bvid (string) | { bvid, title, pic, owner, stat: { view, like, danmaku, reply }, duration, pubdate, desc } |
| search_videos | q (search keywords), page?, page_size? | { total, page, page_size, results: [{ bvid, title, pic, owner, pubdate }] } |
Note: Field names mirror common Bilibili API responses but may be normalized for clarity. The server is intended for read-only metadata and search; it does not stream video content.
Use Cases
- Augment LLM assistants with live Bilibili context
- Example: An assistant can call get_user_by_mid to show a creator’s profile in a conversation, or get_video_by_bvid to summarize a video’s metadata for a user question.
- Build a search-backed content discovery feature
- Example: Use search_videos to populate a “related videos” widget in a chat interface, then fetch details for the top picks.
- Indexing and analytics pipelines
- Example: Batch query video metadata for a list of bvids to build an offline index or analytics table (views, likes, publish date).
- Rapid prototyping and local testing with MCP-enabled agents
- Example: Use the npx server during development so your local assistant can call real Bilibili metadata endpoints without embedding HTTP logic.
Concrete example — fetch a video by bvid (conceptual):
// Tool call (MCP client)
// Example response
Notes & Resources
- The server normalizes and exposes metadata; it does not provide media file hosting or download functionality.
- For a detailed list of supported fields and any rate-limiting behaviors, check the repository README and source: https://github.com/wangshunnn/bilibili-mcp-server
- Credits / API references: Bilibili public API collections (e.g., socialsisteryi/bilibili-API-collect)
If you encounter issues, open an issue on the GitHub project or check the repository for contribution and build instructions.