Skip to main content
Glama
CALCULATE_MCP

CALCULATE_MCP

by YAMA-TANA

CALCULATE_MCP

Deterministic calculation tools for LLMs via the Model Context Protocol (MCP).

Instead of asking a language model to do arithmetic in hidden reasoning, CALCULATE_MCP gives it explicit deterministic tools for arithmetic, high-precision decimals, units, statistics, finance, matrices, complex numbers, numerical calculus, probability distributions, date math, and root solving.

Built for the 2026 MCP TypeScript SDK v2 and usable over both Streamable HTTP and stdio.

Tools

Tool

Purpose

calculate_expression

Safe arithmetic/scientific expression evaluation with variables

calculate_decimal

1-200 digit decimal arithmetic using decimal.js

convert_units

Length, mass, time, area, volume, speed, data, temperature

list_units

Discover accepted unit symbols

summarize_statistics

Mean, median, variance, standard deviation, quartiles, IQR

calculate_percentage

Percent-of, percent ratio, increase/decrease, percentage change

calculate_finance

Compound FV/PV and periodic loan payments

solve_root

Bracketed numerical root solving with bisection

calculate_matrix

Add/subtract/multiply/transpose/determinant/inverse/solve Ax=b

calculate_complex

Complex add/subtract/multiply/divide/abs/arg/conjugate/pow/sqrt

calculate_calculus

Numerical derivative and definite integral

calculate_probability

Normal PDF/CDF, binomial PMF/CDF, Poisson PMF/CDF

calculate_date

ISO date add/difference/weekday/business-day calculations

Related MCP server: Math-MCP

Why another calculator MCP?

The point is not to replace a pocket calculator. The point is to give an LLM a deterministic numerical execution layer that it can call whenever a response depends on exact arithmetic or repeatable numerical methods.

The expression evaluator does not use JavaScript eval. Expressions are parsed by a dedicated math parser with assignment, logical expressions, conditionals, concatenation, and membership operators disabled.

For decimal-sensitive work such as 0.1 + 0.2, use calculate_decimal:

{
  "operation": "add",
  "a": "0.1",
  "b": "0.2",
  "precision": 50
}

Result: 0.3.

Advanced examples

Matrix solve:

{
  "operation": "solve",
  "a": [[2, 1], [1, -1]],
  "b": [5, 1]
}

Numerical derivative:

{
  "operation": "derivative",
  "expression": "x^3",
  "x": 2
}

Normal CDF:

{
  "distribution": "normal",
  "operation": "cdf",
  "params": { "x": 1.96, "mean": 0, "sd": 1 }
}

Date math uses YYYY-MM-DD and UTC calendar semantics. business_days counts Monday-Friday and does not remove public holidays.

Run over HTTP

Requires Node.js 22+.

npm install
npm run build
npm start

MCP endpoint: http://localhost:3000/mcp
Health check: GET /health

Environment variables:

Variable

Default

Description

PORT

3000

HTTP port

HOST

0.0.0.0

Bind address

ALLOWED_HOSTS

unset

Comma-separated public hostnames for Host validation

For public deployment, set ALLOWED_HOSTS, for example:

ALLOWED_HOSTS=calculate.example.com npm start

Run over stdio

npm install
npm run build
npm run start:stdio

Example local MCP client configuration:

{
  "mcpServers": {
    "calculate": {
      "command": "node",
      "args": ["/absolute/path/to/CALCULATE_MCP/dist/src/stdio.js"]
    }
  }
}

Expression syntax

Examples:

2 + 3 * 4
sqrt(2)^2
sin(pi / 2)
log10(1000)
a*b + c
x^3 - x - 2

Constants: pi, e, tau.

Functions include abs, sqrt, sin, cos, tan, inverse/hyperbolic trig, ln, log10, log2, exp, min, max, hypot, floor, ceil, round, trunc, and sign.

Supported units

Call list_units for the machine-readable list. Categories include length, mass, time, area, volume, speed, data size, and temperature.

Numerical-method notes

  • Matrix inverse/solve use Gaussian elimination with partial pivoting.

  • Derivatives use a five-point central difference.

  • Definite integrals use Simpson's rule.

  • Root solving uses bisection and requires a sign-changing bracket.

  • Probability functions are deterministic numerical implementations; they are not intended as a replacement for specialized high-precision statistical libraries in extreme-tail scientific work.

Development

npm install
npm run check
npm test
npm run build

License

MIT

Available Tools

13 tools
calculate_calculusC

Numerical calculus for one-variable expressions: five-point numerical derivative or Simpson definite integral.

Inputs: operation (required), expression (required), x, step, +3 more.

calculate_complexC

Complex-number arithmetic using {re, im}: add, subtract, multiply, divide, magnitude, argument, conjugate, power, and square root.

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

calculate_dateB

Deterministic ISO calendar math in UTC: add days/weeks/months/years, date difference, weekday, or weekday-only business-day count.

Inputs: date (required), operation (required), unit, amount, +1 more.

calculate_decimalB

Perform high-precision decimal arithmetic without IEEE-754 surprises. Inputs are decimal strings and precision can be 1-200 significant digits.

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

calculate_expressionA

Safely evaluate a mathematical expression with optional numeric variables. Supports arithmetic, powers, factorial, trig, logs, sqrt, min/max, pi, e, and tau.

Inputs: expression (required), variables.

calculate_financeC

Calculate compound future/present value or periodic loan payment.

Inputs: years (required), operation (required), principal (required), annualRatePercent (required), +1 more.

calculate_matrixC

Matrix arithmetic: add, subtract, multiply, transpose, determinant, inverse, and solve Ax=b.

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

calculate_percentageC

Calculate percent-of, what-percent, increase/decrease, and percentage change.

Inputs: x (required), y (required), operation (required).

calculate_probabilityC

Evaluate normal PDF/CDF, binomial PMF/CDF, or Poisson PMF/CDF.

Inputs: params (required), operation (required), distribution (required).

convert_unitsC

Convert common length, mass, time, area, volume, speed, data-size, and temperature units.

Inputs: to (required), from (required), value (required), category (required).

list_unitsA

List every accepted unit symbol, grouped by category.

Inputs: no named parameters.

solve_rootB

Numerically solve f(x)=0 on a bracket using robust bisection.

Inputs: lower (required), upper (required), expression (required), tolerance, +1 more.

summarize_statisticsB

Compute descriptive statistics: count, sum, mean, median, range, variance, standard deviation, quartiles, and IQR.

Inputs: values (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 13 tools

    Disambiguation5/5

    Each tool targets a distinct mathematical subdomain (expression evaluation, decimal precision, units, statistics, percentage, finance, root solving, matrix, complex, calculus, probability, date). Overlap is minimal and descriptions clarify when to use specialized tools like calculate_finance versus calculate_expression.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern (e.g., calculate_expression, convert_units, list_units). The variation in verbs (calculate, convert, list, summarize, solve) is appropriate and predictable.

    Tool Count5/5

    13 tools is well within the ideal 3-15 range for a multi-domain calculation server. Each tool covers a distinct area and earns its place without redundancy.

    Completeness4/5

    The surface covers a broad range of mathematical operations, from basic arithmetic to finance, statistics, and calculus. Minor gaps exist (e.g., base conversion, random number generation, polynomial root finding without brackets), but core workflows are well supported.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server that exposes 8 mathematical tools (arithmetic, algebra, calculus, matrix operations, statistics, probability, unit conversions) to any MCP-compatible AI agent, enabling mathematical computations without code.
      8
      11 npm
      1
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server that provides basic mathematical, statistical and trigonometric functions to Large Language Models (LLMs).
      59
      35 npm
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A stdio MCP server that gives LLMs a safe scientific calculator with infix math, complex numbers, matrices, statistics, unit conversions, and more via tools that return JSON.
      33
      1
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables AI agents to perform arithmetic operations — addition, subtraction, multiplication, and division with divide-by-zero validation — through MCP tool calls. It can be run locally over stdio or as an HTTP microservice via streamable-http transport.
      4
      -