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

oil-price-mcp

v0.1.0

Published

Stdio MCP server for querying China oil prices by province or city.

Downloads

11

Readme

oil-price-mcp

一个可通过 npx 直接启动的 stdio MCP 服务,用于查询中国省份油价,并支持“城市 -> 省份”自动映射。适合发布到 npm 后,在支持 npx 的 MCP 托管平台或客户端中直接接入。

功能

  • 按省份查询今日油价
  • 按城市自动映射到所属省份后查询
  • 使用环境变量 MXNZP_APP_IDMXNZP_APP_SECRET
  • 返回稳定 JSON 结构,方便后续做推送或展示

环境要求

  • Node.js 20+
  • 已申请 MXNZP 的 app_id / app_secret

本地开发

安装依赖:

npm install

设置环境变量后启动:

set MXNZP_APP_ID=你的_app_id
set MXNZP_APP_SECRET=你的_app_secret
npm run dev

构建

npm run build

作为 stdio MCP 使用

本地直接运行:

npx oil-price-mcp

或者在支持 command / args / env 的 MCP 配置里这样写:

{
  "mcpServers": {
    "oil-price": {
      "command": "npx",
      "args": [
        "-y",
        "oil-price-mcp"
      ],
      "env": {
        "MXNZP_APP_ID": "你的_app_id",
        "MXNZP_APP_SECRET": "你的_app_secret"
      }
    }
  }
}

这正好适合你截图里的 npx 托管界面。

ModelScope 自定义 MCP 示例

如果平台要求填“服务配置”,直接填:

{
  "mcpServers": {
    "oil-price": {
      "command": "npx",
      "args": [
        "-y",
        "oil-price-mcp"
      ],
      "env": {
        "MXNZP_APP_ID": "你的_app_id",
        "MXNZP_APP_SECRET": "你的_app_secret"
      }
    }
  }
}

安装命令选 npx

可用工具

get_oil_price_by_province

输入:

{
  "province": "广东"
}

get_oil_price_by_city

输入:

{
  "city": "深圳"
}

list_supported_provinces

返回当前支持的省份列表。

get_deployment_info

返回当前服务的运行模式、所需环境变量和上游接口地址。

返回格式说明

工具会返回一段摘要文本,并附带 JSON 文本。核心字段如下:

{
  "queryType": "city",
  "queryValue": "深圳",
  "normalizedProvince": "广东",
  "normalizedCity": "深圳",
  "prices": {
    "t0": "7.64",
    "t89": "7.42",
    "t92": "7.99",
    "t95": "8.65",
    "t98": "9.79"
  },
  "fetchedAt": "2026-03-14T11:22:33.000Z",
  "source": {
    "provider": "mxnzp",
    "endpoint": "https://www.mxnzp.com/api/oil/search",
    "message": "数据返回成功!"
  }
}

测试

npm test

发布到 npm

先确认登录:

npm whoami

预览发布内容:

npm pack --dry-run

正式发布:

npm publish --access public

当前限制

  • 城市映射基于内置表,优先覆盖常见城市和主要地级市
  • 如果某个城市暂未收录,请直接传省份名称,或后续补充映射表