Skip to main content
ClaudeWave
cyanheads avatar
cyanheads

calculator-mcp-server

View on GitHub

A calculator MCP server that lets any LLM verify mathematical computations. Evaluate, simplify, and differentiate expressions via a single tool. Powered by math.js v15.

MCP ServersOfficial Registry1 stars0 forksTypeScriptApache-2.0Updated 2d ago
ClaudeWave Trust Score
87/100
Trusted
Passed
  • Open-source license (Apache-2.0)
  • Actively maintained (<30d)
  • Clear description
  • Topics declared
Last scanned: 6/11/2026
Install in Claude Code / Claude Desktop
Method: Manual
Claude Code CLI
git clone https://github.com/cyanheads/calculator-mcp-server
claude_desktop_config.json (Claude Desktop)
{
  "mcpServers": {
    "calculator": {
      "command": "node",
      "args": ["/path/to/calculator-mcp-server/dist/index.js"]
    }
  }
}
1. Run the command above in your terminal (Claude Code), or paste the JSON config into claude_desktop_config.json (Claude Desktop).
2. Replace any <placeholder> values with your API keys or paths.
3. Restart Claude. The MCP server and its tools appear automatically.
💡 Clone https://github.com/cyanheads/calculator-mcp-server and follow its README for install instructions.
Use cases

MCP Servers overview

<div align="center">
  <h1>@cyanheads/calculator-mcp-server</h1>
  <p><b>Evaluate, simplify, and differentiate mathematical expressions via MCP. STDIO or Streamable HTTP.</b>
  <div>1 Tool • 1 Resource</div>
  </p>
</div>

<div align="center">

[![Version](https://img.shields.io/badge/Version-0.3.4-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/calculator-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-%5E1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/calculator-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/calculator-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-%5E6.0.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.0-blueviolet.svg?style=flat-square)](https://bun.sh/)

</div>

<div align="center">

[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/calculator-mcp-server/releases/latest/download/calculator-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=calculator-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvY2FsY3VsYXRvci1tY3Atc2VydmVyIl19) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22calculator-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fcalculator-mcp-server%22%5D%7D)

[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)

</div>

<div align="center">

**Public Hosted Server:** [https://calculator.caseyjhand.com/mcp](https://calculator.caseyjhand.com/mcp)

</div>

---

## 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 `scope` parameter: `{ "x": 5, "y": 3 }`
- Configurable precision for numeric results
- Blank optional `variable` and `precision` values 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`](https://github.com/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), variable name regex enforcement
- 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:

```json
{
  "mcpServers": {
    "calculator-mcp-server": {
      "type": "streamable-http",
      "url": "https://calculator.caseyjhand.com/mcp"
    }
  }
}
```

### Self-Hosted / Local

Add to your MCP client config (e.g., `claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "calculator-mcp-server": {
      "type": "stdio",
      "command": "bunx",
      "args": ["@cyanheads/calculator-mcp-server@latest"]
    }
  }
}
```

### Prerequisites

- [Bun v1.3.0](https://bun.sh/) or higher

### Installation

1. **Clone the repository:**
```sh
git clone https://github.com/cyanheads/calculator-mcp-server.git
```

2. **Navigate into the directory:**
```sh
cd calculator-mcp-server
```

3. **Install dependencies:**
```sh
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_PORT` | Port for HTTP server. | `3010` |
| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |
| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |

---

## Running the Server

### Local Development

- **Build and run the production version:**
  ```sh
  bun run build
  bun run start:http   # or start:stdio
  ```

- **Run checks and tests:**
  ```sh
  bun run devcheck     # Lints, formats, type-checks
  bun run test         # Runs test suite
  ```

### Docker

```sh
docker build -t calculator-mcp-server .
docker run -p 3010:3010 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`](./AGENTS.md) or [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:

- Handlers throw, framework catches — no `try/catch` in tool logic
- Use `ctx.log` for logging
- Register new tools and resources in `src/index.ts`

---

## Contributing

Issues and pull requests are welcome. Run checks before submitting:

```sh
bun run devcheck
bun run test
```

---

## License

Apache-2.0 — see [LICENSE](LICENSE) for details.
calculatorcyanheadsllm-toolsmathmathjsmcpmcp-servermodel-context-protocoltypescript

What people ask about calculator-mcp-server

What is cyanheads/calculator-mcp-server?

+

cyanheads/calculator-mcp-server is mcp servers for the Claude AI ecosystem. A calculator MCP server that lets any LLM verify mathematical computations. Evaluate, simplify, and differentiate expressions via a single tool. Powered by math.js v15. It has 1 GitHub stars and was last updated 2d ago.

How do I install calculator-mcp-server?

+

You can install calculator-mcp-server by cloning the repository (https://github.com/cyanheads/calculator-mcp-server) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.

Is cyanheads/calculator-mcp-server safe to use?

+

Our security agent has analyzed cyanheads/calculator-mcp-server and assigned a Trust Score of 87/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.

Who maintains cyanheads/calculator-mcp-server?

+

cyanheads/calculator-mcp-server is maintained by cyanheads. The last recorded GitHub activity is from 2d ago, with 0 open issues.

Are there alternatives to calculator-mcp-server?

+

Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.

Deploy calculator-mcp-server to your cloud

Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.

Maintain this repo? Add a badge to your README

Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.

Featured on ClaudeWave: cyanheads/calculator-mcp-server
[![Featured on ClaudeWave](https://claudewave.com/api/badge/cyanheads-calculator-mcp-server)](https://claudewave.com/repo/cyanheads-calculator-mcp-server)
<a href="https://claudewave.com/repo/cyanheads-calculator-mcp-server"><img src="https://claudewave.com/api/badge/cyanheads-calculator-mcp-server" alt="Featured on ClaudeWave: cyanheads/calculator-mcp-server" width="320" height="64" /></a>

More MCP Servers

calculator-mcp-server alternatives