LabscoMCP early access ↗
carlomagnoglobalMCP SERVER · OFFICIAL PROJECT

toRustCalcMCP

Exact arbitrary-precision arithmetic as a tool call — `1/3 * 3` is exactly 1, and `2^256` comes back to the last digit.

by carlomagnoglobal ↗Time, Dates & Calculation✓ Official

LABSCO SUMMARY

Where a model's own arithmetic stops being trustworthy.

Large factorials, exact rationals and 256-bit powers are precisely the cases language models get subtly wrong, and this returns them exact rather than plausible. The ~ marker is a nice touch: you can tell at a glance whether a result was rendered exactly or rounded to the session epsilon.

What it is

A Rust port of calc, Landon Curt Noll's arbitrary-precision calculator, that speaks JSON-RPC 2.0 over stdio as an MCP server. The numeric core is exact rational arithmetic, which is the same model calc uses natively, so results are not floating-point approximations.

What you get

  • calc_eval — evaluate an expression; expression is required, with mode (real, frac or int), digits and epsilon as per-call overrides
  • calc_config — read or change the session's precision and display settings, including input and output base from 2 to 36
  • calc_functions — list the builtins, optionally filtered by substring
  • 483 builtin names, with variables, user-defined functions, if/while/for control flow, lists, complex numbers and string operations
  • A leading ~ in real-mode output marks a rounded or non-terminating rendering, the same convention calc uses
  • The same binary also runs as the rcalc command-line calculator and as a browser REPL

Requirements

Rust 1.75 or later to build; cargo build --release produces toRustCalcMCP, which auto-detects MCP versus CLI mode, and rcalc, which is always the calculator. Start it with toRustCalcMCP --mcp to speak JSON-RPC over stdio. digits defaults to 20 in real mode and accepts up to 10000; the default epsilon is exactly 1/10^20. Licensed LGPL-2.1.

Setup effort

Build from source — git clone https://github.com/carlomagnoglobal/toRustCalcMCP.git