{
"mcpServers": {
"mcp-server-sagemath": {
"command": "<see-readme>",
"args": []
}
}
}No install config available. Check the server's README for setup instructions.
Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
基于 Model Context Protocol (MCP) 的本地 SageMath 服务端,当前提供两项工具:
Is it safe?
No package registry to scan.
No authentication — any process on your machine can connect.
MIT. View license →
Is it maintained?
Last commit 117 days ago. 9 stars.
Will it work with my client?
Transport: stdio, sse, http. Works with Claude Desktop, Cursor, Claude Code, and most MCP clients.
Context cost
3 tools. ~200 tokens (0.1% of 200K).
No automated test available for this server. Check the GitHub README for setup instructions.
No known vulnerabilities.
sagemath_version查询本地 SageMath 版本,检测 SageMath 是否安装及版本信息。
sagemath_evaluate执行 SageMath 脚本并返回标准输出/错误。将代码写入临时文件后调用 SageMath 执行。
sagemath_health轻量级自检,验证 SageMath 可用性。尝试执行简单计算并返回状态。
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Dynamic problem-solving through sequential thought chains
A Model Context Protocol server for searching and analyzing arXiv papers
An open-source AI agent that brings the power of Gemini directly into your terminal.
The official Python SDK for Model Context Protocol servers and clients
MCP Security Weekly
Get CVE alerts and security updates for Mcp Server Sagemath and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
基于 Model Context Protocol (MCP) 的本地 SageMath 服务端,当前提供两项工具:
sagemath_version:查询本地 SageMath 版本。sagemath_evaluate:执行 SageMath 脚本并返回标准输出/错误。sagemath_health:轻量级自检,验证 SageMath 可用性。项目处于早期预览阶段(v0.0.1)。
GET /mcp 与 POST /mcp)。项目在运行时按照以下优先级查找 SageMath 可执行文件:
src/config.ts 中的 config.sagePath(若设置为非空字符串)。SAGE_PATH。sage 命令。默认情况下,config.sagePath 会读取 SAGE_PATH 环境变量的值;如需固定路径,可在该文件内显式填写,例如:
export const config = {
sagePath: "/opt/sage/bin/sage",
};
npm install
npm run buildnode dist/index.jsnpx -y tsx src/test/stdio-client.ts
MCP_TRANSPORT=http npm run dev
http://localhost:3000/mcp,可通过 PORT 环境变量调整端口。MCP_TRANSPORT=http npx -y tsx src/test/client.ts
GET /mcp:用于 SSE/流式 JSON-RPC。POST /mcp:标准 JSON-RPC over HTTP。{
"mcpServers": {
"sagemath-server": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-sagemath/dist/index.js"],
"autoApprove": ["sagemath_version", "sagemath_evaluate"],
"env": {
// "SAGE_PATH": "/absolute/path/to/sage" // 可选
}
}
}
}
{
"mcpServers": {
"sagemath-server-http": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-sagemath/dist/index.js"],
"env": {
"MCP_TRANSPORT": "http",
"PORT": "3000"
}
}
}
}
sagemath_versionstdout, stderr, exitCode, durationMs, timedOut。sagemath_evaluatecode (string) — 必填,SageMath 脚本。timeoutMs (number) — 可选,超时时间,默认 10000 ms。sagemath_healthprint(1+1)。ok(布尔)、message(字符串)、details(包含 stdout/stderr/exitCode 等)。npx -y tsx src/test/stdio-client.tsMCP_TRANSPORT=http npx -y tsx src/test/client.tsstructuredContent(JSON 对象),并附带简短文本提示;不再需要从 content[0].text 手动 JSON 解析。sagemath_health 确认 SageMath 可用,再调用其他工具。http://localhost:3000/mcp(可改 PORT)。支持 GET /mcp(SSE/流式 JSON-RPC)与 POST /mcp。node dist/index.js(或开发模式 npx -y tsx src/index.ts)。sagemath_evaluate 可执行任意 Sage 代码;HTTP 模式建议放在受控网络或加鉴权/限流。~/.config/modelcontext/mcp.json 里增加:
{
"mcpServers": {
"sagemath-server": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-sagemath/dist/index.js"],
"autoApprove": ["sagemath_version", "sagemath_evaluate", "sagemath_health"],
"env": {
// "SAGE_PATH": "/absolute/path/to/sage"
}
}
}
}
希望走 HTTP 时,可改用:
{
"mcpServers": {
"sagemath-server-http": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-sagemath/dist/index.js"],
"env": {
"MCP_TRANSPORT": "http",
"PORT": "3000"
},
"client": {
"url": "http://localhost:3000/mcp"
}
}
}
}
若希望 Claude 直接以 STDIO 启动:
{
"mcpServers": {
"sagemath-server": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-sagemath/dist/index.js"],
"autoApprove": ["sagemath_version", "sagemath_evaluate", "sagemath_heal
... [View full README on GitHub](https://github.com/GaloisHLee/mcp-server-sagemath#readme)