Skip to main content
Glama
SanLangLOVE

Simple Calculator MCP

by SanLangLOVE

简单计算器MCP工具

这是一个简单的计算器MCP(Model Context Protocol)工具,提供基本的数学运算功能。

{
  "name": "simple-calculator-mcp",
  "version": "1.0.0",
  "description": "一个简单的计算器MCP工具,提供基本的数学运算功能",
  "author": "SanLangLOVE",
  "license": "MIT",
  "runtime": "node",
  "entry": "dist/index.js",
  "dependencies": {
    "@modelcontextprotocol/sdk": "^0.4.0"
  },
  "tools": [
    {
      "name": "add",
      "description": "计算两个数字的和",
      "parameters": {
        "type": "object",
        "properties": {
          "a": {
            "type": "number",
            "description": "第一个数字"
          },
          "b": {
            "type": "number",
            "description": "第二个数字"
          }
        },
        "required": ["a", "b"]
      }
    },
    {
      "name": "subtract",
      "description": "计算两个数字的差",
      "parameters": {
        "type": "object",
        "properties": {
          "a": {
            "type": "number",
            "description": "被减数"
          },
          "b": {
            "type": "number",
            "description": "减数"
          }
        },
        "required": ["a", "b"]
      }
    },
    {
      "name": "multiply",
      "description": "计算两个数字的乘积",
      "parameters": {
        "type": "object",
        "properties": {
          "a": {
            "type": "number",
            "description": "第一个数字"
          },
          "b": {
            "type": "number",
            "description": "第二个数字"
          }
        },
        "required": ["a", "b"]
      }
    },
    {
      "name": "divide",
      "description": "计算两个数字的商",
      "parameters": {
        "type": "object",
        "properties": {
          "a": {
            "type": "number",
            "description": "被除数"
          },
          "b": {
            "type": "number",
            "description": "除数"
          }
        },
        "required": ["a", "b"]
      }
    },
    {
      "name": "power",
      "description": "计算一个数字的幂",
      "parameters": {
        "type": "object",
        "properties": {
          "base": {
            "type": "number",
            "description": "底数"
          },
          "exponent": {
            "type": "number",
            "description": "指数"
          }
        },
        "required": ["base", "exponent"]
      }
    }
  ]
}

功能特性

  • 加法运算

  • 减法运算

  • 乘法运算

  • 除法运算

  • 幂运算

Related MCP server: Math MCP Server

安装和设置

1. 安装依赖

npm install

2. 构建项目

npm run build

3. 配置MCP客户端

在你的MCP客户端配置文件中添加以下配置:

对于Claude Desktop (macOS)

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "simple-calculator": {
      "command": "node",
      "args": ["/Users/sanrosang/Documents/mcp/dist/index.js"],
      "env": {}
    }
  }
}

对于其他MCP客户端

根据你的MCP客户端文档,添加相应的服务器配置。

使用方法

启动MCP客户端后,你可以使用以下工具:

1. 加法 (add)

  • 参数:a (数字), b (数字)

  • 示例:计算 5 + 3

2. 减法 (subtract)

  • 参数:a (被减数), b (减数)

  • 示例:计算 10 - 4

3. 乘法 (multiply)

  • 参数:a (数字), b (数字)

  • 示例:计算 6 × 7

4. 除法 (divide)

  • 参数:a (被除数), b (除数)

  • 示例:计算 15 ÷ 3

  • 注意:除数不能为零

5. 幂运算 (power)

  • 参数:base (底数), exponent (指数)

  • 示例:计算 2^8

开发

运行开发版本

npm run dev

项目结构

├── src/
│   └── index.ts          # 主程序文件
├── dist/                 # 编译输出目录
├── package.json          # 项目配置
├── tsconfig.json         # TypeScript配置
└── README.md            # 说明文档

扩展功能

你可以通过修改 src/index.ts 文件来添加更多功能:

  1. tools 数组中添加新的工具定义

  2. CallToolRequestSchema 处理函数中添加对应的处理逻辑

许可证

MIT License

ModelScope 部署

本项目已配置为支持ModelScope平台部署。主要配置信息:

  • 运行时: Node.js

  • 入口文件: dist/index.js

  • 依赖管理: npm

  • 构建命令: npm run build

  • 启动命令: node dist/index.js

部署要求

  1. 确保项目已构建(npm run build

  2. 确保所有依赖已安装(npm install

  3. 确保dist/index.js文件存在且可执行

ModelScope平台配置

在ModelScope平台的设置页面中,使用以下配置:

服务名称: mcp-calculator 服务描述: 一个简单的计算器MCP工具,提供基本的数学运算功能 运行环境: Node.js 启动命令: node dist/index.js 工作目录: /

工具列表

本MCP服务器提供以下工具:

  1. add - 加法运算

  2. subtract - 减法运算

  3. multiply - 乘法运算

  4. divide - 除法运算

  5. power - 幂运算

所有工具都支持数字类型参数,并提供完整的错误处理机制。

环境变量

{
  "NODE_ENV": "production"
}

健康检查

服务支持MCP协议标准健康检查,确保服务正常运行。

Available Tools

5 tools
addB

计算两个数字的和

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes第一个数字
bYes第二个数字

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states what the tool does mathematically, but doesn't mention any behavioral traits like error handling (e.g., overflow), performance characteristics, or whether it's idempotent. For a tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized for this simple arithmetic tool and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple arithmetic tool with 100% schema coverage and no output schema, the description is minimally adequate. It explains what the tool does but doesn't provide information about return values, error conditions, or behavioral context that would be helpful for an AI agent. The lack of annotations means the description should do more to compensate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with both parameters 'a' and 'b' clearly documented as '第一个数字' (first number) and '第二个数字' (second number). The description adds no additional parameter information beyond what the schema already provides, so the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '计算两个数字的和' (calculates the sum of two numbers) clearly states the specific verb ('计算' - calculate) and resource ('两个数字的和' - sum of two numbers). It precisely distinguishes this tool from its siblings (divide, multiply, power, subtract) by specifying the exact arithmetic operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While the purpose is clear, there's no mention of when addition is appropriate compared to other arithmetic operations like subtraction or multiplication, nor any context about prerequisites or constraints.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

divideB

计算两个数字的商

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes被除数
bYes除数

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the action but doesn't disclose behavioral traits like error handling (e.g., division by zero), performance, or output format. This is a significant gap for a tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the tool's purpose without any waste. It is appropriately sized and front-loaded, making it easy to understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (simple arithmetic), 100% schema coverage, and no output schema, the description is minimally adequate. However, it lacks details on behavioral aspects like error handling, which would improve completeness for a tool with no annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for parameters 'a' (被除数 - dividend) and 'b' (除数 - divisor). The description adds no additional meaning beyond the schema, so it meets the baseline of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '计算两个数字的商' (calculates the quotient of two numbers) clearly states the verb (calculate) and resource (quotient of two numbers). It distinguishes from sibling tools like add, multiply, and subtract by specifying division, though it doesn't explicitly contrast them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like multiply or power. The description implies usage for division but lacks explicit context, prerequisites, or exclusions, such as handling division by zero.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

multiplyB

计算两个数字的乘积

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes第一个数字
bYes第二个数字

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the mathematical operation without mentioning any behavioral traits such as error handling (e.g., for non-numeric inputs), performance characteristics, or side effects. This leaves significant gaps for an AI agent to understand how the tool behaves beyond its basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence ('计算两个数字的乘积') that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy for an AI agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (basic arithmetic), 100% schema coverage, and no output schema, the description is minimally adequate. However, it lacks context about return values (e.g., what the product output looks like) and behavioral details, which could be important for an AI agent to use it correctly in varied scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage with clear parameter descriptions ('第一个数字' and '第二个数字'), so the schema does the heavy lifting. The tool description adds no additional meaning beyond what the schema provides, such as explaining parameter interactions or constraints, which aligns with the baseline score when schema coverage is high.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as '计算两个数字的乘积' (calculates the product of two numbers), which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'multiply' vs 'add' or 'divide', though the mathematical operation is inherently distinct.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'add', 'divide', or 'power'. It states what the tool does but offers no context about appropriate use cases, prerequisites, or comparisons with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

powerB

计算一个数字的幂

ParametersJSON Schema
NameRequiredDescriptionDefault
baseYes底数
exponentYes指数

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. The description only states what the tool does mathematically but reveals nothing about behavioral traits like error handling (e.g., handling of large exponents, invalid inputs), performance characteristics, or side effects. For a mathematical operation tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the tool's purpose with zero wasted words. It's appropriately sized for a simple mathematical function and front-loads the essential information without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple mathematical tool with 2 parameters, 100% schema coverage, and no output schema, the description is minimally adequate. It states the core function but lacks context about mathematical constraints, error cases, or result format. Given the simplicity of the operation and good schema documentation, it meets basic requirements but could be more complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with both parameters ('base' and 'exponent') clearly documented in the schema. The description adds no additional parameter semantics beyond what the schema already provides. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no parameter information in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '计算一个数字的幂' (calculate the power of a number) clearly states the tool's function with a specific verb and resource. It distinguishes from sibling tools like add, subtract, multiply, and divide by focusing on exponentiation rather than basic arithmetic operations. However, it doesn't explicitly differentiate from potential non-sibling power-related tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While the purpose is clear, there's no mention of when exponentiation is appropriate compared to other mathematical operations or any prerequisites for use. The agent must infer usage from the tool name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

subtractB

计算两个数字的差

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes被减数
bYes减数

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the calculation function without mentioning any behavioral traits such as error handling (e.g., for non-numeric inputs), performance characteristics, or side effects. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence ('计算两个数字的差') that directly states the tool's purpose without any wasted words. It is appropriately sized for a simple arithmetic tool and front-loaded with the core functionality, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (simple subtraction with two parameters) and high schema coverage (100%), the description is somewhat complete but lacks depth. It doesn't explain the return value (no output schema exists) or potential errors, which could be helpful. However, for such a basic operation, the description is minimally adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description does not add meaning beyond what the input schema provides. The schema has 100% coverage with clear descriptions for parameters 'a' (被减数 - minuend) and 'b' (减数 - subtrahend), which already define their roles in subtraction. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '计算两个数字的差' (calculates the difference between two numbers) clearly states the tool's purpose with a specific verb ('计算' - calculate) and resource ('两个数字的差' - difference of two numbers). It distinguishes from siblings like 'add' or 'multiply' by specifying subtraction, though it doesn't explicitly contrast them. The purpose is unambiguous but could be slightly more explicit about the mathematical operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'add' or 'divide'. It states what the tool does but offers no context about appropriate scenarios, prerequisites, or comparisons to sibling tools. Users must infer usage from the tool name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updates
    • First observedadd
    • First observeddivide
    • First observedmultiply
    • First observedpower
    • First observedsubtract

TDQS

A3.7/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct mathematical operation: addition, division, multiplication, exponentiation, and subtraction. There is no overlap in purpose, and the descriptions explicitly state what each tool does, making misselection unlikely.

Naming Consistency5/5

All tool names follow a consistent verb-only pattern (e.g., add, divide, multiply, power, subtract). They are all in lowercase and describe the core operation without unnecessary variation, making the set highly predictable.

Tool Count5/5

With 5 tools, this server is well-scoped for a simple calculator. Each tool covers a fundamental arithmetic operation, and there are no extraneous tools. The count is appropriate for the domain, providing essential functionality without bloat.

Completeness5/5

The tool set covers all basic arithmetic operations (addition, subtraction, multiplication, division) and includes exponentiation, which is a common extension. There are no obvious gaps for a simple calculator, as it supports the core mathematical workflows agents would need.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

  • Precision math engine for AI agents. 203 exact methods. Zero hallucination.

  • Deterministic time-value-of-money and fund-performance tools for AI agents — future value, present value, CAGR, annuities, perpetuities, loan payments, payback, discounted payback, DPI, RVPI and TVPI via Model Context Protocol. Useful for corporate finance, financial projections, financial analysis, quantitative analysis, financial formulas and financial modeling.

  • Deterministic profitability and market-value analysis tools for AI agents — margins, ROA, ROE, ROCE, ROIC, EPS, P/E, P/B, dividend yield and payout ratio via Model Context Protocol. Useful for corporate finance, equity analysis, financial analysis, quantitative analysis, financial formulas and financial modeling.

  • Deterministic operational-efficiency ratio tools for AI agents — asset, fixed-asset, inventory, receivables and payables turnover, days outstanding measures and cash conversion cycle via Model Context Protocol. Useful for corporate finance, financial analysis, working-capital analysis, financial formulas and financial modeling.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides basic arithmetic operations and advanced mathematical functions through the Model Context Protocol (MCP), with features like calculation history tracking and expression evaluation.
    1
    -
  • A
    license
    A
    quality
    D
    maintenance
    Enables basic arithmetic operations (addition, subtraction, multiplication, division) with 64-bit precision and matrix multiplication capabilities. Provides mathematical computation tools for AI assistants through the Model Context Protocol.
    5
    1
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    Provides mathematical computation capabilities including basic arithmetic operations (add, subtract, multiply, divide), advanced functions (square root, factorial, logarithm), and trigonometric functions (sin, cos, tan) through the Model Context Protocol.
    5
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides basic arithmetic operations (add, multiply, divide) for AI assistants through the Model Context Protocol.
    -