A FastMCP server for solving algebraic equations using SymPy.
- Solve linear equations algebraically
- Get step-by-step solutions
- Easy integration with Claude Desktop and other MCP clients
This project uses pipenv for dependency management. The required dependencies are:
- sympy
- fastmcp
- npx(for running the MCP Inspector)
These dependencies are already specified in the Pipfile at the root of the project with the exception of npx.
Compiled binaries for Linux(amd64 and arm64) and macOS(arm64) can be found here. Download the appropriate binary for your platform, and run: ./<FILENAME>.
Note
Windows binaries will be released fairly soon.
Warning
Note that macOS may throw an error when you try running the binary since these binaries are unsigned. To get around that, open System Settings > Privacy & Security. Scroll down and you'll see the equationscp binary being flagged with an option to allow the executable to run anyway. Click that, and you may be asked to authenticate with your root password / TouchID.
Congratulations! The MCP server is now running. It runs listening for MCP requests over stdio by default, but this will be made more flexible to accomodate streamable HTTP or SSE in the future. You can now configure Claude Desktop using the instructions documented here: https://modelcontextprotocol.io/quickstart/server#testing-your-server-with-claude-for-desktop. Here's what a sample claude_desktop_config.json would look like:
{
"mcpServers": {
"equationscp": {
"command": "/Users/rudimk/Downloads/equationscp-v0.1.0-rc-2505150621-darwin-arm64",
"args": []
}
}
}Restart Claude Desktop, and you should now be able to use the MCP server. Here's what it looks like in action:
Claude asking for permission to call EquationsCP
The equation being converted to an input for the MCP server
The MCP server's output along with how Claude finally renders the solution
To start the server, run:
pipenv run stdio-serverOr alternatively:
fastmcp run server.pyThis will start the MCP server and listen for calls over stdio.
To run the app in HTTP mode(with SSE):
pipenv run http-serverOr alternatively:
fastmcp run server.py --transport sse --host 127.0.0.1 --port 4242The server will start on http://127.0.0.1:4242.
Warning
The SSE transport has no authentication. Keep it bound to loopback; do not expose it to a network without putting authentication in front of it.
TBD, since I refuse to spend $100 every month on a Claude Max plan just to test support for adding HTTP-based MCP servers. We'll wait for our friends to Anthropic to release this in GA.
pipenv install --dev
pipenv run testIf you have npx available, you can use the MCP Inspector:
pipenv run inspectorAlternatively:
npx @modelcontextprotocol/inspector fastmcp run server.pyThis will allow you to access the MCP Inspector at http://127.0.0.1:6274, where you can list available tools, and run sample calls against them.
The server exposes a tool called solve_linear_equation that can be used to solve linear equations.
{
"equation": "2*x + 3 = 7",
"variable": "x"
}Responses are tagged with an outcome — one of solved, no_solution, infinite_solutions or error. See docs/linear-equations.md for the full contract.
{
"outcome": "solved",
"solution": {
"variable": "x",
"value": "2",
"float_value": 2.0
},
"steps": [
"Original equation: 2*x + 3 = 7",
"Equation in symbolic form: 2*x + 3 = 7",
"Subtract 3 from both sides: 2*x = 4",
"Divide both sides by 2: x = 2",
"Solution: x = 2"
]
}solution.value is the exact result as a string, so 1/3 stays 1/3 instead of being rounded. float_value carries the decimal approximation alongside it, and is null for complex or symbolic results.
Input:
{
"equation": "-3*y + 5 = 8",
"variable": "y"
}Output:
{
"outcome": "solved",
"solution": {
"variable": "y",
"value": "-1",
"float_value": -1.0
},
"steps": [
"Original equation: -3*y + 5 = 8",
"Equation in symbolic form: 5 - 3*y = 8",
"Subtract 5 from both sides: -3*y = 3",
"Divide both sides by -3: y = -1",
"Solution: y = -1"
]
}Input:
{
"equation": "3*x = 1",
"variable": "x"
}Output:
{
"outcome": "solved",
"solution": {
"variable": "x",
"value": "1/3",
"float_value": 0.3333333333333333
},
"steps": [
"Original equation: 3*x = 1",
"Equation in symbolic form: 3*x = 1",
"Divide both sides by 3: x = 1/3",
"Solution: x = 1/3 (≈ 0.3333333333333333)"
]
}The tool answers linear equations or says why it can't. It will not return one root of a quadratic as though it were the answer.
Input:
{
"equation": "x**2 + x = 4",
"variable": "x"
}Output:
{
"outcome": "error",
"error": "not_linear",
"message": "This equation is of degree 2 in x; only linear equations are supported.",
"steps": [
"Original equation: x**2 + x = 4",
"Equation in symbolic form: x**2 + x = 4"
]
}- Support for quadratic equations
- Support for systems of linear equations
- Support for symbolic solutions (with parameters)
- Support for differential equations
- Support for a lot more(differential and integral calculus, combinatorics, discrete math, matrix and linear algebra among others)