数学计算MCP服务器

一款为AI助手提供高级数学工具和计算功能的服务,支持基本运算、统计分析、单位换算等多种功能。

  • by Ankluna72
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 Ankluna72/Math-Calculator-MCP-Server-

使用说明

🧮 数学与计算器MCP服务器

一个强大的 模型上下文协议(MCP)服务器 它为Claude和其他MCP兼容客户端等AI助手提供高级数学实用程序和计算器工具。

📖 关于

此MCP服务器公开了AI助手可用于执行计算、统计分析、单位转换等的数学工具。它采用模型上下文协议SDK构建,与Claude Desktop、VSCode和其他MCP客户端无缝集成。

作者 杰斐逊·罗萨斯·查比拉
存储库: https://github.com/Ankluna72/Math-Calculator-MCP-Server-

✨ 特性

🔢 基础计算器

  • 加法、减法、乘法、除法
  • 幂、平方根、模运算
  • 错误处理(除零、无效操作)

📊 统计分析

  • 平均值、中位数、众数
  • 标准差和方差
  • 完整的统计摘要

🔄 单位转换

  • 长度: 米、公里、英里、英尺、英寸
  • 重量: 千克、克、磅、盎司
  • 温度: 摄氏度、华氏度、开尔文

📐 方程解算器

  • 二次方程求解器(ax²+bx+c=0)
  • 处理真实和复杂的解决方案
  • 判别分析

💯 百分比计算器

  • 数字的百分比
  • 增减百分比
  • “X占Y的百分比是多少?”

📏 三角学

  • Sin、cos、tan(和逆函数)
  • 角度计算(单位:度)
  • 精确的浮点结果

🚀 安装

先决条件

  • Node.js>=18.0.0
  • npm或纱线

克隆并安装

git clone https://github.com/Ankluna72/Math-Calculator-MCP-Server-.git
cd Math-Calculator-MCP-Server-
npm install
npm run build

⚙️ 配置

适用于克劳德桌面

添加到您的Claude Desktop配置文件(claude_desktop_config.json):

窗户: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "math-calculator": {
      "command": "node",
      "args": [
        "C:\\path\\to\\Math-Calculator-MCP-Server-\\dist\\index.js"
      ]
    }
  }
}

适用于带Cline扩展的VSCode

添加到VSCode设置(.vscode/settings.json 或用户设置):

{
  "mcp.servers": {
    "math-calculator": {
      "command": "node",
      "args": [
        "C:\\path\\to\\Math-Calculator-MCP-Server-\\dist\\index.js"
      ]
    }
  }
}

📚 使用示例

配置后,您的AI助手可以自动使用这些工具。以下是一些示例请求:

基本计算

"Calculate 25 * 4"
"What is the square root of 144?"
"Divide 100 by 7"

统计

"Calculate the mean of [10, 20, 30, 40, 50]"
"Find median and mode for these numbers: [5, 3, 5, 2, 8, 5]"
"Give me all statistics for [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

单位转换

"Convert 100 kilometers to miles"
"How many pounds is 75 kilograms?"
"Convert 32 Fahrenheit to Celsius"

求解方程

"Solve x² - 5x + 6 = 0"
"Find solutions for 2x² + 3x - 2 = 0"

百分比

"What is 15% of 200?"
"Increase 50 by 20%"
"What percentage is 25 of 200?"

三角学

"Calculate sin(30°)"
"What is cos(45°)?"
"Find tan(60°)"

🛠️ 可用工具

工具 说明
calculate 基本算术运算
statistics 数字数组的统计分析
convert_units 在不同单位之间转换
solve_equation 求解二次方程
percentage 百分比计算
trigonometry 三角函数

📁 项目结构

Math-Calculator-MCP-Server-/
├── src/
│   └── index.ts          # Main MCP server implementation
├── dist/                 # Compiled JavaScript (after build)
├── package.json          # Project dependencies
├── tsconfig.json         # TypeScript configuration
├── .gitignore
└── README.md

🔧 发展

# Install dependencies
npm install

# Build the project
npm run build

# Development mode (watch for changes)
npm run dev

# Start the server
npm start

🧪 测试

您可以使用手动测试服务器 stdio 通信:

npm start

然后通过stdin发送MCP协议消息以测试工具执行。

📝 许可证

MIT许可证-有关详细信息,请参阅许可证文件

🤝 贡献

欢迎投稿!请随时提交拉取请求。

  1. 复刻仓库
  2. 创建功能分支(git checkout -b feature/AmazingFeature)
  3. 提交您的更改(git commit -m 'Add some AmazingFeature')
  4. 推到分支(git push origin feature/AmazingFeature)
  5. 打开拉取请求

📧 联系

杰斐逊·罗萨斯·查比拉

🌟 致谢


⭐ 如果你觉得这个项目有用,请考虑在GitHub上给它一颗星!