npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mseep/bilibili-mcp-server

v1.0.0

Published

MCP server for Bilibili follower count retrieval

Readme

Bilibili 粉丝数查询 MCP 服务

这是一个基于Model Context Protocol (MCP)的服务,用于查询B站用户的粉丝数量。通过提供B站用户ID,可以获取该用户的粉丝数。

功能特点

  • 通过用户ID直接查询B站用户粉丝数
  • 支持MCP协议,可与Claude、GPT等大模型集成
  • 支持错误处理和详细日志记录

安装方法

前置要求

  • Node.js v16.0.0 或更高版本
  • npm 或 yarn 包管理器

安装步骤

  1. 克隆或下载本仓库
  2. 进入项目目录并安装依赖
cd bilibili-mcp-server
npm install

使用方法

启动服务器

npm start

启动成功后,终端会显示:

Starting Bilibili follower count MCP server...
MCP server connected and running!
Use Inspector to access the getBilibiliFollowerCount tool

使用MCP Inspector测试

  1. 安装MCP Inspector (如果尚未安装)
  2. 将Inspector连接到本地MCP服务器
  3. 选择getBilibiliFollowerCount工具
  4. 输入参数:
    • userId: B站用户的数字ID (如:184594996163637592等)
  5. 点击"Run"执行查询

输出格式

成功响应:

{
  "result": {
    "username": "用户名",
    "followerCount": 12345
  }
}

错误响应:

{
  "error": "错误信息"
}

API参考

getBilibiliFollowerCount

获取B站用户的粉丝数量。

参数:

  • userId (必填): B站用户ID,纯数字,通常为7-10位,如"163637592"

返回值:

  • username: 用户名
  • followerCount: 粉丝数量

如何获取B站用户ID

B站用户ID可以通过以下方式获取:

  1. 访问用户空间页面,查看URL

    • 例如:https://space.bilibili.com/163637592 中的 163637592 即为用户ID
  2. 在B站搜索用户名,点击进入用户空间,查看URL中的数字ID

常见问题

Q: 为什么需要使用用户ID而不是用户名?

A: B站API直接支持通过用户ID查询,这种方式更加可靠和高效。用户名可能重复或变更,而ID是唯一的。

Q: 如何处理API请求失败?

A: 服务会自动重试并记录详细错误日志,您可以在logs目录中查看错误详情。

测试工具

项目包含一个测试脚本,用于直接测试B站API:

node test-api.js

这将测试几个预设的用户ID,并显示详细的响应结果。

许可证

MIT