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.0.tar.gz (137.5 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.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bili_stalker_mcp-2.6.0.tar.gz
Algorithm Hash digest
SHA256 56f65935464c570dfdaabbfc93062f84d64aface54d671f70077eb7590249a9f
MD5 bc794ad2ca00b85646038bc78c9da710
BLAKE2b-256 0863f0192d27116efb3e329f5b684ffec18046d2d5e4792c9cb86b3c2816ae9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_stalker_mcp-2.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e866cc23a9c5a61427769480b6791732581c22b9c13a84b700553046c67048b3
MD5 a68eb2a5f6d607cc625d17a4dca939b8
BLAKE2b-256 66a81befce1fb6b6e9d9b26606074002657d61b2b611ec4907bb088caa7f1ac3

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