Math-MCP

May 30, 2026 ยท View on GitHub

A Model Context Protocol (MCP) server that provides basic mathematical, statistical and trigonometric functions to Large Language Models (LLMs). This server enables LLMs to perform accurate numerical calculations through a simple API.

Math-MCP MCP server

Features

  • Basic arithmetic operations (addition, subtraction, multiplication, division, sum, modulo)
  • Statistical functions (mean, median, mode, min, max)
  • Rounding functions (floor, ceiling, round)
  • Trigonometric functions (sin, cos, tan, and their inverses; degrees/radians conversions)

Installation

Note: Ensure you have Node.js installed on your computer.

Just clone this repository and save it locally somewhere on your computer.

Then add this server to your MCP configuration file:

"math": {
  "command": "node",
  "args": ["PATH\\TO\\PROJECT\\math-mcp\\build\\index.js"]
}

Here is an example for OpenCode

{
  "mcp": {
    "math-mcp": {
      "type": "local",
      "command": [
        "node",
        "PATH\\TO\\PROJECT\\math-mcp\\build\\index.js"
      ]
    }
  }
}

Replace PATH\\TO\\PROJECT with the actual path to where you cloned the repository.

Note: This project comes prebuilt, so installation is easy but if you change anything in the code, rebuild the project with npm run build.

Available Functions

The Math-MCP server provides the following mathematical operations:

Arithmetic Operations

FunctionDescriptionParameters
addAdds two numbers togetherfirstNumber: The first addend
secondNumber: The second addend
subtractSubtracts the second number from the first numberminuend: The number to subtract from (minuend)
subtrahend: The number being subtracted (subtrahend)
multiplyMultiplies two numbers togetherfirstNumber: The first number
secondNumber: The second number
divisionDivides the first number by the second numbernumerator: The number being divided (numerator)
denominator: The number to divide by (denominator)
sumAdds any number of numbers togethernumbers: Array of numbers to sum
moduloDivides two numbers and returns the remaindernumerator: The number being divided (numerator)
denominator: The number to divide by (denominator)
floorRounds a number down to the nearest integernumber: The number to round down
ceilingRounds a number up to the nearest integernumber: The number to round up
roundRounds a number to the nearest integernumber: The number to round

Statistical Operations

FunctionDescriptionParameters
meanCalculates the arithmetic mean of a list of numbersnumbers: Array of numbers to find the mean of
medianCalculates the median of a list of numbersnumbers: Array of numbers to find the median of
modeFinds the most common number in a list of numbersnumbers: Array of numbers to find the mode of
minFinds the minimum value from a list of numbersnumbers: Array of numbers to find the minimum of
maxFinds the maximum value from a list of numbersnumbers: Array of numbers to find the maximum of

Trigonometric Operations

FunctionDescriptionParameters
sinCalculates the sine of a number in radiansnumber: The number in radians to find the sine of
arcsinCalculates the arcsine (in radians) of a numbernumber: The number to find the arcsine of
cosCalculates the cosine of a number in radiansnumber: The number in radians to find the cosine of
arccosCalculates the arccosine (in radians) of a numbernumber: The number to find the arccosine of
tanCalculates the tangent of a number in radiansnumber: The number in radians to find the tangent of
arctanCalculates the arctangent (in radians) of a numbernumber: The number to find the arctangent of
radiansToDegreesConverts a radian value to its equivalent in degreesnumber: The number in radians to convert to degrees
degreesToRadiansConverts a degree value to its equivalent in radiansnumber: The number in degrees to convert to radians