数学计算服务器

一个简单的MCP服务器,用于执行数学计算,包括加法、减法、乘法、除法和表达式计算。

  • by ai-engineer-devansh-singh
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 ai-engineer-devansh-singh/mcp-test

使用说明

你好,世界

执行数学计算的简单MCP服务器

安装

npm install @mcp/hello-world

配置

添加到MCP设置文件中:

{
  "mcpServers": {
    "hello-world": {
      "command": "npx",
      "args": ["-y", "@mcp/hello-world"]
    }
  }
}

工具

添加

将两个数字相加

输入架构:

{
  "type": "object",
  "properties": {
    "a": {
      "type": "number",
      "description": "First number"
    },
    "b": {
      "type": "number",
      "description": "Second number"
    }
  },
  "required": ["a", "b"]
}

减去

从第一个数字中减去第二个数字

输入架构:

{
  "type": "object",
  "properties": {
    "a": {
      "type": "number",
      "description": "First number (minuend)"
    },
    "b": {
      "type": "number",
      "description": "Second number (subtrahend)"
    }
  },
  "required": ["a", "b"]
}

乘

将两个数字相乘

输入架构:

{
  "type": "object",
  "properties": {
    "a": {
      "type": "number",
      "description": "First number"
    },
    "b": {
      "type": "number",
      "description": "Second number"
    }
  },
  "required": ["a", "b"]
}

分割

将第一个数字除以第二个数字

输入架构:

{
  "type": "object",
  "properties": {
    "a": {
      "type": "number",
      "description": "Dividend"
    },
    "b": {
      "type": "number",
      "description": "Divisor (must not be zero)"
    }
  },
  "required": ["a", "b"]
}

计算

计算数学表达式(支持+、-、*、/、括号)

输入架构:

{
  "type": "object",
  "properties": {
    "expression": {
      "type": "string",
      "description": "Mathematical expression to evaluate (e.g., '2 + 3 * 4', '(10 + 5) / 3')"
    }
  },
  "required": ["expression"]
}

发展

# Install dependencies
npm install

# Build
npm run build

# Test
npm test

# Watch mode
npm run dev

许可证

麻省理工学院