calculator-mcp-server
Evaluate, simplify, and differentiate mathematical expressions via MCP. STDIO or Streamable HTTP.
Install / Use
claude mcp add cyanheads -- npx -y github:cyanheads/calculator-mcp-serverIf the server publishes to npm under a different name, use that package instead — check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
AI & Machine LearningSupported Platforms
Tags
Our assessment of calculator-mcp-server
calculator-mcp-server scores 78/100 on our quality scale, 794th of 933 AI & Machine Learning skills we index.
Its MCP Server is 9.7 KB long, well organised into 16 sections with 5 code examples: a thorough specification that gives an agent plenty to work with.
It has 3 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated 6 days ago, so calculator-mcp-server is actively maintained.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 87/100, with 2 cautions from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
calculator-mcp-server compared with similar skills
All 4 of these similar skills score higher than calculator-mcp-server; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| calculator-mcp-server (this skill)by cyanheads | 78 | 3 | 6d ago | MCP Server |
| claude-memby thedotmack | 100 | 110.9k | today | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 108.1k | 2d ago | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 90.0k | 8d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 78.7k | today | CLAUDE.md |
Frequently asked questions
- How do I install calculator-mcp-server?
- Run
claude mcp add cyanheads -- npx -y github:cyanheads/calculator-mcp-server. The install tabs above show the steps for each supported agent. - Which AI agents does calculator-mcp-server work with?
- It is written for Claude Code and Claude Desktop, as a MCP Server file. Other agents that read the same format can often use it too.
- Is calculator-mcp-server safe to use?
- It is Apache-2.0-licensed and scores 87/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is calculator-mcp-server still maintained?
- The repository was last updated 6 days ago, so calculator-mcp-server is actively maintained.
Skill content
View source on GitHubPublic Hosted Server: https://calculator.caseyjhand.com/mcp
</div>Overview
Calculator powered by math.js. Verify numeric results, simplify algebraic expressions, and compute symbolic derivatives through one tool.
Tools
| Tool | Description |
|:----------|:------------|
| calculate | Evaluate math expressions, simplify algebraic expressions, or compute symbolic derivatives. |
Resources
| Resource | Description |
|:------------|:------------|
| calculator://help | Available functions, operators, constants, and syntax reference. |
Capability reference
calculate <sub>tool</sub>
- One
expressionper call.operationselectsevaluate(default),simplify, orderivative; derivatives requirevariable(e.g."x"). - Evaluate arithmetic, trigonometry, logarithms, statistics, matrices, complex numbers, units, and combinatorics; assign numeric variables through
scope, e.g.{ "x": 5 }. numericTypeselectsnumber,BigNumber(64 significant digits, for values that overflow a 64-bit float), orFraction(exact rationals). Fraction mode returnsfraction_unsupported, with guidance to change numeric type, when a result has no exact rational value (sqrt(2)), the expression calls a function Fraction mode cannot compute (sqrt(4),5!), or it uses a value Fraction mode holds only as a rounded float (pi,2^(1/2)).precisionsets 1–16 significant digits for numeric results. Blank optionalvariableandprecisionvalues are treated as omitted; scope and precision do not affect symbolic operations.- Simplification includes algebraic and trigonometric identities (
2x + 3x→5 * x);unchanged: trueidentifies expressions the simplifier cannot reduce, including polynomial factoring and rational cancellation cases. - Returns the result string, result type, original expression, and operation. Validation failures include typed reasons and recovery hints.
calculator://help <sub>resource</sub>
- Markdown reference for functions, operators, constants, units, and expression syntax; no parameters.
- Examples cover scope, matrices, complex numbers, precision, and all three operations.
- Cacheable for 24 hours with public scope (
cacheHint) — static content that never changes at runtime.
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
Calculator-specific:
- Hardened math.js v15 instance — dangerous functions disabled, evaluation run under a
vmtimeout - No auth required — all operations are read-only and stateless
- Input validation: expression length limits and rejection of multiple statements; matrix row separators and string contents remain valid
- Result validation: blocked result types (functions, parsers, result sets), configurable max result size
- Size limits: functions that build a matrix or string from a size, product, broadcast, index, or precision argument are capped per call, and each evaluation has a total element budget; oversized requests fail fast with
result_too_large - Scope sanitization: numeric-only values, prototype pollution prevention (blocked
__proto__,constructor, etc.)
Agent-friendly output:
- Effective-call echo — every response echoes the expression and operation, plus which scope variables and what precision were applied, so agents can verify what was actually computed
- Discriminated output contracts —
unchanged: trueonsimplifyflags a no-op result instead of silently returning the same expression - Typed error reasons — validation and evaluation failures carry a typed
reason(e.g.fraction_unsupported,evaluation_timeout,disallowed_result_type) plus an actionable recovery hint, rather than a raw exception
Getting started
Connect to the hosted instance, no install:
claude mcp add --transport http calculator-mcp-server https://calculator.caseyjhand.com/mcp
Or run it locally:
claude mcp add calculator-mcp-server -- npx -y @cyanheads/calculator-mcp-server
For other clients, add this to the MCP config file:
{
"mcpServers": {
"calculator-mcp-server": {
"command": "npx",
"args": ["-y", "@cyanheads/calculator-mcp-server"]
}
}
}
For Docker or a source build, see Running the server.
Configuration
| Variable | Description | Default |
|:---------|:------------|:--------|
| CALC_MAX_EXPRESSION_LENGTH | Maximum allowed expression string length (10–10,000). | 1000 |
| CALC_EVALUATION_TIMEOUT_MS | Maximum evaluation time in milliseconds (100–30,000). | 5000 |
| CALC_MAX_RESULT_LENGTH | Maximum result string length in characters (1,000–1,000,000). | 100000 |
| MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
| MCP_HTTP_HOST | Hostname for the HTTP server. | 127.0.0.1 |
| MCP_HTTP_PORT | Port for HTTP server. | 3010 |
| MCP_HTTP_ENDPOINT_PATH | Path for the HTTP MCP endpoint. | /mcp |
| MCP_HTTP_MAX_BODY_BYTES | Maximum inbound HTTP request size; 0 disables the limit. | 1048576 |
| MCP_AUTH_MODE | Auth mode: none, jwt, or oauth. | none |
| MCP_SESSION_MODE | auto, stateful, or stateless. The server declares stateless in code, so every launch path resolves the same way; setting this overrides that declaration. | stateless |
| MCP_LOG_LEVEL | Log level (RFC 5424). | info |
See .env.example for optional session, resumability, logging, and telemetry settings.
Running the server
Local development
Requires Bun v1.4.0 or higher. The built server also runs on Node.js v24+.
-
Clone and install:
git clone https://github.com/cyanheads/calculator-mcp-server.git cd calculator-mcp-server && bun install cp .env.example .env -
Build and run the production version:
bun run build bun run start:http # or start:stdio -
Run checks and tests:
bun run devcheck # Lints, formats, type-checks bun run test # Runs test suite
Docker
docker run --rm -p 3010:3010 ghcr.io/cyanheads/calculator-mcp-server:latest
The image defaults to Streamable HTTP on port 3010, stateless sessions, and logs at /var/log/calculator-mcp-server. For stdio, use docker run -i --rm -e MCP_TRANSPORT_TYPE=stdio ghcr.io/cyanheads/calculator-mcp-server:latest. To build locally, run docker build -t calculator-mcp-server .; OpenTelemetry dependencies are installed by default, and --build-arg OTEL_ENABLED=false omits them.
Project structure
| Directory | Purpose |
|:----------|:--------|
| src/mcp-server/tools/ | Tool definitions (*.tool.ts). |
| src/mcp-server/resources/ | Resource definitions (*.resource.ts). |
| src/services/ | Domain service integrations (MathService). |
| src/config/ | Environment variable parsing and validation with Zod. |
| docs/ | Generated directory tree. |
| tests/ | Calculation, configuration, and response-contract tests. |
Development guide
See AGENTS.md or CLAUDE.md for development guidelines and architectural rules. The short version:
- Handlers throw, framework catches — no
try/catchin tool logic - Use
ctx.logfor logging - Register new tools and resources in
src/index.ts
Contributing
Issues are welcome. Run checks before submitting:
bun run devcheck
bun run test
License
Apache-2.0 — see LICENSE for details.
Related Skills
claude-mem
110.9kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Agent-Reach
108.1kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
Understand-Anything
90.0kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
headroom
78.7kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
