BiliStalkerMCP

222wcnm/BiliStalkerMCP

3.2

If you are the rightful owner of BiliStalkerMCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

BiliStalkerMCP is a Model-Context-Protocol server that allows AI models to fetch the latest video updates from specified Bilibili users through tool calls based on the MCP protocol.

BiliStalkerMCP

Python MCP Version

BiliStalkerMCP is an MCP server providing high-fidelity Bilibili data access for AI agents (Claude, ChatGPT).

English |

Installation

uvx bili-stalker-mcp
# or
pip install bili-stalker-mcp

Configuration (Claude Desktop, Recommended)

{
  "mcpServers": {
    "bilistalker": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/BiliStalkerMCP", "bili-stalker-mcp"],
      "env": {
        "SESSDATA": "required_sessdata",
        "BILI_JCT": "optional_jct",
        "BUVID3": "optional_buvid3"
      }
    }
  }
}

Prefer uv run --directory ... for faster local updates when PyPI release propagation is delayed. You can still use uvx bili-stalker-mcp for quick one-off usage.

Auth: Obtain SESSDATA from Browser DevTools (F12) > Application > Cookies > .bilibili.com.

Environment Variables

KeyReqDescription
SESSDATAYesBilibili session token.
BILI_JCTNoCSRF protection token.
BUVID3NoHardware fingerprint (reduces rate-limiting risk).
BILI_LOG_LEVELNoDEBUG, INFO (Default), WARNING.
BILI_TIMEZONENoOutput time zone for formatted timestamps (default: Asia/Shanghai).

Available Tools

ToolCapabilityParameters
get_user_infoProfile & core statisticsuser_id_or_username
get_user_videosLightweight video listuser_id_or_username, page, limit
get_video_detailFull video detail + optional subtitlesbvid, fetch_subtitles (default: false), subtitle_mode (smart/full/minimal), subtitle_lang (default: auto), subtitle_max_chars
get_user_dynamicsStructured dynamics with cursor paginationuser_id_or_username, cursor, limit, dynamic_type
get_user_articlesLightweight article listuser_id_or_username, page, limit
get_article_contentFull article markdown contentarticle_id
get_user_followingsSubscription list analysisuser_id_or_username, page, limit

Dynamic Filtering (dynamic_type)

  • ALL (default): Text, Draw, and Reposts.
  • ALL_RAW: Unfiltered (includes Videos & Articles).
  • VIDEO, ARTICLE, DRAW, TEXT: Specific category filtering.

Pagination: Responses include next_cursor. Pass this to subsequent requests for seamless scrolling.

Subtitle Modes (get_video_detail)

  • smart (default when fetch_subtitles=true): fetch metadata for all pages, download only one best-matched subtitle track text.
  • full: download text for all subtitle tracks (higher cost).
  • minimal: skip subtitle metadata and subtitle text fetching.

subtitle_lang can force a language (for example en-US); auto uses built-in priority fallback.
subtitle_max_chars caps returned subtitle text size to avoid token explosion.

Development

# Setup
git clone https://github.com/222wcnm/BiliStalkerMCP.git
cd BiliStalkerMCP
uv pip install -e .[dev]

# Test
uv run pytest -q

# Integration & Performance (Requires Auth)
uv run python scripts/integration_suite.py -u <UID>
uv run python scripts/perf_baseline.py -u <UID> --tools dynamics -n 3

Release (Maintainers)

Prerequisite: Ensure that a .pypirc file is configured in your user home directory to provide PyPI credentials.

# Build + test + twine check (no upload)
.\scripts\pypi_release.ps1

# Upload to TestPyPI
.\scripts\pypi_release.ps1 -TestPyPI -Upload

# Upload to PyPI
.\scripts\pypi_release.ps1 -Upload

Docker

Runs via stdio transport. No ports exposed.

docker build -t bilistalker-mcp .
docker run -e SESSDATA=... bilistalker-mcp

Troubleshooting

  • 412 Precondition Failed: Bilibili anti-crawling system triggered. Refresh SESSDATA or provide BUVID3.
  • Cloud IPs: Highly susceptible to blocking; local execution is recommended.

License

MIT


This project is built and maintained with the help of AI.