符号数学计算服务

一个基于SymPy的符号数学计算服务,提供符号表达式、微积分、方程求解、矩阵运算等功能。

  • by daedalus
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 daedalus/mcp-sympy

使用说明

mcp症状

暴露SymPy符号数学功能的MCP服务器

安装

pip install mcp-sympy

MCP服务器

mcp名称:io.github.daedalus/mcp-sympy

用法

作为MCP服务器

在MCP客户端中配置:

{
  "mcpServers": {
    "mcp-sympy": {
      "command": "mcp-sympy",
      "env": {}
    }
  }
}

Python API

from mcp_sympy import tools

# Simplify expressions
result = tools.sympy_simplify("sin(x)**2 + cos(x)**2")
print(result)  # "1"

# Solve equations
result = tools.sympy_solve("x**2 - 4", "x")
print(result)  # "[2, -2]"

# Differentiate
result = tools.sympy_diff("x**2", "x")
print(result)  # "2*x"

# Integrate
result = tools.sympy_integrate("x**2", "x")
print(result)  # "x**3/3"

# Create matrices
result = tools.sympy_matrix("1,2; 3,4")
print(result)  # "Matrix([[1, 2], [3, 4]])"

# Number theory
result = tools.sympy_isprime("7")
print(result)  # "True"

可用工具

MCP服务器提供全面的SymPy功能,包括:

  • 符号表达式:符号、符号化、简化、扩展、因子
  • 微积分:微分、积分、极限、级数、导数、积分
  • 解决:求解、求解集、nsolve、丢番图、dsolve
  • 矩阵:矩阵运算、逆、行列式、特征值
  • 三角学:sin、cos、tan及其逆
  • 特殊功能:gamma、zeta、erf、斐波那契等。
  • 数论:isprime、prime、gcd、lcm、totient
  • 集合:终点集、区间、联合、交叉
  • 逻辑:而且,或者,不是,Xor
  • 印刷:LaTeX、MathML、Python代码

发展

git clone https://github.com/daedalus/mcp-sympy.git
cd mcp-sympy
pip install -e ".[test]"

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy src/

许可证

MIT许可证-请参阅许可证文件。