Skip to main content

Comprehensive MCP Server for Bilibili Data Retrieval (UserInfo, Videos, Dynamics, Articles, Followings)

Project description

BiliStalkerMCP

Python MCP Version

BiliStalkerMCP is a Model Context Protocol (MCP) server for Bilibili, specifically designed for AI assistants (like Claude, ChatGPT).

English | 中文说明

Installation

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

Configuration

Add to your MCP client settings (e.g., Claude Desktop):

{
  "mcpServers": {
    "bilistalker": {
      "command": "uvx",
      "args": ["bili-stalker-mcp"],
      "env": {
        "SESSDATA": "your_sessdata",
        "BILI_JCT": "your_bili_jct",
        "BUVID3": "your_buvid3"
      }
    }
  }
}

Tip: You can find these values in your browser by pressing F12 -> Application -> Cookies on the Bilibili website.

Environment Variables

Variable Required Description
SESSDATA Yes Authentication token from Bilibili cookies.
BILI_JCT No CSRF token from cookies.
BUVID3 No Browser fingerprint, helps reduce rate limiting issues.
BILI_LOG_LEVEL No Log level (INFO, DEBUG, WARNING), default is WARNING.

Available Tools

Tool Description Parameters
get_user_info User profile and stats user_id or username
get_user_video_updates Video publications with subtitles user_id/username, page, limit
get_user_dynamic_updates User dynamics with type filtering user_id/username, offset, limit, dynamic_type
get_user_articles Article publications user_id/username, page, limit
get_user_followings Following list user_id/username, page, limit

Dynamic Type Filtering

The get_user_dynamic_updates tool supports filtering by type:

dynamic_type Description
ALL (default) TEXT, IMAGE_TEXT, REPOST only (analysis-focused)
ALL_RAW All types including VIDEO, ARTICLE
VIDEO Video dynamics only
ARTICLE Article dynamics only
DRAW Image-text dynamics only
TEXT Text-only dynamics

Development

# Clone and setup
git clone https://github.com/222wcnm/BiliStalkerMCP.git
cd BiliStalkerMCP
uv pip install -e .

# Run tests
python tests/test_suite.py -u <user_id_or_username>

🐳 Docker Support

You can also run the server using Docker:

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

❓ Troubleshooting

Q: Why am I getting "412 Precondition Failed"? A: This usually means you are being rate-limited or blocked by Bilibili. Try to:

  1. Refresh your SESSDATA.
  2. Ensure you provide BUVID3.
  3. If running on a cloud server, try running locally as cloud IPs are more likely to be blocked.

License

MIT


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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bili_stalker_mcp-2.6.1.tar.gz (137.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bili_stalker_mcp-2.6.1-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file bili_stalker_mcp-2.6.1.tar.gz.

File metadata

  • Download URL: bili_stalker_mcp-2.6.1.tar.gz
  • Upload date:
  • Size: 137.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for bili_stalker_mcp-2.6.1.tar.gz
Algorithm Hash digest
SHA256 5a5c5b8df9a177b1ff1cddd954f9279c5562942aca99241b62e6840d448dd4ff
MD5 74464ba63098da42ed04c121f4235476
BLAKE2b-256 373b94cc3389baa942085a783b4307d955e12c47400d657f03b66cba0da6f286

See more details on using hashes here.

File details

Details for the file bili_stalker_mcp-2.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bili_stalker_mcp-2.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5cc30ed7e6b27fba30e7785bb17016fcdd50a80b5983f427dd202045be3b588
MD5 6b1bd47c3a05d0c287959d6d5c99c261
BLAKE2b-256 5088928ffe8d6024a18320990f9e4c66644346e7be7c58d400cdb7b3bbf0af9e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page