justice8096 avatar

Sagemath Mcp Server

justice8096/sagemath-mcp-server

Wraps the entire SageMath computer algebra system as a subprocess and exposes 10 symbolic math tools to Claude: equation solving, calculus (differentiation, integration), matrix operations (eigenvalues, determinants, RREF), polynomial factoring, expression simplification with multiple strategies, number theory primitives (primes, totients, GCD), LaTeX conversion, and plotting with base64 PNG output. Built for problems where exact symbolic manipulation matters more than floating point approximation. Runs over stdio by default but supports HTTP transport with API key auth. Requires either a local SageMath install or Docker. The TypeScript wrapper is CC0, SageMath stays GPL and executes in a separate process with input sanitization.

tools
10
auth
Secret needed
transport
STDIO
env vars
5
last updated
May 18, 2026

Tools

10 tools

Public tool metadata for what this MCP can expose to an agent.

sage_evaluateRun an arbitrary SageMath expression.

Run an arbitrary SageMath expression.

No parameter schema in public metadata yet.

sage_solve_equationSolve algebraic / transcendental equations symbolically.

Solve algebraic / transcendental equations symbolically.

No parameter schema in public metadata yet.

sage_differentiateCompute derivatives (any order, any variable).

Compute derivatives (any order, any variable).

No parameter schema in public metadata yet.

sage_integrateIndefinite and definite integrals.

Indefinite and definite integrals.

No parameter schema in public metadata yet.

sage_simplifySimplify expressions (`default`, `full`, `trig`, `rational`).

Simplify expressions (`default`, `full`, `trig`, `rational`).

No parameter schema in public metadata yet.

sage_factorFactor polynomials or integers.

Factor polynomials or integers.

No parameter schema in public metadata yet.

sage_matrix_opsDeterminant, inverse, eigenvalues, rank, RREF, transpose over `QQ` / `RR` / `ZZ` / `CC`.

Determinant, inverse, eigenvalues, rank, RREF, transpose over `QQ` / `RR` / `ZZ` / `CC`.

No parameter schema in public metadata yet.

sage_plotPlot an expression and return a base64 PNG.

Plot an expression and return a base64 PNG.

No parameter schema in public metadata yet.

sage_latex_convertConvert a SageMath expression to LaTeX.

Convert a SageMath expression to LaTeX.

No parameter schema in public metadata yet.

sage_number_theory`is_prime`, `next_prime`, `factor`, `euler_phi`, `gcd`, `lcm`, `prime_range`, `sigma`, `moebius`.

`is_prime`, `next_prime`, `factor`, `euler_phi`, `gcd`, `lcm`, `prime_range`, `sigma`, `moebius`.

No parameter schema in public metadata yet.

Sponsors

Configuration

SAGE_TIMEOUT

Per-call SageMath timeout in milliseconds. Default 30000.

SAGE_DOCKER_IMAGE

Docker image used when SageMath is not installed locally. Default sagemath/sagemath:latest.

TRANSPORT

Transport mode: 'stdio' (default) or 'http'.

PORT

HTTP port when TRANSPORT=http. Default 3000.

API_KEYsecret

If set, HTTP transport requires matching API_KEY header. Ignored for stdio.

Readme

SageMath MCP Server

License: CC0-1.0 npm

A Model Context Protocol server that exposes SageMath — a 100+ package computer algebra system — to LLM clients such as Claude. Where most "math MCPs" wrap a single library (SymPy, mathjs), this one subprocess-wraps the entire SageMath stack so the model has access to genuine symbolic mathematics, not arithmetic.

Why

LLMs are bad at exact arithmetic, brittle with multi-step algebra, and unreliable when symbolic manipulation matters. The right pattern is to keep the conceptual reasoning in the model and delegate mechanical computation to a tool — the same trick a person with dyscalculia uses with a calculator. SageMath gives you the broadest tool surface for that delegation: factoring, integration, eigenvalues, number theory, LaTeX rendering, and plotting all behind one interface.

Tools


View the full README on GitHub

Details

Repository
github.com/justice8096/sagemath-mcp-server
Package
@justice8096/sagemath-mcp-server
Transport
STDIO
Auth
Required
Registry
MCP registry, active