calculator-mcp-server
Click on "Deploy 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-server add 5 and 3"
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.
Calculator MCP Server
A Model Context Protocol server exposing calculator operations, built as a learning project.
Tools
add(a, b)
subtract(a, b)
multiply(a, b)
divide(a, b)
power(base, exponent)
square_root(number)
modulus(a, b)
Related MCP server: Calculator MCP
Run
uv run mcp dev src/calculator_mcp/server.pyTest
uv run pytest tests/ -vArchitecture
operations.py— pure calculator logic, no MCP dependencyserver.py— FastMCP tool registration, thin wrappers over operations.pyexceptions.py— custom exception hierarchy (CalculatorError base)tests/— pytest unit tests, independent of the MCP layer
Connect to Claude Desktop
Add this to claude_desktop_config.json:
{
"mcpServers": {
"calculator": {
"command": "uv",
"args": ["run", "--directory", "/path/to/calculator-mcp-server", "mcp", "run", "src/calculator_mcp/server.py"]
}
}
}This structure generalizes to any MCP server: keep domain logic separate from protocol code, use typed exceptions per failure mode, annotate tools honestly (readOnly/idempotent/destructive/openWorld), and test the logic layer without needing a live server.
Available Tools
7 toolsaddARead-onlyIdempotent
Add two numbers together.
Args: a: The first number. b: The second number.
Returns: The sum of a and b.
Inputs: a (required), b (required). Returns: result
divideARead-onlyIdempotent
Divide the first number by the second.
Args: a: The number to be divided (the dividend). b: The number to divide by (the divisor). Must not be zero.
Returns: The result of a divided by b.
Raises: DivisionByZeroError: If b is zero.
Inputs: a (required), b (required). Returns: result
modulusARead-onlyIdempotent
Compute the remainder when dividing a by b.
Args: a: The dividend. b: The divisor. Must not be zero.
Returns: The remainder of a divided by b.
Raises: DivisionByZeroError: If b is zero.
Inputs: a (required), b (required). Returns: result
multiplyARead-onlyIdempotent
Multiply two numbers together.
Args: a: The first number. b: The second number.
Returns: The product of a and b.
Inputs: a (required), b (required). Returns: result
powerARead-onlyIdempotent
Raise a number to a power.
Args: base: The base number. exponent: The power to raise the base to.
Returns: base raised to the power of exponent.
Raises: InvalidPowerOperationError: If the result would be complex, or if the computation overflows.
Inputs: base (required), exponent (required). Returns: result
square_rootARead-onlyIdempotent
Compute the square root of a number.
Args: number: The number to take the square root of. Must be non-negative.
Returns: The square root of number.
Raises: NegativeSquareRootError: If number is negative.
Inputs: number (required). Returns: result
subtractARead-onlyIdempotent
Subtract the second number from the first.
Args: a: The number to subtract from. b: The number to subtract.
Returns: The result of a minus 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
Scored across 7 tools
Each tool performs a distinct mathematical operation: add, subtract, multiply, divide, modulus, square_root, and power. There is no overlap or ambiguity between them, so an agent will never have to guess which tool to use for a given operation.
The names are clear and short, but not perfectly uniform: add, subtract, multiply, divide, and power are verbs, while modulus and square_root are nouns. However, this is a common and readable convention for math operations, and the intent is obvious.
With 7 tools, the server is well-scoped for a calculator. It covers basic arithmetic plus modulus, square root, and power, which is a reasonable and expected set for the purpose without unnecessary bloat.
The core arithmetic and common math operations are present, providing good coverage for a calculator server. Minor omissions like absolute value or factorial exist, but they are not essential for the primary purpose and agents can typically work around them.
Maintenance
Related MCP Connectors
Model Context Protocol server for Studex tools, notifications, and profile integrations
Model Context Protocol extension for Hebrew calendar
Safe scientific calculator MCP for numeric expressions
Model Context Protocol server for todo.vu task management and time tracking.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides basic arithmetic operations and advanced mathematical functions through the Model Context Protocol (MCP), with features like calculation history tracking and expression evaluation.1-
- AlicenseBqualityDmaintenanceProvides mathematical computation capabilities including basic arithmetic operations (add, subtract, multiply, divide), advanced functions (square root, factorial, logarithm), and trigonometric functions (sin, cos, tan) through the Model Context Protocol.5MIT
- AlicenseAqualityDmaintenanceProvides basic mathematical operations including addition, subtraction, multiplication, division, and power calculations through a Model Context Protocol interface.51MIT
- AlicenseNot gradedqualityDmaintenanceProvides basic arithmetic operations (add, multiply, divide) for AI assistants through the Model Context Protocol.ISC