Skip to main content
MCP server CX Codex

SageMath — Claude Code MCP server: what it does, how to install

An MCP server that gives your agent a sandboxed SageMath session which keeps state between calls, with 40 tools and a checker for claimed results.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add sagemath-mcp -- uvx sagemath-mcp
Open on GitHub

What SageMath does

Every MCP session gets its own Sage worker process, so variables, functions and assumptions survive from one tool call to the next. The 40 tools cover symbolic calculus, number theory, linear algebra, ODEs, plots, combinatorics, groups and elliptic curves. One of them, verify_claim, runs a stated result up the proof ladder and returns proved, refuted, supported or undecided with the evidence attached.

Caller code is deny-by-default: imports, external CAS interfaces, file access and display primitives are refused. The policy lets through 98.9% of SageMath's own 438,124 documented examples, and each refusal maps to a named rule. Install with pip install "sagemath-mcp[passagemath]" on Python 3.12: about 1 GB, no Docker, no Sage build.

On 3.13 and later memory-allocator gets compiled from source, which calls for a C compiler, and uvx without --python grabs the newest interpreter it can find and fails there. macOS and Linux work; native Windows is partial, so use the container or WSL. Worth knowing too: a pip install runs with your own privileges, so for untrusted input or a shared host take the container build.

What it helps with

  • compute an integral or a limit without leaving the chat for a Sage REPL
  • keep assumptions and variables alive across tool calls
  • re-check a stated theorem with verify_claim
  • plot a function or a group's Cayley graph from a description
  • factor a large integer and inspect which divisors are prime

Example prompts for the agent

  • Factor 2^67 − 1 and tell me which of the divisors are prime
  • Assume x is real and work out the limit of sin(x)/x as x goes to 0
  • Run verify_claim on the statement that x^4+1 is irreducible over Q

How to install SageMath

Platform CLI

claude mcp add sagemath-mcp -- uvx sagemath-mcp

uvx runs the command named after the package; if the README names another one, use uvx --from sagemath-mcp <command>

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about SageMath

How do I install SageMath MCP in Claude Code?

Run claude mcp add sagemath-mcp -- uvx sagemath-mcp. That registers the server as sagemath-mcp and launches it through uvx.

What does SageMath MCP do?

It hands the agent 40 SageMath tools inside a sandbox: symbolic work, claim verification, plots. Session state carries over between calls.

Which Python version does it need?

Python 3.12 — the version CI tests and the newest where every dependency ships a wheel. From 3.13 on, memory-allocator is compiled from source and needs a C compiler.

Similar MCP servers

Everything for Science and research →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor