home / mcp / math mcp server

Math MCP Server

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

Installation
Add the following to your MCP client configuration file.

Configuration

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

Math-MCP is a server that provides basic mathematical, statistical, and trigonometric functions to help you perform accurate numerical calculations within language model workflows. It exposes a simple API through MCP, enabling your models to compute arithmetic, statistics, and trigonometry on demand.

How to use

To use Math-MCP with your MCP client, add it as a server you can connect to via the MCP protocol. You will be able to call arithmetic operations like addition and division, statistical functions such as mean and max, and trigonometric operations including sin and arctan. Each function accepts the specific parameters described in its section and returns the computed result. You can combine multiple function calls within a single session to perform complex calculations needed by your prompts.

Typical usage patterns include performing a sequence of computations to derive a result that depends on intermediate values, such as calculating a mean from a list, then using that mean in a subsequent calculation, or converting between radians and degrees before applying a trigonometric function. The server supports a wide range of operations so you can offload numerical work from your prompt logic to the MCP server.

How to install

Prerequisites: ensure you have Node.js installed on your system. You will also need npm (the Node package manager) to install dependencies if applicable.

1) Clone the project to your local machine.

2) Save the repository on your computer in a preferred location.

3) Add the Math-MCP server to your MCP configuration using the following snippet. Replace PATH\TO\PROJECT with the actual path to where you cloned the repository.

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

Additional notes

If your setup requires building the project before running the server, follow your usual workflow to build the project and then start the MCP server using the command shown in the configuration snippet above. Ensure the path to the built index.js file is correct for your environment.

Available functions and usage notes

The Math-MCP server provides arithmetic, statistical, and trigonometric operations. Use these functions by specifying the function name and the required parameters in your MCP requests.

Available tools

add

Adds two numbers together. Parameters: firstNumber and secondNumber.

subtract

Subtracts the second number from the first. Parameters: minuend and subtrahend.

multiply

Multiplies two numbers. Parameters: firstNumber and SecondNumber.

division

Divides the first number by the second. Parameters: numerator and denominator.

sum

Adds any number of numbers. Parameters: numbers (array of numbers).

modulo

Calculates the remainder after division. Parameters: numerator and denominator.

floor

Rounds a number down to the nearest integer. Parameters: number.

ceiling

Rounds a number up to the nearest integer. Parameters: number.

round

Rounds a number to the nearest integer. Parameters: number.

mean

Calculates the arithmetic mean of a list of numbers. Parameters: numbers (array).

median

Calculates the median of a list of numbers. Parameters: numbers (array).

mode

Finds the most common value in a list of numbers. Parameters: numbers (array).

min

Finds the minimum value in a list of numbers. Parameters: numbers (array).

max

Finds the maximum value in a list of numbers. Parameters: numbers (array).

sin

Calculates the sine of a number in radians. Parameters: number.

arcsin

Calculates the arcsine of a number in radians. Parameters: number.

cos

Calculates the cosine of a number in radians. Parameters: number.

arccos

Calculates the arccosine of a number in radians. Parameters: number.

tan

Calculates the tangent of a number in radians. Parameters: number.

arctan

Calculates the arctangent of a number in radians. Parameters: number.

radiansToDegrees

Converts a radian value to degrees. Parameters: number.

degreesToRadians

Converts a degree value to radians. Parameters: number.