Calculator

Provides a unified mathematical calculator with automatic expression detection and dual Markdown/JSON outputs.
  • python

0

GitHub Stars

python

Language

6 months ago

First Indexed

3 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "tengmmvp-calculator_mcp": {
      "command": "python",
      "args": [
        "<PROJECT_PATH>/calculator_mcp/server.py"
      ],
      "env": {
        "PYTHONPATH": "<PROJECT_PATH>"
      }
    }
  }
}

You will run a unified mathematical calculator server that follows the Model Context Protocol (MCP). It automatically detects the type of mathematical expression and returns results in both human-friendly Markdown and machine-readable JSON, making it easy to embed advanced calculations into your workflows and Claude-powered environments.

How to use

You interact with the server through an MCP client that invokes the single calculate tool. You can perform basic arithmetic, call built-in functions, compute statistics, solve linear equations, or run batch calculations. The tool automatically detects the expression type and returns a structured result in your chosen format. Typical usage patterns include evaluating expressions like 2 + 3 * 4, solving 2x + 3 = 7, computing means with mean([1,2,3,4,5]), and running multiple expressions in one go separated by semicolons.

How to install

Prerequisites: you need Python installed on your system. Optional tooling like UVX can simplify installation and updates.

  1. Clone the project repository.

  2. Install Python dependencies.

  3. Prepare the server for running in your environment.

  4. Run the server in development mode for debugging.

Configuration and run instructions

{
  "mcpServers": {
    "calculator_mcp": {
      "command": "python",
      "args": ["<PROJECT_PATH>/calculator_mcp/server.py"],
      "env": {
        "PYTHONPATH": "<PROJECT_PATH>"
      },
      "description": "Unified mathematical calculator with expression auto-detection"
    }
  }
}

Security and reliability notes

The server uses AST parsing to validate inputs and prevent code injection. It performs strict input validation and includes safeguards such as zero-division protection. If an expression cannot be evaluated, it returns a clear error message without exposing internal details.

Examples and tips

Use this server to handle a wide range of calculations, from simple arithmetic to statistical analysis and equation solving. For batch tasks, you can combine expressions using semicolons, for example: mean([1,2,3,4,5]); stdev([1,2,3,4,5]); max([7,2,9]).

Troubleshooting

If the server fails to start, verify that Python is installed and that the path to server.py is correct. Check that the environment variable PYTHONPATH points to the project root if your import paths rely on it. Review any error messages for clues about missing dependencies or syntax issues in expressions.

Available tools

calculate

A unified calculation tool that auto-detects expression type and performs basic arithmetic, functions, statistics, equation solving, and batch calculations, returning results in Markdown or JSON.

mean

Compute the mean (average) of a list of numbers.

stdev

Compute the standard deviation of a list of numbers.

median

Compute the median of a list of numbers.

max

Return the maximum value from a list.

min

Return the minimum value from a list.

sum

Compute the sum of values in a list.

len

Return the length of a list or string.

sin

Sine of an angle (in radians) or expression.

cos

Cosine of an angle (in radians) or expression.

tan

Tangent of an angle (in radians) or expression.

log

Natural logarithm of a value.

log10

Base-10 logarithm of a value.

sqrt

Square root of a value.

abs

Absolute value of a number.

round

Round a number to the nearest integer or specified decimals.

pow

Raise a number to a power.

solve_linear

Solve a simple linear equation of the form ax + b = c.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational