sympy-mcp
by sdiehl·★ 70·综合分 48
一个MCP服务器,通过MCP工具调用将SymPy的符号数学功能暴露给LLM。
概述
Sympy-MCP是一个全面的MCP服务器,通过模型上下文协议为LLM提供强大的符号数学功能访问。它暴露了许多SymPy工具,用于操作数学表达式、解方程、执行微积分运算,甚至处理张量微积分等高级主题。该服务器弥合了LLM和专用计算机代数系统之间的差距,使LLM能够进行准确的符号操作,而不会出现通常影响语言模型数学运算的幻觉问题。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当你需要精确的符号数学计算,并希望利用LLMs来编排数学工作流,同时避免在数学运算中出现幻觉时,选择这个服务器。
什么时候不要选它
如果你需要的是数值计算而非符号运算,或者在你无法使用Python/uv包管理的环境中工作,就不要选择这个服务器。
此 server 暴露的工具
从 README 抽取出 12 个工具introIntroduces a variable with specified assumptions and stores it
intro_manyIntroduces multiple variables with specified assumptions simultaneously
introduce_expressionParses an expression string using available local variables and stores it
solve_algebraicallySolves an equation algebraically for a given variable over a given domain
dsolve_odeSolves an ordinary differential equation
integrate_expressionIntegrates an expression with respect to a variable
differentiate_expressionDifferentiates an expression with respect to a variable
simplify_expressionSimplifies a mathematical expression using SymPy's canonicalize function
create_matrixCreates a SymPy matrix from the provided data
matrix_determinantCalculates the determinant of a matrix
calculate_tensorCalculates tensors from a metric (Ricci, Einstein, Weyl tensors)
create_predefined_metricCreates a predefined spacetime metric (e.g. Schwarzschild, Kerr, Minkowski)
可对比工具
安装
- 首先安装[uv](https://docs.astral.sh/uv/getting-started/installation/)。
# 设置项目
git clone https://github.com/sdiehl/sympy-mcp.git
cd sympy-mcp
uv sync
# 安装服务器到Claude Desktop
uv run mcp install server.py
# 运行服务器
uv run mcp run server.py对于Claude Desktop配置:
{
"mcpServers": {
"sympy-mcp": {
"command": "/opt/homebrew/bin/uv",
"args": [
"run",
"--with",
"einsteinpy",
"--with",
"mcp[cli]",
"--with",
"pydantic",
"--with",
"sympy",
"mcp",
"run",
"/ABSOLUTE_PATH_TO_SYMPY_MCP/server.py"
]
}
}
}FAQ
- 这个MCP服务器支持哪些数学运算?
- 服务器支持代数方程求解、积分和微分、矢量微积分、广义相对论的张量微积分、常微分方程和偏微分方程、矩阵运算、单位转换等。
- 这个服务器能处理广义相对论计算吗?
- 是的,它可以从度规计算张量(里奇张量、爱因斯坦张量、外尔张量),并包含预定义的时空度规,如史瓦西度规、克尔度规和闵可夫斯基度规。要进行广义相对论计算,需要安装einsteinpy库。
sympy-mcp 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。