Get the FREE Ultimate OpenClaw Setup Guide →

math

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
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ethanhenrickson-math-mcp node PATH\\TO\\PROJECT\\math-mcp\\build\\index.js

How to use

The Math-MCP server provides a collection of basic arithmetic, statistical, and trigonometric functions that can be invoked by an LLM through the MCP interface. It exposes operations such as add, subtract, multiply, division, and sums, as well as statistical tools like mean, median, mode, min, and max, along with rounding and trigonometric functions (sin, cos, tan, arcsin, arccos, arctan) and unit conversions between radians and degrees. LLMs can call these endpoints to perform precise numerical calculations or data analysis as part of generated responses. The server is designed to accept structured function calls with named parameters, returning numeric results that can be used directly in follow-up reasoning or generated outputs.

How to install

Prerequisites:

  • Node.js (LTS version) installed on your system
  • Access to the repository containing the Math-MCP server

Installation steps:

  1. Install Node.js from https://nodejs.org/ if you don’t have it already.

  2. Clone the Math-MCP repository and navigate to the project directory:

    git clone <repository-url>\n cd math-mcp

  3. Build or prepare the server as described by the project, ensuring you have a built index.js at build/index.js. If a build step is required, run the project’s build script (for example, npm ci && npm run build) if provided by the repo.

  4. Update your MCP configuration file to include the new server:

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

  5. Start the server using your normal MCP startup workflow. If you run the server directly, you can test with:

    node PATH\TO\PROJECT\math-mcp\build\index.js

Note: Replace PATH\TO\PROJECT with the actual file path to where you cloned the repository and where the built index.js resides.

Additional notes

Tips and considerations:

  • Ensure the build/index.js path in the mcp_config matches where the server is built on your machine.
  • If the server relies on environment variables (for example, API keys or configuration flags), add them under an env section in the MCP config or set them in your runtime environment.
  • When integrating with an LLM, consider providing explicit error handling for numeric edge cases (division by zero, invalid inputs) and return clear error messages.
  • If you update the code, re-build and verify that the index.js path in the MCP config remains correct.
  • Test a few sample calls (e.g., add(1,2), mean([1,2,3]), sin(0.5)) to confirm correct behavior and output formats.

Related MCP Servers

Sponsor this space

Reach thousands of developers