calculator-mcp-server
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., "@calculator-mcp-serverwhat's the derivative of 2x^2 + 3x + 4?"
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.
@guan-tends/calculator-mcp-server
A scientific calculator MCP tool server for AI agents — safe expression evaluation, symbolic calculus (derivatives, simplification, equation solving, integration), statistics, and matrix operations, over the Model Context Protocol.
Stateless pure math. The agent is the brain; the server is the calculator.
Tools (13)
Tool | What it does | Example |
| Safe expression evaluation |
|
| Symbolic differentiation |
|
| Algebraic simplification |
|
| Equation solving |
|
| Definite integrals |
|
| Polynomial antiderivatives |
|
| Summary statistics | mean/median/mode/variance/quartiles |
| Pearson correlation |
|
| OLS linear regression | slope/intercept/r²/rmse |
| t-based CI for the mean | verified against R |
| Element-wise sum |
|
| Matrix product |
|
| Transpose | rows become columns |
Every tool description embeds worked examples — an LLM caller learns each tool from the tool itself.
Related MCP server: ReasonForge
Highlights
Sandboxed by design. Expressions are parsed to ASTs and audited before evaluation: a symbol allowlist (namespace members + your scope variables), a host-global blocklist enforced in every mode, assignment rejection, and throwing stubs on
import/evaluate/createUnit. Escape-vector tests (constructor.constructor,import("fs"),process,globalThis) are first-class and must stay green.Exact where possible. Linear/quadratic equations are solved symbolically (rationals as fractions, complex pairs as
1 + 2i); polynomial definite integrals (degree ≤ 4) are exact via antiderivatives that are self-checked (dF/dx ≡ fverified before returning).Numeric where not. Transcendental equations: deterministic scan of [-100, 100] with bisection polish. General integrals: adaptive Simpson with an error estimate.
Statistics you can trust. The t-quantile (continued-fraction incomplete beta + Lanczos log-gamma) matches R's
qt()to 15 digits — verified in the test suite against reference values.JSON-native matrices. Plain nested arrays in, plain nested arrays out. No library types leak across the wire.
All transports. stdio (default for the bin entry), HTTP, and SSE — see Configuration.
Install
npm install @guan-tends/calculator-mcp-server
# or run directly:
npx calculator-mcp-serverRequires Node.js ≥ 22.
Usage with MCP clients
stdio (Claude Desktop, most clients)
{
"mcpServers": {
"calculator": {
"command": "npx",
"args": ["-y", "@guan-tends/calculator-mcp-server"]
}
}
}HTTP / SSE
npx calculator-mcp-server # stdio (bin default)
CALC_MCP_TRANSPORT=http npx calculator-mcp-server # HTTP on 127.0.0.1:3778
CALC_MCP_TRANSPORT=sse npx calculator-mcp-server # SSELibrary use:
import { createCalculatorMcpServer } from '@guan-tends/calculator-mcp-server'
const server = createCalculatorMcpServer({ transport: 'http', port: 3778, host: '127.0.0.1' })
await server.start()Configuration
Precedence: code defaults ← JSON5 config file ← environment variables.
Setting | Default | Config key | Env var |
Transport |
|
|
|
Port |
|
|
|
Host |
|
|
|
Config file path defaults to ./config.json5 (override with
CALC_MCP_CONFIG). See config.example.json5. An explicitly chosen
transport always wins over entry defaults.
Security notes
Expressions are untrusted input. The engine evaluates them in a sandboxed mathjs namespace with an audited AST pipeline — see
src/engine/evaluate.jsfor the threat model and defense layers.Scope values must be finite numbers; nothing else crosses the boundary.
DoS bounds: expression length ≤ 2000 chars, datasets ≤ 1M values, matrix dimensions ≤ 400×400.
Bind loopback-only deployments unless you explicitly need otherwise; layer firewall rules for anything network-reachable.
Development
npm install
npm test # vitest: 169 unit + e2e tests
npm run lint # eslint
npm run format:checkLicense
This server cannot be deployed
Maintenance
Related MCP Connectors
Math.js MCP — wraps the mathjs.org API (free, no auth)
Precision math engine for AI agents. 203 exact methods. Zero hallucination.
Scientific compute for AI agents: symbolic, numerical, quantum, chemistry, ODE. Paid via x402.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseCqualityDmaintenanceA Model Context Protocol server that enables LLMs to perform precise numerical calculations by evaluating mathematical expressions.13,613 PyPI157MIT
- AlicenseNot gradedqualityDmaintenanceProvides a suite of deterministic math tools powered by SymPy to handle algebra, calculus, linear algebra, and statistics via the Model Context Protocol. It enables smaller language models to delegate complex computations to a verified symbolic backend for accurate and reliable results.Apache 2.0
- AlicenseAqualityCmaintenanceA 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.89 npm1MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server providing 150+ mathematical functions across arithmetic, trigonometry, statistics, unit conversions, and more, consolidated into 15 powerful tools for seamless integration with VS Code Copilot and other MCP-compatible clients.MIT