calculator-mcp-server
Click on "Install 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-serversimplify 2x + 3x"
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.
Public Hosted Server: https://calculator.caseyjhand.com/mcp
Tools
One tool for all mathematical operations:
Tool Name | Description |
| 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 identitiesDerivative — 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
Related MCP server: Math MCP Server
Resources
URI Pattern | Description |
| 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 timeoutNo 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:
{
"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):
{
"mcpServers": {
"calculator-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@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.gitNavigate into the directory:
cd calculator-mcp-serverInstall dependencies:
bun installConfiguration
Variable | Description | Default |
| Maximum allowed expression string length (10–10,000). |
|
| Maximum evaluation time in milliseconds (100–30,000). |
|
| Maximum result string length in characters (1,000–1,000,000). |
|
| Transport: |
|
| Port for HTTP server. |
|
| Auth mode: |
|
| Log level (RFC 5424). |
|
Running the Server
Local Development
Build and run the production version:
bun run build bun run start:http # or start:stdioRun 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-serverProject Structure
Directory | Purpose |
| Tool definitions ( |
| Resource definitions ( |
| Domain service integrations (MathService). |
| Environment variable parsing and validation with Zod. |
| 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 logicUse
ctx.logfor loggingRegister new tools and resources in
src/index.ts
Contributing
Issues and pull requests are welcome. Run checks before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
This server cannot be installed
Maintenance
Related MCP Servers
- AlicenseAqualityCmaintenanceA mathematical computation service that enables users to perform symbolic calculations including basic arithmetic, algebra, calculus, equation solving, and matrix operations through the MCP protocol.Last updated16MIT
- AlicenseBqualityAmaintenanceProvides secure mathematical computation capabilities including expression evaluation, symbolic math (derivatives, simplification), matrix operations, statistics, and unit conversion, with multi-tier acceleration through WebAssembly and WebWorkers for high-performance calculations.Last updated751ISC
- AlicenseAqualityBmaintenanceA symbolic mathematics MCP server supporting calculus, linear algebra, number theory, statistics, and unit conversion via natural language.Last updated8MIT
- Alicense-qualityCmaintenanceA secure MCP server for evaluating mathematical expressions with grammar validation, function whitelisting, and sandboxed execution. It provides tools for expression evaluation, variable management, and resources for grammar and function documentation.Last updated52MIT
Related MCP Connectors
Newton MCP — wraps the Newton math solver API (free, no auth)
Find and call the right MCP server for any task - pay per use, no install.
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyanheads/calculator-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server