SymPy Calculator
About
Provides symbolic mathematics capabilities through a Python-based server that leverages SymPy for complex calculations, equation solving, and mathematical manipulation.
Details
- Author
- 611711dark
- Repository
- 611711Dark/mcp_calculate_server
- GitHub stars
- 2
- Downloads
- 128
- License
- MIT License
- Categories
- Design, Developer Tools, AI, Frontend, Infrastructure, Other
Jump to
- Basic Operations: Addition, subtraction, multiplication, division, exponentiation
- Algebraic Operations: Expression expansion, factorization, simplification
- Calculus: Differentiation, integration (definite/indefinite), limit calculation
- Equation Solving: Algebraic equations, systems of equations
- Matrix Operations: Matrix inversion, eigenvalues/eigenvectors calculation
- Series Expansion: Taylor series expansion
- Special Functions: Trigonometric, logarithmic, exponential functions
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
SymPy CalculatorCommand (node, npx, python, etc.)pythonArguments-
Argument 1
server.py
Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
-
Argument 1
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
To install Calculate Server for Claude Desktop automatically via Smithery:
bashnpx -y @smithery/cli install @611711Dark/mcp_sympy_calculate_server --client claude
1. Clone repository:
bashgit clone https://github.com/611711Dark/mcp_calculate_server.git
cd mcp_calculate_server
2. Create virtual environment and install dependencies:
bashuv venv
source .venv/bin/activate
uv pip install -e .
3. Configuration:
json"calculate_expression1": {
"isActive": false,
"command": "python",
"args": [
"server.py"
],
"cwd": "/path/to/mcp_calculate_server"
}
``
Call
calculate_expression tool via MCP protocol by passing a mathematical expression string. The parser accepts a restricted set of SymPy expressions such as arithmetic, expand, factor, simplify, diff, integrate, limit, series, solve, Matrix(...).det()/inv()/eigenvals()/eigenvects(), and Sum(...).doit()`.calculate_expression
Call this tool to evaluate a mathematical expression string using the MCP protocol. Accepts a restricted set of SymPy expressions such as arithmetic, expand, factor, simplify, diff, integrate, limit, series, solve, and matrix operations.
expand
Expand a given algebraic expression.
factor
Factor a given algebraic expression.
simplify
Simplify a given algebraic expression.
diff
Differentiate a given expression with respect to a variable.
integrate
Integrate a given expression, supports both definite and indefinite integrals.
limit
Calculate the limit of an expression as a variable approaches a specified value.
solve
Solve algebraic equations or systems of equations.
Matrix.inv
Calculate the inverse of a given matrix.
Matrix.eigenvals
Calculate the eigenvalues of a given matrix.
Matrix.eigenvects
Calculate the eigenvectors of a given matrix.
Sum.doit
Evaluate a summation expression.
series
Calculate the series expansion of a function around a specified point.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"sympy calculator": {
"cwd": "/path/to/mcp_calculate_server",
"env": {},
"args": [
"server.py"
],
"command": "python"
}
}
}
Linux
{
"cwd": "/path/to/mcp_calculate_server",
"env": [],
"args": [
"server.py"
],
"command": "python"
}
Macos
{
"cwd": "/path/to/mcp_calculate_server",
"env": [],
"args": [
"server.py"
],
"command": "python"
}
Windows
{
"cwd": "/path/to/mcp_calculate_server",
"env": [],
"args": [
"server.py"
],
"command": "python"
}
MCP Calculate Server
A mathematical calculation service based on MCP protocol and SymPy library, providing powerful symbolic computation capabilities.
Security
As of version 0.1.1, the server parses expressions through a restricted SymPy-only evaluator. It does not execute arbitrary Python code, and only a curated set of mathematical symbols, functions, and matrix methods are supported.
This release also adds validation for oversized expressions and large results to reduce denial-of-service risk from expensive symbolic computations.
Key Features
- Basic Operations: Addition, subtraction, multiplication, division, exponentiation
- Algebraic Operations: Expression expansion, factorization, simplification
- Calculus: Differentiation, integration (definite/indefinite), limit calculation
- Equation Solving: Algebraic equations, systems of equations
- Matrix Operations: Matrix inversion, eigenvalues/eigenvectors calculation
- Series Expansion: Taylor series expansion
- Special Functions: Trigonometric, logarithmic, exponential functions
Usage Examples
# Basic operations
"2 + 35" → 17
Algebraic operations
"expand((x + 1)2)" → x² + 2x + 1
"factor(x2 - 2x - 15)" → (x - 5)(x + 3)
Calculus
"diff(sin(x), x)" → cos(x)
"integrate(exp(x), (x, 0, 1))" → E - 1
"integrate(exp(-x2)*sin(x), (x, -oo, oo))" → 0
"limit(tan(x)/x, x, 0)" → 1
Equation solving
"solve(x2 - 4, x)" → [-2, 2]
"solve([x2 + y2 - 1, x + y - 1], [x, y])" → [(0, 1), (1, 0)]
Matrix operations
"Matrix([[1, 2], [3, 4]]).inv()" → [[-2, 1], [3/2, -1/2]]
"Matrix([[1, 2, 3], [4, 5, 6]]).eigenvals()" → {9/2 - sqrt(33)/2: 1, 9/2 + sqrt(33)/2: 1}
"Sum(k, (k, 1, 10)).doit()" → 55
"series(cos(x), x, 0, 4)" → 1 - x²/2 + O(x⁴)
Installation
Installing via Smithery
To install Calculate Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @611711Dark/mcp_sympy_calculate_server --client claude
Local Installation
1. Clone repository:
git clone https://github.com/611711Dark/mcp_calculate_server.git
cd mcp_calculate_server
2. Create virtual environment and install dependencies:
uv venv
source .venv/bin/activate
uv pip install -e .
3. Configuration:
"calculate_expression1": {
"isActive": false,
"command": "python",
"args": [
"server.py"
],
"cwd": "/path/to/mcp_calculate_server"
}
API Usage
Call calculate_expression tool via MCP protocol by passing a mathematical expression string. The parser accepts a restricted set of SymPy expressions such as arithmetic, expand, factor, simplify, diff, integrate, limit, series, solve, Matrix(...).det()/inv()/eigenvals()/eigenvects(), and Sum(...).doit().
Supported Names
- Symbols: lowercase variables such as x, y, z, and k
- Constants: pi, E, oo, I
- Functions: Abs, sin, cos, tan, log, exp, sqrt, expand, factor, simplify, diff, integrate, limit, series, solve, Sum, Matrix
- Matrix methods: .det(), .inv(), .eigenvals(), .eigenvects()
- SymPy method: .doit() on supported objects such as Sum(...)
Validation Rules
Expressions that rely on arbitrary Python features, imports, filesystem access, or other non-mathematical constructs are intentionally rejected.
Very large expansions, high-complexity solves, and oversized results may also be rejected to reduce denial-of-service risk.
Keyword arguments, private attributes, unsupported matrix methods, malformed matrices, and unsupported names are rejected with an error message.
Dependencies
- mcp>=1.5.0
- sympy>=1.13.3
Acknowledgements
Thanks to this blog post for the introduction, and to Stefano for his help and responsible disclosure.License
This project is licensed under MIT License. See LICENSE file.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




