Skip to main content

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

Project description

BiliStalkerMCP

Python MCP Version smithery badge

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

English | 中文说明

Installation

Installing via Smithery

To install bilistalkermcp automatically via Smithery:

npx -y @smithery/cli install @222wcnm/bilistalkermcp

Manual Installation

uvx 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.5.0.tar.gz (139.9 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.5.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bili_stalker_mcp-2.5.0.tar.gz
Algorithm Hash digest
SHA256 d9b6ff035aa13bf9726a11c53f8de79a1c166180bf0db2488a45ff33761ec134
MD5 b0c398b6fd43c5a5e87051b66f473ae2
BLAKE2b-256 34936cb1097d133f466e12f8232ba5ac8918430d2e25e8efee87bfa6f65a7bd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bili_stalker_mcp-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40672d1772f6e34bfe98f50460b0e585e8e45f9d49425b7596a0674f417b4a10
MD5 ba8d717b6481e192b212f2f9d894c320
BLAKE2b-256 385b23cf6c31081390742f9f9a902cc4131dea62c90a4ed32707e7f79fe5e5be

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