一个基于MCP协议和SymPy库的数学计算服务,提供强大的符号计算功能,能满足各类复杂数学计算需求。
本服务是基于MCP协议和SymPy库构建的数学计算服务,借助它可实现强大的符号计算功能。你可以按照下面的安装指南进行安装,然后参考使用示例开展计算工作。
# 基本运算
"2 + 3*5" → 17
# 代数运算
"expand((x + 1)**2)" → x² + 2x + 1
"factor(x**2 - 2*x - 15)" → (x - 5)(x + 3)
# 微积分
"diff(sin(x), x)" → cos(x)
"integrate(exp(x), (x, 0, 1))" → E - 1
"limit(tan(x)/x, x, 0)" → 1
# 方程求解
"solve(x**2 - 4, x)" → [-2, 2]
"solve([x**2 + y**2 - 1, x + y - 1], [x, y])" → [(0, 1), (1, 0)]
# 矩阵运算
"Matrix([[1, 2], [3, 4]]).inv()" → [[-2, 1], [3/2, -1/2]]
"Matrix([[1, 2, 3], [4, 5, 6]]).eigenvals()" → {9/2 - sqrt(33)/2: 1, 9/2 + sqrt(33)/2: 1}
要通过 Smithery 自动安装 Calculate Server for Claude Desktop:
npx -y @smithery/cli install @611711Dark/mcp_sympy_calculate_server --client claude
克隆仓库:
git clone https://github.com/611711Dark/mcp-calculate-server.git
cd mcp-calculate-server
创建虚拟环境并安装依赖项:
uv venv
source .venv/bin/activate
uv pip install -e .
配置:
"calculate_expression1": {
"isActive": false,
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/mcp_calculate_server",
"server.py"
],
}
通过 MCP 协议调用 calculate_expression 工具,传递数学表达式字符串,即可返回计算结果。
本项目依赖以下库来实现各项功能:
| 属性 | 详情 |
|---|---|
| 依赖项 | mcp>=1.5.0、sympy>=1.13.3、fastapi>=0.95.0、uvicorn>=0.21.0 |
本项目 licensed under MIT License。更多内容请查看 LICENSE 文件。
English Version