math-mcp

avanishd-3/math-mcp

3.2

If you are the rightful owner of math-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This is a Math MCP Server capable of performing basic arithmetic operations and matrix multiplication with 64-bit precision.

Math MCP Server

Overview

This is an MCP (Model Context Protocol) server that can do basic arithmetic in 64 bit precision, along with matrix multiplication.

Math Server MCP server

Features

  • Addition

  • Subtraction

  • Multiplication

  • Division

  • Matrix multiplication

Installation

Prerequisities

Ensure you have the following installed:

  • Python 3.13+
  • uv
Installing UV

See installation guide for all options.

Unix/MacOS
curl -LsSf https://astral.sh/uv/install.sh | sh

or

brew install uv
Windows
winget install --id=astral-sh.uv  -e

Clone the Repository

git clone https://github.com/avanishd-3/math-mcp.git
cd math-mcp-server
uv sync

Integration with Clients

Claude Code

fastmcp install claude-code src/math_server.py:math_mcp

Claude Desktop

fastmcp install claude-desktop src/math_server.py:math_mcp

Cursor

fastmcp install cursor src/math_server.py:math_mcp

VS Code

Add the following .vscode/mcp.json and use your actual path.

{
  "servers": {
    "Math MCP Server": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "fastmcp",
        "--with",
        "numpy",
        "fastmcp",
        "run",
        "/absolute/path/Desktop/to/math-mcp-server/src/math_server.py:math_mcp"
      ]
    }
  },
}

Contributing

  1. Fork the repository

  2. Create a new branch:

git checkout -b add-feature
  1. Make changes and commit (remember to add unit tests in test/ directory)
git commit -m "Added a new feature"
  1. Push to your fork
git push origin add-feature
  1. Open a pull request.

Project Structure

/
ā”œā”€ā”€ src
│   └── math_server.py
ā”œā”€ā”€ tests
│   ā”œā”€ā”€ test_arithmetic.py
│   │   └── astro.svg
│   ā”œā”€ā”€ test_linear_algebra.py
ā”œā”€ā”€ pytest.ini
ā”œā”€ā”€ pyproject.toml
└── uv.lock

Architecture

This MCP server uses Fast MCP 2.0, which provides many more features than Fast MCP 1.0, which is what the official Python SDK for MCP uses.

Also, the unit tests are written with Pytest, which is what Fast MCP 2.0 recommends.

Lastly, if you don't know, uv is a much faster version of pip that also provides a lockfile for project dependencies (this will be familiar if you've used npm or cargo before). The MCP Python SDK itself uses uv, and I use it for all new Python projects, because it's 10-100x faster than pip, and the lockfile makes dependency version management much simpler.