Home / MCP / Symbolic Algebra MCP Server

Symbolic Algebra MCP Server

Provides symbolic mathematics tools via MCP, enabling LLMs to perform algebra, calculus, tensor operations, and differential equations with SymPy.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "sympy_http": {
            "url": "http://127.0.0.1:8081/sse"
        }
    }
}

You run a Symbolic Algebra MCP Server to empower language models to perform symbolic math, algebra, calculus, tensor operations, and differential equations via a trusted SymPy backend. This server exposes core symbolic tools through an MCP interface so you can orchestrate transformations and get reliable mathematical results from an LLM-powered workflow.

How to use

Connect an MCP client to the server and start issuing symbolic math tasks. You can introduce variables, define functions, parse expressions, and request algebraic solves, integrations, differentiations, and tensor calculations. Typical workflows include solving equations, differentiating expressions, integrating expressions with respect to a variable, and calculating tensors from predefined or custom metrics. You can also format outputs in LaTeX for clean display in your app.

When you start a session, you will often perform these steps: define variables with assumptions, declare any functions you will use, and then feed expressions to solve, differentiate, or integrate. The server handles the heavy symbolic lifting using SymPy, while your client manages the orchestration and presentation of results.

How to install

# Prerequisites
- Install uv (MCP runtime):
  brew install uv
- Ensure you have a working Python environment if you plan to use the python server wheel or scripts

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

# Install the server into Claude Desktop environment (example path shown)
uv run mcp install server.py

# Run the server locally
uv run mcp run server.py

If you want a completely standalone version that runs with a single command, you can start from a pre-built wheel. This approach runs code directly from the wheel and launches the server script.

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
```

Note: This starts the server using a wheel and the Python runtime; review the wheel source before running arbitrary code.

Additional content

Configure additional capabilities such as relativity tooling by installing optional dependencies like einsteinpy. If you plan to do general relativity calculations, sync the relativity group to enable those features.

uv sync --group relativity
```

To access the server from different clients, you’ll typically use either a local stdio command (uv) or a containerized http endpoint. The local stdio approach starts the MCP server process and connects to it via standard input/output. The http approach exposes a remote endpoint that clients can call via HTTP.

Configuration and connections

The server can be connected through different MCP client configurations. A local stdio setup invokes the runtime command and points to the server script. A remote http setup provides a URL that clients can call to interact with the MCP server.

Example http connection endpoint (local): http://127.0.0.1:8081/sse. Use this URL in clients that support HTTP MCP connections.

Example stdio connection (local uv command): the following command starts the MCP server with required helpers and the server script path.

Security

Running this server gives the language model access to execute Python logic. It uses symbolic math tooling under the hood and can parse expressions from strings. Review code before running in production, especially if you are loading untrusted input. Running in a Docker container provides an extra layer of isolation, but you should still audit the code being executed.

Example interaction patterns

Sample interactions illustrate how you can drive the server to perform differential equations, algebraic solving, or general relativity calculations. Define variables, introduce functions, and request specific operations such as solving an equation or computing a tensor, with the results returned in a readable format.

Available tools

intro

Introduces a variable with specified assumptions and stores it

intro_many

Introduces multiple variables with specified assumptions simultaneously

introduce_expression

Parses an expression string using available local variables and stores it

print_latex_expression

Prints a stored expression in LaTeX format, along with variable assumptions

solve_algebraically

Solves an equation algebraically for a given variable over a given domain

solve_linear_system

Solves a system of linear equations

solve_nonlinear_system

Solves a system of nonlinear equations

introduce_function

Introduces a function variable for use in differential equations

dsolve_ode

Solves an ordinary differential equation

pdsolve_pde

Solves a partial differential equation

create_predefined_metric

Creates a predefined spacetime metric (e.g. Schwarzschild, Kerr, Minkowski)

search_predefined_metrics

Searches available predefined metrics

calculate_tensor

Calculates tensors from a metric (Ricci, Einstein, Weyl tensors)

create_custom_metric

Creates a custom metric tensor from provided components and symbols

print_latex_tensor

Prints a stored tensor expression in LaTeX format

simplify_expression

Simplifies a mathematical expression using SymPy's canonicalize function

substitute_expression

Substitutes a variable with an expression in another expression

integrate_expression

Integrates an expression with respect to a variable

differentiate_expression

Differentiates an expression with respect to a variable

create_coordinate_system

Creates a 3D coordinate system for vector calculus operations

create_vector_field

Creates a vector field in the specified coordinate system

calculate_curl

Calculates the curl of a vector field

calculate_divergence

Calculates the divergence of a vector field

calculate_gradient

Calculates the gradient of a scalar field

convert_to_units

Converts a quantity to given target units

quantity_simplify_units

Simplifies a quantity with units

create_matrix

Creates a SymPy matrix from the provided data

matrix_determinant

Calculates the determinant of a matrix

matrix_inverse

Calculates the inverse of a matrix

matrix_eigenvalues

Calculates the eigenvalues of a matrix

matrix_eigenvectors

Calculates the eigenvectors of a matrix