Skip to main content
Glama
MathJS Calculator MCP Server

MathJS Calculator MCP Server

by edwardpwtsoi

MathJS Calculator MCP Server

An MCP server implementation that provides mathematical calculation capabilities using the MathJS library.

Features

  • Evaluate mathematical expressions

  • Calculate derivatives of expressions

  • Handle complex mathematical operations

  • Provide clear error messages for invalid inputs

Related MCP server: Calculator MCP Server

Tools

calculate

Evaluates mathematical expressions and returns the result.

Inputs:

  • expression (string): The mathematical expression to evaluate

derivative

Calculates the derivative of a mathematical expression with respect to a variable.

Inputs:

  • expression (string): The mathematical expression to differentiate

  • variable (string): The variable to differentiate with respect to

Usage

The MathJS Calculator tool is designed for:

  • Evaluating mathematical expressions

  • Computing derivatives

  • Handling complex calculations

  • Providing clear feedback for calculation errors

Configuration

Usage with Claude Desktop

Add this to your claude_desktop_config.json:

npx

{
  "mcpServers": {
    "mathjs-calculator": {
      "command": "npx",
      "args": [
        "-y",
        "mathjs-mcp-server"
      ]
    }
  }
}

Building and Testing

Build

To build the project:

npm install
npm run build

Testing with Inspector

To test the server with the MCP Inspector:

  1. Open the MCP Inspector in another terminal:

npm run inspector
  1. Connect to the server at http://localhost:5173 (default port)

  2. Test the available tools:

    • Use the "calculate" tool to evaluate expressions

    • Use the "derivative" tool to compute derivatives

Example Usage

// Calculate expression
{
  "expression": "2 * (3 + 4)"
}
// Result: 14

// Calculate derivative
{
  "expression": "x^2 + 2*x",
  "variable": "x"
}
// Result: The derivative of x^2 + 2*x with respect to x is: 2*x + 2

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

Available Tools

2 tools
calculateC

Evaluate a mathematical expression

Inputs: expression (required).

derivativeB

Calculate the derivative of an expression with respect to a variable

Inputs: variable (required), expression (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools, calculate and derivative, have completely distinct purposes: evaluating an expression versus differentiating it. There is no overlap or ambiguity between them.

    Naming Consistency4/5

    Both tool names are single words, but 'calculate' is a verb while 'derivative' is a noun. A more consistent pattern might use 'differentiate' instead of 'derivative,' but the naming is still clear and predictable.

    Tool Count3/5

    With only 2 tools, the server is very minimal. For a simple calculator this could be acceptable, but it feels thin compared to the typical 3-15 tool range, leaving the server on the borderline.

    Completeness2/5

    The server covers evaluation and differentiation but misses other common mathematical operations like simplification, solving equations, integration, or expansion. This is a significant gap for a calculator-oriented server.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables LLMs to perform accurate mathematical calculations by evaluating expressions using mathjs. Supports basic arithmetic, functions, constants, and complex mathematical operations through natural language requests.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides mathematical operation tools including basic arithmetic (add, subtract, multiply, divide), power and square root calculations, and safe evaluation of mathematical expressions.
      -
    • A
      license
      B
      quality
      B
      maintenance
      Provides secure mathematical computation capabilities including expression evaluation, symbolic math (derivatives, simplification), matrix operations, statistics, and unit conversion, with multi-tier acceleration through WebAssembly and WebWorkers for high-performance calculations.
      7
      33 npm
      ISC