- Home
- MCP servers
- MathJS Calculator
MathJS Calculator
- javascript
0
GitHub Stars
javascript
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"edwardpwtsoi-mathjs-mcp": {
"command": "npx",
"args": [
"-y",
"mathjs-mcp-server"
]
}
}
}You have a MathJS Calculator MCP Server that offers practical mathematical capabilities through an MCP client. It lets you evaluate expressions and compute derivatives, handling complex calculations with clear feedback for invalid inputs. This server is designed to be easy to run locally and to integrate into your workflow via the MCP protocol.
How to use
Use an MCP client to connect to the MathJS Calculator MCP Server and access its two tools. The calculate tool evaluates mathematical expressions you provide, while the derivative tool returns the derivative of an expression with respect to a specified variable. You can chain calculations, test complex expressions, and request derivatives for basic to advanced math expressions. If you provide an incorrect expression or an invalid variable, you will receive a helpful error message to guide you toward a valid input.
How to install
Prerequisites you need before installing: Node.js and npm (Node.js 14+ is commonly supported). Ensure npm is available on your system.
# Install dependencies for the project
npm install
# Build the MCP server package
npm run build
Start the MCP server using the standard MCP execution pattern shown in the configuration example. The server is run via npx and uses the mathjs-mcp-server package.
npx -y mathjs-mcp-server
Optional tooling for testing and development includes the MCP Inspector. Run the inspector and connect to the local server to verify that the tools respond as expected.
npm run inspector
Additional configuration and concepts
The MCP server is configured to run as a local (stdio) process. The example configuration provided uses npx to execute the server with the mathjs-mcp-server package. You can reproduce the runtime configuration in your own setup as shown.
{
"mcpServers": {
"mathjs_calculator": {
"command": "npx",
"args": [
"-y",
"mathjs-mcp-server"
]
}
}
}
Examples of usage with the tools
Calculate an expression: provide the expression string to the calculate tool. Example inputs yield results such as evaluating 2 * (3 + 4) to 14.
Compute a derivative: provide the expression and the variable to differentiate with respect to. For example, differentiating x^2 + 2*x with respect to x yields 2*x + 2.
Available tools
calculate
Evaluates mathematical expressions provided by the client and returns the computed result.
derivative
Calculates the derivative of a given expression with respect to a specified variable.