Skip to main content
Glama
souravjai

Calculator MCP Server

by souravjai

Calculator MCP Server

一个基于 Model Context Protocol (MCP) 的小型服务器,可通过 stdio 提供基本的计算器操作。

计算器 MCP 服务器教程

功能

该服务器提供以下工具:

工具

说明

参数

add

将两个数字相加

op1, op2

sub

用第一个数字减去第二个数字

op1, op2

mul

将两个数字相乘

op1, op2

div

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

op1, op2

所有参数都必须为数字。当 op20 时,div 会返回错误。

Related MCP server: Math MCP Server

环境要求

  • Node.js 18 或更高版本

  • npm

安装

从当前目录安装依赖:

npm install

运行服务器

通过 stdio 启动 MCP 服务器:

npm start

服务器会等待 MCP 客户端连接,因此不会在终端中打印正常的应用程序输出。

使用示例客户端进行测试

示例客户端会启动服务器、列出其工具,并以 100 调用 div,以演示除以零错误:

npm run test-client

要测试成功运算,请更新 mcp-client-test.ts 中的 callTool 参数,例如:

arguments: { op1: 10, op2: 2 },

使用 MCP Inspector

使用以下命令运行交互式 MCP Inspector:

npm run mcp-inspect

打开命令输出的 URL,然后选择一个计算器工具,并为 op1op2 提供值。

项目文件

  • mcp-server.ts - MCP 服务器和计算器工具定义

  • mcp-client-test.ts - 示例 MCP 客户端

  • mcp-calculator.gif - 教程演示

  • package.json - 脚本和依赖

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    C
    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
  • F
    license
    A
    quality
    D
    maintenance
    Provides basic mathematical operations including addition, subtraction, multiplication, division, and power calculations through a Model Context Protocol interface.
    5
    1
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides file reading and mathematical calculation tools through the Model Context Protocol. Enables reading file contents and evaluating mathematical expressions via stdio transport.

View all related MCP servers

Related MCP Connectors

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

  • A Model Context Protocol server for Wix AI tools

  • AI-callable calculators and engineering models with real formulas. No hallucinated math.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/souravjai/calculator-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server