math mcp

Local 2025-08-31 23:25:46 0

A Model Context Protocol server that provides basic mathematical and statistical functions to LLMs, enabling them to perform accurate numerical calculations through a simple API.


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.

Math-MCP MCP server

Features

  • Basic arithmetic operations (addition, subtraction, multiplication, division)
  • Statistical functions (sum, average, min, max)
  • Rounding functions (floor, ceiling, round)

Installation

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"]
}

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

Available Functions

The Math-MCP server provides the following mathematical operations:

Function Description Parameters
add Adds two numbers together firstNumber: The first addend
secondNumber: The second addend
subtract Subtracts the second number from the first number minuend: The number to subtract from
subtrahend: The number being subtracted
multiply Multiplies two numbers together firstFactor: The first factor
secondFactor: The second factor
division Divides the first number by the second number numerator: The number being divided
denominator: The number to divide by
sum Adds any number of numbers together numbers: Array of numbers to sum
average Calculates the arithmetic mean of a list of numbers numbers: Array of numbers to find the average of
min Finds the minimum value from a list of numbers numbers: Array of numbers to find the minimum of
max Finds the maximum value from a list of numbers numbers: Array of numbers to find the maximum of
floor Rounds a number down to the nearest integer value: The number to round down
ceiling Rounds a number up to the nearest integer value: The number to round up
round Rounds a number to the nearest integer value: The number to round
[
  {
    "description": "Adds two numbers together",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "firstNumber": {
          "description": "The first addend",
          "type": "number"
        },
        "secondNumber": {
          "description": "The second addend",
          "type": "number"
        }
      },
      "required": [
        "firstNumber",
        "secondNumber"
      ],
      "type": "object"
    },
    "name": "add"
  },
  {
    "description": "Subtracts the second number from the first number",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "minuend": {
          "description": "The number to subtract from (minuend)",
          "type": "number"
        },
        "subtrahend": {
          "description": "The number being subtracted (subtrahend)",
          "type": "number"
        }
      },
      "required": [
        "minuend",
        "subtrahend"
      ],
      "type": "object"
    },
    "name": "subtract"
  },
  {
    "description": "Multiplies two numbers together",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "firstFactor": {
          "description": "The first factor",
          "type": "number"
        },
        "secondFactor": {
          "description": "The second factor",
          "type": "number"
        }
      },
      "required": [
        "firstFactor",
        "secondFactor"
      ],
      "type": "object"
    },
    "name": "multiply"
  },
  {
    "description": "Divides the first number by the second number",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "denominator": {
          "description": "The number to divide by (denominator)",
          "type": "number"
        },
        "numerator": {
          "description": "The number being divided (numerator)",
          "type": "number"
        }
      },
      "required": [
        "numerator",
        "denominator"
      ],
      "type": "object"
    },
    "name": "division"
  },
  {
    "description": "Adds any number of numbers together",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "numbers": {
          "description": "Array of numbers to sum",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      },
      "required": [
        "numbers"
      ],
      "type": "object"
    },
    "name": "sum"
  },
  {
    "description": "Calculates the arithmetic mean of a list of numbers",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "numbers": {
          "description": "Array of numbers to find the mean of",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      },
      "required": [
        "numbers"
      ],
      "type": "object"
    },
    "name": "mean"
  },
  {
    "description": "Calculates the median of a list of numbers",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "numbers": {
          "description": "Array of numbers to find the median of",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      },
      "required": [
        "numbers"
      ],
      "type": "object"
    },
    "name": "median"
  },
  {
    "description": "Finds the most common number in a list of numbers",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "numbers": {
          "description": "Array of numbers to find the mode of",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      },
      "required": [
        "numbers"
      ],
      "type": "object"
    },
    "name": "mode"
  },
  {
    "description": "Finds the minimum value from a list of numbers",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "numbers": {
          "description": "Array of numbers to find the minimum of",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      },
      "required": [
        "numbers"
      ],
      "type": "object"
    },
    "name": "min"
  },
  {
    "description": "Finds the maximum value from a list of numbers",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "numbers": {
          "description": "Array of numbers to find the maximum of",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      },
      "required": [
        "numbers"
      ],
      "type": "object"
    },
    "name": "max"
  },
  {
    "description": "Rounds a number down to the nearest integer",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "value": {
          "description": "The number to round down",
          "type": "number"
        }
      },
      "required": [
        "value"
      ],
      "type": "object"
    },
    "name": "floor"
  },
  {
    "description": "Rounds a number up to the nearest integer",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "value": {
          "description": "The number to round up",
          "type": "number"
        }
      },
      "required": [
        "value"
      ],
      "type": "object"
    },
    "name": "ceiling"
  },
  {
    "description": "Rounds a number to the nearest integer",
    "inputSchema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "additionalProperties": false,
      "properties": {
        "value": {
          "description": "The number to round",
          "type": "number"
        }
      },
      "required": [
        "value"
      ],
      "type": "object"
    },
    "name": "round"
  }
]