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

bsc-balance

v0.1.2

Published

一个用于查询BSC地址BNB余额的MCP服务器,支持npx直接运行

Downloads

4

Readme

BSC余额查询 MCP服务器

一个用于查询BSC(币安智能链)地址BNB余额的Model Context Protocol服务器

这是一个基于TypeScript的MCP服务器,专门用于查询BSC地址的BNB余额。它展示了MCP的核心概念,通过提供工具功能实现与区块链的交互。

功能特点

工具

  • check_bnb - 查询BSC地址的BNB余额
    • 接受一个参数:address(BSC钱包地址)
    • 返回该地址的BNB余额

开发

安装依赖:

npm install

构建服务器:

npm run build

开发模式(自动重新构建):

npm run watch

安装与使用

通过npx直接使用(无需安装)

您可以通过npx直接运行本服务器,无需安装:

npx bsc-balance

这将启动MCP服务器,然后您可以在Claude等支持MCP的工具中配置它。

在Claude Desktop中配置

要与Claude Desktop一起使用,请添加服务器配置:

在Windows上: %APPDATA%/Claude/claude_desktop_config.json 在MacOS上: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "bsc-balance": {
      "command": "/path/to/bsc-balance/build/index.js"
    }
  }
}

或者,如果您通过npx使用:

{
  "mcpServers": {
    "bsc-balance": {
      "command": "npx",
      "args": ["bsc-balance"]
    }
  }
}

调试

由于MCP服务器通过标准输入/输出进行通信,调试可能具有挑战性。我们推荐使用MCP Inspector,可以通过以下命令启动:

npm run inspector

或者通过npx直接使用:

npx @modelcontextprotocol/inspector npx bsc-balance

Inspector将提供一个URL,可在浏览器中访问调试工具。

使用示例

一旦服务器运行,您可以通过Claude查询BSC地址的BNB余额:

查询 0xF8de5e61322302b2c6e0a525cC842F10332811bf 的BNB余额

这将返回该地址的BNB余额信息。

技术细节

  • 使用Web3.js库与BSC区块链交互
  • 使用节点 https://meme.bsc.blockrazor.xyz/ 查询区块链数据
  • 完全支持中文界面和错误提示
  • 支持通过npx直接运行,无需安装

源码说明

主要功能集中在checkBNBBalance函数中,它执行以下操作:

  1. 验证BSC地址格式
  2. 查询地址的BNB余额
  3. 将余额从Wei转换为BNB
  4. 返回格式化的结果