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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@michaelguo/math-mcp-server-nodejs

v1.0.5

Published

A NodeJS MCP Server that provides mathematical operations

Downloads

15

Readme

Math MCP Server (NodeJS)

npm version License: MIT

一个基于 NodeJS 的 Model Context Protocol (MCP) 服务器,提供数学计算功能。

功能特性

  • 加法工具: 提供两个数字的加法计算
  • 服务器信息资源: 展示服务器的基本信息
  • 计算提示模板: 用于数学计算的提示模板

安装

从 npm 安装(推荐)

npm install -g @michaelguo91/math-mcp-server-nodejs

从源码安装

  1. 克隆或下载项目到本地
  2. 安装依赖:
npm install

构建

npm run build

运行

开发模式

npm run dev

生产模式

npm start

监听模式(自动重新编译)

npm run watch

使用方法

这个 MCP 服务器通过 stdio 传输层与客户端通信。它提供以下功能:

工具 (Tools)

add

计算两个数字的和。

参数:

  • a (number): 第一个数字
  • b (number): 第二个数字

示例:

{
  "name": "add",
  "arguments": {
    "a": 5,
    "b": 3
  }
}

返回:

{
  "content": [
    {
      "type": "text",
      "text": "计算结果: 5 + 3 = 8"
    }
  ]
}

资源 (Resources)

server-info

获取服务器的基本信息。

URI: info://server

提示 (Prompts)

calculate

用于数学计算的提示模板。

参数:

  • operation (string): 要执行的数学操作
  • numbers (array): 参与计算的数字数组

与 MCP 客户端集成

全局安装后使用

如果你全局安装了这个包,可以直接使用命令:

{
  "mcpServers": {
    "math-server": {
      "command": "math-mcp-server"
    }
  }
}

本地安装使用

要在 MCP 客户端中使用此服务器,请将以下配置添加到客户端的配置文件中:

{
  "mcpServers": {
    "math-server": {
      "command": "node",
      "args": ["path/to/math-mcp-server-nodejs/dist/index.js"]
    }
  }
}

使用 npx(无需安装)

{
  "mcpServers": {
    "math-server": {
      "command": "npx",
      "args": ["@michaelguo91/math-mcp-server-nodejs"]
    }
  }
}

测试

你可以使用 MCP Inspector 来测试这个服务器:

npx @modelcontextprotocol/inspector node dist/index.js

项目结构

math-mcp-server-nodejs/
├── src/
│   └── index.ts          # 主服务器文件
├── dist/                 # 编译后的 JavaScript 文件
├── package.json          # 项目配置和依赖
├── tsconfig.json         # TypeScript 配置
└── README.md            # 项目说明

技术栈

  • NodeJS: JavaScript 运行时
  • TypeScript: 类型安全的 JavaScript
  • MCP SDK: Model Context Protocol TypeScript SDK
  • Zod: 运行时类型验证

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!

扩展功能

你可以轻松扩展这个服务器来添加更多数学功能:

  • 减法、乘法、除法
  • 高级数学函数(三角函数、对数等)
  • 统计计算
  • 矩阵运算

只需在 src/index.ts 中添加新的工具定义即可。