Calculator Mcp

io.github.tech-sushant由 GitHub 账号 tech-sushant 发布v1.0.1更新于 Oct 24, 2026

A simple Model Context Protocol calculator server

发布方自己的服务:Calculator Tools MCP

已验证STDIO仅桌面

概览

AI 生成的概览

一个本地 MCP 服务器,为助手提供基础算术工具:加、减、乘、除、乘方和平方根。

可以做什么
对两个数执行加、减、乘运算,并以类似 5 + 3 = 8 的表达式形式返回结果。
适用场景
适合希望助手通过专用工具完成简单算术、而不是自行计算的场景,例如在 Claude Desktop 等桌面 MCP 客户端中使用。
运行要求
作为本地 Node.js 进程运行,从 npm 包安装;README 说明需安装依赖、构建 TypeScript 代码,并在 MCP 客户端配置中指向编译后的入口文件。未声明任何账户、API 密钥或环境变量。
安装前请注意
这些工具只进行计算并返回结果;README 未提及写入、网络请求或向第三方共享数据。除数为零和对负数求平方根会返回错误而非数值。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Calculator Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Calculator MCP Server

A simple Model Context Protocol (MCP) server that provides basic calculator functionality through MCP tools.

Features

This MCP server provides the following calculator tools:

  • add: Add two numbers together
  • subtract: Subtract second number from first number
  • multiply: Multiply two numbers together
  • divide: Divide first number by second number (with zero-division protection)
  • power: Raise first number to the power of second number
  • sqrt: Calculate square root of a number (with negative number protection)

Installation

  1. Install dependencies:
bash
npm install
  1. Build the TypeScript code:
bash
npm run build

Usage

Running the Server

Start the MCP server:

bash
npm start

Or run in development mode:

bash
npm run dev

MCP Client Configuration

To use this calculator MCP server with an MCP client (like Claude Desktop), add it to your MCP configuration:

json
{  "mcpServers": {    "calculator": {      "command": "node",      "args": ["/path/to/calculator-mcp/dist/index.js"],      "env": {}    }  }}

Available Tools

add

Adds two numbers together.

  • Parameters: a (number), b (number)
  • Example: add(5, 3) returns 5 + 3 = 8
subtract

Subtracts the second number from the first.

  • Parameters: a (number), b (number)
  • Example: subtract(10, 4) returns 10 - 4 = 6
multiply

Multiplies two numbers together.

  • Parameters: a (number), b (number)
  • Example: multiply(6, 7) returns 6 × 7 = 42
divide

Divides the first number by the second.

  • Parameters: a (number), b (number)
  • Example: divide(15, 3) returns 15 ÷ 3 = 5
  • Error handling: Returns error for division by zero
power

Raises the base to the power of the exponent.

  • Parameters: base (number), exponent (number)
  • Example: power(2, 8) returns 2^8 = 256
sqrt

Calculates the square root of a number.

  • Parameters: number (number)
  • Example: sqrt(16) returns √16 = 4
  • Error handling: Returns error for negative numbers

Development

Project Structure

calculator-mcp/├── src/│   └── index.ts          # Main MCP server implementation├── dist/                 # Compiled JavaScript output├── package.json          # Dependencies and scripts├── tsconfig.json         # TypeScript configuration└── README.md            # This file

Building

bash
npm run build

Development Mode

bash
npm run dev

Error Handling

The calculator includes proper error handling for:

  • Division by zero
  • Square root of negative numbers
  • Invalid tool names
  • General execution errors

All errors are returned with appropriate error messages and the isError flag set to true.

License

MIT

来源:README.md,提交 9dfd897

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.1最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。

其他 Calculator 集成