Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

calculator-mcp-server

MCP.Pizza Chef: huhabla

The calculator-mcp-server is an MCP server that equips LLMs like Claude with advanced mathematical capabilities, including symbolic math, statistical analysis, and matrix operations. It supports safe evaluation of expressions, equation solving, derivatives, integrals, and statistical metrics such as mean, variance, and regression. This server enables complex math computations within AI workflows, enhancing data analysis and problem-solving tasks.

Use This MCP server To

Perform symbolic math like solving equations and computing derivatives Calculate statistical metrics such as mean, variance, and correlation Execute matrix operations including addition, multiplication, and transposition Integrate advanced math capabilities into AI chatbots and assistants Automate mathematical problem solving in educational tools Support data analysis workflows with built-in statistical functions Enable real-time math computations in conversational AI environments

README

Mathematical Calculator MCP Server

This is a Model Context Protocol (MCP) server that provides Claude with advanced mathematical calculation capabilities, including symbolic math, statistical analysis, and matrix operations.

Features

The Mathematical Calculator MCP Server provides the following tools:

  • Basic Calculations: Evaluate mathematical expressions safely
  • Symbolic Mathematics:
    • Solve equations (linear, quadratic, polynomial, etc.)
    • Calculate derivatives of expressions
    • Compute integrals of expressions
  • Statistical Analysis:
    • Mean, median, mode
    • Variance, standard deviation
    • Correlation coefficient
    • Linear regression
    • Confidence intervals
  • Matrix Operations:
    • Matrix addition
    • Matrix multiplication
    • Matrix transposition

Installation

Prerequisites

  • Python 3.10+ (recommended: Python 3.11+)
  • uv (recommended) or pip
  • Claude Desktop app (to use the MCP server with Claude)

Installation Steps

  1. Clone the repository:

    git clone https://github.com/huhabla/calculator-mcp-server.git
    cd calculator-mcp-server
  2. (Option 1) Setup with the provided script:

    chmod +x setup_venv.sh
    ./setup_venv.sh

    (Option 2) Or manually set up the virtual environment:

    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
  3. Run doc-tests to verify everything works:

    bash run_doctests.sh

Integration with Claude Desktop

To use this MCP server with Claude Desktop:

  1. Make sure you have uv installed (Installation Guide)

  2. Install the MCP server in Claude Desktop:

    fastmcp install calculator_server.py

    Or with a custom name:

    fastmcp install calculator_server.py --name "Math Calculator"
  3. Once installed, Claude will automatically have access to all the mathematical tools and functions.

Usage Examples

After integrating with Claude Desktop, you can ask Claude to perform various mathematical operations. Here are some examples:

Basic Calculations

Can you calculate 3.5^2 * sin(pi/4)?

Solving Equations

Solve the following equation: x^2 - 5x + 6 = 0

Calculating Derivatives

What's the derivative of sin(x^2) with respect to x?

Computing Integrals

Calculate the integral of x^2 * e^x

Statistical Analysis

Find the mean, median, mode, and standard deviation of this dataset: [23, 45, 12, 67, 34, 23, 18, 95, 41, 23]

Linear Regression

Perform a linear regression on these points: (1,2), (2,3.5), (3,5.1), (4,6.5), (5,8.2)

Matrix Operations

Multiply these two matrices:
[1, 2, 3]
[4, 5, 6]

and

[7, 8]
[9, 10]
[11, 12]

Development

Testing

Run the comprehensive doctest suite:

bash run_doctests.sh

Interactive Development Mode

For development and debugging, you can use the FastMCP development mode:

fastmcp dev calculator_server.py

This will start a local web interface where you can test all tools interactively.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

  • FastMCP for the Pythonic MCP server framework
  • SymPy for symbolic mathematics
  • NumPy and SciPy for numerical and statistical computations

calculator-mcp-server FAQ

How do I install the calculator-mcp-server?
Install Python 3.10+, then use pip or uv to install dependencies. Follow the GitHub README for setup.
Can this MCP server handle symbolic math?
Yes, it supports solving equations, derivatives, and integrals symbolically.
What statistical functions are available?
It provides mean, median, mode, variance, standard deviation, correlation coefficient, linear regression, and confidence intervals.
Does it support matrix operations?
Yes, including matrix addition, multiplication, and transposition.
Which LLMs can use this MCP server?
Primarily designed for Claude, but can be integrated with other LLMs like OpenAI GPT and Gemini with appropriate adapters.
Is it safe to evaluate arbitrary math expressions?
Yes, the server safely evaluates expressions to prevent code injection or unsafe operations.
Can I extend this MCP server with custom math functions?
The server is open source, so you can modify or extend it to add custom capabilities.
What Python version is recommended?
Python 3.11 or higher is recommended for best compatibility and performance.