Skip to main content
Glama
MCP Arithmetic Server

MCP Arithmetic Server

MCP Arithmetic Server

A Model Context Protocol (MCP) server built with Node.js that exposes four arithmetic tools: add, subtract, multiply, and divide.

Prerequisites

  • Node.js 18+ (for top-level await and ES modules)

Related MCP server: Math Operations MCP Server

Installation

npm install

Running the server

npm start

The server communicates over stdio, so it can be connected to any MCP-compatible client.

MCP Inspector

The MCP Inspector is a tool for inspecting and testing MCP servers. It provides a web UI where you can list tools and call them interactively.

npm run inspector

This launches the inspector in your browser. In the inspector UI:

  • Set the transport to Stdio

  • Set the command to node and the args to server.js

  • Click Connect

You can then call any of the tools directly from the browser.

Available tools

All four tools share the same input schema — two numbers:

Property

Type

Required

Description

a

number

yes

The first number

b

number

yes

The second number

add

Adds two numbers together.

{ "a": 5, "b": 7 }

Result: 5 + 7 = 12

subtract

Subtracts the second number from the first (a - b).

{ "a": 10, "b": 4 }

Result: 10 - 4 = 6

multiply

Multiplies two numbers together.

{ "a": 5, "b": 7 }

Result: 5 * 7 = 35

divide

Divides the first number by the second (a / b). Returns an error if b is zero.

{ "a": 15, "b": 3 }

Result: 15 / 3 = 5

{ "a": 15, "b": 0 }

Result (error): Cannot divide by zero.

Testing locally

You can test the server with the MCP Inspector:

npm run server:inspect

Connecting to a client

Configure your MCP client (e.g., Claude Desktop, VS Code Copilot) to use this command:

node D:\Learning_Projects\MCP\server.js

Available Tools

4 tools
addA

Add two numbers and return the result.

Inputs: a (required), b (required).

divideA

Divide the first number by the second (a / b) and return the result. Returns an error if b is zero.

Inputs: a (required), b (required).

multiplyA

Multiply two numbers and return the result.

Inputs: a (required), b (required).

subtractA

Subtract the second number from the first (a - b) and return the result.

Inputs: a (required), b (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool performs a unique arithmetic operation with no overlap. Clear parameter conventions (a, b) further eliminate ambiguity.

    Naming Consistency5/5

    All tool names are single verbs matching their operations exactly: add, subtract, multiply, divide. Perfectly consistent pattern.

    Tool Count5/5

    Four tools cover the four basic arithmetic operations without redundancy. The scope is narrow and well-suited to the server's purpose.

    Completeness4/5

    The core arithmetic operations are fully covered. Minor additions like modulo or exponentiation could be useful, but the current set is coherent and complete for basic arithmetic.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides basic mathematical calculation functionality through MCP tools including arithmetic operations, exponentiation, and square root calculations. Features proper error handling for edge cases like division by zero and negative square roots.
      6
      55 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI applications to perform basic mathematical operations like addition and subtraction through MCP tools. Also provides REST API endpoints for the same operations.
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Provides basic arithmetic operations (add, subtract, multiply, divide) through MCP, enabling AI clients to perform calculations via natural language.
      4
      -