The Symbolic Algebra MCP Server enables language models to perform symbolic mathematics and computer algebra by providing access to SymPy's functionality. It allows LLMs to handle symbolic manipulation tasks they typically struggle with, such as solving equations, performing calculus, and working with vector and tensor mathematics.
First, install uv:
brew install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository
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
For a standalone version that runs with a single command:
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
For general relativity calculations, install the Einstein library:
uv sync --group relativity
You can use Docker to run the server:
# Pull the pre-built image
docker pull ghcr.io/sdiehl/sympy-mcp:main
# Run the container
docker run -p 8081:8081 --rm ghcr.io/sdiehl/sympy-mcp:main
Or build and run locally:
# Build the Docker image
docker build -t sympy-mcp .
# Run the Docker container
docker run -p 8081:8081 sympy-mcp
The mcp install
command should automatically configure Claude Desktop. If not, edit the config file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
Add the following to the mcpServers
object:
{
"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 supports MCPs in agent mode. Enable Chat > Agent: Enable
in settings.
Manual Configuration: Add to your 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"
]
}
}
}
}
Or for Docker:
{
"mcp": {
"servers": {
"sympy-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"-p",
"8081:8081",
"--rm",
"ghcr.io/sdiehl/sympy-mcp:main"
]
}
}
}
}
sympy-mcp
http://127.0.0.1:8081/sse
In 5ire, go to Tools -> New and set:
sympy-mcp
/opt/homebrew/bin/uv run --with einsteinpy --with mcp[cli] --with pydantic --with sympy mcp run /ABSOLUTE_PATH_TO/server.py
The server provides over 30 symbolic mathematics tools, including:
intro
, intro_many
)introduce_expression
, print_latex_expression
)solve_algebraically
, solve_linear_system
, solve_nonlinear_system
)dsolve_ode
, pdsolve_pde
)integrate_expression
, differentiate_expression
)create_predefined_metric
, calculate_tensor
)create_vector_field
, calculate_curl
, calculate_divergence
)create_matrix
, matrix_determinant
, matrix_eigenvalues
)You can solve differential equations like the damped harmonic oscillator:
m*d²x/dt² + c*dx/dt + kx = F(t)
The server will:
For tensor calculations, you can:
Compute the trace of the Ricci tensor using the inverse metric for Anti-de Sitter spacetime
The server will:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "sympy-mcp" '{"command":"uv","args":["run","--with","einsteinpy","--with","mcp[cli]","--with","pydantic","--with","sympy","mcp","run","/ABSOLUTE_PATH_TO_SYMPY_MCP/server.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"sympy-mcp": {
"command": "uv",
"args": [
"run",
"--with",
"einsteinpy",
"--with",
"mcp[cli]",
"--with",
"pydantic",
"--with",
"sympy",
"mcp",
"run",
"/ABSOLUTE_PATH_TO_SYMPY_MCP/server.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"sympy-mcp": {
"command": "uv",
"args": [
"run",
"--with",
"einsteinpy",
"--with",
"mcp[cli]",
"--with",
"pydantic",
"--with",
"sympy",
"mcp",
"run",
"/ABSOLUTE_PATH_TO_SYMPY_MCP/server.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect