SageMath MCP Server
Exposes the entire SageMath computer algebra system to LLM clients for symbolic mathematics, including algebra, calculus, number theory, matrix operations, plotting, and LaTeX conversion.
Click on "Install 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., "@SageMath MCP ServerSolve 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.
SageMath MCP Server
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.
Related MCP server: SageMath MCP Server
Tools
Tool | Description |
| Run an arbitrary SageMath expression. |
| Solve algebraic / transcendental equations symbolically. |
| Compute derivatives (any order, any variable). |
| Indefinite and definite integrals. |
| Simplify expressions ( |
| Factor polynomials or integers. |
| Determinant, inverse, eigenvalues, rank, RREF, transpose over |
| Plot an expression and return a base64 PNG. |
| Convert a SageMath expression to LaTeX. |
|
|
All tools follow the same schema pattern (see src/schemas/common.ts).
Installation
The server needs either a local SageMath install or Docker available on the host so it can spawn a SageMath process.
Option 1: npm + local SageMath
npm install -g @justice8096/sagemath-mcp-server
# requires `sage` on PATH — see https://doc.sagemath.org/html/en/installation/
sagemath-mcpOption 2: Docker (no local SageMath required)
docker compose up
# uses the official sagemath/sagemath image; the server runs inside the containerOption 3: from source
git clone https://github.com/justice8096/sagemath-mcp-server.git
cd sagemath-mcp-server
npm install
npm run build
npm startConfiguring an MCP client
Claude Desktop / Claude Code (stdio transport)
Add to ~/.claude.json (or the equivalent Claude Desktop config):
{
"mcpServers": {
"sagemath": {
"command": "sagemath-mcp"
}
}
}Remote / HTTP transport
TRANSPORT=http API_KEY=your-secret-key npm startThen point an MCP HTTP client at http://<host>:3000/mcp with the matching API_KEY header.
Architecture
TypeScript wrapper, runtime is Node.js ≥ 18.
Subprocess wrapping — the wrapper code is CC0; SageMath remains GPL-3.0 and runs as a separate process, which is the canonical safe interaction model per the GNU GPL FAQ on aggregation. Embedding via FFI would propagate copyleft; subprocess execution does not.
Dual transport — stdio (Claude Desktop, Claude Code, local MCP clients) and Streamable HTTP (remote deployment, optional
API_KEYenv var).i18n — English, Spanish, French via
src/i18n.tsandlocales/.Multi-format build —
build.tsemits Claude plugin, OpenAI function-calling, n8n node, MCP server descriptor, CLI tool, and YAML prompt-library outputs from the same source manifest.
Configuration
Env var | Default | Purpose |
|
|
|
|
| HTTP port when |
| (none) | If set, HTTP requests must include matching |
|
| Per-call SageMath timeout in milliseconds. |
|
| Image used when SageMath isn't installed locally. |
Security
All SageMath input is sanitized to strip shell metacharacters before subprocess execution; see
src/services/sage-executor.ts.HTTP transport requires
API_KEYif set — there is no default credential.See
SECURITY.mdandTHREAT_MODEL.mdfor the full posture.Pre-commit audit suite under
audits/: SAST/DAST scan, supply-chain audit, CWE mapping, LLM-compliance report, contribution analysis.
License
This wrapper is released under CC0-1.0 (public domain). SageMath itself remains GPL-3.0; the subprocess execution model keeps the licenses independent. See SECURITY.md and the project's compliance analysis for the legal reasoning.
Status
v1.0.0 — public release. The wrapper layer is stable; the SageMath surface is feature-rich and stable upstream. File issues at https://github.com/justice8096/sagemath-mcp-server/issues.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseCqualityCmaintenanceExposes 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.Last updated512
- Alicense-qualityDmaintenanceA universal mathematics MCP server that gives LLM clients full access to SageMath for symbolic calculus, number theory, linear algebra, and more, with persistent state across tool calls.Last updated8MIT
- Alicense-qualityDmaintenanceProvides a comprehensive set of mathematical functions as MCP tools, enabling language models to perform calculations including arithmetic, trigonometry, logarithms, and more.Last updated51MIT
- AlicenseAqualityCmaintenanceA Model Context Protocol server that exposes 8 mathematical tools (arithmetic, algebra, calculus, matrix operations, statistics, probability, unit conversions) to any MCP-compatible AI agent, enabling mathematical computations without code.Last updated8281MIT
Related MCP Connectors
Precision math engine for AI agents. 203 exact methods. Zero hallucination.
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
Educational MCP server with 17 math/stats tools, visualizations, and persistent workspace
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/justice8096/sagemath-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server