
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 分