Home / MCP / Symbolic Algebra MCP Server
Provides symbolic mathematics tools via MCP, enabling LLMs to perform algebra, calculus, tensor operations, and differential equations with SymPy.
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.
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.
# 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.pyIf 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.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.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.
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.
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.
Introduces a variable with specified assumptions and stores it
Introduces multiple variables with specified assumptions simultaneously
Parses an expression string using available local variables and stores it
Prints a stored expression in LaTeX format, along with variable assumptions
Solves an equation algebraically for a given variable over a given domain
Solves a system of linear equations
Solves a system of nonlinear equations
Introduces a function variable for use in differential equations
Solves an ordinary differential equation
Solves a partial differential equation
Creates a predefined spacetime metric (e.g. Schwarzschild, Kerr, Minkowski)
Searches available predefined metrics
Calculates tensors from a metric (Ricci, Einstein, Weyl tensors)
Creates a custom metric tensor from provided components and symbols
Prints a stored tensor expression in LaTeX format
Simplifies a mathematical expression using SymPy's canonicalize function
Substitutes a variable with an expression in another expression
Integrates an expression with respect to a variable
Differentiates an expression with respect to a variable
Creates a 3D coordinate system for vector calculus operations
Creates a vector field in the specified coordinate system
Calculates the curl of a vector field
Calculates the divergence of a vector field
Calculates the gradient of a scalar field
Converts a quantity to given target units
Simplifies a quantity with units
Creates a SymPy matrix from the provided data
Calculates the determinant of a matrix
Calculates the inverse of a matrix
Calculates the eigenvalues of a matrix
Calculates the eigenvectors of a matrix