Skip to main content
Glama
Symbolic Algebra MCP Server
by sdiehl

シンボリック代数MCPサーバー

Sympy-MCPは、LLMが自律的に記号数学とコンピュータ代数を実行できるようにするモデルコンテキストプロトコル(CMP)サーバーです。Sympy-MCPは、数式や方程式を操作するための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

使用法

まず紫外線が必要です。

  • 自作- brew install uv

  • Curl - curl -LsSf https://astral.sh/uv/install.sh | sh

次に、次のコマンドを使用してサーバーをインストールして実行します。

# Setup the project
git clone https://github.com/sdiehl/sympy-mcp.git
cd sympy-mcp
uv sync

# Install the server to Claude Desktop
uv run mcp install server.py

# Run the server
uv run mcp run server.py

Claudeデスクトップアプリでサーバーが利用可能になっているはずです。他のクライアントについては、以下をご覧ください。

単一のコマンドで実行できる完全なスタンドアロンバージョンが必要な場合は、以下をご利用ください。ただし、これは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

説明

変数の導入

intro

指定された仮定を持つ変数を導入し、それを保存します

複数の変数

intro_many

指定された仮定に基づいて複数の変数を同時に導入する

式パーサー

introduce_expression

利用可能なローカル変数を使用して式文字列を解析し、保存します。

LaTeXプリンター

print_latex_expression

保存された式を変数の仮定とともにLaTeX形式で出力します。

代数ソルバー

solve_algebraically

与えられた変数について、与えられたドメインで方程式を代数的に解く

線形ソルバー

solve_linear_system

線形方程式を解く

非線形ソルバー

solve_nonlinear_system

非線形方程式系を解く

関数変数

introduce_function

微分方程式で使用する関数変数を導入する

ODE ソルバー

dsolve_ode

常微分方程式を解く

PDE ソルバー

pdsolve_pde

偏微分方程式を解く

標準メートル法

create_predefined_metric

定義済みの時空メトリック(例:シュワルツシルト、カー、ミンコフスキー)を作成します。

メトリック検索

search_predefined_metrics

利用可能な定義済みメトリックを検索します

テンソル計算機

calculate_tensor

計量からテンソルを計算します(リッチ、アインシュタイン、ワイルテンソル)

カスタムメトリック

create_custom_metric

提供されたコンポーネントとシンボルからカスタム計量テンソルを作成します

テンソルLaTeX

print_latex_tensor

保存されたテンソル式をLaTeX形式で出力します。

簡素化者

simplify_expression

SymPyの正規化関数を使用して数式を簡略化します

代替

substitute_expression

変数を別の式の式に置き換えます

統合

integrate_expression

変数に関して式を積分する

差別化

differentiate_expression

変数に関して式を微分する

座標

create_coordinate_system

ベクトル計算演算用の3D座標系を作成します

ベクトル場

create_vector_field

指定された座標系にベクトル場を作成します

カール

calculate_curl

ベクトル場の回転を計算する

発散

calculate_divergence

ベクトル場の発散を計算する

勾配

calculate_gradient

スカラー場の勾配を計算する

単位換算

convert_to_units

数量を指定された目標単位に変換します

単位簡略化器

quantity_simplify_units

単位付きの量を簡略化する

マトリックスクリエイター

create_matrix

提供されたデータからSymPy行列を作成する

行列式

matrix_determinant

行列の行列式を計算します

逆行列

matrix_inverse

逆行列を計算します

固有値

matrix_eigenvalues

行列の固有値を計算します

固有ベクトル

matrix_eigenvectors

行列の固有ベクトルを計算する

デフォルトでは、変数は仮定に基づいて事前定義されます(SymPyのsymbols()関数の動作に似ています)。特に指定がない限り、変数は複素体$\mathbb{C}$上の複素可換項であるという仮定がデフォルトで適用されます。

財産

価値

commutative

真実

complex

真実

finite

真実

infinite

間違い

クロードデスクトップセットアップ

通常、 mcp installコマンドはclaude_desktop_config.jsonファイルにサーバーを自動的に追加します。追加されない場合は、設定ファイルを見つけて以下の行を追加してください。

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

mcpServersオブジェクトに以下を追加し、 /ABSOLUTE_PATH_TO_SYMPY_MCP/server.py 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 Code のセットアップ

VS Code および VS Code Insiders は、エージェントモードで MCP をサポートするようになりました。VS Code の場合は、設定でChat > Agent: Enableを有効にする必要があります。

  1. ワンクリックセットアップ:

VS Codeにインストール

VS Code Insiders にインストール

または、 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"
        ]
      }
    }
  }
}
  1. サーバー設定の上にある「開始」をクリックし、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:latest

Claude Desktop が Docker コンテナを起動するように構成するには、 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) $$

アシスタント: (内部ツール呼び出し) 変数を導入するための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"
}

アシスタント: (内部ツール呼び出し) 微分方程式を作成するための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}$を使用してリッチテンソル$R_{\mu\nu}$のトレースを計算し、その定数スカラー曲率$R$を決定します。

アシスタント: (内部ツール呼び出し) create_predefined_metric Anti-de Sitter メトリックを作成します。

{
  "metric_name": "AntiDeSitter"
}

アシスタント: (内部ツール呼び出し) Ricci テンソルを計算するcalculate_tensor :

{
  "metric_key": "metric_AntiDeSitter",
  "tensor_type": "RICCI_TENSOR",
  "simplify_result": true
}

アシスタント: (内部ツール呼び出し) 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] $$

アシスタント: (内部ツール呼び出し) Ricci スカラーを計算するcalculate_tensor :

{
  "metric_key": "metric_AntiDeSitter",
  "tensor_type": "RICCI_SCALAR",
  "simplify_result": true
}

アシスタント: (内部ツール呼び出し) 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 tools
calculate_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.

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

    B3.4/5.0

    Scored across 32 tools

    Disambiguation4/5

    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.

    Naming Consistency4/5

    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.

    Tool Count3/5

    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.

    Completeness5/5

    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

    ActivitySlowing
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides 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
    • A
      license
      A
      quality
      D
      maintenance
      A 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.
      8
      15 npm
      1
      MIT