Symbolic Algebra MCP Server
기호 대수 MCP 서버
Sympy-MCP는 LLM이 기호 수학 및 컴퓨터 대수를 자율적으로 수행할 수 있도록 하는 모델 컨텍스트 프로토콜(Model Context Protocol) 서버입니다. SymPy의 핵심 기능부터 MCP 클라이언트까지 다양한 도구를 제공하여 수학적 표현식과 방정식을 조작할 수 있도록 합니다.
왜?
언어 모델은 기호 조작에 정말 형편없습니다. 변수를 환각 상태로 만들고, 무작위 상수를 만들어내고, 항을 순열시키고, 전반적으로 엉망진창을 만들어냅니다. 하지만 기호 조작을 위해 특별히 설계된 컴퓨터 대수 시스템이 있으므로, 도구 호출을 사용하여 일련의 변환을 조정하고 기호 커널이 모든 복잡한 작업을 처리하도록 할 수 있습니다.
물론 LLM에서 Mathematica나 Python 코드를 생성할 수도 있지만, LLM을 에이전트나 즉석 계산기로 사용하려면 MCP 서버를 사용하고 기호 도구를 직접 노출하는 것이 더 나은 경험입니다.
이 서버는 대수 방정식 풀이, 적분 및 미분, 벡터 미적분, 일반 상대성 이론을 위한 텐서 미적분, 상미분 방정식과 편미분 방정식을 포함한 기호 수학 기능의 하위 집합을 제공합니다.
예를 들어, 자연어로 미분 방정식을 풀도록 요청할 수 있습니다.
강제 항을 사용하여 감쇠 조화 진동자를 풀어보세요. 질량-스프링-감쇠 시스템은 미분 방정식으로 설명되는데, 여기서 m은 질량, c는 감쇠 계수, k는 스프링 상수, F(t)는 외부 힘입니다.
$$ m\frac{d^2x}{dt^2} + c\frac{dx}{dt} + kx = F(t) $$
또는 일반 상대성 이론과 관련해서:
역 거리 $g^{\mu\nu}$를 사용하여 안티-드 시터 시공간에서 리치 텐서 $R_{\mu\nu}$의 추적을 계산하여 상수 스칼라 곡률 $R$을 결정합니다.
Related MCP server: ReasonForge
용법
먼저 uv가 필요합니다.
Homebrew -
brew install uv컬 -
curl -LsSf https://astral.sh/uv/install.sh | sh
그런 다음 다음 명령을 사용하여 서버를 설치하고 실행할 수 있습니다.
지엑스피1
이제 Claude Desktop 앱에서 서버를 사용할 수 있습니다. 다른 클라이언트는 아래를 참조하세요.
단일 명령으로 실행되는 완전히 독립형 버전을 원하시면 다음을 사용하세요. 단, Github에서 가져온 임의의 코드를 실행하므로 주의하세요.
uv run --with https://github.com/sdiehl/sympy-mcp/releases/download/0.1/sympy_mcp-0.1.0-py3-none-any.whl python server.py일반 상대성 이론 계산을 하려면 einsteinpy 라이브러리를 설치해야 합니다.
uv sync --group relativity사용 가능한 도구
sympy-mcp 서버는 기호 수학을 위한 다음과 같은 도구를 제공합니다.
도구 | 도구 ID | 설명 |
변수 소개 |
| 지정된 가정을 사용하여 변수를 도입하고 저장합니다. |
다중 변수 |
| 지정된 가정을 사용하여 여러 변수를 동시에 도입합니다. |
표현식 파서 |
| 사용 가능한 로컬 변수를 사용하여 표현식 문자열을 구문 분석하고 저장합니다. |
LaTeX 프린터 |
| 변수 가정과 함께 LaTeX 형식으로 저장된 표현식을 인쇄합니다. |
대수 솔버 |
| 주어진 도메인에 대해 주어진 변수에 대한 방정식을 대수적으로 풉니다. |
선형 솔버 |
| 선형 방정식 시스템을 풉니다 |
비선형 솔버 |
| 비선형 방정식 시스템을 풉니다 |
함수 변수 |
| 미분 방정식에 사용할 함수 변수를 소개합니다. |
ODE 솔버 |
| 상미분방정식을 푼다 |
편미분방정식 솔버 |
| 편미분 방정식을 풉니다 |
표준 미터법 |
| 사전 정의된 시공간 측정법(예: Schwarzschild, Kerr, Minkowski)을 생성합니다. |
메트릭 검색 |
| 사용 가능한 사전 정의된 메트릭 검색 |
텐서 계산기 |
| 메트릭(Ricci, Einstein, Weyl 텐서)에서 텐서를 계산합니다. |
사용자 정의 메트릭 |
| 제공된 구성 요소와 기호에서 사용자 지정 메트릭 텐서를 생성합니다. |
텐서 LaTeX |
| LaTeX 형식으로 저장된 텐서 표현식을 인쇄합니다. |
단순화기 |
| SymPy의 canonicalize 함수를 사용하여 수학 표현식을 단순화합니다. |
치환 |
| 다른 표현식에서 변수를 표현식으로 대체합니다. |
완성 |
| 변수에 대한 표현식을 통합합니다. |
분화 |
| 변수에 대한 표현식을 차별화합니다. |
좌표 |
| 벡터 미적분 연산을 위한 3D 좌표계를 생성합니다. |
벡터장 |
| 지정된 좌표계에 벡터 필드를 생성합니다. |
컬 |
| 벡터장의 컬을 계산합니다 |
분기 |
| 벡터장의 발산을 계산합니다 |
구배 |
| 스칼라 필드의 기울기를 계산합니다 |
단위 변환기 |
| 수량을 주어진 대상 단위로 변환합니다. |
단위 단순화기 |
| 단위를 사용하여 수량을 단순화합니다. |
매트릭스 크리에이터 |
| 제공된 데이터에서 SymPy 행렬을 생성합니다. |
결정자 |
| 행렬의 행렬식을 계산합니다 |
역행렬 |
| 행렬의 역행렬을 계산합니다 |
고유값 |
| 행렬의 고유값을 계산합니다 |
고유벡터 |
| 행렬의 고유 벡터를 계산합니다 |
기본적으로 변수는 가정을 통해 미리 정의됩니다(SymPy의 symbols() 함수 작동 방식과 유사). 달리 명시되지 않는 한, 기본 가정은 변수가 복소수체 $\mathbb{C}$에 대한 복소수이고 가환항이라는 것입니다.
재산 | 값 |
| 진실 |
| 진실 |
| 진실 |
| 거짓 |
클로드 데스크탑 설정
일반적으로 mcp install 명령은 서버를 claude_desktop_config.json 파일에 자동으로 추가합니다. 그렇지 않은 경우 구성 파일을 찾아 다음을 추가해야 합니다.
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
mcpServers 개체에 다음을 추가하고 /ABSOLUTE_PATH_TO_SYMPY_MCP/server.py sympy-mcp server.py 파일의 절대 경로로 바꿉니다.
{
"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"
]
}
}
}커서 설정
~/.cursor/mcp.json 에 다음을 추가합니다. 여기서 ABSOLUTE_PATH_TO_SYMPY_MCP sympy-mcp server.py 파일의 경로입니다.
{
"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"
]
}
}
}VS 코드 설정
VS Code와 VS Code Insiders는 이제 에이전트 모드 에서 MCP를 지원합니다. VS Code의 경우 설정에서 Chat > Agent: Enable 활성화해야 할 수 있습니다.
원클릭 설정:
또는 settings.json (전역)에 구성을 수동으로 추가합니다.
{
"mcp": {
"servers": {
"sympy-mcp": {
"command": "uv",
"args": [
"run",
"--with",
"einsteinpy",
"--with",
"mcp[cli]",
"--with",
"pydantic",
"--with",
"sympy",
"mcp",
"run",
"/ABSOLUTE_PATH_TO_SYMPY_MCP/server.py"
]
}
}
}
}서버 구성 위의 "시작"을 클릭하고 Python이나 수학 파일을 열고 채팅에서 에이전트 모드로 전환한 다음 "integrate x^2" 또는 "solve x^2 = 1"과 같은 명령을 사용해 시작해 보세요.
클라인 설정
Cline을 사용하려면 먼저 "사용법" 섹션의 명령을 사용하여 MCP 서버를 수동으로 실행해야 합니다. MCP 서버가 실행되면 Cline을 열고 상단의 "MCP 서버"를 선택하세요.
그런 다음 "원격 서버"를 선택하고 다음을 추가합니다.
서버 이름:
sympy-mcp서버 URL:
http://127.0.0.1:8081/sse
5ire 설정
백엔드에서 여러 모델(o3, o4-mini, DeepSeek-R1 등)을 지원하는 또 다른 MCP 클라이언트는 5ire입니다.
5ire 를 설정하려면 5ire를 열고 도구 -> 새로 만들기로 가서 다음 구성을 설정하세요.
도구 키:
sympy-mcp이름: SymPy MCP
명령어:
/opt/homebrew/bin/uv run --with einsteinpy --with mcp[cli] --with pydantic --with sympy mcp run /ABSOLUTE_PATH_TO/server.py
/ABSOLUTE_PATH_TO/server.py sympy-mcp server.py 파일의 실제 경로로 바꾸세요.
컨테이너에서 실행
Docker를 사용하여 로컬로 서버를 빌드하고 실행할 수 있습니다.
# Build the Docker image
docker build -t sympy-mcp .
# Run the Docker container
docker run -p 8081:8081 sympy-mcp또는 GitHub Container Registry에서 미리 빌드된 이미지를 가져올 수 있습니다.
# Pull the latest image
docker pull ghcr.io/sdiehl/sympy-mcp:latest
# Run the container
docker run -p 8081:8081 --rm ghcr.io/sdiehl/sympy-mcp:latestDocker 컨테이너를 시작하도록 Claude Desktop을 구성하려면 claude_desktop_config.json 파일을 편집하세요.
{
"mcpServers": {
"sympy-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"-p",
"8081:8081",
"--rm",
"sympy-mcp"
]
}
}
}또는 GitHub에서 미리 빌드된 컨테이너를 사용하려면:
{
"mcpServers": {
"sympy-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"-p",
"8081:8081",
"--rm",
"ghcr.io/sdiehl/sympy-mcp:latest"
]
}
}
}이 구성은 Claude Desktop이 필요할 때 Docker 컨테이너를 시작하도록 합니다. 이 구성으로 Claude Desktop을 사용하기 전에 Docker 이미지( docker build -t sympy-mcp . )를 빌드해야 합니다.
uv 명령을 docker run 명령으로 변경하면 다른 설치 방법도 Docker에서 작동하도록 조정할 수 있습니다.
예제 상호작용 1: 미분 방정식
다음은 MCP 서버를 사용하여 AI 도우미와 대화할 때 도구 호출이 작동하는 방식의 예입니다.
사용자 : 강제 항을 사용하여 감쇠 조화 진동자를 풀어보세요. 미분 방정식으로 표현되는 질량-스프링-감쇠 시스템입니다. 여기서 m은 질량, c는 감쇠 계수, k는 스프링 상수, F(t)는 외부 힘입니다.
$$ m\frac{d^2x}{dt^2} + c\frac{dx}{dt} + kx = F(t) $$
Assistant : (내부 도구 호출) 변수를 소개하는 intro_many :
{
"variables": [
{"var_name": "t", "pos_assumptions": ["real"], "neg_assumptions": []},
{"var_name": "m", "pos_assumptions": ["real", "positive"], "neg_assumptions": []},
{"var_name": "c", "pos_assumptions": ["real", "positive"], "neg_assumptions": []},
{"var_name": "k", "pos_assumptions": ["real", "positive"], "neg_assumptions": []}
]
}보조 : (내부 도구 호출) x(t)를 정의하는 introduce_function :
{
"func_name": "x"
}Assistant : (내부 도구 호출) 미분 방정식을 생성하기 위한 introduce_expression :
{
"expr_str": "Eq(m*Derivative(x(t), t, t) + c*Derivative(x(t), t) + k*x(t), F(t))"
}도우미 : (내부 도구 호출) 방정식을 보기 좋게 표시하기 위한 print_latex_expression :
{
"expr_key": "expr_12"
}결과:
$$ c \frac{d}{dt} x{\left(t \right)} + kx{\left(t \right)} + m \frac{d^{2}}{dt^{2}} x{\left(t \right)} = F{\left(t \right)} $$
보조 : (내부 도구 호출) F(t)를 정의하는 introduce_function :
{
"func_name": "F"
}보조 : (내부 도구 호출) dsolve_ode 사용하여 미분 방정식을 풉니다.
{
"expr_key": "expr_12",
"func_name": "x"
}결과:
$$ x{\left(t \right)} = C_{1} e^{\frac{t \left(- c + \sqrt{c^{2} - 4 km}\right)}{2 m}} + C_{2} e^{- \frac{t \left(c + \sqrt{c^{2} - 4 km}\right)}{2 m}} + \cdots $$
예시 상호작용 2: 일반 상대성 이론
사용자 : 역 거리 $g^{\mu\nu}$를 사용하여 Anti-de Sitter 시공간에서 Ricci 텐서 $R_{\mu\nu}$의 추적을 계산하여 상수 스칼라 곡률 $R$을 결정합니다.
Assistant : (내부 도구 호출) create_predefined_metric 사용하여 Anti-de Sitter 메트릭을 생성합니다.
{
"metric_name": "AntiDeSitter"
}Assistant : (내부 도구 호출) calculate_tensor 사용하여 Ricci 텐서를 계산합니다.
{
"metric_key": "metric_AntiDeSitter",
"tensor_type": "RICCI_TENSOR",
"simplify_result": true
}Assistant : (내부 도구 호출) Ricci 텐서를 표시하기 위한 print_latex_tensor :
{
"tensor_key": "riccitensor_metric_AntiDeSitter"
}결과:
$$ \left[\begin{matrix}3 & 0 & 0 & 0\\0 & - 3 \cos^{2}{\left(t \right)} & 0 & 0\\0 & 0 & - 3 \cos^{2}{\left(t \right)} \sinh^{2}{\left(\chi \right)} & 0\\0 & 0 & 0 & - 3 \sin^{2}{\left(\theta \right)} \cos^{2}{\left(t \right)} \sinh^{2}{\left(\chi \right)}\end{matrix}\right] $$
Assistant : (내부 도구 호출) Ricci 스칼라를 계산하기 위한 calculate_tensor :
{
"metric_key": "metric_AntiDeSitter",
"tensor_type": "RICCI_SCALAR",
"simplify_result": true
}Assistant : (내부 도구 호출) Ricci 스칼라를 표시하기 위한 print_latex_tensor :
{
"tensor_key": "ricciscalar_metric_AntiDeSitter"
}결과:
$$ -12 $$
보안 면책 조항
이 서버는 사용자 컴퓨터에서 실행되며 언어 모델에 Python 로직을 실행할 수 있는 접근 권한을 부여합니다. 특히 Sympy의 parse_expr 사용하여 수학 표현식을 파싱하는데, 이는 내부적으로 eval 사용하여 임의 코드 실행을 효과적으로 허용합니다. 서버를 실행하면 Claude가 생성하는 코드를 신뢰하게 됩니다. Docker 이미지에서 실행하는 것이 약간 더 안전하지만, 실행하기 전에 코드를 검토하는 것이 좋습니다.
특허
저작권 2025 Stephen Diehl.
이 프로젝트는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 LICENSE 파일을 참조하세요.
Available Tools
32 toolscalculate_curlA
Calculates the curl of a vector field using SymPy's curl function.
Args:
vector_field_key: The key of the vector field expression.
Example:
# First create a coordinate system
create_coordinate_system("R")
# Create a vector field F = (y, -x, 0)
vector_field = create_vector_field("R", "R_y", "-R_x", "0")
# Calculate curl
curl_result = calculate_curl(vector_field)
# Returns (0, 0, -2)
Returns:
A key for the curl expression.
Inputs: vector_field_key (required).
calculate_divergenceA
Calculates the divergence of a vector field using SymPy's divergence function.
Args:
vector_field_key: The key of the vector field expression.
Example:
# First create a coordinate system
create_coordinate_system("R")
# Create a vector field F = (x, y, z)
vector_field = create_vector_field("R", "R_x", "R_y", "R_z")
# Calculate divergence
div_result = calculate_divergence(vector_field)
# Returns 3
Returns:
A key for the divergence expression.
Inputs: vector_field_key (required).
calculate_gradientA
Calculates the gradient of a scalar field using SymPy's gradient function.
Args:
scalar_field_key: The key of the scalar field expression.
Example:
# First create a coordinate system
create_coordinate_system("R")
# Create a scalar field f = x^2 + y^2 + z^2
scalar_field = introduce_expression("R_x**2 + R_y**2 + R_z**2")
# Calculate gradient
grad_result = calculate_gradient(scalar_field)
# Returns (2x, 2y, 2z)
Returns:
A key for the gradient vector field expression.
Inputs: scalar_field_key (required).
calculate_tensorC
Calculates a tensor from a metric using einsteinpy.symbolic.
Inputs: metric_key (required), tensor_type (required), simplify_result.
convert_to_unitsA
Converts a quantity to the given target units using sympy.physics.units.convert_to.
Args:
expr_key: The key of the expression (previously introduced) to convert.
target_units: List of unit names as strings (e.g., ["meter", "1/second"]).
unit_system: Optional unit system (from UnitSystem enum). Defaults to SI.
The following units are available by default:
SI base units: meter, second, kilogram, ampere, kelvin, mole, candela
Length: kilometer, millimeter
Mass: gram
Energy: joule
Force: newton
Pressure: pascal
Power: watt
Electric: coulomb, volt, ohm, farad, henry
Constants: speed_of_light, gravitational_constant, planck
IMPORTANT: For compound units like meter/second, you must separate the numerator and
denominator into separate units in the list. For example:
- For meter/second: use ["meter", "1/second"]
- For newton*meter: use ["newton", "meter"]
- For kilogram*meter²/second²: use ["kilogram", "meter**2", "1/second**2"]
Example:
# Convert speed of light to kilometers per hour
expr_key = introduce_expression("speed_of_light")
result = convert_to_units(expr_key, ["kilometer", "1/hour"])
# Returns approximately 1.08e9 kilometer/hour
# Convert gravitational constant to CGS units
expr_key = introduce_expression("gravitational_constant")
result = convert_to_units(expr_key, ["centimeter**3", "1/gram", "1/second**2"], UnitSystem.CGS)
SI prefixes (femto, pico, nano, micro, milli, centi, deci, deca, hecto, kilo, mega, giga, tera)
can be used directly with base units.
Returns:
A key for the converted expression, or an error message.
Inputs: expr_key (required), target_units (required), unit_system.
create_coordinate_systemA
Creates a 3D coordinate system for vector calculus operations.
Args:
name: The name for the coordinate system.
coord_names: Optional list of coordinate names (3 names for x, y, z).
If not provided, defaults to [name+'_x', name+'_y', name+'_z'].
Example:
# Create a coordinate system
coord_sys = create_coordinate_system("R")
# Creates a coordinate system R with coordinates R_x, R_y, R_z
# Create a coordinate system with custom coordinate names
coord_sys = create_coordinate_system("C", ["rho", "phi", "z"])
Returns:
The name of the created coordinate system.
Inputs: name (required), coord_names.
create_custom_metricC
Creates a custom metric tensor from provided components and symbols.
Inputs: components (required), symbols (required), config.
create_matrixB
Creates a SymPy matrix from the provided data.
Args:
matrix_data: A list of lists representing the rows and columns of the matrix.
Each element can be a number or a string expression.
matrix_var_name: Optional name for storing the matrix. If not provided, a
sequential name will be generated.
Example:
# Create a 2x2 matrix with numeric values
matrix_key = create_matrix([[1, 2], [3, 4]], "M")
# Create a matrix with symbolic expressions (assuming x, y are defined)
matrix_key = create_matrix([["x", "y"], ["x*y", "x+y"]])
Returns:
A key for the stored matrix.
Inputs: matrix_data (required), matrix_var_name.
create_predefined_metricC
Creates a predefined spacetime metric.
Inputs: metric_name (required).
create_vector_fieldA
Creates a vector field in the specified coordinate system.
Args:
coord_sys_name: The name of the coordinate system to use.
component_x: String expression for the x-component of the vector field.
component_y: String expression for the y-component of the vector field.
component_z: String expression for the z-component of the vector field.
Example:
# First create a coordinate system
create_coordinate_system("R")
# Create a vector field F = (y, -x, z)
vector_field = create_vector_field("R", "R_y", "-R_x", "R_z")
Returns:
A key for the vector field expression.
Inputs: component_x (required), component_y (required), component_z (required), coord_sys_name (required).
differentiate_expressionA
Differentiates an expression with respect to a variable using SymPy's diff function.
Args:
expr_key: The key of the expression (previously introduced) to differentiate.
var_name: The name of the variable to differentiate with respect to.
order: The order of differentiation (default is 1 for first derivative).
Example:
# Introduce a variable
intro("x", [Assumption.REAL], [])
# Create an expression to differentiate: x^3
expr_key = introduce_expression("x**3")
# First derivative
first_deriv = differentiate_expression(expr_key, "x")
# Returns 3x²
# Second derivative
second_deriv = differentiate_expression(expr_key, "x", 2)
# Returns 6x
Returns:
A key for the differentiated expression.
Inputs: expr_key (required), var_name (required), order.
dsolve_odeA
Solves an ordinary differential equation using SymPy's dsolve function.
Args:
expr_key: The key of the expression (previously introduced) containing the differential equation.
func_name: The name of the function (previously introduced) to solve for.
hint: Optional solving method from ODEHint enum. If None, SymPy will try to determine the best method.
Example:
# First introduce a variable and a function
intro("x", [Assumption.REAL], [])
introduce_function("f")
# Create a second-order ODE: f''(x) + 9*f(x) = 0
expr_key = introduce_expression("Derivative(f(x), x, x) + 9*f(x)")
# Solve the ODE
result = dsolve_ode(expr_key, "f")
# Returns solution with sin(3*x) and cos(3*x) terms
Returns:
A LaTeX string representing the solution. Returns an error message string if issues occur.
Inputs: expr_key (required), func_name (required), hint.
integrate_expressionA
Integrates an expression with respect to a variable using SymPy's integrate function.
Args:
expr_key: The key of the expression (previously introduced) to integrate.
var_name: The name of the variable to integrate with respect to.
lower_bound: Optional lower bound for definite integration.
upper_bound: Optional upper bound for definite integration.
Example:
# Introduce a variable
intro("x", [Assumption.REAL], [])
# Create an expression to integrate: x^2
expr_key = introduce_expression("x**2")
# Indefinite integration
indefinite_result = integrate_expression(expr_key, "x")
# Returns x³/3
# Definite integration from 0 to 1
definite_result = integrate_expression(expr_key, "x", "0", "1")
# Returns 1/3
Returns:
A key for the integrated expression.
Inputs: expr_key (required), var_name (required), lower_bound, upper_bound.
introC
Introduces a sympy variable with specified assumptions and stores it.
Takes a variable name and a list of positive and negative assumptions.
Inputs: neg_assumptions (required), pos_assumptions (required), var_name (required).
introduce_expressionA
Parses a sympy expression string using available local variables and stores it. Assigns it to either a temporary name (expr_0, expr_1, etc.) or a user-specified global name.
Uses Sympy parse_expr to parse the expression string.
Applies default Sympy canonicalization rules unless canonicalize is False.
For equations (x^2 = 1) make the input string "Eq(x^2, 1") not "x^2 == 1"
Examples:
{expr_str: "Eq(x^2 + y^2, 1)"}
{expr_str: "Matrix(((25, 15, -5), (15, 18, 0), (-5, 0, 11)))"}
{expr_str: "pi+e", "expr_var_name": "z"}
Inputs: expr_str (required), canonicalize, expr_var_name.
introduce_functionB
Introduces a SymPy function variable and stores it.
Takes a function name and creates a SymPy Function object for use in defining differential equations.
Example:
{func_name: "f"} will create the function f(x), f(t), etc. that can be used in expressions
Returns:
The name of the created function.
Inputs: func_name (required).
intro_manyA
Introduces multiple sympy variables with specified assumptions and stores them.
Takes a list of VariableDefinition objects for the 'variables' parameter.
Each object in the list specifies:
- var_name: The name of the variable (string).
- pos_assumptions: A list of positive assumption strings (e.g., ["real", "positive"]).
- neg_assumptions: A list of negative assumption strings (e.g., ["complex"]).
The JSON payload for the 'variables' argument should be a direct list of these objects, for example:
```json
[
{
"var_name": "x",
"pos_assumptions": ["real", "positive"],
"neg_assumptions": ["complex"]
},
{
"var_name": "y",
"pos_assumptions": [],
"neg_assumptions": ["commutative"]
}
]
```
The assumptions must be consistent, so a real number is not allowed to be non-commutative.
Prefer this over intro() for multiple variables because it's more efficient.
Inputs: variables (required).
matrix_determinantA
Calculates the determinant of a matrix using SymPy's det method.
Args:
matrix_key: The key of the matrix to calculate the determinant for.
Example:
# Create a matrix
matrix_key = create_matrix([[1, 2], [3, 4]])
# Calculate its determinant
det_key = matrix_determinant(matrix_key)
# Results in -2
Returns:
A key for the determinant expression.
Inputs: matrix_key (required).
matrix_eigenvaluesB
Calculates the eigenvalues of a matrix using SymPy's eigenvals method.
Args:
matrix_key: The key of the matrix to calculate eigenvalues for.
Example:
# Create a matrix
matrix_key = create_matrix([[1, 2], [2, 1]])
# Calculate its eigenvalues
evals_key = matrix_eigenvalues(matrix_key)
Returns:
A key for the eigenvalues expression (usually a dictionary mapping eigenvalues to their multiplicities).
Inputs: matrix_key (required).
matrix_eigenvectorsA
Calculates the eigenvectors of a matrix using SymPy's eigenvects method.
Args:
matrix_key: The key of the matrix to calculate eigenvectors for.
Example:
# Create a matrix
matrix_key = create_matrix([[1, 2], [2, 1]])
# Calculate its eigenvectors
evecs_key = matrix_eigenvectors(matrix_key)
Returns:
A key for the eigenvectors expression (usually a list of tuples (eigenvalue, multiplicity, [eigenvectors])).
Inputs: matrix_key (required).
matrix_inverseA
Calculates the inverse of a matrix using SymPy's inv method.
Args:
matrix_key: The key of the matrix to invert.
Example:
# Create a matrix
matrix_key = create_matrix([[1, 2], [3, 4]])
# Calculate its inverse
inv_key = matrix_inverse(matrix_key)
Returns:
A key for the inverted matrix.
Inputs: matrix_key (required).
pdsolve_pdeA
Solves a partial differential equation using SymPy's pdsolve function.
Args:
expr_key: The key of the expression (previously introduced) containing the PDE.
If the expression is not an equation (Eq), it will be interpreted as
PDE = 0.
func_name: The name of the function (previously introduced) to solve for.
This should be a function of multiple variables.
Example:
# First introduce variables and a function
intro("x", [Assumption.REAL], [])
intro("y", [Assumption.REAL], [])
introduce_function("f")
# Create a PDE: 1 + 2*(ux/u) + 3*(uy/u) = 0
expr_key = introduce_expression(
"Eq(1 + 2*Derivative(f(x, y), x)/f(x, y) + 3*Derivative(f(x, y), y)/f(x, y), 0)"
)
# Solve the PDE
result = pdsolve_pde(expr_key, "f")
# Returns solution with exponential terms and arbitrary function
Returns:
A LaTeX string representing the solution. Returns an error message string if issues occur.
Inputs: expr_key (required), func_name (required), hint.
print_latex_expressionC
Prints a stored expression in LaTeX format, along with variable assumptions.
Inputs: expr_key (required).
print_latex_tensorC
Prints a stored tensor expression in LaTeX format.
Inputs: tensor_key (required).
quantity_simplify_unitsA
Simplifies a quantity with units using sympy's built-in simplify method for Quantity objects.
Args:
expr_key: The key of the expression (previously introduced) to simplify.
unit_system: Optional unit system (from UnitSystem enum). Not used with direct simplify method.
The following units are available by default:
SI base units: meter, second, kilogram, ampere, kelvin, mole, candela
Length: kilometer, millimeter
Mass: gram
Energy: joule
Force: newton
Pressure: pascal
Power: watt
Electric: coulomb, volt, ohm, farad, henry
Constants: speed_of_light, gravitational_constant, planck
Example:
# Simplify force expressed in base units
expr_key = introduce_expression("kilogram*meter/second**2")
result = quantity_simplify_units(expr_key)
# Returns newton (as N = kg·m/s²)
# Simplify a complex expression with mixed units
expr_key = introduce_expression("joule/(kilogram*meter**2/second**2)")
result = quantity_simplify_units(expr_key)
# Returns a dimensionless quantity (1)
# Simplify electrical power expression
expr_key = introduce_expression("volt*ampere")
result = quantity_simplify_units(expr_key)
# Returns watt
Example with Speed of Light:
# Introduce the speed of light
c_key = introduce_expression("speed_of_light")
# Convert to kilometers per hour
km_per_hour_key = convert_to_units(c_key, ["kilometer", "1/hour"])
# Simplify to get the numerical value
simplified_key = quantity_simplify_units(km_per_hour_key)
# Print the result
print_latex_expression(simplified_key)
# Shows the numeric value of speed of light in km/h
Returns:
A key for the simplified expression, or an error message.
Inputs: expr_key (required), unit_system.
reset_stateA
Resets the state of the SymPy MCP server.
Clears all stored variables, functions, expressions, metrics, tensors,
coordinate systems, and resets the expression counter.
Then reinitializes unit variables.
Runs after all tool calls for a given computation are done to reset the state for the next computation.
Returns:
A message confirming the reset.
Inputs: no named parameters.
search_predefined_metricsC
Searches for predefined metrics in einsteinpy.symbolic.predefined.
Inputs: query (required).
simplify_expressionA
Simplifies a mathematical expression using SymPy's simplify function.
Args:
expr_key: The key of the expression (previously introduced) to simplify.
Example:
# Introduce variables
intro("x", [Assumption.REAL], [])
intro("y", [Assumption.REAL], [])
# Create an expression to simplify: sin(x)^2 + cos(x)^2
expr_key = introduce_expression("sin(x)**2 + cos(x)**2")
# Simplify the expression
simplified = simplify_expression(expr_key)
# Returns 1
Returns:
A key for the simplified expression.
Inputs: expr_key (required).
solve_algebraicallyA
Solves an equation (expression = 0) algebraically for a given variable.
Args:
expr_key: The key of the expression (previously introduced) to be solved.
solve_for_var_name: The name of the variable (previously introduced) to solve for.
domain: The domain to solve in: Domain.COMPLEX, Domain.REAL, Domain.INTEGERS, or Domain.NATURALS. Defaults to Domain.COMPLEX.
Returns:
A LaTeX string representing the set of solutions. Returns an error message string if issues occur.
Inputs: expr_key (required), solve_for_var_name (required), domain.
solve_linear_systemA
Solves a system of linear equations using SymPy's linsolve.
Args:
expr_keys: The keys of the expressions (previously introduced) forming the system.
var_names: The names of the variables to solve for.
domain: The domain to solve in (Domain.COMPLEX, Domain.REAL, etc.). Defaults to Domain.COMPLEX.
Returns:
A LaTeX string representing the solution set. Returns an error message string if issues occur.
Inputs: expr_keys (required), var_names (required), domain.
solve_nonlinear_systemA
Solves a system of nonlinear equations using SymPy's nonlinsolve.
Args:
expr_keys: The keys of the expressions (previously introduced) forming the system.
var_names: The names of the variables to solve for.
domain: The domain to solve in (Domain.COMPLEX, Domain.REAL, etc.). Defaults to Domain.COMPLEX.
Returns:
A LaTeX string representing the solution set. Returns an error message string if issues occur.
Inputs: expr_keys (required), var_names (required), domain.
substitute_expressionA
Substitutes a variable in an expression with another expression using SymPy's subs method.
Args:
expr_key: The key of the expression to perform substitution on.
var_name: The name of the variable to substitute.
replacement_expr_key: The key of the expression to substitute in place of the variable.
Example:
# Create variables x and y
intro("x", [], [])
intro("y", [], [])
# Create expressions
expr1 = introduce_expression("x**2 + y**2")
expr2 = introduce_expression("sin(x)")
# Substitute y with sin(x) in x^2 + y^2
result = substitute_expression(expr1, "y", expr2)
# Results in x^2 + sin^2(x)
Returns:
A key for the resulting expression after substitution.
Inputs: expr_key (required), replacement_expr_key (required), var_name (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 32 tools
Most tools have distinct purposes, such as calculate_curl for vector calculus, differentiate_expression for derivatives, and solve_algebraically for equation solving. However, there is some overlap between intro and intro_many (both introduce variables) and between the various solve_* tools (linear, nonlinear, algebraic), which could cause minor confusion. Descriptions help clarify, but the boundaries are not perfectly sharp.
The tool names follow a consistent verb_noun pattern throughout, such as calculate_curl, create_coordinate_system, and simplify_expression. Minor deviations include intro and intro_many (abbreviated verbs) and reset_state (verb_noun but less descriptive), but overall the naming is predictable and readable.
With 32 tools, the count feels heavy for a symbolic algebra server, bordering on excessive. While the domain is broad (covering calculus, linear algebra, differential equations, units, etc.), the set includes many specialized tools that might be overwhelming. A more streamlined set of 15-25 tools could improve coherence without losing functionality.
The tool surface is highly complete for symbolic algebra, covering core operations like differentiation, integration, equation solving (algebraic, linear, nonlinear, ODEs, PDEs), matrix operations (determinant, eigenvalues, inverse), vector calculus (gradient, divergence, curl), unit conversion, and expression manipulation (simplify, substitute). There are no obvious gaps; agents can perform complex workflows from variable introduction to solution output.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Real-time planetary signal engine and Model Context Protocol (MCP) server for autonomous AI agents.
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
Related MCP Servers
- AlicenseCqualityDmaintenanceA Model Context Protocol server that enables LLMs to perform precise numerical calculations by evaluating mathematical expressions.17,291 PyPI161MIT
- AlicenseNot gradedqualityDmaintenanceProvides a suite of deterministic math tools powered by SymPy to handle algebra, calculus, linear algebra, and statistics via the Model Context Protocol. It enables smaller language models to delegate complex computations to a verified symbolic backend for accurate and reliable results.Apache 2.0
- AlicenseBqualityAmaintenanceA universal mathematics MCP server that gives LLM clients full access to SageMath for symbolic calculus, number theory, linear algebra, and more, with persistent state across tool calls.4022MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that exposes 8 mathematical tools (arithmetic, algebra, calculus, matrix operations, statistics, probability, unit conversions) to any MCP-compatible AI agent, enabling mathematical computations without code.815 npm1MIT