Skip to main content

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

Method 1: Configure in Claude Desktop

Add the server to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

Add the following to the mcpServers section:

{
  "mcpServers": {
    "calculator": {
      "command": "uvx",
      "args": [
        "--from",
        "calculator-mcp-server@git+https://github.com/huhabla/calculator-mcp-server.git",
        "--",
        "calculator-mcp-server",
        "--stdio"
      ]
    }
  }
}

Note: The --stdio flag is required for proper integration with Claude Desktop. The -- separates uvx arguments from the calculator server arguments.

Method 2: Install with FastMCP

  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

mcp_calculator

Metadata

Release files for isuru211-calculator-mcp-server 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for isuru211-calculator-mcp-server 1.0.0
File Size Uploaded Provenance
isuru211_calculator_mcp_server-1.0.0.tar.gz 8.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for isuru211-calculator-mcp-server 1.0.0
File Interpreter ABI Platform
isuru211_calculator_mcp_server-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / isuru211_calculator_mcp_server-1.0.0.tar.gz

Download URL isuru211_calculator_mcp_server-1.0.0.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cb4eead2d0dd3e850d938f1c050e11cb02f26e2dd6e17a6555a1fdb0c07e107c
BLAKE2b-256 checksum
How to use checksums
570c6c575a441dd90d2fb432e288926085a3fe78e549a28b6a320e262991d8b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / isuru211_calculator_mcp_server-1.0.0-py3-none-any.whl

Download URL isuru211_calculator_mcp_server-1.0.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a626fa30721a6cbe2bd3b99361fe3431982023fca08922a2e4fbaa3804c410f
BLAKE2b-256 checksum
How to use checksums
391b0e16040168e97ae49ab882b170d2ef1705c601b3ddcd63284222062bca69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Security for isuru211-calculator-mcp-server 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page