Math MCP Server
Provides mathematical tools for symbolic algebra, calculus, numerical methods, linear algebra, statistics, discrete math, graph theory, rendering, and optional GPU acceleration, accessible from GitHub Copilot via MCP.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Math MCP Server solve x^2 - 5x + 6 = 0"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Math MCP Server
Math MCP Server is a Python 3.12 Model Context Protocol server that exposes a broad mathematics toolkit over stdio. It combines symbolic algebra, calculus, numerical methods, linear algebra, statistics, discrete mathematics, graph theory, rendering, and optional GPU acceleration behind MCP tools that are usable from Claude Desktop, GitHub Copilot, and other MCP-compatible hosts.
The server is designed to run on CPU-only systems by default. If CUDA and CuPy are available, the GPU tool family accelerates supported workloads automatically and otherwise falls back to CPU implementations when possible.
Installation
Editable install with uv:
uv pip install -e .For GPU acceleration (requires CUDA 12.x and a compatible NVIDIA GPU):
uv pip install -e ".[gpu]"Editable install with uv and optional GPU support:
uv pip install -e ".[gpu]"Editable install with pip:
pip install -e .Use the base install for CPU-only systems. Install the gpu extra only on machines with a compatible CUDA 12.x environment.
For development dependencies and tests:
.venv/bin/uv sync --extra devRelated MCP server: advanced-math-mcp
Running The Server
Run directly with Python:
python -m math_mcp.serverRun through uv:
uv run python -m math_mcp.serverRun via the console script:
math-mcp-serverThe server communicates over stdio, which is the expected transport for most MCP hosts.
MCP Host Configuration
Most MCP clients accept a JSON config that declares a named server, the command to run, and its arguments. A generic config looks like this:
{
"mcpServers": {
"math": {
"command": "/absolute/path/to/.venv/bin/python",
"args": ["-m", "math_mcp.server"],
"cwd": "/absolute/path/to/math-mcp-server"
}
}
}If the package is already installed in the active environment, you can use the console script instead:
{
"mcpServers": {
"math": {
"command": "math-mcp-server"
}
}
}Claude Desktop
Add the math server entry to your Claude Desktop MCP configuration file and point it at either the environment Python executable or the installed math-mcp-server script.
GitHub Copilot
Use the same mcpServers structure in your MCP-enabled Copilot or VS Code host configuration. The server name can remain math so it matches the packaged MCP entry point.
Other MCP Hosts
Any host that supports stdio MCP servers can run this project with the same command and args shown above.
Tool Catalog
Symbolic Tools
Tool | Description |
| Simplify algebraic, trigonometric, and rational expressions. |
| Expand products, powers, and composite symbolic expressions. |
| Factor polynomials and integers into structured symbolic factors. |
| Solve equations, systems, and inequalities over configurable domains. |
| Compute indefinite and definite symbolic integrals. |
| Differentiate expressions, including higher-order derivatives. |
| Evaluate one-sided and two-sided limits. |
| Produce Taylor or Laurent-like series expansions. |
| Evaluate finite and infinite symbolic summations. |
| Evaluate finite and infinite symbolic products. |
| Solve ordinary differential equations symbolically. |
| Compute Laplace transforms in the frequency domain. |
| Transform Laplace-domain expressions back to time-domain forms. |
Numerical Tools
Tool | Description |
| Numerically integrate real-valued functions on finite or improper intervals. |
| Find roots with bracketing or open methods such as Brent or Newton. |
| Solve initial value problems for scalar or vector ODE systems. |
| Interpolate tabular data with linear or spline-based methods. |
| Fit parametric models to observed data and report fitted parameters. |
Linear Algebra Tools
Tool | Description |
| Multiply dense matrices and vectors. |
| Solve square linear systems with direct or iterative methods. |
| Solve overdetermined systems with least-squares regression. |
| Compute QR, LU, Cholesky, or SVD-style decompositions. |
| Compute eigenvalues and eigenvectors. |
| Report determinant, rank, conditioning, definiteness, and shape metadata. |
Statistics Tools
Tool | Description |
| Return descriptive statistics for a sample. |
| Evaluate distribution PDFs, CDFs, quantiles, and related functions. |
| Run supported hypothesis tests and report significance details. |
| Fit linear and polynomial regression models. |
| Estimate confidence intervals with bootstrap resampling. |
| Draw samples from supported probability distributions. |
Discrete Math And Number Theory Tools
Tool | Description |
| Factor integers into prime powers. |
| Test whether an integer is prime. |
| Enumerate primes over an interval or generate the first |
| Compute GCD, LCM, extended GCD, or Euclidean algorithm steps. |
| Solve modular arithmetic tasks such as inverses, powers, and congruences. |
| Evaluate permutations, combinations, Catalan numbers, and related counts. |
| Count integer partitions and constrained partition variants. |
| Solve supported Diophantine equations over the integers. |
Graph Theory Tools
Tool | Description |
| Build graphs from named templates, edge lists, or adjacency matrices. |
| Compute shortest paths on weighted or unweighted graphs. |
| Compute a spanning tree or minimum spanning tree. |
| Report graph connectivity and structural metrics. |
| Compute maximum flow on directed graphs. |
GPU Tools
Tool | Description |
| Accelerate matrix multiplication with GPU support and CPU fallback. |
| Compute FFTs on GPU when available. |
| Compute batched eigenvalues for multiple matrices. |
| Solve batched linear systems using GPU acceleration where available. |
Rendering Tools
Tool | Description |
| Convert symbolic expressions to LaTeX and renderable output. |
| Render LaTeX math to an image data URI. |
| Plot explicit functions over configurable domains. |
| Plot implicit equations and inequalities. |
Hardware Requirements
Python 3.12 or newer.
CPU-only systems are fully supported for the non-GPU tool families.
Optional CUDA-capable NVIDIA GPU for the GPU tool family.
If CUDA or CuPy is unavailable, GPU tools either fall back to CPU implementations or report that GPU acceleration is not available.
Memory needs depend on workload size. Large symbolic expressions, large matrices, and graph algorithms can require significant RAM.
Example Queries
Simplify
(x^2 - 1) / (x - 1).Solve
x^2 - 5x + 6 = 0over the reals.Compute the definite integral of
sin(x)from0topi.Find the eigenvalues of
[[4, 1], [1, 3]].Fit an exponential decay model to observed time-series data.
Compute the bootstrap confidence interval for a sample mean.
Factor
123456789into prime powers.Find the shortest weighted path from node
Ato nodeD.Render the equation
x^2 + y^2 = 1as an implicit plot.Multiply a batch of matrices with GPU acceleration if hardware is available.
Verification
uv run python -c "from math_mcp.server import main; print('Import OK')"
uv run python -c "from math_mcp.tools.symbolic import simplify; print('Tools OK')"
uv run pytest tests/ -vAvailable Tools
51 toolsbootstrapC
Estimate bootstrap confidence intervals and uncertainty.
Inputs: data (required), statistic, n_resamples, confidence_level, +2 more. Returns: object
combinatoricsC
Evaluate combinatorial number sequences and counting functions.
Inputs: operation (required), n (required), k, as_formula. Returns: object
curve_fitC
Fit a nonlinear model to data with least squares.
Inputs: model (required), x_data (required), y_data (required), parameters, +3 more. Returns: object
describeC
Compute comprehensive descriptive statistics for a dataset.
Inputs: data (required), percentiles. Returns: object
diophantineC
Solve Diophantine equations over the integers.
Inputs: equation (required), method, bound. Returns: object
distributionC
Evaluate, fit, and sample probability distributions.
Inputs: name (required), operation (required), params, x, +3 more. Returns: object
dsolveC
Solve ordinary differential equations symbolically.
Inputs: equation (required), function, ics, hint. Returns: object
eigen_decompC
Compute eigenvalues and optionally eigenvectors.
Inputs: matrix (required), compute_vectors. Returns: object
expandA
Expand a mathematical expression.
Args:
expression: SymPy-compatible expression.
Examples: "(x+1)**3", "(a+b)*(c+d)"
Returns:
Standard result dictionary containing the expanded expression.
Inputs: expression (required). Returns: object
factorB
Factor a mathematical expression over the rational numbers.
Args:
expression: SymPy-compatible polynomial or rational expression.
Examples: "x**3 - 6*x**2 + 11*x - 6", "x**4 - 1"
Returns:
Standard result dictionary containing the factored expression.
Inputs: expression (required). Returns: object
factor_intC
Factor an integer into prime factors.
Inputs: n (required), method. Returns: object
find_rootC
Find a root of a scalar function numerically.
Inputs: expression (required), variable, method, bracket, +3 more. Returns: object
gcd_lcmC
Compute GCD, LCM, or Euclidean algorithm steps.
Inputs: numbers (required), operation, extended. Returns: object
gpu_eigen_batchC
Compute batched eigen decompositions with GPU fallback.
Inputs: matrices (required), symmetric, eigenvalues_only. Returns: object
gpu_fftC
Compute FFTs on GPU when beneficial, otherwise on CPU.
Inputs: data (required), operation, real_input, axis, +1 more. Returns: object
gpu_matrix_multiplyC
Multiply two matrices with GPU acceleration when beneficial.
Inputs: a (required), b (required), force_cpu. Returns: object
gpu_solveC
Solve batched linear systems with GPU fallback.
Inputs: a_batch (required), b_batch (required). Returns: object
graph_createC
Create a graph from a named specification, edge list, or adjacency matrix.
Inputs: specification (required), graph_type, n, edges, +2 more. Returns: object
graph_metricsC
Compute common graph-theoretic summary metrics.
Inputs: edges (required), weights, metrics, edge_weights_attr. Returns: object
hypothesis_testC
Perform a named statistical hypothesis test.
Inputs: test (required), data1 (required), data2, params, +2 more. Returns: object
interpolateC
Interpolate scattered one-dimensional data.
Inputs: x_data (required), y_data (required), method, x_eval, +2 more. Returns: object
inverse_laplaceC
Compute the inverse Laplace transform.
Inputs: expression (required), s_var, t_var. Returns: object
is_primeC
Test whether an integer is prime.
Inputs: n (required), rigorous. Returns: object
laplace_transformC
Compute the Laplace transform of a time-domain expression.
Inputs: expression (required), t_var, s_var, noconds. Returns: object
limitC
Compute limits of expressions.
Inputs: expression (required), variable, point, direction. Returns: object
lstsqC
Compute a least-squares solution to Ax ≈ b.
Inputs: a (required), b (required), method, regularization. Returns: object
matrix_decomposeC
Compute standard matrix decompositions.
Inputs: matrix (required), decomposition. Returns: object
matrix_infoC
Compute structural and numerical information about a matrix.
Inputs: matrix (required). Returns: object
matrix_multiplyC
Multiply two matrices A @ B.
Inputs: a (required), b (required). Returns: object
max_flowC
Compute maximum flow in a capacitated directed graph.
Inputs: edges (required), source (required), sink (required), capacities (required). Returns: object
modularD
Perform modular arithmetic operations.
Inputs: operation (required), a (required), b, mod, +1 more. Returns: object
numerical_integrateC
Numerically integrate a scalar function.
Inputs: expression (required), variable, lower, upper, +5 more. Returns: object
ode_solveC
Solve an initial value problem numerically.
Inputs: dydt (required), y0 (required), t_span (required), variable, +7 more. Returns: object
partitionsC
Count or list integer partitions.
Inputs: n (required), operation, k. Returns: object
plot_functionC
Plot one or more functions as 2D curves.
Inputs: expression (required), variable, x_range, num_points, +6 more. Returns: object
plot_implicitC
Plot implicit equations or inequalities in x and y.
Inputs: equation (required), x_range, y_range, grid_size, +2 more. Returns: object
primes_rangeC
List primes in a range or generate the first N primes.
Inputs: start (required), end (required), limit. Returns: object
random_sampleC
Generate random samples from NumPy distributions.
Inputs: distribution, params, size, dimensions, +1 more. Returns: object
regressionC
Perform regression analysis for linear, polynomial, or logistic models.
Inputs: x (required), y (required), model, degree, +3 more. Returns: object
render_mathB
Render arbitrary LaTeX math to a PNG data URI.
Inputs: latex (required), fontsize, dpi. Returns: object
seriesC
Compute Taylor or Laurent series expansions.
Inputs: expression (required), variable, point, order. Returns: object
shortest_pathC
Compute shortest paths on an edge-list graph.
Inputs: edges (required), source (required), target, weights, +2 more. Returns: object
simplifyA
Simplify a mathematical expression algebraically.
Args:
expression: A SymPy-compatible expression string.
Examples: "(x**2 - 1)/(x - 1)", "sin(x)**2 + cos(x)**2"
Returns:
Standard result dictionary containing the simplified expression.
Inputs: expression (required). Returns: object
solveA
Solve equations or systems of equations symbolically.
Args:
equation: Equation string or comma-separated system.
variables: Optional variable names to solve for.
domain: "real", "complex", "integer", or "positive".
show_steps: Whether to include a short human-readable explanation.
Inputs: equation (required), variables, domain, show_steps. Returns: object
solve_linearC
Solve a square linear system Ax = b.
Inputs: a (required), b (required), method. Returns: object
spanning_treeC
Compute a minimum or maximum spanning tree.
Inputs: edges (required), weights, maximize, edge_weights_attr. Returns: object
symbolic_diffC
Compute symbolic derivatives of arbitrary order.
Inputs: expression (required), variable, order, show_steps. Returns: object
symbolic_integrateC
Compute symbolic indefinite or definite integrals.
Inputs: expression (required), variable, limits, show_steps, +1 more. Returns: object
symbolic_productC
Compute symbolic finite or infinite products.
Inputs: expression (required), index, start, end. Returns: object
symbolic_sumC
Compute symbolic finite or infinite summations.
Inputs: expression (required), index, start, end. Returns: object
to_latexC
Convert a mathematical expression to LaTeX and render it.
Inputs: expression (required), style. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 51 tools
Many tools have distinct purposes, but there is overlap between symbolic and numeric solvers (solve, solve_linear, find_root, dsolve, ode_solve) and between fitting tools (regression, curve_fit, lstsq). Descriptions often clarify, but an agent could still misselect.
Tool names follow a mix of patterns: single verbs (factor, simplify), verb_noun (factor_int, find_root), and noun_verb (graph_create, matrix_decompose). Some use abbreviations (gpu_fft) or adjectives (max_flow). The inconsistency is notable across 51 tools.
With 51 tools, the set is large and contains redundancies (e.g., multiple ODE solvers, multiple rendering tools). While the domain is broad, the granularity could be reduced for better usability.
The tool set covers a wide range of mathematical domains: symbolic, numeric, statistical, linear algebra, graph theory, number theory, transforms, and plotting. Minor gaps exist (e.g., optimization, special functions) but overall it's very comprehensive.
Related MCP Connectors
Unofficial Math.js MCP — wraps the mathjs.org API (free, no auth)
Educational MCP server with 17 math/stats tools, visualizations, and persistent workspace
MCPCalc gives agents access to a comprehensive library of calculators spanning finance, math, health, construction, engineering, food, automotive, and more. It includes a full Computer Algebra System (CAS) and a grid-based Spreadsheet calculator.
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides a comprehensive set of mathematical functions as MCP tools, enabling language models to perform calculations including arithmetic, trigonometry, logarithms, and more.1MIT
- AlicenseAqualityCmaintenanceEnables advanced mathematics operations including linear algebra, vector math, symbolic computation, and calculus through MCP tools. Designed for use with Claude and other MCP-compatible LLMs.192MIT
- AlicenseNot gradedqualityBmaintenanceProvides a token-efficient exact math engine for AI agents, enabling computation of derivatives, integrals, equations, and optimized Python/NumPy code via a single MCP tool.56 PyPI8MIT
- -licenseNot gradedqualityNot gradedmaintenanceMCP server providing Claude with advanced mathematical capabilities including symbolic math, statistics, and matrix operations.-