Skip to main content
Glama
bilibili-info-mcp

bilibili-info-mcp

by sunwu51

bilibili-info-mcp

npm version GitHub

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

Related MCP server: video-toolkit-mcp

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/BVxxxxx

  • https://m.bilibili.com/video/BVxxxxx?k=v

  • https://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:

  1. Chinese (matching 中文, zh-CN, zh-Hans, zh)

  2. 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

  1. Video info -- Calls https://api.bilibili.com/x/web-interface/view?bvid=BVID to get metadata.

  2. WBI keys -- Fetches img_key and sub_key from https://api.bilibili.com/x/web-interface/nav (cached for 1 hour).

  3. Subtitles -- Calls https://api.bilibili.com/x/player/wbi/v2 with WBI signature (w_rid + wts) and SESSDATA cookie to get subtitle URLs, then fetches the subtitle JSON content.

License

ISC

Available Tools

1 tool
get-bilibili-video-infoA

Fetches Bilibili video metadata (title, author, duration, description, publish date, view count) and subtitles/captions.

Inputs: url (required), includeSubtitles. Returns: title, author, subtitle, viewCount, +3 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only one tool, there is zero ambiguity or potential for misselection. The tool's purpose is fully unique by default.

    Naming Consistency5/5

    A single descriptive tool name using a get-<resource>-info pattern. Consistency is trivial but the style is clear and predictable.

    Tool Count3/5

    One tool feels thin for a video platform server, but it is compact and focused on the 'info' scope. It sits at the low end of the borderline range.

    Completeness3/5

    The tool covers metadata and subtitles for a known video, but there is no discovery (search/list/trending) or related operations (comments, chapters). This leaves an agent stranded without a video ID.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      An MCP server (stdio + HTTP/SSE) that fetches video transcripts/subtitles via yt-dlp, with pagination for large responses. Supports YouTube, Twitter/X, Instagram, TikTok, Twitch, Vimeo, Facebook, Bilibili, VK, Dailymotion. Whisper fallback — transcribes audio when subtitles are unavailable (local or OpenAI API). Works with Cursor and other MCP host
      8
      24
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      A Model Context Protocol (MCP) server that provides comprehensive video tools: transcript retrieval, video downloading, and automatic subtitle generation using AI speech-to-text. Works with YouTube, Bilibili, Vimeo, and any platform supported by yt-dlp.
      11
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      A Bilibili subtitle fetching MCP server that supports various input formats (BV number, video URL, short link) and offers configurable language preferences, output formats, and ASR fallback.
      10
      GPL 3.0