Math MCP Server
Exposes a broad mathematics toolkit including symbolic algebra, calculus, numerical methods, linear algebra, statistics, discrete math, graph theory, rendering, and optional GPU acceleration via MCP tools for use with Claude Desktop and other MCP hosts.
README
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 dev
Running The Server
Run directly with Python:
python -m math_mcp.server
Run through uv:
uv run python -m math_mcp.server
Run via the console script:
math-mcp-server
The 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 |
Simplify algebraic, trigonometric, and rational expressions. |
expand |
Expand products, powers, and composite symbolic expressions. |
factor |
Factor polynomials and integers into structured symbolic factors. |
solve |
Solve equations, systems, and inequalities over configurable domains. |
symbolic_integrate |
Compute indefinite and definite symbolic integrals. |
symbolic_diff |
Differentiate expressions, including higher-order derivatives. |
limit |
Evaluate one-sided and two-sided limits. |
series |
Produce Taylor or Laurent-like series expansions. |
symbolic_sum |
Evaluate finite and infinite symbolic summations. |
symbolic_product |
Evaluate finite and infinite symbolic products. |
dsolve |
Solve ordinary differential equations symbolically. |
laplace_transform |
Compute Laplace transforms in the frequency domain. |
inverse_laplace |
Transform Laplace-domain expressions back to time-domain forms. |
Numerical Tools
| Tool | Description |
|---|---|
numerical_integrate |
Numerically integrate real-valued functions on finite or improper intervals. |
find_root |
Find roots with bracketing or open methods such as Brent or Newton. |
ode_solve |
Solve initial value problems for scalar or vector ODE systems. |
interpolate_data |
Interpolate tabular data with linear or spline-based methods. |
curve_fit |
Fit parametric models to observed data and report fitted parameters. |
Linear Algebra Tools
| Tool | Description |
|---|---|
matrix_multiply |
Multiply dense matrices and vectors. |
solve_linear |
Solve square linear systems with direct or iterative methods. |
lstsq |
Solve overdetermined systems with least-squares regression. |
matrix_decompose |
Compute QR, LU, Cholesky, or SVD-style decompositions. |
eigen_decomp |
Compute eigenvalues and eigenvectors. |
matrix_info |
Report determinant, rank, conditioning, definiteness, and shape metadata. |
Statistics Tools
| Tool | Description |
|---|---|
describe |
Return descriptive statistics for a sample. |
distribution |
Evaluate distribution PDFs, CDFs, quantiles, and related functions. |
hypothesis_test |
Run supported hypothesis tests and report significance details. |
regression |
Fit linear and polynomial regression models. |
bootstrap |
Estimate confidence intervals with bootstrap resampling. |
random_sample |
Draw samples from supported probability distributions. |
Discrete Math And Number Theory Tools
| Tool | Description |
|---|---|
factor_int |
Factor integers into prime powers. |
is_prime |
Test whether an integer is prime. |
primes_range |
Enumerate primes over an interval or generate the first n primes. |
gcd_lcm |
Compute GCD, LCM, extended GCD, or Euclidean algorithm steps. |
modular |
Solve modular arithmetic tasks such as inverses, powers, and congruences. |
combinatorics |
Evaluate permutations, combinations, Catalan numbers, and related counts. |
partitions |
Count integer partitions and constrained partition variants. |
diophantine |
Solve supported Diophantine equations over the integers. |
Graph Theory Tools
| Tool | Description |
|---|---|
graph_create |
Build graphs from named templates, edge lists, or adjacency matrices. |
shortest_path |
Compute shortest paths on weighted or unweighted graphs. |
spanning_tree |
Compute a spanning tree or minimum spanning tree. |
graph_metrics |
Report graph connectivity and structural metrics. |
max_flow |
Compute maximum flow on directed graphs. |
GPU Tools
| Tool | Description |
|---|---|
gpu_matrix_multiply |
Accelerate matrix multiplication with GPU support and CPU fallback. |
gpu_fft |
Compute FFTs on GPU when available. |
gpu_eigen_batch |
Compute batched eigenvalues for multiple matrices. |
gpu_solve |
Solve batched linear systems using GPU acceleration where available. |
Rendering Tools
| Tool | Description |
|---|---|
to_latex |
Convert symbolic expressions to LaTeX and renderable output. |
render_math |
Render LaTeX math to an image data URI. |
plot_function |
Plot explicit functions over configurable domains. |
plot_implicit |
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/ -v
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。