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

@leehaohao/unit-converter-mcp

v4.2.0

Published

MCP server providing unit conversion utilities - convert between various units including length, weight, temperature, area, volume and data storage

Readme

Unit Converter MCP

一个简单高效的 MCP 服务器,提供多种单位转换功能。帮助 AI 在不同单位之间进行准确转换。

为什么需要这个工具?

AI 模型通常不能直接进行准确的单位转换。这个 MCP 服务器让 AI 能够:

  • 在各种长度单位之间转换(米、千米、英寸、英尺等)
  • 在各种重量单位之间转换(克、千克、磅、盎司等)
  • 在各种温度单位之间转换(摄氏度、华氏度、开尔文等)
  • 在各种面积单位之间转换
  • 在各种体积单位之间转换
  • 在各种数据存储单位之间转换

工具列表

| 工具 | 描述 | |------|------| | convert_length | 在各种长度单位之间进行转换 | | convert_weight | 在各种重量单位之间进行转换 | | convert_temperature | 在各种温度单位之间进行转换 | | convert_area | 在各种面积单位之间进行转换 | | convert_volume | 在各种体积单位之间进行转换 | | convert_data | 在各种数据存储单位之间进行转换 | | list_length_units | 列出所有支持的长度单位 | | list_weight_units | 列出所有支持的重量单位 | | list_temperature_units | 列出所有支持的温度单位 | | list_area_units | 列出所有支持的面积单位 | | list_volume_units | 列出所有支持的体积单位 | | list_data_units | 列出所有支持的数据存储单位 |

支持的单位

长度单位 (length)

  • m (米)
  • km (千米)
  • cm (厘米)
  • mm (毫米)
  • in (英寸)
  • ft (英尺)
  • yd (码)
  • mi (英里)

重量单位 (weight)

  • g (克)
  • kg (千克)
  • mg (毫克)
  • lb (磅)
  • oz (盎司)

温度单位 (temperature)

  • c (摄氏度)
  • f (华氏度)
  • k (开尔文)

面积单位 (area)

  • m2 (平方米)
  • km2 (平方千米)
  • cm2 (平方厘米)
  • mm2 (平方毫米)
  • ac (英亩)
  • ha (公顷)
  • ft2 (平方英尺)
  • yd2 (平方码)
  • in2 (平方英寸)
  • mi2 (平方英里)

体积单位 (volume)

  • m3 (立方米)
  • cm3 (立方厘米)
  • ft3 (立方英尺)
  • in3 (立方英寸)
  • l (升)
  • ml (毫升)
  • gal (加仑)
  • qt (夸脱)
  • pt (品脱)
  • cup (杯)

数据存储单位 (data)

  • b (字节)
  • bit (比特)
  • kb (千字节)
  • mb (兆字节)
  • gb (吉字节)
  • tb (太字节)
  • pb (拍字节)
  • kib (千二进制字节)
  • mib (兆二进制字节)
  • gib (吉二进制字节)
  • tib (太二进制字节)
  • pib (拍二进制字节)

安装

npx -y @leehaohao/unit-converter-mcp

配置

STDIO模式(默认)

在 MCP 配置文件中添加:

{
  "mcpServers": {
    "unit-converter": {
      "command": "npx",
      "args": ["-y", "@leehaohao/[email protected]"]
    }
  }
}

HTTP/SSE模式

对于需要HTTP/SSE端点的平台,在 MCP 配置文件中添加:

{
  "mcpServers": {
    "unit-converter": {
      "command": "npx",
      "args": ["-y", "@leehaohao/[email protected]", "--http"],
      "env": {
        "PORT": "3000"
      }
    }
  }
}

然后通过 http://localhost:3000/sse 访问SSE端点。

使用示例

长度单位转换

工具: convert_length
参数: { "value": 100, "from_unit": "cm", "to_unit": "m" }
输出: 1 米

重量单位转换

工具: convert_weight
参数: { "value": 2.5, "from_unit": "kg", "to_unit": "lb" }
输出: 5.511557 磅

温度单位转换

工具: convert_temperature
参数: { "value": 0, "from_unit": "c", "to_unit": "f" }
输出: 32 华氏度

面积单位转换

工具: convert_area
参数: { "value": 1, "from_unit": "ac", "to_unit": "m2" }
输出: 4046.86 平方米

体积单位转换

工具: convert_volume
参数: { "value": 1, "from_unit": "l", "to_unit": "gal" }
输出: 0.264172 加仑

数据存储单位转换

工具: convert_data
参数: { "value": 1, "from_unit": "gb", "to_unit": "mb" }
输出: 1024 兆字节

列出支持的单位

工具: list_length_units
输出: ["m", "km", "cm", "mm", "in", "ft", "yd", "mi"]

工具: list_temperature_units
输出: ["c", "f", "k"]

开发者指南

构建项目

npm run build

启动服务(STDIO模式)

npm start

启动服务(HTTP/SSE模式)

npm run start:http

或者指定端口:

PORT=8080 npm run start:http

实时编译

npm run watch

API 参考

convert_length

在各种长度单位之间进行转换

参数:

  • value: number - 要转换的数值
  • from_unit: string - 源单位
  • to_unit: string - 目标单位

convert_weight

在各种重量单位之间进行转换

参数:

  • value: number - 要转换的数值
  • from_unit: string - 源单位
  • to_unit: string - 目标单位

convert_temperature

在各种温度单位之间进行转换

参数:

  • value: number - 要转换的数值
  • from_unit: string - 源单位
  • to_unit: string - 目标单位

convert_area

在各种面积单位之间进行转换

参数:

  • value: number - 要转换的数值
  • from_unit: string - 源单位
  • to_unit: string - 目标单位

convert_volume

在各种体积单位之间进行转换

参数:

  • value: number - 要转换的数值
  • from_unit: string - 源单位
  • to_unit: string - 目标单位

convert_data

在各种数据存储单位之间进行转换

参数:

  • value: number - 要转换的数值
  • from_unit: string - 源单位
  • to_unit: string - 目标单位

list_*_units

列出特定类别下所有支持的单位

参数: 无

返回: string[] - 支持的单位数组

License

MIT