Skip to main content
Glama
MCP Calculator

MCP Calculator

by devantage

Logo

MCP Calculator

A modern Model Context Protocol server for mathematical calculations. Exposes 13 tools (6 core + 7 specialized) with high-precision arithmetic, a safe expression evaluator, statistics, unit conversion, and financial math.

Requirements

  • Python 3.10+

  • uv (or Docker, for the containerized setup)

Related MCP server: Symath-MCP

Installation

uv venv

uv pip install -e ".[dev]"

Running

The server supports two transports, selected via the MCP_TRANSPORT environment variable (see Configuration).

STDIO

The server speaks MCP over stdio by default (the transport used by most MCP clients such as Claude Desktop and Claude Code):

source .venv/bin/activate

mcp-calculator

Streamable HTTP

To serve over streamable HTTP instead:

source .venv/bin/activate

MCP_TRANSPORT=http mcp-calculator

The HTTP endpoint is then available at http://0.0.0.0:8080/mcp/.

Docker

Build the image and run it in HTTP mode (the image defaults to HTTP on port 8080):

docker build -t mcp-calculator .

docker run --rm -p 8080:8080 mcp-calculator

Override any setting at runtime with -e, e.g. a different port:

docker run --rm -p 9000:9000 -e MCP_PORT=9000 mcp-calculator

Configuration

Variable

Default

Description

MCP_TRANSPORT

stdio

Transport to use: stdio or http (streamable HTTP).

MCP_HOST

0.0.0.0

Host/interface to bind when using HTTP. Use 0.0.0.0 to expose it.

MCP_PORT

8080

Port to listen on when using HTTP.

Available Tools

Core

Tool

Description

basic_math

add / subtract / multiply / divide with decimal precision (0-15)

advanced_math

trig, inverse trig, log/ln, sqrt, abs, factorial, exp, pow

expression_eval

evaluate expressions with variables, constants, and functions

statistics_analysis

mean, median, mode, std_dev, variance, percentile, range, skewness, kurtosis, summary

unit_conversion

length, weight, temperature, volume, area

financial_calc

simple/compound interest, loan payment, ROI, present/future value

Specialized

Tool

Description

stats_summary

full statistical overview of a dataset

percentile

a specific percentile (0-100) of a dataset

batch_conversion

convert many values between units at once

npv

Net Present Value of cash flows

irr

Internal Rate of Return (Newton-Raphson)

loan_comparison

compare loans, return the lowest monthly payment

investment_scenarios

compare investments, return the highest return

Development

Testing

Run the test suite with:

pytest

License

MIT

Available Tools

13 tools
advanced_mathA

Perform advanced mathematical functions (trigonometry, logarithms, etc.).

Trig functions accept unit='degrees' to convert the input; inverse trig functions return degrees when unit='degrees'. pow uses exponent. Domain rules: log/ln require positive input, sqrt non-negative, factorial a non-negative integer <= 170, exp argument <= 700.

Inputs: value (required), function (required), unit, exponent. Returns: object

basic_mathA

Perform basic mathematical operations (add, subtract, multiply, divide).

Uses high-precision decimal arithmetic and rounds the result to precision decimal places (0-15). Supports two or more operands applied left to right.

Inputs: operands (required), operation (required), precision. Returns: object

batch_conversionB

Convert multiple values between units in a single call.

Inputs: values (required), to_unit (required), category (required), from_unit (required). Returns: object

expression_evalA

Evaluate mathematical expressions with variable substitution.

Supports +, -, *, /, %, ^ (power), parentheses, comparison/logical operators, the constants pi/e (and PI/E), and the functions sin, cos, tan, asin, acos, atan, log (base 10), ln, sqrt, pow, abs, exp, factorial. Variable names must start with a letter and may not collide with reserved names.

Inputs: expression (required), variables. Returns: object

financial_calcA

Perform financial calculations (interest, loans, ROI).

Rates are percentages. compound_interest/present_value/future_value default to annual compounding (periods=1); loan_payment defaults to monthly (periods=12). roi uses principal (initial) and future_value (final).

Inputs: operation (required), rate, time, periods, +2 more. Returns: object

investment_scenariosA

Compare multiple investment scenarios and identify the highest return.

Each scenario defaults to compound_interest but may set operation to any supported financial operation. Invalid scenarios are reported per-index.

Inputs: scenarios (required). Returns: object

irrB

Calculate Internal Rate of Return of cash flows (Newton-Raphson).

Inputs: cash_flows (required). Returns: object

loan_comparisonA

Compare multiple loan options and identify the lowest monthly payment.

Each loan object accepts the same fields as financial_calc loan_payment (principal, rate, time, periods). Invalid loans are reported per-index rather than aborting the whole comparison.

Inputs: loans (required). Returns: object

npvB

Calculate Net Present Value of a series of cash flows.

Inputs: cash_flows (required), discount_rate (required). Returns: object

percentileC

Calculate a specific percentile (0-100) of a dataset.

Inputs: data (required), percentile (required). Returns: object

statistics_analysisA

Perform statistical analysis on data sets.

Standard deviation and variance use the sample estimator (n-1). The percentile operation returns the 25/50/75/90/95/99th percentiles.

Inputs: data (required), operation (required). Returns: object

stats_summaryA

Get comprehensive statistical summary of a dataset.

Returns count, mean, median, standard deviation, variance, range, min, max and the 25/50/75th percentiles in a single call.

Inputs: data (required). Returns: object

unit_conversionC

Convert between different units of measurement.

Categories and units — length: mm, cm, m, km, in, ft, yd, mi, mil, μm, nm; weight: mg, g, kg, t, oz, lb, st, ton; temperature: C, F, K, R; volume: ml, cl, dl, l, kl, fl_oz, cup, pt, qt, gal, tsp, tbsp, bbl; area: mm2, cm2, m2, km2, in2, ft2, yd2, mi2, acre, ha.

Inputs: value (required), to_unit (required), category (required), from_unit (required). Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 13 tools

    Disambiguation3/5

    Statistics has three overlapping tools (statistics_analysis, stats_summary, percentile) which could confuse an agent. Financial_calc overlaps with loan_comparison and investment_scenarios, though the comparative tools are distinct. Other tools are clearly separated.

    Naming Consistency3/5

    Most tools use noun_noun or adjective_noun patterns, but npv and irr are acronyms that break the pattern. expression_eval is verb-last while others are noun-first. Still readable but not fully consistent.

    Tool Count5/5

    With 13 tools, the server covers math, statistics, conversions, and finance without exceeding a manageable count. Each tool has a clear domain, though some redundancy exists in stats.

    Completeness4/5

    The server covers basic and advanced math, expression evaluation, statistics, unit conversions, and financial calculations, including comparative tools. Missing features like complex numbers or regression analysis are minor for a calculator.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Free MCP server for Claude with math and financial calculation tools — unit conversion, currency math, compound interest, statistics.
      8
      2
      MIT
    • F
      license
      B
      quality
      D
      maintenance
      A comprehensive MCP server providing basic and advanced math operations (addition, subtraction, statistics, etc.) as well as smart prompts for multiplication tables, equation solving, financial calculations, geometry, unit conversion, loan amortization, probability, and fitness analytics.
      23
      1
      -
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      MCP server providing Claude with advanced mathematical capabilities including symbolic math, statistics, and matrix operations.
      -