Calculator

io.github.slettmayerPublished by GitHub account slettmayerv0.1.9Updated Oct 24, 2026

Exact arithmetic: one calculator tool over an AST allowlist, with integers exact at any size.

The publisher's own server: calc.engineer

VerifiedSTDIODesktop onlyDeveloper Tools

Overview

AI-generated overview

A local MCP server exposing one calculate tool that evaluates arithmetic expressions exactly, so an assistant does not have to do math mentally.

What you can do
Evaluate arithmetic expressions with +, -, *, /, //, %, ** and parentheses, plus unicode operator variants and unary signs, returning the result as a string or an Error line instead of failing the call. Use constants pi, e and tau and functions such as sqrt, log, trig, factorial, gcd and lcm. Get exact integers at any size, with floats rendered at 12 significant digits to strip representation noise.
When to use it
Add it when an assistant needs reliable arithmetic, large-integer multiplication or scientific functions rather than estimating numbers itself, and when you want a small, bounded, single-purpose calculator server instead of a general code-execution tool.
Requirements
Runs as a local stdio process started with uvx from the PyPI package calc-mcp-server, so a Python environment with uv/uvx is needed. No accounts, API keys, environment variables or headers are declared. The README advises pinning the version rather than using @latest.
Before you install
The tool only computes; it does not read or write files or reach the network. Expressions are parsed against an allowlist and capped by length, nesting depth, result size and factorial argument, so very large or deeply nested inputs are rejected with an Error line rather than evaluated.

Installation

In SourceWeft

  1. Open Calculator in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

Calculator MCP Server

[PyPI] [Python] [License: MIT]

An MCP server that does arithmetic, exactly — so an LLM does not have to do it mentally.

One tool, calculate, evaluating expressions against a hand-rolled AST allowlist. No eval(), no sympy, no unbounded dependencies.

2 + 3 * (4 - 1) / 2 ** 2   ->  4.25sqrt(16) + sin(pi/2)       ->  5.0123456789 * 987654321      ->  121932631112635269

Why this exists

The widely-used mcp-server-calculator package is abandoned (last commit May 2025) and declares mcp>=1.4.1 with no upper bound. When the MCP Python SDK released v2 and removed mcp.server.fastmcp, every uvx …@latest install of it started crashing on import — which took down the entire MCP proxy hosting it, and every other server alongside it.

No maintained Python replacement exists. The one actively-maintained npm calculator computes in float64, so 123456789 * 987654321 comes back as 121932631112635260 — off by 9. That is a poor trait in a tool whose whole purpose is that the model should not be doing the arithmetic itself.

So this server:

  • bounds its one dependency (mcp[cli]>=2,<3) — the failure above cannot recur here;
  • keeps integers exact at any size, never coercing to float;
  • bounds resource use, not just code execution — see below.

Safety

Two problems, and most calculator servers only solve the first.

Code execution. Expressions are parsed with ast.parse and walked against an explicit allowlist of node types. Attribute is not on it, so (1).__class__.__bases__ is rejected. A Call is only evaluated when its target is a bare name in the function allowlist, so __import__('os').system(…) is rejected before any argument is even evaluated.

Resource exhaustion. An allowlist alone still lets 9**9**9 occupy the process for minutes on unbounded bignum exponentiation — the incumbent hangs for over five seconds on it. Four caps close that: expression length (500 chars), nesting depth (32), result size (4300 digits, checked on the operands before exponentiating), and factorial argument (1000).

Full detail in docs/tech/SAFE-EVALUATION.md.

Install

bash
uvx calc-mcp-server

Pin it. Do not add @latest — that is how the package this replaces broke.

Configure

As a stdio MCP server:

json
{  "mcpServers": {    "calculator": {      "command": "uvx",      "args": ["calc-mcp-server"]    }  }}

The calculate tool

ArgumentTypeDescription
expressionstrThe expression to evaluate

Returns the result as a string, or a line starting with Error: explaining why the expression was rejected. The tool never raises, so a bad expression is an answer the agent can read back rather than a tool-call failure.

Operators — + - * / // % **, parentheses, unary +/-. ^ is accepted as a power operator, and × · ÷ − are accepted as their ASCII equivalents (speech-to-text produces them).

Constants — pi, e, tau.

Functions — abs round min max sqrt exp log log2 log10 sin cos tan asin acos atan atan2 degrees radians hypot floor ceil factorial gcd lcm.

Results — integer arithmetic returns an exact integer of any size. Floats are rendered at 12 significant digits, which removes IEEE-754 representation noise (0.1 + 0.2 reads 0.3, not 0.30000000000000004) while keeping far more precision than a calculator result is used at. A whole float keeps its .0, so 8 / 2 reads 4.0 and stays distinct from the exact integer 4.

Development

bash
uv syncuv run pytest tests/ -vuv run ruff check .uv run ruff format .

See AGENTS.md for the project guide and docs/ for the full documentation set.

License

MIT — see LICENSE.

Source: README.md at commit b2e8ffa

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

2
  1. v0.1.9LatestSep 18, 2026
  2. v0.1.8Sep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

Other Calc integrations