basic-math-calculator-mcp-server

rohitpatilll/basic-math-calculator-mcp-server

3.1

If you are the rightful owner of basic-math-calculator-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A comprehensive MCP server for performing basic mathematical calculations easily.

Tools
4
Resources
0
Prompts
0

Basic Math Calculator MCP Server

A comprehensive MCP server for performing basic mathematical calculations easily. Provides essential math operations from simple arithmetic to expression evaluation, making complex calculations accessible through Claude.

Features

  • Basic arithmetic operations (addition, subtraction, multiplication, division)
  • Advanced mathematical functions (powers, square roots, percentage calculations, absolute values)
  • List operations for multiple numbers (sum, average, minimum, maximum, count)
  • Safe mathematical expression evaluation with proper operator precedence
  • Comprehensive input validation and error handling
  • Professional-grade calculation tools for everyday math needs

Tools Available

basic_arithmetic

Performs fundamental arithmetic operations between two numbers. Perfect for simple calculations like adding expenses, calculating differences, or basic multiplication and division tasks.

advanced_math

Handles more sophisticated single-number operations including exponentiation, square roots, percentage calculations, and absolute values. Ideal for scientific calculations and financial computations.

list_operations

Analyzes arrays of numbers to find statistical information like sums, averages, minimums, maximums, and counts. Great for analyzing datasets, calculating totals, or finding trends in numerical data.

evaluate_expression

Safely evaluates complex mathematical expressions with multiple operations and proper precedence. Supports parentheses for grouping and handles decimal numbers. Perfect for compound calculations that would otherwise require multiple steps.

Installation

npm install

Usage

With MCP Inspector (Testing)

npm run inspector

With Claude Desktop

Add to your MCP config file:

{
  "mcpServers": {
    "basic-math-calculator": {
      "command": "node",
      "args": ["[absolute-path]/server.js"]
    }
  }
}

Requirements

  • Node.js 18.0.0 or higher
  • No external dependencies beyond MCP SDK

Structure

  • server.js - Main MCP server implementation with all mathematical tools
  • package.json - Dependencies and configuration
  • README.md - This documentation
  • description.md - Brief server description

Testing

The server has been tested with:

  • All basic arithmetic operations with various number combinations
  • Advanced math functions including edge cases (square root of negative numbers, division by zero)
  • List operations with different array sizes and number types
  • Expression evaluation with complex nested operations and parentheses
  • Comprehensive input validation and error handling scenarios

Example Usage

Basic Arithmetic:

{
  "operation": "multiply",
  "a": 25,
  "b": 4
}

Advanced Math:

{
  "operation": "percentage",
  "percentage": 15,
  "of_number": 200
}

List Operations:

{
  "operation": "average",
  "numbers": [85, 92, 78, 96, 88]
}

Expression Evaluation:

{
  "expression": "(15 + 25) * 2 / 4"
}

Generated by MCP Server Generator