Skip to main content
Glama
Calculator MCP Server

Calculator MCP Server

by JamaalDavis

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.

Related MCP server: calculator-mcp-server

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

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.

Available Tools

7 tools
addA

Add two numbers together.

Args: a: The first number. b: The second number.

Returns: A string with the sum of a and b.

Inputs: a (required), b (required). Returns: result

divideA

Divide the first number by the second.

Args: a: The numerator. b: The denominator. Must not be zero.

Returns: A string with the result of a / b, or an error message if b is zero.

Inputs: a (required), b (required). Returns: result

multiplyA

Multiply two numbers together.

Args: a: The first number. b: The second number.

Returns: A string with the product of a and b.

Inputs: a (required), b (required). Returns: result

percentageA

Compute what percentage 'part' is of 'whole'.

Args: part: The partial amount. whole: The total amount. Must not be zero.

Returns: A string with the percentage part is of whole, or an error message if whole is zero.

Inputs: part (required), whole (required). Returns: result

powerA

Raise a number to a power.

Args: base: The base number. exponent: The exponent to raise the base to.

Returns: A string with the result of base ** exponent, or an error message if the operation is undefined (e.g. a negative base with a fractional exponent).

Inputs: base (required), exponent (required). Returns: result

square_rootA

Compute the square root of a number.

Args: value: The number to take the square root of. Must be non-negative.

Returns: A string with the square root of value, or an error message if value is negative.

Inputs: value (required). Returns: result

subtractA

Subtract the second number from the first.

Args: a: The number to subtract from. b: The number to subtract.

Returns: A string with the result of a - b.

Inputs: a (required), b (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    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

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides comprehensive mathematical capabilities including basic arithmetic, advanced functions, statistical tools, and access to mathematical constants. It allows users to perform computations and generate math-related prompts through a standardized MCP interface.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides a comprehensive set of mathematical functions as MCP tools, enabling language models to perform calculations including arithmetic, trigonometry, logarithms, and more.
      10 npm
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables advanced mathematics operations including linear algebra, vector math, symbolic computation, and calculus through MCP tools. Designed for use with Claude and other MCP-compatible LLMs.
      19
      2
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to perform arithmetic operations such as addition, subtraction, multiplication, and division through standardized MCP tools.
      1
      -