bilibili-info-mcp
MCP server for fetching Bilibili video metadata and subtitles. Supports running locally via stdio transport for integration with MCP clients like Cursor or Claude Desktop.
README
bilibili-info-mcp
MCP server for fetching Bilibili video metadata and subtitles. Runs locally via stdio transport.
Features
- Fetch video metadata: title, author, view count, description, duration, publish date
- Fetch subtitles (requires login cookie): prioritizes Chinese, falls back to English
- WBI signature support for reliable subtitle retrieval
- Stdio transport for local MCP client integration
Usage
No installation required. Use directly with npx:
npx bilibili-info-mcp
MCP Client Configuration
Cursor / Claude Desktop
{
"mcpServers": {
"bilibili-info": {
"command": "npx",
"args": ["bilibili-info-mcp"],
"env": {
"SESSDATA": "your_bilibili_sessdata_cookie"
}
}
}
}
Environment Variables
| Variable | Required | Description |
|---|---|---|
SESSDATA |
Only for subtitles | Bilibili login cookie. Find it in browser DevTools > Application > Cookies > bilibili.com after logging in. |
Tool: get-bilibili-video-info
Fetches Bilibili video metadata and optionally subtitles.
Input
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
url |
string | Yes | - | Bilibili video URL, e.g. https://www.bilibili.com/video/BVxxxxx |
includeSubtitles |
boolean | No | false |
Whether to fetch subtitles. Requires SESSDATA env var. |
Supported URL formats:
https://www.bilibili.com/video/BVxxxxxhttps://m.bilibili.com/video/BVxxxxx?k=vhttps://bilibili.com/video/BVxxxxx/
Output
{
"title": "Video title",
"author": "Author name",
"viewCount": "12345",
"description": "Video description",
"lengthSeconds": "360",
"publishDate": "2025-01-15T12:00:00+08:00",
"subtitle": {
"languageCode": "zh-Hans",
"content": "Subtitle text content joined by spaces"
}
}
| Field | Type | Description |
|---|---|---|
title |
string | Video title |
author |
string | Uploader name |
viewCount |
string | Total view count |
description |
string | Video description (prefers desc_v2, falls back to desc) |
lengthSeconds |
string | Video duration in seconds |
publishDate |
string | Publish time in ISO 8601 format with +08:00 timezone |
subtitle |
object (optional) | Subtitle track, only present when includeSubtitles is true and subtitles are available |
Subtitle Priority
When includeSubtitles is true, returns a single subtitle track with the following priority:
- Chinese (matching
中文,zh-CN,zh-Hans,zh) - English (matching
English,英语,en,en-US)
Development
git clone https://github.com/sunwu51/bilibili-info-mcp.git
cd bilibili-info-mcp
npm install
npm run build
Project Structure
src/
index.ts # MCP server entry point (stdio transport)
bilibili-fetcher.ts # Bilibili API calls (video info + subtitles)
wbi.ts # WBI signature algorithm implementation
How It Works
- Video info -- Calls
https://api.bilibili.com/x/web-interface/view?bvid=BVIDto get metadata. - WBI keys -- Fetches
img_keyandsub_keyfromhttps://api.bilibili.com/x/web-interface/nav(cached for 1 hour). - Subtitles -- Calls
https://api.bilibili.com/x/player/wbi/v2with WBI signature (w_rid+wts) andSESSDATAcookie to get subtitle URLs, then fetches the subtitle JSON content.
License
ISC
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.