Token导航 LogoToken导航TokenDH.com
Precision Math MCP logo
运维云端stdio官方级别未说明来源级核验

Precision Math MCP

MCP Server

@nerdo/precision-math-mcp

为LLM提供精确数学计算能力的服务器,支持算术、代数、微积分等多种数学运算。

工具数

6

提示词数

0

GitHub Stars

1

资源数

0
数学计算TypeScriptClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

nerdo

提供方

nerdo

最后核验

2026/5/17 20:22

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx -y @nerdo/precision-math-mcp

详细介绍

精密数学mcp

法学硕士不会做数学。 他们预测令牌,而不是计算答案。要求法学硕士乘法或求解方程,你可能会得到听起来很自信的错误答案。

这个MCP服务器通过给你的LLM一个真正的计算器来解决这个问题。它的动力来自 math.js,一个经过实战考验的数学库,拥有14k+GitHub star,处理从基本算术到符号微积分的所有内容。

所有表达式都使用 math.js语法 -看 math.js文档 供完整表达参考。

特性

  • 6数学工具:

- calculate -计算数学表达式 - simplify -简化代数表达式 - derivative -计算符号导数 - solve -求解变量方程 - format -用精度/符号格式化数字 - convert -单位间转换

  • 3种运输方式:

- stdio -标准I/O(默认,适用于Claude Desktop) - http -可流式HTTP传输 - sse -服务器发送事件(向后兼容性)

快速开始

无需安装即可直接运行(需要Bun、npm、yarn或pnpm):

# Using bunx (recommended)
bunx -y @nerdo/precision-math-mcp

# Using npx
npx -y @nerdo/precision-math-mcp

# Using yarn
yarn dlx @nerdo/precision-math-mcp

# Using pnpm
pnpm dlx @nerdo/precision-math-mcp

安装

全局安装

# Using bun
bun add -g @nerdo/precision-math-mcp

# Using npm
npm install -g @nerdo/precision-math-mcp

# Using yarn
yarn global add @nerdo/precision-math-mcp

# Using pnpm
pnpm add -g @nerdo/precision-math-mcp

然后运行:

precision-math-mcp

本地开发

git clone https://github.com/nerdo/precision-math-mcp
cd precision-math-mcp
bun install
bun run src/index.ts

用法

运输方式

# Stdio mode (default)
bunx -y @nerdo/precision-math-mcp --stdio

# HTTP mode
PORT=3141 bunx -y @nerdo/precision-math-mcp --http

# HTTP mode with authentication
PORT=3141 MCP_AUTH_TOKEN=your-secret bunx -y @nerdo/precision-math-mcp --http

环境变量

变量默认值描述
PORT3141HTTP服务器端口
MCP_AUTH_TOKEN(无)HTTP的可选身份验证令牌
MCP_TRANSPORTstdio传输模式:stdio、http、sse
DESCRIPTION_MODE强制工具描述模式:强制(AI必须用于所有数学)或宽松(可选使用)

MCP客户端配置

克劳德桌面版

添加到您的Claude Desktop配置文件中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "precision-math": {
      "command": "bunx",
      "args": ["-y", "@nerdo/precision-math-mcp"]
    }
  }
}

或者使用npx:

{
  "mcpServers": {
    "precision-math": {
      "command": "npx",
      "args": ["-y", "@nerdo/precision-math-mcp"]
    }
  }
}

克劳德代码

添加到您的Claude Code MCP设置中:

{
  "mcpServers": {
    "precision-math": {
      "command": "bunx",
      "args": ["-y", "@nerdo/precision-math-mcp"]
    }
  }
}

工具示例

计算

使用可选变量计算数学表达式。

{
  "name": "calculate",
  "arguments": {
    "expression": "sqrt(a^2 + b^2)",
    "scope": { "a": 3, "b": 4 }
  }
}
// Returns: { "result": "5", "type": "number" }

支持:

  • 基本算术: 2 + 2 * 38
  • 功能: sin(pi/4), log(100), factorial(5)
  • 复数: sqrt(-1)i
  • 矩阵: [[1,2],[3,4]] * [[1,0],[0,1]]
  • 单位: 2 inch to cm5.08 cm

简化

简化代数表达式。

{
  "name": "simplify",
  "arguments": {
    "expression": "2x + 3x - x"
  }
}
// Returns: { "result": "4 * x" }

衍生物

计算符号导数。

{
  "name": "derivative",
  "arguments": {
    "expression": "x^3 + 2*x",
    "variable": "x"
  }
}
// Returns: { "result": "3 * x ^ 2 + 2", "simplified": "3 * x ^ 2 + 2" }

解决

求解变量的方程式。

{
  "name": "solve",
  "arguments": {
    "equation": "x^2 - 4 = 0",
    "variable": "x"
  }
}
// Returns: { "solutions": ["2", "-2"], "type": "exact" }

格式

用特定精度或符号格式化数字。

{
  "name": "format",
  "arguments": {
    "value": "pi",
    "precision": 4
  }
}
// Returns: { "result": "3.142" }

转换

在单位之间转换。

{
  "name": "convert",
  "arguments": {
    "value": "100 km/h",
    "toUnit": "m/s"
  }
}
// Returns: { "result": "27.77777777777778 m / s", "numericValue": 27.77777777777778 }

测试

# Run all tests
bun test

# Run specific test file
bun test tests/tools/calculate.test.ts

MCP检验员测试

npx @modelcontextprotocol/inspector bun run src/index.ts

打开MCP检查器http://localhost:6274您可以在哪里:

  • 查看所有可用工具
  • 使用自定义参数调用工具
  • 请参阅JSON-RPC通信日志

发展

# Type check
bunx tsc --noEmit

# Run in watch mode
bun --watch run src/index.ts

许可证

麻省理工学院

目录标签

目录标签

数学计算TypeScriptClaude本地部署代数简化微积分求解单位转换数值格式化

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

@nerdo/precision-math-mcp

工具数量(toolCount,工具数)

6

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP