Axiom is a precise symbolic and numerical mathematics tool for large language models (LLMs), based on the Giac/Xcas computer algebra system, and provided through both a Model Context Protocol (MCP) server and shell commands. It is published on npm under the name axiom-math.
Purpose
LLMs often make mistakes in computation, especially in symbolic mathematics, exact fractions, and multi-step problems. Axiom provides verified exact results through a two-layer engine: math.js for fast numerical computation (arithmetic, trigonometry, matrices), and Giac/Xcas WASM for symbolic computation (calculus, algebra, equation solving).
Main capabilities
Axiom exposes 3 MCP tools:
- compute: a unified gateway for all mathematical computation. Pass in a CAS-style problem string, and the router parses it and dispatches it to the correct engine. It recognizes CAS-style verbs and covers multiple domains; unrecognized input falls back to raw Giac/Xcas evaluation.
- verify: independently checks mathematical propositions. It returns four fields: verified, evaluated, confidence, checks_performed. Among these, evaluated should be read first; it is false when no check produced a usable answer, in which case verified: false means "unknown" rather than "refuted".
- plot: renders two-dimensional functions as SVG images, returning base64-encoded SVG (including axes, grid, labels, asymptote detection) as well as a textual description.
The server also registers guided MCP prompts for multi-step workflows linking compute/verify: solve-step-by-step, analyze-function, verify-identity, convert-units, analyze-dataset, solve-ode-system, regression-workflow.
Usage
It can be used directly as a CLI, or configured as an MCP server for any client. As an agent skill, it can be placed in skills/axiom-math/SKILL.md, a file that teaches the agent the three commands and their exit codes.
Installation: the package name is axiom-math, no installation is required for normal use; npx will fetch and cache it. It can also be installed so that the axiom-math command is on PATH. Requires Node.js >= 20. The first run downloads about 3.8 MB (the CAS engine compiled to WebAssembly) and takes a few seconds; subsequent runs read from the npx cache.
CLI (STDIO transport): the same binary can be used as a one-shot CLI; with no arguments it is an MCP server, and with a subcommand it runs one computation and exits. Exit codes: 0 success, 1 tool or usage error, 2 verify checked the proposition and it is false. 2 is a mathematical verdict, so it is not used for unchecked propositions: propositions that fail to parse, that the CAS cannot evaluate, or whose superscript has multiple readings exit with 1 and no output on stdout.
HTTP transport is stateless: each POST /mcp is handled independently, no Mcp-Session-Id is issued, and no session state is retained between requests. The server does not send server-initiated notifications.
Applicable scenarios
Suitable for LLM applications that need exact symbolic mathematical computation, such as calculus, equation solving, linear algebra, combinatorics, proposition verification, and so on. It can serve as a second opinion on model-generated results.
Limitations
- Results longer than 100,000 characters are refused.
- Some inputs are rejected rather than answered: arithmetic evaluating to NaN (such as 0/0) is an error; infinite results are returned with a warning; t-tests require variation; contingency tables require non-negative counts, no all-zero rows or columns, equal-length rows, and more than one row and one column; one-way ANOVA requires within-group variation and more observations than groups; numerical methods are rejected when the expression does not depend on the variable being solved for or integrated, or when the CAS gives a symbolic answer instead of a numerical one.
- Systems of differential equations written as a list are rewritten into matrix form, returning the solution for each function, with components returned in the order the equations are written, and the JSON envelope names them in the components field. Initial conditions must be given for every function in the same place, or not given at all. Partial sets are rejected. Nonlinear systems, coefficients depending on the independent variable, derivative order higher than one, more than nine equations, and systems the CAS cannot complete are all rejected.
- Security: no authentication and no rate limiting. The default bind address is 127.0.0.1, but docker/docker-compose.yml sets MCP_HOST=0.0.0.0. If the port is exposed, it should be placed behind a reverse proxy with authentication and rate limiting. POST /mcp also verifies that the Host header isWhether it is in the allowed list (default localhost, 127.0.0.1, [::1]) to prevent DNS rebinding. If accessed via a non-loopback address, MCP_ALLOWED_HOSTS must be set, otherwise all POST /mcp requests will receive 403. This check is not authentication.
- License: GNU General Public License v3.0 or later. Axiom embeds Giac/Xcas (GPL-3.0-or-later), so the combined work carries the same license. Agents that communicate with Axiom via MCP are not affected by the GPL, because they are separate programs. Redistributing Axiom itself requires compliance with the copyleft terms.
Benchmarking
Benchmark results (GLM-5.1, May 2026): The Phase 0 scorer (LaTeX/Unicode normalization + symbolic equivalence) is the main value driver for all datasets. CAS-quick improved from 26.7% (before the April scorer) to 70% (after the scorer). Omni-MATH ≥7 has reached the upper limit for the current LLM+CAS setup. Full results are in benchmark/results/ and docs/superpowers/specs/.
Build and Test
WASM build (Giac): Run scripts/build-giac-wasm.sh, use docker build to build docker/build-giac-wasm/Dockerfile, and write giac.wasm.js directly to src/server/giac/. Requires Docker Desktop or another Docker daemon running locally. Tests: npm test runs unit tests without requiring a build; npm run test:integration builds first and then tests the packaged dist/ output. The unit + integration suite has a 100% pass rate.
Project Status
Bug reports and pull requests are welcome; see CONTRIBUTING.md. The project has undergone extensive ablation experiments across five phases (Phase 0–4). Some experimental approaches were tested and rejected, and the related documentation is retained as project archives.