npm @cyanheads/calculator-mcp-serverstreamable-httpupdated 17d ago
@cyanheads/calculator-mcp-server Evaluate, simplify, and differentiate mathematical expressions via MCP. STDIO or Streamable HTTP. 1 Tool • 1 Resource
What can you do with calculator mcp server?
Public Hosted Server: https://calculator.caseyjhand.com/mcp
Tools
One tool for all mathematical operations:
| Tool Name | Description |
|---|---|
calculate |
Evaluate math expressions, simplify algebraic expressions, or compute symbolic derivatives. |
calculate
A single tool covering 100% of the server's purpose. The operation parameter defaults to evaluate, so the common case is just { expression: "..." }.
- Evaluate — arithmetic, trigonometry, logarithms, statistics, matrices, complex numbers, unit conversion, combinatorics
- Simplify — reduce algebraic expressions symbolically (e.g.,
2x + 3x->5 * x). Supports algebraic and trigonometric identities - Derivative — compute symbolic derivatives (e.g.,
3x^2 + 2x + 1->6 * x + 2) - Variable scope via
scopeparameter:{ "x": 5, "y": 3 } - Configurable precision for numeric results
- Blank optional
variableandprecisionvalues from form-based MCP clients are treated as omitted
Resources
| URI Pattern | Description |
|---|---|
calculator://help |
Available functions, operators, constants, and syntax reference. |
Features
Built on @cyanheads/mcp-ts-core:
- Declarative tool definitions — single file per tool, framework handles registration and validation
- Unified error handling across all tools
- Structured logging with optional OpenTelemetry tracing
- Runs locally (stdio/HTTP) or in Docker
Calculator-specific:
- Hardened math.js v15 instance — dangerous functions disabled, evaluation sandboxed via
vm.runInNewContext()with timeout - No auth required — all operations are read-only and stateless
- Input validation: expression length limits, expression separator rejection (semicolons and newlines), numeric-only scope values
- Result validation: blocked result types (functions, parsers, result sets), configurable max result size
- Scope sanitization: numeric-only values, prototype pollution prevention (blocked
__proto__,constructor, etc.)
Getting Started
Public Hosted Instance
A public instance is available at https://calculator.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"calculator-mcp-server": {
"type": "streamable-http",
"url": "https://calculator.caseyjhand.com/mcp"
}
}
}
Self-Hosted / Local
Add one of the following to your MCP client configuration file:
{
"mcpServers": {
"calculator-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/calculator-mcp-server@latest"]
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"calculator-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/calculator-mcp-server@latest"]
}
}
}
Or with Docker:
{
"mcpServers": {
"calculator-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/calculator-mcp-server:latest"
]
}
}
}
Prerequisites
- Bun v1.3.0 or higher
Installation
- Clone the repository:
git clone https://github.com/cyanheads/calculator-mcp-server.git
- Navigate into the directory:
cd calculator-mcp-server
- Install dependencies:
bun install
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. | localhost |
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_LOG_LEVEL |
Log level (RFC 5424). | info |
See .env.example for optional session, resumability, logging, and telemetry settings.
Running the Server
Local Development
-
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 build -t calculator-mcp-server .
docker run -p 3010:3010 calculator-mcp-server
The image defaults to Streamable HTTP on port 3010, stateless sessions, and logs at /var/log/calculator-mcp-server.
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. |
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 and pull requests are welcome. Run checks before submitting:
bun run devcheck
bun run test
License
Apache-2.0 — see LICENSE for details.
Install
Add calculator mcp server to your client. Pick the one you use.
{
"servers": {
"calculator-mcp-server": {
"type": "http",
"url": "https://calculator.caseyjhand.com/mcp"
}
}
}Add to `.vscode/mcp.json` in your workspace.
claude mcp add calculator-mcp-server -- npx -y @cyanheads/calculator-mcp-servercodex mcp add calculator-mcp-server -- npx -y @cyanheads/calculator-mcp-serveramp mcp add calculator-mcp-server -- npx -y @cyanheads/calculator-mcp-server{
"mcpServers": {
"calculator-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/calculator-mcp-server"
]
}
}
}Add to `claude_desktop_config.json`, then restart Claude Desktop.
{
"mcpServers": {
"calculator-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/calculator-mcp-server"
]
}
}
}Add to `~/.cursor/mcp.json`, or `.cursor/mcp.json` for a single project.
{
"mcpServers": {
"calculator-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/calculator-mcp-server"
]
}
}
}Add to `~/.codeium/windsurf/mcp_config.json`.
{
"mcpServers": {
"calculator-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/calculator-mcp-server"
]
}
}
}Add to `cline_mcp_settings.json` via the MCP Servers panel.
{
"mcpServers": {
"calculator-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/calculator-mcp-server"
]
}
}
}Add to `~/.gemini/settings.json`.
{
"mcpServers": {
"calculator-mcp-server": {
"type": "local",
"command": "npx",
"args": [
"-y",
"@cyanheads/calculator-mcp-server"
],
"tools": [
"*"
]
}
}
}Add to `~/.copilot/mcp-config.json`, or run `/mcp add` inside the CLI.
{
"context_servers": {
"calculator-mcp-server": {
"command": {
"path": "npx",
"args": [
"-y",
"@cyanheads/calculator-mcp-server"
]
}
}
}
}Add to your Zed `settings.json`.
npx -y @cyanheads/calculator-mcp-serverRun `goose configure`, choose **Add Extension → Command-line Extension**, and paste this command.
Score
74 / 100
Good
- Documentation25/25
- Maintenance25/25
- Trust6/20
- Capability3/15
- Install experience15/15
- Documents what it does and how to connect
- Has a resolvable package or endpoint
- Exposes at least one tool, prompt or resource
- README has substantive content
- Includes a code example
- Documents its configuration
- Mentions credentials or security posture
- Last commit 10 days ago
- Has a release history
- Repository is not archived
- No licence detected
- Namespace verified in the official MCP registry
- Claimed by its owner
- Published under an organisation
- 0 tool(s) documented
- Provides prompt templates
- Provides resources
- 18 documented install method(s)
- Published to a package registry
- Offers a hosted endpoint — no local install
Version history
| Versions | Published |
|---|---|
| 0.4.1Latest | Aug 22, 2026 |
| 0.4.0 | Jul 2, 2026 |
| 0.3.5 | Jun 20, 2026 |
| 0.3.4 | Jun 15, 2026 |
| 0.3.3 | Jun 15, 2026 |
| 0.3.2 | Jun 4, 2026 |
| 0.3.1 | Jun 2, 2026 |
| 0.3.0 | May 31, 2026 |
| 0.2.0 | May 31, 2026 |
| 0.1.26 | May 30, 2026 |
| 0.1.25 | May 29, 2026 |
| 0.1.24 | May 23, 2026 |
| 0.1.23 | May 23, 2026 |
| 0.1.22 | May 16, 2026 |
| 0.1.21 | May 5, 2026 |
| 0.1.20 | Apr 29, 2026 |
| 0.1.19 | Apr 29, 2026 |
| 0.1.18 | Apr 29, 2026 |
| 0.1.17 | Apr 28, 2026 |
| 0.1.16 | Apr 28, 2026 |
| 0.1.15 | Apr 28, 2026 |
| 0.1.14 | Apr 28, 2026 |
| 0.1.13 | Apr 27, 2026 |
| 0.1.12 | Apr 27, 2026 |
| 0.1.11 | Apr 24, 2026 |
| 0.1.10 | Apr 21, 2026 |
| 0.1.9 | Apr 15, 2026 |
| 0.1.8 | Mar 30, 2026 |
| 0.1.7 | Mar 30, 2026 |
| 0.1.6 | Mar 30, 2026 |