math-mcp-ay

v0.3.0
math-mcp-ay Checked 4 days ago Published 2 months ago

A Model Context Protocol (MCP) server exposing safe math tools.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

evaluate

Evaluate a mathematical expression and return its numeric value. Supports ``+ - * / // % **``, parentheses, the constants ``pi``, ``e``, ``tau`` and functions such as ``sqrt``, ``sin``, ``cos``, ``log``, ``exp``, ``factorial``, ``gcd``, ``hypot``. Evaluation is sandboxed: no Python ``eval`` is used and only whitelisted names are allowed. Example: ``"sqrt(2) * sin(pi / 4)"`` -> ``1.0``.

ParameterTypeDescription
expression *string

descriptive_statistics

Return summary statistics for a list of numbers. Includes count, sum, min, max, mean, median, population and sample standard deviation, and variance. Requires at least one value (sample stdev/variance require at least two and are ``null`` otherwise).

ParameterTypeDescription
numbers *array

is_prime

Return whether the integer *n* is a prime number. Uses trial division up to sqrt(n). Values below 2 are not prime.

ParameterTypeDescription
n *integer

prime_factorization

Return the prime factorization of a positive integer *n*. The result is a list of ``{"prime": p, "exponent": k}`` entries, ordered by prime. ``prime_factorization(360)`` -> 2^3 * 3^2 * 5^1.

ParameterTypeDescription
n *integer

gcd_lcm

Return the greatest common divisor and least common multiple. Accepts two or more integers, e.g. ``[12, 18, 24]``.

ParameterTypeDescription
numbers *array

solve_quadratic

Solve ``a*x^2 + b*x + c = 0`` and return its roots. Reports the discriminant and the (real or complex) roots. Requires ``a != 0``; use a linear solve otherwise.

ParameterTypeDescription
a *number
b *number
c *number

convert_base

Convert an integer *number* from one base to another. ``number`` is given as a string in ``from_base`` (2-36); the result is a string in ``to_base`` (2-36). Example: ``("ff", 16, 2)`` -> ``"11111111"``.

ParameterTypeDescription
from_base *integer
number *string
to_base *integer

matrix_multiply

Return the matrix product ``A @ B``. Columns of A must match rows of B. Matrices are lists of rows.

ParameterTypeDescription
a *array
b *array

matrix_transpose

Return the transpose of a matrix.

ParameterTypeDescription
matrix *array

matrix_determinant

Return the determinant of a square matrix.

ParameterTypeDescription
matrix *array

matrix_inverse

Return the inverse of a square, non-singular matrix.

ParameterTypeDescription
matrix *array

solve_linear_system

Solve ``A x = b`` for x, where A is square and non-singular.

ParameterTypeDescription
a *array
b *array

simplify_expression

Simplify a symbolic expression, e.g. ``sin(x)**2 + cos(x)**2`` -> ``1``.

ParameterTypeDescription
expression *string

expand_expression

Expand a symbolic expression, e.g. ``(x + 1)**2`` -> ``x**2 + 2*x + 1``.

ParameterTypeDescription
expression *string

factor_expression

Factor a symbolic expression, e.g. ``x**2 - 1`` -> ``(x - 1)*(x + 1)``.

ParameterTypeDescription
expression *string

differentiate

Differentiate *expression* w.r.t. *variable* (optionally to a higher *order*).

ParameterTypeDescription
expression *string
orderinteger
variablestring

integrate

Return the indefinite integral of *expression* w.r.t. *variable*.

ParameterTypeDescription
expression *string
variablestring

solve_symbolic_equation

Solve an equation for a variable, e.g. ``"x**2 = 4"`` -> ``["-2", "2"]``. Accepts a bare expression (assumed ``= 0``) or an explicit ``=`` equation.

ParameterTypeDescription
equation *string
variablestring

definite_integral

Definite integral of *expression* from *lower* to *upper*. Bounds are expressions, so ``oo`` / ``-oo`` / ``pi`` are accepted.

ParameterTypeDescription
expression *string
lowerstring
upperstring
variablestring

limit

Limit of *expression* as *variable* -> *point* (``oo`` allowed). *direction*: ``"+"`` (right), ``"-"`` (left) or ``"+-"`` (two-sided).

ParameterTypeDescription
expression *string
directionstring
pointstring
variablestring

taylor_series

Taylor series of *expression* about *point* up to *order* terms (O-term dropped).

ParameterTypeDescription
expression *string
orderinteger
pointstring
variablestring