Skip to main content
Glama
JamaalDavis

Calculator MCP Server

by JamaalDavis
README.md
# Calculator MCP Server

A Model Context Protocol (MCP) server built with `FastMCP` that exposes a
calculator as a set of tools, resources, and prompts for use by an LLM
client.

## Tools

- **Basic:** `add`, `subtract`, `multiply`, `divide`
- **Advanced:** `power`, `square_root`, `percentage`

Each tool validates its inputs (division by zero, negative square roots,
undefined powers, zero-denominator percentages) and returns a formatted
string, and logs every successful calculation to an in-memory history.

## Resources

- `constants://math` — pi, e, the golden ratio, and tau
- `history://calculations` — a chronological log of every calculation made
  during the current session

## Prompts

- `solve_equation(problem)` — walks a word problem step by step, directing
  the model to use the calculator tools for arithmetic
- `calculation_help(topic)` — explains which tools/resources are relevant to
  a topic, with a worked example

## Running it

```bash
uv sync
uv run python calculator_server.py
```

Point an MCP client (e.g. Claude Desktop, or an MCP inspector) at that
command over stdio.

TDQS

A4.4/5.0

Scored across 7 tools

Disambiguation5/5

Each tool performs a unique arithmetic operation with no overlap or ambiguity. The names and descriptions clearly distinguish addition, subtraction, multiplication, division, exponentiation, square root, and percentage.

Naming Consistency5/5

All tool names follow a consistent lowercase_with_underscores pattern (e.g., add, square_root, percentage). The naming is uniform and predictable across the set.

Tool Count5/5

With 7 tools, the set covers the core arithmetic operations needed for a calculator server. The count is well within the typical 3-15 range and feels neither sparse nor bloated.

Completeness4/5

The tool set covers the essential operations (add, subtract, multiply, divide, power, square root, percentage). A modulo operation could be expected but its absence does not create a significant gap for standard calculator use.

Maintenance

ActivityMaintained
ResponsivenessNo issues