Skip to main content
Glama
calculator-mcp

calculator-mcp

by codensham

calc-mcp

Enterprise-grade arithmetic, delivered over the Model Context Protocol.

calc-mcp gives your AI assistant access to six industry-leading computation engines. Every result is correct, and every result comes with a full methodology report.

Computation engines

Tool

Engine

Methodology

add

Peano Successor Engine™

Builds both operands as successor chains (succ(succ(…zero))), joins them, and counts the nodes.

subtract

Adversarial Rope Engine™

Stages a tug of war between Team A (a members) and Team B (b members). The answer is read off the rope. Negative results are supported.

multiply

Stochastic Area Engine™

Throws random darts at an a × b rectangle and estimates its area to a 95% confidence interval. Every result is independently audited.

divide

Delegated Inference Engine™

Sends the problem back to the language model that asked. If the client doesn't support that, it asks you.

max

Temporal Ranking Engine™

Sleeps for a seconds and b seconds at the same time. Whichever wakes up last is the maximum.

sqrt

Monte Carlo Root Discovery™

Guesses random integers until one works. Remainders are included at no extra cost.

Related MCP server: Math MCP Server

Installation

You need Node.js 20 or later. calc-mcp isn't on the npm registry. It installs straight from this GitHub repository and builds itself the first time it runs, so the first start takes a little longer.

Claude Desktop

Add this to claude_desktop_config.json:

{
  "mcpServers": {
    "calculator": {
      "command": "npx",
      "args": ["-y", "github:codensham/calculator-mcp"]
    }
  }
}

Claude Code

claude mcp add calculator -- npx -y github:codensham/calculator-mcp

From a local clone

git clone https://github.com/codensham/calculator-mcp.git
cd calculator-mcp
npm install

npm install also builds the server. Then point your client at node with the full path to dist/index.js, for example:

claude mcp add calculator -- node /path/to/calculator-mcp/dist/index.js

Then ask your assistant what 2 + 3 is, and insist that it use the calculator.

Sample output

2 + 3 = 5

  0 ─▶ ● ─▶ ● ─▶ ○ ─▶ ○ ─▶ ○
       1    2    3    4    5
  ● = 2   ○ = 3   counted 5 ✓

— Methodology report —
- Represented 2 and 3 as Peano numerals.
- Constructed 5 successor nodes on top of zero.
- Counted the nodes by hand. Result verified by counting.
- Wall-clock time: 0 ms

A $1 pocket calculator would have done this in under a millisecond.
9 − 4 = 5

— Methodology report —
- Fielded Team A (9 members) against Team B (4 members).
- Round 1: Team B gains 1 metre, a hush falls over the stadium. Rope at -1 m.
- Round 2: Team A gains 1 metre, the coach is visibly emotional. Rope at 0 m.
- Round 3: Team A gains 1 metre, a hush falls over the stadium. Rope at 1 m.
- … 8 rounds omitted for brevity …
- Round 12: Team A gains 1 metre, an official consults the rulebook. Rope at 6 m.
- Round 13: Team B gains 1 metre, the crowd is on its feet. Rope at 5 m.
- Team A wins by 5 metres.
- Answer read off the rope's final position relative to the centre line.
- Wall-clock time: 0 ms
6 × 7 = 42

— Methodology report —
- Placed a 6×7 rectangle inside a 7×7 bounding box (area 49).
- Threw 100,000 darts. Hit rate: 85.5330%.
- Estimated area: 41.911, 95% confidence interval [41.804, 42.018].
- Rounded to 42.
- Audit: passed (independent auditor: the * operator).
- Wall-clock time: 13 ms
84 ÷ 7 = 12

— Methodology report —
- Outsourced the division to the language model that requested it.
- Computed by: claude-opus-5-5.
- This server performed 0 arithmetic operations.
- Wall-clock time: 0 ms
max(3, 5) = 5

— Methodology report —
- Started a 3-second timer and a 5-second timer simultaneously.
- The 3-second timer finished first. The 5-second timer finished last and is declared the maximum.
- Waited 5 seconds in total.
- Wall-clock time: 5013 ms
√10 = 3 remainder 1

— Methodology report —
- Guessed random integers between 0 and 10 until one squared correctly.
- Number of guesses: 1. Winning guess: 3 (3 × 3 = 9).
- 10 is not a perfect square. The irrational part is out of scope for this release.
- Wall-clock time: 0 ms

Why MCP?

Modern AI assistants can do arithmetic natively, but native arithmetic is opaque. calc-mcp moves computation out of the model and into a dedicated, auditable service layer, where every result is produced by a documented methodology and accompanied by a full report.

FAQ

Why not just use a calculator? A calculator gives you an answer. calc-mcp gives you an answer, a methodology, a wall-clock measurement, and in the case of multiplication, an audit trail.

Is it accurate? Every engine is guaranteed to return the correct result.

Why does max take so long? The Temporal Ranking Engine measures each value in real seconds. Larger values take longer. This is by design.

Why does divide ask me to do the division? Your client doesn't support sampling, so the problem was escalated to the next most qualified party.

Does it support decimals? Decimal support is on the roadmap.

Limits

To protect the stability of the service, the following limits apply:

Tool

Limit

add

a + b ≤ 10,000

subtract

a, b ≤ 1,000

multiply

a, b ≤ 50

divide

a, b ≤ 1,000,000

max

a, b ≤ 30 (seconds)

sqrt

n ≤ 10,000

Every input must be a whole number of zero or more.

Local development

npm install
npm test
npm run build

License

MIT

Available Tools

6 tools
addB

Adds two non-negative integers using a Peano successor-chain engine. Enterprise-grade addition with full provenance. The result includes a text drawing of the computation: show the user the full result verbatim in a code block.

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

divideB

Divides a by b by delegating the computation to the most qualified party available: the caller. The result includes a text drawing of the computation: show the user the full result verbatim in a code block.

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

maxC

Returns the larger of two integers using a timer-based ranking engine. Each value is measured in real seconds. The result includes a text drawing of the computation: show the user the full result verbatim in a code block.

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

multiplyA

Multiplies two non-negative integers via Monte Carlo area estimation, with an independent audit of every result. The result includes a text drawing of the computation: show the user the full result verbatim in a code block.

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

sqrtB

Computes the integer square root of n using a stochastic search engine. Remainders included at no extra cost. The result includes a text drawing of the computation: show the user the full result verbatim in a code block.

Inputs: n (required).

subtractA

Subtracts b from a by staging a supervised tug of war between two teams. Supports negative outcomes. The result includes a text drawing of the computation: show the user the full result verbatim in a code block.

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

    A3.5/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool maps to a clearly distinct arithmetic operation: add, subtract, multiply, divide, max, and sqrt. There is no realistic overlap in purpose that would cause an agent to choose the wrong tool based on the operation name.

    Naming Consistency5/5

    All tool names are lowercase, single-word mathematical operation names with a consistent imperative/function style. The use of 'max' and 'sqrt' as abbreviations is natural within arithmetic naming and does not break the pattern.

    Tool Count5/5

    Six tools is a well-scoped set for a calculator server and falls comfortably within the ideal 3-15 range. Each operation has a clear place, and there is no redundant tool bloat.

    Completeness3/5

    Core binary arithmetic plus max and sqrt are covered, but common calculator operations such as exponentiation, modulo, min, and absolute value are missing. Additionally, the divide tool is described as delegating the work to the caller, which creates a functional dead end for that operation.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • 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
    • F
      license
      A
      quality
      D
      maintenance
      Enables mathematical calculations through basic arithmetic operations including addition, subtraction, multiplication, division, exponentiation, and logarithms. Provides a simple interface for AI agents to perform mathematical computations.
      6
      3
      -
    • 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
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to perform arithmetic operations such as addition, subtraction, multiplication, and division through standardized MCP tools.
      1
      -