
Sagemath Mcp Server
io.github.justice8096由 GitHub 账号 justice8096 发布v1.0.1更新于 Oct 25, 2026
MCP server wrapping SageMath's full computer algebra system — 10 symbolic-math tools for LLMs.
概览
一个本地 MCP 服务器,封装 SageMath,为助手提供 10 个精确符号数学工具:解方程、微积分、因式分解、矩阵、数论、绘图与 LaTeX 转换。
- 可以做什么
- 运行任意 SageMath 表达式,并符号化求解代数或超越方程。计算任意阶导数与不定/定积分,并按多种模式化简表达式。对多项式或整数做因式分解,执行行列式、逆、特征值、秩、RREF 等矩阵运算。进行素数判定、下一个素数、欧拉函数、gcd、lcm、素数区间等数论运算。将表达式绘制为 base64 PNG 图像,并转换为 LaTeX。
- 适用场景
- 当助手需要可靠的精确或符号计算而非心算时使用:多步代数、微积分、矩阵运算、数论,或为数学文稿生成 LaTeX 与图像。
- 运行要求
- 以 Node.js 18 或更高版本的本地进程运行,从 npm 安装。需要本机已安装 SageMath 且 sage 在 PATH 中,或需要 Docker 来运行 SageMath 镜像。可选环境变量:TRANSPORT、PORT、API_KEY、SAGE_TIMEOUT、SAGE_DOCKER_IMAGE。
安装
在 SourceWeft 中
- 打开 控制台中的 Sagemath Mcp Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
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.
Tools
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
Option 2: Docker (no local SageMath required)
Option 3: from source
Configuring an MCP client
Claude Desktop / Claude Code (stdio transport)
Add to ~/.claude.json (or the equivalent Claude Desktop config):
Remote / HTTP transport
Then 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
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.
来源:README.md,提交 da1a377
工具
0版本历史
1- v1.0.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分