advanced-math-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., "@advanced-math-mcp integrate x^2 from 0 to 1"
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.
advanced-math-mcp
MCP (Model Context Protocol) server for advanced mathematics — linear algebra, vector math, symbolic computation, and calculus. Designed for use with Claude and other MCP-compatible LLMs.
Quick Start
npm install -g advanced-math-mcpThen add to your MCP client configuration (e.g., mcp_settings.json):
{
"mcpServers": {
"advanced-math-mcp": {
"command": "advanced-math-mcp",
"args": [],
"alwaysAllow": [
"evaluate",
"set_variable",
"get_variable",
"list_variables",
"clear_variables",
"matrix_create",
"matrix_identity",
"matrix_zeros",
"matrix_diagonal",
"symbolic_simplify",
"symbolic_substitute",
"symbolic_derivative",
"symbolic_expand",
"symbolic_integrate",
"symbolic_definite_integral",
"symbolic_limit",
"symbolic_partial_derivative"
]
}
}
}Related MCP server: Math MCP Server
Tools (17 total)
Unified Expression Evaluator
Tool | Description |
| Universal expression evaluator with natural math syntax. Supports matrices, vectors, scalars, decompositions, and custom functions. |
| Define a named variable (matrix, vector, or scalar) for use in |
| Retrieve a variable's value |
| List all defined variables and their types |
| Reset all variables |
Matrix Creation
Tool | Description |
| Create a matrix from a 2D array of strings |
| Create an n×n identity matrix |
| Create an m×n matrix of zeros |
| Create a diagonal matrix from a vector of values |
Symbolic Math
Tool | Description |
| Simplify algebraic expressions |
| Expand factored expressions |
| Substitute variables with values or expressions |
| Compute ordinary derivatives (single-variable) |
| Compute partial derivatives (multivariable) |
| Compute indefinite integrals (antiderivatives) |
| Compute definite integrals with bounds |
| Compute limits of expressions |
evaluate — The Universal Evaluator
All matrix/vector operations use a single evaluate tool with natural expression syntax:
Matrix Operations
// Arithmetic
evaluate("A + B") // addition
evaluate("A - B") // subtraction
evaluate("A * B") // matrix multiplication
evaluate("A ^ 3") // matrix power
// Properties
evaluate("det(A)") // determinant
evaluate("trace(A)") // trace
evaluate("rank(A)") // rank
evaluate("inv(A)") // inverse
evaluate("transpose(A)") // transpose
// Decompositions
evaluate("eig(A)") // eigenvalues & eigenvectors
evaluate("charpoly(A)") // characteristic polynomial (2×2, 3×3)
evaluate("lu(A)") // LU decomposition
evaluate("qr(A)") // QR decomposition
evaluate("svd(A)") // singular value decomposition
// Linear systems
evaluate("solve(A, b)") // solve Ax = bVector Operations
evaluate("dot([1,2,3], [4,5,6])") // dot product → 32
evaluate("cross([1,2,3], [4,5,6])") // cross product → [-3, 6, -3]
evaluate("norm([3,4])") // L2 norm → 5
evaluate("norm([3,4], \"1\")") // L1 norm → 7
evaluate("project([3,4], [1,0])") // vector projection → [3, 0]Inline Literals
evaluate("[[1,2],[3,4]] * [[5,6],[7,8]]") // → [[19,22],[43,50]]
evaluate("det([[4,1],[2,3]])") // → 10
evaluate("inv([[4,7],[2,6]])") // → [[0.6,-0.7],[-0.2,0.4]]Variable Workflow
set_variable("A", "[[1,2],[3,4]]")
set_variable("B", "[[5,6],[7,8]]")
evaluate("A * B") // uses stored variables
list_variables() // see all defined variables
clear_variables() // resetSymbolic Math
Simplification & Expansion
symbolic_simplify("x^2 + 2*x + 1 - (x+1)^2") // → 0
symbolic_expand("(x+1)*(x-1)*(x+2)") // → x^3 + 2x^2 - x - 2Substitution
// Single variable
symbolic_substitute("x^2 + 2*x", { x: "3" }) // → 15
// Multi-variable
symbolic_substitute("x^2 + y*x + z", { x: "3", y: "2", z: "1" }) // → 16Calculus
// Derivatives
symbolic_derivative("x^3 + 2*x^2", "x") // → 3x^2 + 4x
symbolic_partial_derivative("x^2*y + sin(z)", "x", 2) // → 2y (second partial)
// Integration
symbolic_integrate("x^2 + sin(x)", "x") // → 0.333x^3 - cos(x) + C
symbolic_definite_integral("x^2", "x", "0", "2") // → 2.667 (∫₀² x² dx)
// Limits
symbolic_limit("sin(x)/x", "x", "0") // → 1Architecture
src/
├── index.ts # Entry point, loads nerdamer plugins
├── server.ts # MCP server setup, tool routing
├── types.ts # Shared types and Zod schemas
├── engine/
│ ├── evaluator.ts # Unified expression evaluator (mathjs + custom functions)
│ ├── symbolic.ts # Symbolic engine (nerdamer + mathjs)
│ ├── math-engine.ts # Low-level matrix operations
│ └── format.ts # Output formatting utilities
└── tools/
├── evaluate.ts # evaluate + variable management tools
├── matrix-create.ts # matrix_create, identity, zeros, diagonal
├── symbolic.ts # symbolic_simplify, substitute, derivative, expand
└── calculus.ts # symbolic_integrate, definite_integral, limit, partial_derivativeDependencies
Package | Purpose |
| MCP protocol implementation |
| Numeric matrix operations, expression parsing |
| Symbolic algebra, calculus (integrals, limits) |
| Runtime input validation |
Custom Functions in evaluate
The evaluator extends mathjs with these custom functions:
Function | Implementation |
| Via eigenvalue count of AᵀA |
| Wraps |
| Wraps |
| Via eigenvalue decomposition of AᵀA |
| Formula-based for 2×2 and 3×3 |
| Alias for |
| Alias for |
| Vector projection formula |
| L1, L2 (default), L∞ |
Development
git clone https://github.com/PsyWhat/advanced-math-mcp.git
cd advanced-math-mcp
npm install
npm run build # compile TypeScript
npm run dev # watch mode
npm link # install globally for local testingTesting
npm test # run all tests (vitest)
npm run test:watch # watch mode
npm run typecheck # TypeScript validation onlySuite | Tests | Coverage |
| 36 | Matrix ops, vector ops, decompositions, eigenvalues, variable scope, error handling |
| 15 | Simplify, expand, substitute, ordinary derivatives |
| 17 | Indefinite/definite integrals, limits, partial derivatives |
All 68 tests pass.
Known Limitations
SVD: The rank-deficient SVD gives zero vectors for nullspace columns (computed via AᵀA eigen-decomposition, not full Golub-Reinsch)
Cholesky: Not available in mathjs v13; use
lu()for general decompositionnorm(v, inf): Must use quoted"inf"(not bareinf) due to mathjs parsingcharpoly: Numeric only, supports 2×2 and 3×3 matricessymbolic_limit: Some advanced limits (e.g.,(1+1/x)^xasx→∞) may not fully resolve
License
MIT
Available Tools
8 toolsget_variableA
Get value of a stored variable. Example: get_variable({ name: 'A' }) sid — required session ID.
Inputs: sid (required), name (required).
list_variablesA
List all defined variables with types/sizes in a session. sid — required session ID.
Inputs: sid (required).
matrix_identityA
Create n×n identity matrix. Example: n: 3
Inputs: n (required).
symbolic_definite_integralA
Definite integral ∫[lower,upper] f(x)dx. Returns antiderivative + numeric/symbolic result. Example: expression: "x^2", variable: "x", lower: "0", upper: "2"
Inputs: lower (required), upper (required), variable (required), expression (required).
symbolic_expandB
Expand factored expression. Example: expression: "(x+1)*(x-1)" → x^2 - 1
Inputs: expression (required).
symbolic_integrateB
Indefinite integral ∫f(x)dx. Example: expression: "x^2 + sin(x)", variable: "x"
Inputs: variable (required), expression (required).
symbolic_limitA
Limit lim[x→point] f(x). Supports L'Hôpital (0/0, ∞/∞). point: '0', 'inf', '+inf', '-inf'. Example: expression: "sin(x)/x", variable: "x", point: "0" → 1
Inputs: point (required), variable (required), expression (required).
symbolic_partial_derivativeA
Partial derivative ∂^n/∂var^n (multivariable). Treats other vars as constants. Example: expression: "x^2y + sin(z)", variable: "x", order: 2 → 2y
Inputs: variable (required), expression (required), order.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct mathematical operation: matrix creation, variable access, symbolic expansion, integration (indefinite and definite), limits, and partial derivatives. No two tools have overlapping purposes.
Naming conventions are mixed: some tools use verb_noun (get_variable, list_variables), some use noun-like (matrix_identity), and others use symbolic_ prefix with varying verb forms (symbolic_integrate vs symbolic_definite_integral). This inconsistency could cause confusion.
With 8 tools, the server covers a reasonable scope of advanced math operations without being bloated. The count is well-suited for the domain.
The tool set is missing critical operations: there is no way to create or set variables (only get and list), no ordinary derivative, and no equation-solving or matrix manipulation beyond identity creation. These gaps would hinder many common tasks.
Maintenance
Related MCP Connectors
Unofficial Math.js MCP — wraps the mathjs.org API (free, no auth)
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
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.
Unofficial Newton MCP — wraps the Newton math solver API (free, no auth)
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides comprehensive mathematical capabilities including basic arithmetic, advanced functions, statistical tools, and access to mathematical constants. It allows users to perform computations and generate math-related prompts through a standardized MCP interface.MIT
- FlicenseCqualityDmaintenanceExposes 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.513-
- AlicenseNot gradedqualityDmaintenanceProvides a comprehensive set of mathematical functions as MCP tools, enabling language models to perform calculations including arithmetic, trigonometry, logarithms, and more.1MIT
- 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.155 PyPI8MIT