calculate-mcp
This server is a Model Context Protocol (MCP) tool server for precise numerical, binary, cryptographic, and data-encoding calculations, with a chained batch execution engine for multi-step operations.
batch_calc: Run multiple calculation steps in one call and reference earlier results via
{"$step": index, "field": ...}Arithmetic & rounding: add, subtract, multiply, division, sum, modulo, floor, ceiling, round
Statistics: mean, median, mode, min, max
Trigonometry & conversion: sin, cos, tan, arcsin, arccos, arctan, degreesToRadians, radiansToDegrees
Number systems & binary data: integer conversion across hex/dec/bin/oct, signed/unsigned bit-widths, endianness swap
Bitwise operations: AND, OR, XOR, NOT, shifts, rotations with 8/16/32/64-bit widths
IEEE 754 decomposition: analyze float32/float64 sign, exponent, mantissa, and value classification
Cryptographic utilities: MD5/SHA1/SHA256 hashes, CRC32/CRC16 checksums, and BigInt modular arithmetic (mod_pow, mod_inverse, gcd)
Data codecs: Base64 (standard/URL-safe), Hex, UTF-8 text, and URL encode/decode
Arbitrary precision: uses native BigInt for large-integer operations without precision loss
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@calculate-mcp hash 'hello' with sha256 and convert the hex digest to base64"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
calculate-mcp
A comprehensive Model Context Protocol (MCP) server providing precision numerical calculations, low-level binary data operations, IEEE 754 float decomposition, cryptographic utilities, data codecs, and an intelligent chained batch execution engine (batch_calc) designed to eliminate multi-turn round-trip overhead for Large Language Models.
🌟 Highlights
⚡ 29 Specialized Tools: Covers arbitrary-precision integer conversions, bitwise logic, endianness swapping, IEEE 754 floating-point layouts, modular arithmetic, cryptography, statistics, and trigonometry.
🔗 Zero-Round-Trip Chained Execution (
batch_calc): Run multiple operations in a single tool call with step-to-step dependency referencing ({"$step": 0, "field": "resultHex"}), reducing LLM latency and token consumption.🔢 Arbitrary-Precision & Native Bit-Widths: Powered by native
BigInt— zero precision loss for 64-bit/128-bit+ integers with full 8/16/32/64-bit signed and unsigned two's complement representations.🛡️ Zero Bloat: Built purely with TypeScript, Node.js standard libraries, and Zod. No heavy native bindings or fragile dependencies.
Related MCP server: Polymath MegaBlaster MCP
📦 Installation & Configuration
Option A: Using npx (Recommended)
{
"mcpServers": {
"calculate-mcp": {
"command": "npx",
"args": ["-y", "calculate-mcp"]
}
}
}Option B: From Source (Clone & Run Locally)
Clone and build the server:
git clone https://github.com/KonghuanSmart/calculate-mcp.git
cd calculate-mcp
npm install
npm run buildAdd to your MCP client config (e.g.
claude_desktop_config.jsonormcp.json):
{
"mcpServers": {
"calculate-mcp": {
"command": "node",
"args": ["/path/to/calculate-mcp/build/index.js"]
}
}
}🛠️ Tool Catalog (29 Tools)
1. Pipeline & Batch Execution (1 Tool)
Tool | Description |
| Executes multiple calculation steps in a single call. Steps can reference earlier results using |
2. Number Systems & Binary Data (6 Tools)
Tool | Description |
| Converts integers across Hex, Dec, Bin, Oct, 8/16/32/64-bit signed/unsigned, Little-Endian, and ASCII. Supports batch arrays. |
| Bitwise operations ( |
| Swaps endianness (Big-Endian <-> Little-Endian) for numbers, hex values, or arbitrary byte streams. |
| Decomposes Single-precision (Float32) and Double-precision (Float64) IEEE 754 representations (Sign, Exponent, Mantissa, classification). |
| Standard hashes ( |
| Encoders and decoders for Base64 (standard & URL-safe), Hex <-> UTF-8 text, and URL encoding/decoding. |
3. Basic Arithmetic & Rounding (9 Tools)
Tool | Description |
| Adds two numbers. |
| Subtracts the second number from the first. |
| Multiplies two numbers. |
| Divides numerator by denominator. |
| Computes the sum of an array of numbers. |
| Returns the division remainder. |
| Rounds down to the nearest integer. |
| Rounds up to the nearest integer. |
| Rounds to the nearest integer. |
4. Statistics (5 Tools)
Tool | Description |
| Calculates the arithmetic mean. |
| Finds the median value. |
| Determines the most frequent entry/entries. |
| Finds the minimum value. |
| Finds the maximum value. |
5. Trigonometry & Conversions (8 Tools)
Tool | Description |
| Sine, cosine, and tangent (in radians). |
| Inverse trigonometric functions (in radians). |
| Converts degrees to radians. |
| Converts radians to degrees. |
💡 Practical Examples
Example 1: Multi-Step Chained Calculation (batch_calc)
In a single prompt, decode a packet header, swap endianness, mask flags, and calculate a checksum without round-trip delay:
{
"steps": [
{ "op": "data_codec", "args": { "action": "from_base64", "input": "c2VjcmV0", "format": "hex" } },
{ "op": "endian_swap", "args": { "value": "0x78563412", "widthBytes": 4 } },
{ "op": "bitwise", "args": { "operation": "xor", "a": { "$step": 1, "field": "bigEndianHex" }, "b": "0xDEADBEEF", "bitWidth": 32 } },
{ "op": "crypto_calc", "args": { "action": "crc32", "data": { "$step": 0, "field": "decoded" }, "inputFormat": "hex" } }
]
}Example 2: Modular Arithmetic & RSA Private Exponent
Solve $d \equiv e^{-1} \pmod{\phi(n)}$ for $e=65537$ and $\phi(n)=10000000000000000051$:
{
"action": "mod_inverse",
"a": "65537",
"modulus": "10000000000000000051"
}Example 3: IEEE 754 Floating-Point Decomposition
Decompose machine code 0x3f800000 into float components:
{
"value": "0x3f800000",
"precision": "float32"
}Output:
{
"value": 1,
"sign": "+",
"rawExponentDec": 127,
"biasedExponent": 0,
"mantissaHex": "0x000000",
"type": "normal"
}💻 Development
# Clone the repository
git clone https://github.com/KonghuanSmart/calculate-mcp.git
cd calculate-mcp
# Install dependencies
npm install
# Build TypeScript to build/
npm run build
# Run locally in stdio mode
npm start🤖 Companion Agent Skill (Prompt & Tool Guidance)
To prevent AI coding agents (such as Pi, Claude Code, Cursor, etc.) from suffering "mental calculation hallucinations" when dealing with arithmetic, radix conversions, bitwise logic, endianness swapping, and cryptographic hashing, this repository provides a ready-to-use companion Skill specification in skills/calculate-mcp (SKILL.md).
Installation
Copy or symlink skills/calculate-mcp into your agent's skills directory:
For Pi Agent / Universal Agent Harnesses:
# Windows (PowerShell):
Copy-Item -Recurse -Force "skills/calculate-mcp" "$HOME/.agents/skills/"# Linux / macOS:
cp -r skills/calculate-mcp ~/.agents/skills/Once installed, the agent will automatically trigger and prioritize calling calculate-mcp tools whenever precise arithmetic, radix conversions (Hex/Bin/Dec/Oct), bitwise operations (AND/OR/XOR), endianness swaps, or hash/encoding tasks are requested.
📄 License
MIT License © 2026
Available Tools
29 toolsaddA
Adds two numbers. For several operations or chained steps in one call, use batch_calc.
Inputs: firstNumber (required), secondNumber (required).
arccosA
Calculates the arccosine (in radians) of a number. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
arcsinA
Calculates the arcsine (in radians) of a number. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
arctanA
Calculates the arctangent (in radians) of a number. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
batch_calcA
Executes multiple calculation steps in one call and returns all results at once.
Steps run sequentially in array order. Each step is {"op": "", "args": {...}}, where "op" is any of: add, subtract, multiply, division, sum, modulo, floor, ceiling, round, mean, median, mode, min, max, sin, arcsin, cos, arccos, tan, arctan, radiansToDegrees, degreesToRadians, int_convert, bitwise, endian_swap, ieee754_convert, crypto_calc, data_codec.
Chaining: an argument value may be a reference to an earlier step's result: {"$step": } -> the whole result of that step {"$step": , "field": ""} -> a specific field of that step's object result (required when the result is an object, e.g. "resultHex", "decimal", "hex", "base64")
References only point to earlier steps (index < current). Returns a compact JSON array in step order, each item {step, op, status, result|error|reason}. A step is "skipped" only if a step it depends on failed; unrelated steps still run.
Inputs: steps (required).
bitwiseA
Performs bitwise operations (AND, OR, XOR, NOT, SHL, SHR, SAR, ROL, ROR) with 8/16/32/64-bit width. For several operations or chained steps in one call, use batch_calc.
Inputs: a (required), operation (required), b, bitWidth.
ceilingA
Rounds a number up to the nearest integer. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
cosA
Calculates the cosine of a number in radians. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
crypto_calcA
Computes cryptographic hashes (MD5, SHA1, SHA256), CRC checksums (CRC32, CRC16), and modular arithmetic (mod_pow, mod_inverse, gcd). For several operations or chained steps in one call, use batch_calc.
Inputs: action (required), a, b, data, +4 more.
data_codecA
Encodes and decodes data between Base64, Hex, ASCII/UTF-8 string, and URL formats. For several operations or chained steps in one call, use batch_calc.
Inputs: input (required), action (required), format, urlSafe.
degreesToRadiansA
Converts degrees to radians. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
divisionA
Divides the first number by the second. For several operations or chained steps in one call, use batch_calc.
Inputs: numerator (required), denominator (required).
endian_swapA
Swaps endianness (Big-Endian <-> Little-Endian) for hex values, numbers, or byte streams. For several operations or chained steps in one call, use batch_calc.
Inputs: value (required), widthBytes.
floorA
Rounds a number down to the nearest integer. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
ieee754_convertA
Converts and decomposes between Float/Double numbers and IEEE 754 binary/hex layout (Sign, Exponent, Mantissa). For several operations or chained steps in one call, use batch_calc.
Inputs: value (required), precision.
int_convertA
Converts integer(s) to Hex/Dec/Bin/Oct, 8/16/32/64-bit signed/unsigned, Little-Endian and ASCII. For several operations or chained steps in one call, use batch_calc.
Inputs: value, values.
maxA
Finds the maximum value from a list of numbers. For several operations or chained steps in one call, use batch_calc.
Inputs: numbers (required).
meanA
Calculates the arithmetic mean of a list of numbers. For several operations or chained steps in one call, use batch_calc.
Inputs: numbers (required).
medianA
Calculates the median of a list of numbers. For several operations or chained steps in one call, use batch_calc.
Inputs: numbers (required).
minA
Finds the minimum value from a list of numbers. For several operations or chained steps in one call, use batch_calc.
Inputs: numbers (required).
modeA
Finds the most common number in a list of numbers. For several operations or chained steps in one call, use batch_calc.
Inputs: numbers (required).
moduloA
Returns the remainder of a division. For several operations or chained steps in one call, use batch_calc.
Inputs: numerator (required), denominator (required).
multiplyA
Multiplies two numbers. For several operations or chained steps in one call, use batch_calc.
Inputs: firstNumber (required), secondNumber (required).
radiansToDegreesA
Converts radians to degrees. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
roundA
Rounds a number to the nearest integer. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
sinA
Calculates the sine of a number in radians. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
subtractA
Subtracts the second number from the first. For several operations or chained steps in one call, use batch_calc.
Inputs: minuend (required), subtrahend (required).
sumA
Adds any number of numbers together. For several operations or chained steps in one call, use batch_calc.
Inputs: numbers (required).
tanA
Calculates the tangent of a number in radians. For several operations or chained steps in one call, use batch_calc.
Inputs: number (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 29 tools
Most tools have clearly distinct purposes, but `add` and `sum` overlap heavily since both perform addition and differ only in arity. The broad utility tools (`int_convert`, `bitwise`, `crypto_calc`, `data_codec`) also have somewhat fuzzy boundaries, though their descriptions help.
Naming conventions are mixed: simple lowercase verbs (`add`, `subtract`), noun-like names (`division`, `ceiling`), camelCase (`radiansToDegrees`, `degreesToRadians`), and snake_case (`int_convert`, `endian_swap`, `crypto_calc`). This inconsistent pattern makes it harder to predict tool names.
With 29 tools, the server is in the over-expanded range, especially since `batch_calc` already exists to compose operations. Many simple operations could be grouped into broader tools, though the broad calculation domain keeps it from being an extreme mismatch.
The server covers arithmetic, statistics, trigonometry, rounding, bitwise operations, encoding, hashing, and conversions quite well. However, common basic operations such as exponentiation, square root, logarithms, and absolute value are missing, leaving notable gaps for a general-purpose calculation tool.
Maintenance
Related MCP Connectors
500+ deterministic tools for AI agents: math, conversion, validation, hashing, encoding, date/time.
JSON/YAML, regex, diff, JWT, SQL dialects — the keyless millisecond ops an agent needs mid-task.
High-precision finance & business calculations for AI agents — exact decimals, never floats.
Exact hashing, base64/hex/URL encoding, JWT decoding and UUIDs for AI agents. No auth required.
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceProvides over 500 deterministic tools for math, conversions, validation, hashing, and more, enabling AI agents to perform accurate calculations and data transformations without hallucination.1MIT- AlicenseBqualityBmaintenanceEnables AI agents to perform accurate local computations including arbitrary-precision math, date handling, unit conversion, subnet calculations, encoding, hashing, and text analysis, all without network calls or API keys.27MIT
- AlicenseAqualityCmaintenanceEnables AI agents to perform exact, reproducible mechanical computation — text diffing, hashing, JSON querying, calendar arithmetic, deadline-bounded regex extraction, CSV parsing, similarity scoring, unit and base conversion — instead of relying on probabilistic guessing. Runs dependency-free, read-only and offline over stdio, with schema validation and hard caps on every operation so no call can hang the client.15MIT
- AlicenseAqualityBmaintenanceProvides LLMs with deterministic math tools for sandboxed expression evaluation, descriptive statistics, primality testing, prime factorization, GCD/LCM, quadratic solving, and base conversion. Every operation runs real code rather than relying on the model's arithmetic, with expression parsing restricted to a whitelist of operators, constants, and functions.2120 PyPIMIT