Skip to main content

sagebrush-mcp: computational mathematics for AI agents

An MCP server that gives an AI agent a real computer algebra system for research mathematics, with Sage syntax and exact, verified results. It is Sagebrush: Rust engines, MIT OR Apache-2.0. You don't need Sage, PARI or FLINT, or a C compiler; the wheels cover Linux, macOS and Windows.

pip install sagebrush-mcp        # or: uvx sagebrush-mcp@latest

Claude Code: claude mcp add sagebrush -- sagebrush-mcp

Claude Desktop, Cursor and other clients: in the MCP configuration,

{ "mcpServers": { "sagebrush": { "command": "sagebrush-mcp" } } }

(uvx sagebrush-mcp@latest as the command works without installing anything first, and uv checks for a newer release each time it starts.)

Tools

  • sage: run Sage code in a persistent session. 2^10, 1/3 exact, R.<x> = QQ[], K.<a> = NumberField(x^3 - 11), [1..10]; variables persist between calls. It returns the printed output and the last value, and plots come back as SVG.
  • python: the same session, as plain Python.
  • factor, number_field, newforms: shortcuts for common questions.
  • guide: what is implemented. search_docs: search the Sage library's documentation. reset: clear the session.
  • run_status, run_result, run_cancel, run_list, run_keep: runs that outlast a call.
  • workspace_connect, then the workspace_*, chat_* and latex_comments_* tools: the person's Sagebrush workspace, its chat panel and comments on a .tex, through the page they pair.

What the session covers:

  • Integers: factoring (ECM), primality.
  • Polynomials: factoring and roots over ZZ and QQ.
  • Number fields: maximal orders, prime decomposition, class groups, units and regulators (assuming GRH, as Sage and PARI do).
  • Exact linear algebra over ZZ and QQ: det, rref, inverse, charpoly, kernels, Hermite and Smith forms, LLL.
  • Modular forms: modular symbols, newforms with LMFDB labels, Hecke operators.
  • Elliptic curves: conductors, ranks, a_p.
  • Plots.

The results agree with Sage. The test suite, run under CPython, compares more than 4,000 lines of output with Sage itself.

A sage or python call waits up to wait seconds (60 by default). If the computation hasn't ended by then, the call returns a ticket and the computation keeps running: run_result waits for it, and run_cancel interrupts it (the session keeps its variables). Only a run_deadline you give, or a cancel, stops it. timeout is the old name of wait.

This package is a thin entry point: the server is sagebrush.mcp_server in the sagebrush package, so pip install sagebrush also provides the sagebrush-mcp command.

Metadata

Release files for sagebrush-mcp 0.10.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sagebrush-mcp 0.10.4
File Size Uploaded Provenance Actions
sagebrush_mcp-0.10.4.tar.gz 6.9 kB With provenance Details for sagebrush_mcp-0.10.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sagebrush-mcp 0.10.4
File Interpreter ABI Platform Actions
sagebrush_mcp-0.10.4-py3-none-any.whl Python 3 none any Details for sagebrush_mcp-0.10.4-py3-none-any.whl

Total release size: 15.1 kB

Release files / sagebrush_mcp-0.10.4.tar.gz

Download URL sagebrush_mcp-0.10.4.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2429e31548cc7f3fd50b400ba90e070a4f38fdd60e406fb033e709694c0fa27a
BLAKE2b-256 checksum
How to use checksums
00c38032f10cd993cd8f833a2f4bf5f0761ae000b954a622ffbb416ad81896c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / sagebrush_mcp-0.10.4-py3-none-any.whl

Download URL sagebrush_mcp-0.10.4-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1a28588980b4c28a57dbeda156dc851e68afaabd82f09258ddac8f782ce1e9a
BLAKE2b-256 checksum
How to use checksums
534b81d7cd1b2e5f77187c4705944c6a8be517a427229780b9c3592a93ce55b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for sagebrush-mcp 0.10.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sagebrush_mcp-0.10.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page